Repository navigation
Fix XMallocSIMD compilation and add allocator coverage - #312
Merged
Merged
Conversation
alpaka::popcount takes (intrinsic, value) and only overloads on std::uint32_t/std::uint64_t; ballot() already returns the accelerator's mask_type, so pass the accelerator as the intrinsic. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
The helper was dropped from mallocMC_utils.hpp, leaving the call dangling. It implemented __threadfence_block(), so use the block-scope fence. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
The allocator-level test only instantiated the Noop distribution policy. Add a parameterised test that runs the same allocation through Noop and XMallocSIMD so that the latter is compiled and executed by default. XMallocSIMD is combined with the Scatter creation policy: FlatterScatter cannot free the coalesced sub-chunks that XMallocSIMD hands out and does not treat zero-byte requests as a no-op. The test uses the CPU serial accelerator because alpaka reports a warp size of zero for GPU accelerators during host compilation, which makes XMallocSIMD's shared-memory arrays ill-formed. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
alpaka reports a warp size of zero during the host pass of a GPU compilation and for SYCL. XMallocSIMD used that value as a shared-array extent and as a divisor, so those configurations were ill-formed. Fall back to a single shared slot and warp id zero there. Coalescing is already compiled out when MALLOCMC_DEVICE_COMPILE is undefined, so the policy remains a pass-through. Skip the warp-0 shared-counter initialisation to avoid a same-slot write race on SYCL. For accelerators with a known compile-time warp size the generated code is unchanged. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
chillenzer
approved these changes
Nov 26, 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.
XMallocSIMD did not compile against current alpaka:
alpaka::popcounttakes the intrinsic and the value; the ballot mask was passedas the intrinsic.
threadfenceBlockwas removed frommallocMC_utils.hpp; usealpaka::mem_fence(acc, alpaka::memory_scope::Block{})instead.alpaka::warp::getSizeCompileTimeis zero during the host pass of GPUcompilation and for SYCL, so it cannot be used as a shared-array extent or
divisor.
On the unknown-warp-size paths XMallocSIMD now uses one shared slot and warp id
zero. Coalescing is already compiled out when
MALLOCMC_DEVICE_COMPILEisundefined, so the policy is a pass-through there; the warp-0 counter
initialisation is skipped to avoid a same-slot write race on SYCL. Code
generation for known warp sizes is unchanged.
The allocator unit test now instantiates XMallocSIMD with the Scatter creation
policy, so the distribution policy is compiled and executed by default.
Testing: CPU build and ctest against the pinned alpaka 2.2.0 (both suites pass).
The warp-size 0/1/32/64 paths were checked with a mock accelerator under g++
and clang++ with warnings as errors. No GPU or SYCL toolchain was available, so
device compilation and runtime were not tested.
No documentation change: this is a compilation fix with no user-visible API or
behaviour change.