Repository navigation
COMP: Use std::atomic for the OpenCLVectorBase reference count - #1504
Open
hjmjohnson wants to merge 1 commit into
Open
hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
ITK 6 no longer vendors vcl_atomic_count.h (VXL update of 2026-06-09), so ELASTIX_USE_OPENCL fails to compile against ITK main. std::atomic<int> provides the same initialization, increment, decrement, and comparison.
This was referenced Dec 1, 2026
hjmjohnson
marked this pull request as ready for review
December 1, 2026 19:35
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.
ELASTIX_USE_OPENCL=ONno longer compiles against ITKmain.itkOpenCLVectorBase.cxxincludesvcl_atomic_count.h, which ITK dropped when it switched to a VXL stripped down to the numerics code (InsightSoftwareConsortium/ITK#6421, merged June 2026). This PR replaces the counter withstd::atomic<int>.Merge danger: two-way door; blast radius:
ELASTIX_USE_OPENCL=ONbuilds only (off by default).This is independent of the ITK GPU-module removal discussed in #1503. The header is used by elastix's own OpenCL code, not by ITK's GPU modules.
Shape of the change
referenceCountis initialized to 1, incremented, decremented, and compared with<= 0.std::atomic<int>supports each of these with the same atomicity.Evidence
Local, macOS arm64, conda clang,
ELASTIX_USE_OPENCL=ON, against an ITK build withoutvcl_atomic_count.h(ITKmainafter #6421):itkOpenCLVectorBase.cxx:22: fatal error: 'vcl_atomic_count.h' file not found.ITKGPUCommon): 401 of 401 targets build and link with 0 errors.OpenCLContextrejects Apple's platform with or without this change.vcl_atomic_count.h, butstd::atomicworks there as well, so builds against ITK 5.4.1 or later are unaffected.vcl_atomic_count.AI assistance
Prepared with Claude Code (Opus 5.5) under Hans Johnson's direction; reviewed by Hans Johnson.