Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
---
Language: Cpp
Standard: c++20

# Indentation
TabWidth: 4
IndentWidth: 4
UseTab: Never
IndentPPDirectives: None
IndentWrappedFunctionNames: false
NamespaceIndentation: None

# Empty lines
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Line length
ColumnLimit: 100

# Line endings
DeriveLineEnding: false
LineEnding: LF

# Breaking and Penalties
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: false

PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60

# Spacing and padding
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceAfterLogicalNot: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesBeforeTrailingComments: 1
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeSquareBrackets: false
SpacesInSquareBrackets: false
SpaceBeforeCaseColon: false

# Brace placement
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
Cpp11BracedListStyle: true

# Function definitions
# BreakAfterReturnType: AllDefinitions
AlwaysBreakAfterDefinitionReturnType: All

AttributeMacros:
- __host__
- __device__
- __hostdev__
- __global__
- __forceinline__
- __shared__
- __launch_bounds__

# Alignment
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2

# Single line allowances
BinPackParameters: false
BinPackArguments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false

# Sorting
IncludeBlocks: Regroup
IncludeIsMainRegex: "$"
IncludeCategories:
- Regex: '^<pybind11/' # pybind11 includes
Priority: 0
- Regex: '^"' # quoted includes
Priority: 1
- Regex: '^<fvdb/' # fvdb includes
Priority: 2
- Regex: '^<nanovdb/' # nanovdb includes
Priority: 3
- Regex: '^<(torch|c10|THC|ATen)/' # torch includes
Priority: 4
- Regex: '^<(thrust|cub|cuda)/' # CCCL includes
Priority: 5
- Regex: '^<(cooperative_groups|cuco|cuda.h|cuda_|device_types|math_constants|nvtx3|cute)' # CUDA includes
Priority: 6
- Regex: '^<.*\..*' # other system includes (e.g. with a '.')
Priority: 7
- Regex: '^<[^.]+' # STL includes (no '.')
Priority: 8
IncludeIsMainSourceRegex: "$"
SortIncludes: true
SortUsingDeclarations: true

3 changes: 3 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore all submodules in external directories
**/external/**

72 changes: 72 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# https://clangd.llvm.org/config

# Apply a config conditionally to all C files
If:
PathMatch: .*\.(c|h)$

---

# Apply a config conditionally to all C++ files
If:
PathMatch: .*\.(c|h)pp

---

# Apply a config conditionally to all CUDA files
If:
PathMatch: .*\.cuh?
CompileFlags:
Add:
- "-x"
- "cuda"
# No error on unknown CUDA versions
- "-Wno-unknown-cuda-version"
# Allow variadic CUDA functions
- "-Xclang=-fcuda-allow-variadic-functions"
Diagnostics:
Suppress:
- "variadic_device_fn"
- "attributes_not_allowed"
- "unknown_cuda_version"
- "unknown_type_name"
- "implicit_return_from_non_void_function"
- "no_template_args_on_forwarding_function"

---

# Tweak the clangd parse settings for all files
CompileFlags:
Add:
# report all errors
- "-ferror-limit=0"
- "-fmacro-backtrace-limit=0"
- "-ftemplate-backtrace-limit=0"
# Skip the CUDA version check
- "--no-cuda-version-check"
Remove:
# remove gcc's -fcoroutines
- -fcoroutines
# remove nvc++ flags unknown to clang
- "-gpu=*"
- "-stdpar*"
# remove nvcc flags unknown to clang
- "-arch*"
- "-gencode*"
- "--generate-code*"
- "-ccbin*"
- "-t=*"
- "--threads*"
- "-Xptxas*"
- "-Xcudafe*"
- "-Xfatbin*"
- "-Xcompiler*"
- "--diag-suppress*"
- "--diag_suppress*"
- "--compiler-options*"
- "--extended-lambda"
- "--expt-extended-lambda"
- "--expt-relaxed-constexpr"
- "-forward-unknown-to-host-compiler"
- "-Werror=cross-execution-space-call"
- "-Werror=all-warnings"
- "-G"
48 changes: 27 additions & 21 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,46 @@ jobs:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --verbose --target-version=py311 --line-length=120"
src: "./"
options: "--check --verbose --target-version=py311 --line-length=120 --extend-exclude '.*/external/.*'"
src: "point_transformer_v3"
version: "~= 24.0"

# NOTE: Enable this when/if we have C++ code
# test-cpp-clang-format-lint:
# name: Check C++ code style with clang-format
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: DoozyX/clang-format-lint-action@v0.18.2
# with:
# extensions: 'h,cpp,cc,cu,cuh'
# clangFormatVersion: 18
# style: file
test-cpp-clang-format-lint:
name: Check C++ code style with clang-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: Re-enable when C++ files are present
# - uses: DoozyX/clang-format-lint-action@v0.18.2
# with:
# extensions: 'h,cpp,cc,cu,cuh'
# clangFormatVersion: 18
# style: file
# exclude: '**/external/**'
- name: Placeholder - always succeed
run: echo "clang-format check placeholder - always succeeds"

include-guards:
name: Check include guards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: swahtz/include-guards-check-action@master
# TODO: Re-enable when C++ header files are present
# - uses: swahtz/include-guards-check-action@master
# with:
# exclude: '**/external/**'
- name: Placeholder - always succeed
run: echo "include-guards check placeholder - always succeeds"

check-spdx-identifiers:
name: Check SPDX identifiers
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: enarx/spdx@master
with:
licenses: |-
Apache-2.0
MIT
- name: Check SPDX headers
run: |
python3 point_transformer_v3/scripts/check_spdx.py

# Search the git repository for any trailing spaces excluding auto-generated wlt files
# NOTE: Migrated from openvdb whitespace.yml
Expand All @@ -64,7 +70,7 @@ jobs:
- name: test
run: |
set +e
git grep -n -I -E '^.+[ ]+$' -- ':!*.wlt'
git grep -n -I -E '^.+[ ]+$' -- point_transformer_v3 ':!**/external/**' ':!*.wlt'
test $? -eq 1

# Search for any tabs excluding meeting notes, image files and a few others
Expand All @@ -76,5 +82,5 @@ jobs:
- name: test
run: |
set +e
git grep -n " " -- ':!*/codestyle.yml' ':!*.svg' ':!*.cmd' ':!*.png' ':!*.wlt' ':!*.jpg' ':!*.gif' ':!*.mp4' ':!*.pt' ':!*.pth' ':!*.nvdb' ':!*.npz' ':!*.gitmodules'
git grep -n -I " " -- point_transformer_v3 ':!**/external/**' ':!*/codestyle.yml' ':!*.svg' ':!*.cmd' ':!*.png' ':!*.wlt' ':!*.jpg' ':!*.gif' ':!*.mp4' ':!*.pt' ':!*.pth' ':!*.nvdb' ':!*.npz' ':!*.gitmodules'
test $? -eq 1
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated version file
fvdb/version.py

# Generated compile_commands.json symlink
compile_commands.json

# Top-level build files
/build/*

# Top-level directories
dist
.cache
.idea
.eggs
cmake-build-debug
external
trash
scratch
_build
releases/
/data/
/data/*
lightning_logs
logs

# Top-level config files
.polyscope.ini
imgui.ini
.vscode/launch.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "point_transformer_v3/pointcept_minimal"]
path = point_transformer_v3/external/pointcept
url = https://github.com/Pointcept/Pointcept.git
42 changes: 42 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${env:CONDA_PREFIX}/envs/fvdb/include",
"${env:CONDA_PREFIX}/envs/fvdb/targets/x86_64-linux/include/",
"${env:CONDA_PREFIX}/envs/fvdb/include/python3.11",
"${env:CONDA_PREFIX}/envs/fvdb/lib/python3.11/site-packages/torch/include",
"${env:CONDA_PREFIX}/envs/fvdb/lib/python3.11/site-packages/torch/include/torch/csrc/api/include",
"${env:CONDA_PREFIX}/envs/fvdb/lib/python3.11/site-packages/torch/include/THC",
"${env:CONDA_PREFIX}/envs/fvdb/lib/python3.11/site-packages/torch/include/c10",
"${default}"
],
"macFrameworkPath": [
"${default}"
],
"defines": [
"${default}",
"NDEVELOP_IDE_ONLY",
"__CUDA_ARCH__=800"
],
"forcedInclude": [
"${default}"
],
"compileCommands": "${default}",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${default}",
"path": [
"${default}"
]
},
"intelliSenseMode": "${default}",
"cStandard": "${default}",
"cppStandard": "c++20",
"compilerPath": "${default}",
"configurationProvider": "ms-vscode.cpptools"
}
],
"version": 4
}
Loading