Repository navigation
Support XMallocSIMD with FlatterScatter - #2
Open
chillenzer-agents wants to merge 3 commits into
Open
chillenzer-agents wants to merge 3 commits into
chillenzer-agents wants to merge 3 commits into
Conversation
The coalescing bound assumed a hard-coded 32-lane warp. On AMD gfx9 (wave64) up to 64 lanes participate, so the coalesced request could reach or exceed one page and break the creation policies' single-page chunk layout. Bound each request by pagesize / getWarpSize() instead. Keep the divisor value-dependent with if constexpr: HIP defines MALLOCMC_DEVICE_COMPILE in its host pass too, where the compile-time warp size is zero, so an unguarded division or a static_assert would break that pass. CUDA (warp 32) is unchanged. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
XMallocSIMD expects a creation policy to treat a zero-byte request as no allocation, report out-of-memory only for non-zero requests, and free a coalesced chunk only when its last participant releases a sub-pointer. Add the zero-size guards, make isOOM size-aware like Scatter, and implement the participant-counter free path for chunked and single-page multi-page allocations. Allocations spanning more than one page cannot originate from XMallocSIMD and are rejected safely. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
Add the pagesize constraint using both policies' effective _pagesize so that command-line overrides are covered. Extend the AccessBlock tests with the zero-size and coalesced-free protocol (both free orders and the single-page multi-page case), add all four creation/distribution combinations to the allocator test, and document the new supported combination. Co-authored-by: chillenzer-agents <326908604+chillenzer-agents@users.noreply.github.com>
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.
Stacked on
fix/xmallocsimd, the branch behindalpaka-group#312, so this PR shows only the
feature delta.
pagesize / getWarpSize()so thecoalesced total stays below one page on wave64. The divisor is guarded with
if constexprbecause HIP definesMALLOCMC_DEVICE_COMPILEin its hostpass, where the compile-time warp size is zero.
isOOMis size-aware, and freeing a coalesced sub-pointer decrements theparticipant counter at the chunk base and frees the chunk only for the last
participant. This covers chunked and single-page multi-page allocations;
multi-page allocations that cannot originate from XMallocSIMD fail safely.
_pagesize, theallocator test covers all four creation/distribution combinations, and
Usage.md documents the newly supported combination.
Testing:
assertions. A pre-existing nvcc 12.5 ICE on
test/unit/source/PageInterpretation.cppwas worked around by compilingthat host-only TU with g++ (no source change). A scratch device kernel
instantiates and runs FlatterScatter + XMallocSIMD.
assertions; this run found and fixed the HIP host-pass issue above. The
scratch device kernel coalesced 32/64 lanes into one chunk (header counters
32/64, spreads 992/2016 bytes) with no overlap.
Coverage caveat: the in-tree suite pins
AccCpuSerial, so it does notinstantiate XMallocSIMD device code; the scratch kernels are the device
evidence. An in-tree device test or CI smoke kernel is recommended as a
follow-up.
No issue is closed by this PR. Upstream review is intentionally deferred until
the human approves this internal PR.