optimize mxfp4 cast/transpose#664
Open
matthiasdiener wants to merge 2 commits into
Open
Conversation
Claude reviewReviewed the two-commit optimization in
Copyright headers: OK (both files carry |
wenchenvincent
approved these changes
Jul 14, 2026
wenchenvincent
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Let's wait for level 3 CI results before merging.
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.
Description
Implements two optimizations on the cast/transpose kernel, targeting the inefficient paths:
1. Coalesced columnwise store: The plain (backward) columnwise transpose store was a scattered 16-bit-per-thread write, hitting ~35% write efficiency. It's now staged through LDS (smem_col) and flushed as full 128-bit (uint4) contiguous writes. Gated to the plain-colwise instantiations only (COLWISE_TO_LDS = USE_COLWISE && !SHUFFLE_COLWISE_FP4); rowwise and shuffled-forward paths are unaffected.
2. DPP cross-lane reductions: __shfl_xor was lowering to the LDS-path ds_bpermute on gfx950. Replaced the xor1/xor2 lanes in the amax reduction (warp_reduce_max_8_dpp) and the Hadamard butterfly (hadamard16_inplace) with __builtin_amdgcn_update_dpp permute intrinsics, which fuse into the VALU datapath.
Also fixes a missing columnwise usage flag for MXFP4.
Fixes https://github.com/ROCm/frameworks-internal/issues/16628
Performance results are in https://github.com/ROCm/frameworks-internal/issues/16628#issuecomment-4916784356
Type of change
Changes
Checklist: