Fix DecoupledLookback exclusive carries#91
Draft
maleadt wants to merge 3 commits into
Draft
Conversation
…kback Re-enable DecoupledLookback() coverage in the non-uniform exclusive accumulate test (excluded on the main branch). This branch carries the work-in-progress fix for DecoupledLookback's exclusive carries, so it must exercise that path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…need The decoupled-lookback aggregate publish/consume protocol is not memory- coherent across blocks (stale L1 aggregate reads + missing device-scope ordering), causing ~40% failures on smaller GPUs. The proper fix needs a native device threadfence; `UnsafeAtomics.fence` and acquire/release atomics do not lower on recent NVPTX toolchains (LLVM 18, sm_80) — only `monotonic` does. Document this inline as the path forward. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
accumulate!(...; alg=DecoupledLookback()) produces incorrect results for exclusive multi-block scans on non-uniform data. The default ScanPrefixes() path was fixed in #90 (and is what issue #84 reported); this PR tracks the separate, opt-in DecoupledLookback() exclusive bug, which #90 deliberately deferred by excluding it from the non-uniform exclusive test.
What's here
What's missing
The aggregate fix is arithmetically correct but the publish/consume protocol is not memory-coherent across blocks, so it fails ~40% of the time, nondeterministically, on smaller GPUs (reproduced on an A100 MIG 1g.5gb, sm_80, ~14 SMs) — for both inclusive and exclusive scans. Two distinct problems:
The blocker: no portable device threadfence
The natural fix for (2) is a device-scope fence, but:
A verified working approach (0 failures over 80k randomized iterations on the A100 MIG, across Int32/Int64/Float32/Float64): make flags and aggregates monotonic atomics, and order them with an overridable _decoupled_fence() — a generic no-op fallback overridden per backend via @device_override in CUDA/AMDGPU package extensions.