COMP: Simplify CUDA backend wiring and adopt ITK-conformant formatting (follow-up to #77)#80
Merged
hjmjohnson merged 4 commits intoJun 8, 2026
Conversation
Build the CUDA backend as host code. itkVkCommon.cxx contains no device kernels (VkFFT JIT-compiles them at runtime via nvrtc), so the nvcc language apparatus was inert and is removed: enable_language(CUDA), the LANGUAGE CUDA override that targeted a nonexistent itkVkCommon.cpp, the $<COMPILE_LANGUAGE:CUDA> gencode flags, and CUDA separable compilation. Removing enable_language(CUDA) also avoids enabling the CUDA language for the whole parent project when the module is built in the ITK tree. Make itk-module-init.cmake the single source of the VKFFT_BACKEND default by guarding the duplicate set() in CMakeLists.txt, unset the temporary Apple framework probe cache entries, and align the cache help string with the full backend list. Validated on an RTX 6000 Ada (CUDA 13.2): explicit VKFFT_BACKEND=1, auto-detect (selects CUDA), and VKFFT_BACKEND=3 (OpenCL) each build and pass 36/36 VkFFTBackend tests.
Add a remote-module .gersemi.config matching ITK conventions (2-space indent, 80-column line length, favour-expansion list style) and apply gersemi 0.19.3 to every CMakeLists.txt, *.cmake, and *.wrap file. Formatting only; no build-behavior change. Validated VKFFT_BACKEND=1 builds and passes 36/36 VkFFTBackend tests on CUDA hardware.
Run the ITK-pinned formatters over the tree: clang-format v19.1.7 (itkVkCommon.cxx), black 24.2.0 and pyupgrade on the Python files, and the standard end-of-file / trailing-whitespace hygiene fixes. Formatting only; VKFFT_BACKEND=1 builds and passes 36/36 VkFFTBackend tests on CUDA hardware.
Pin the formatters to the exact versions ITK uses so CMake, C++, and Python formatting stays byte-identical with upstream: gersemi 0.19.3, clang-format v19.1.7, black 24.2.0, pyupgrade v3.21.2. gersemi and the formatters are not stable across releases, so matching ITK's pins is required to avoid reformatting churn against ITK CI. The version-insensitive hygiene hooks (pre-commit-hooks) track their latest release, v6.0.0.
dzenanz
approved these changes
Jun 8, 2026
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.
Follow-up to the merged #77. Two themes: (1) simplify the CUDA backend wiring, and (2) adopt ITK-conformant formatting tooling. The CUDA changes were validated on real hardware (RTX 6000 Ada, CUDA 13.2): explicit
VKFFT_BACKEND=1, auto-detect, andVKFFT_BACKEND=3(OpenCL) each build and pass 36/36 tests.CUDA backend simplification (commit 1)
itkVkCommon.cxxis host code — VkFFT JIT-compiles CUDA kernels at runtime via nvrtc — so the nvcc language apparatus was inert and is removed:enable_language(CUDA)(also stops forcing the CUDA language onto the whole ITK build when this module is built in-tree),set_source_files_properties(... LANGUAGE CUDA)override that targeted a non-existentitkVkCommon.cpp,$<COMPILE_LANGUAGE:CUDA>gencode flags (never applied), andThe CUDA backend now builds as host C++ linking
CUDA::cudart/CUDA::cuda_driver/ nvrtc (the build drops the emptycmake_device_linkstep). Also:itk-module-init.cmakeis now the single source of theVKFFT_BACKENDdefault (the duplicateset()inCMakeLists.txtis guarded), the Apple framework probe no longer leaks cache variables, and the cache help strings are aligned.Formatting + tooling (commits 2–4)
.gersemi.config(remote-module style, mirroring RTK) and all CMake/*.wrapfiles formatted with gersemi 0.19.3..clang-formatalready matches ITK; applied clang-format v19.1.7, black 24.2.0, pyupgrade, plus end-of-file / trailing-whitespace hygiene..pre-commit-config.yamlmodeled on RTK. Formatters are pinned to ITK's exact versions (gersemi 0.19.3, clang-format v19.1.7, black 24.2.0, pyupgrade v3.21.2) because their output is not stable across releases; the version-insensitivepre-commit-hookstrack latest (v6.0.0).Hardware validation (RTX 6000 Ada, CUDA 13.2)
Built as an external module against ITK
main:VKFFT_BACKEND=1VKFFT_BACKEND=3(OpenCL)The fully-formatted final tree was re-validated:
VKFFT_BACKEND=1→ 36/36.