Fix CUDA architecture selection and optimize LBVH Morton codes - #252
Merged
Conversation
Computing 1/mesh_width once turns three divides per box into three multiplies. Rounding can differ in the last bit, which at worst shifts the Morton sort order for a near-tie; the candidate set the query returns is unaffected.
Hard-coding "native" makes CMake probe for a physical GPU, so configuring the test target fails in GPU-less CI and Docker builds. We now use whatever the user passed and only fall back to "native" when they passed nothing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #252 +/- ##
=======================================
Coverage 96.70% 96.70%
=======================================
Files 191 191
Lines 17292 17293 +1
Branches 928 927 -1
=======================================
+ Hits 16722 16723 +1
Misses 570 570
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two independent small fixes, split out of the CUDA branch so they can land on their own.
tests/CMakeLists.txt— the test target hard-codedCUDA_ARCHITECTURES "native", which makes CMake probe for a physical GPU. Configuring therefore fails outright in GPU-less environments (CI runners, Docker image builds), even when the caller already passed-DCMAKE_CUDA_ARCHITECTURES. We now use whatever the user supplied and fall back to"native"only when they supplied nothing.src/ipc/broad_phase/lbvh.cpp—LBVH::init_bvhdivided bymesh_widthinside thetbb::parallel_forover boxes. Hoisting1 / mesh_widthout of the loop turns three divides per box into three multiplies.Behavior
CMAKE_CUDA_ARCHITECTURES, and unchanged for anyone building on the machine they target.a * (1/b)does not always round toa / b. At worst that shifts the Morton sort order for a near-tie, changing the tree shape. The candidate set the query returns is unaffected — the traversal is exhaustive over overlapping nodes, not order-dependent.Type of change
How Has This Been Tested?
[broad_phase] ~[!benchmark]— 13 test cases, 1,464,038 assertions, all passing. CoversLBVH::detect_*_candidatesandCompare BP against brute force, which checks the LBVH candidate set against brute force.ipc_toolkit,ipc_toolkit_tests, andipctkbuilds.The CMake change is not covered: this was a
IPC_TOOLKIT_WITH_CUDA=OFFbuild, so the edited branch never executed. It needs a CUDA configure to exercise.Test Configuration:
CMAKE_BUILD_TYPE=Release,IPC_TOOLKIT_BUILD_TESTS=ON,IPC_TOOLKIT_WITH_CUDA=OFFChecklist