Commit d084783
committed
NanoVDB CUDA: assert the one-thread-per-slot contract in the stencil resolvers
Every stencil resolver resolves the taps of the decoded slot with its own thread index
(smem_leafIndex[tID]), so the block must be launched with blockDim.x == BlockWidth. That
requirement was neither documented nor checked: a smaller block silently skipped the slots
past blockDim.x, and a larger one read smem_leafIndex past the end of a BlockWidth-sized
array and could then index an out-of-range leaf.
Add NANOVDB_ASSERT(blockDim.x == BlockWidth) to the five resolvers and state the contract on
the class, noting that decodeInverseMaps is deliberately more permissive - it strides over
the slots, so it fills the maps correctly for any blockDim.x.
Debug-build only. Verified that a deliberate blockDim.x = BlockWidth/2 launch now trips the
assertion, that the correct launch still passes the VoxelBlockManager_ValueOnIndex unit-test
path (250047 comparisons, zero mismatches), and that all VBM goldens still pass.
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>1 parent 76b32d3 commit d084783
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
| 229 | + | |
224 | 230 | | |
225 | 231 | | |
226 | 232 | | |
| |||
260 | 266 | | |
261 | 267 | | |
262 | 268 | | |
| 269 | + | |
263 | 270 | | |
264 | 271 | | |
265 | 272 | | |
| |||
330 | 337 | | |
331 | 338 | | |
332 | 339 | | |
| 340 | + | |
333 | 341 | | |
334 | 342 | | |
335 | 343 | | |
| |||
370 | 378 | | |
371 | 379 | | |
372 | 380 | | |
| 381 | + | |
373 | 382 | | |
374 | 383 | | |
375 | 384 | | |
| |||
437 | 446 | | |
438 | 447 | | |
439 | 448 | | |
| 449 | + | |
440 | 450 | | |
441 | 451 | | |
442 | 452 | | |
| |||
0 commit comments