[CK] Use SpaceFillingCurve in ThreadwiseTensorSliceTransfer_v3r1#5047
Open
tenpercent wants to merge 6 commits into
Open
[CK] Use SpaceFillingCurve in ThreadwiseTensorSliceTransfer_v3r1#5047tenpercent wants to merge 6 commits into
tenpercent wants to merge 6 commits into
Conversation
Contributor
Author
|
Link #4229 for tracking |
01719db to
5050701
Compare
Contributor
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
5050701 to
28863cf
Compare
tenpercent
added a commit
that referenced
this pull request
Apr 23, 2026
Replace O(N^2) ComputeForwardSweep/ComputeDataIndex/ComputeMoveOnDim calls with O(1) SpaceFillingCurve::GetIndex() lookups in RunRead(), RunWrite(), and TransferDataFromSrcThreadScratchToDstThreadScratch(). This reuses the existing SpaceFillingCurve infrastructure (already used by v6r1, v7r2, etc.) to precompute the serpentine traversal indices at compile time, reducing template instantiation depth significantly. Salvages the approach from PR #5047, rebased onto current develop which has the ThreadwiseTransferHelper refactoring. Generated-by: Claude Code (claude-opus-4-6)
Replace O(N^2) ComputeForwardSweep/ComputeDataIndex/ComputeMoveOnDim calls with O(1) SpaceFillingCurve::GetIndex() lookups in RunRead(), RunWrite(), and TransferDataFromSrcThreadScratchToDstThreadScratch(). This reuses the existing SpaceFillingCurve infrastructure (already used by v6r1, v7r2, etc.) to precompute the serpentine traversal indices at compile time, reducing template instantiation depth significantly. Salvages the approach from PR #5047, rebased onto current develop which has the ThreadwiseTransferHelper refactoring. Generated-by: Claude Code (claude-opus-4-6)
28863cf to
8f82d59
Compare
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.
Summary
Refactors
ThreadwiseTensorSliceTransfer_v3r1to useSpaceFillingCurvefor index computation, replacing O(N^2) nestedComputeForwardSweep/ComputeDataIndex/ComputeMoveOnDimcalls with O(1) precomputed lookup viaSFC::GetIndex().This reuses the existing
SpaceFillingCurveinfrastructure already used by v6r1, v7r2, etc. Changes are confined to a single file.What changed
RunRead(): replacedstatic_fordserpentine loop withstatic_foroverSrcSFC::GetIndex()/GetForwardStep()RunWrite(): same pattern withDstSFCTransferDataFromSrcThreadScratchToDstThreadScratch(): OOB check path usesSrcSFC::GetIndex()ComputeSFCCoordinateResetStepinstead ofComputeCoordinateResetStepResults (
example_grouped_conv_fwd_xdl_fp16, n=10, interleaved,-j1,-ftime-trace)grouped_conv_fwd_xdl_fp16(host)grouped_conv_fwd_xdl_fp16(device)Negative controls (unrelated TUs — no significant change)
device_memory(host)device_memory(device)host_tensor(host)host_tensor(device)Assembly equivalence
GPU assembly compared with
-save-temps=objonexample_grouped_conv_fwd_xdl_fp16(gfx942). Result: 7656 instructions in both builds, identical instruction mix. Only difference is a register allocation swap (v[160:161]<->v[162:163]in twobuffer_load_dwordx2/v_cndmask_b32_e64pairs) — functionally identical, no runtime impact.Methodology
-j1for accurate per-TU timingTest plan
Tracking issue: #4229
Generated-by: Claude Code (claude-opus-4-6)