Skip to content

Improve trt discover and NN interpolation bugfix - #1

Open
tcollins-hub wants to merge 2 commits into
IRCAD:mainfrom
tcollins-hub:improve-trt-discover-and-bugfixes
Open

Improve trt discover and NN interpolation bugfix#1
tcollins-hub wants to merge 2 commits into
IRCAD:mainfrom
tcollins-hub:improve-trt-discover-and-bugfixes

Conversation

@tcollins-hub

Copy link
Copy Markdown

Summary

  • Fixed a bug in the nearest-neighbor interpolation CUDA kernel (grid_sample_3d_nearest_kernel) where the per-channel input/output pointers were never advanced across the channel loop. For C > 1, every channel read from input channel 0, and only output channel 0 was ever written — all other output channels were left uninitialized.
  • Improved TensorRT/CUDA discovery in CMakeLists.txt (see 21cc043).

Testing

  • Added a regression test (testGridSample3dNearestMultiChannel in test.cpp) covering the multi-channel nearest-neighbor bug specifically:
    • Builds a 3-channel, 4×4×4 input with a unique value per (c, d, h, w) voxel and an identity align_corners=true grid, so each output voxel must exactly equal the input voxel at the same coordinates.
    • Seeds the device output buffer with a sentinel value (-1) before running the kernel, so any element the kernel fails to write (as happened for channels > 0 before the fix) is caught rather than masked by leftover memory.
    • Asserts every output element matches the expected value within tolerance.
  • Verified the test catches the bug: temporarily reverted the fix and reran — the new test failed via assertion abort as expected. Reapplied the fix and confirmed it passes again.
  • Full clean build + test suite: ran a clean cmake -B build configure and build from the committed sources (only pre-existing TensorRT deprecation warnings, no errors), then ctest --output-on-failure — 100% tests passing, including the existing testGridSample3dFloat32 sanity test against reference data in test/data/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants