Skip to content

strix-hip: fix main's AMD build (vision_encoder raw mma.sync since #397) - #444

Merged
AzeezIsh merged 1 commit into
mainfrom
amd/fix-strix-hip-397
Dec 4, 2026
Merged

AzeezIsh merged 1 commit into
mainfrom
amd/fix-strix-hip-397

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Since #397 (merged 2026-12-01), every strix-hip build of main fails in atlas-kernels. The cause is the raw mma.sync.aligned.m16n8k16 asm in vit_mma_bf16 (kernels/gb10/qwen3.6-35b-a3b/nvfp4/vision_encoder.cu), whose "+f" constraint hipcc rejects. Many targets share that file, so no Strix Halo build of main works.

Fix

  • Add crates/atlas-kernels/hip/compat/atlas_ptx_emu.h, which provides wave32 stand-ins that match the PTX lane for lane:
    • mma.sync.m16n8k16 (bf16/f16 → f32)
    • ldmatrix / ldmatrix.trans
    • cp.async
    • e2m1 / e4m3 decode
  • vit_mma_bf16 calls atlas_emu::mma_m16n8k16 under __HIP_PLATFORM_AMD__. The NVIDIA path is byte-for-byte unchanged.
  • Add crates/atlas-kernels/hip/tests/ptx_emu_test.hip, a standalone GPU test of the stand-ins against a CPU reference.

The stand-ins are for correctness, not speed. The amd/ling-3.2-air branch (Ling on strix-hip) is built on the same header.

Verified

On Framework Desktop (gfx1151, ROCm 7.13), at e5530ce4d (main) plus this commit:

  • Full strix-hip build of all models: passes (BUILD OK all b900d712b). vision_encoder compiles into the strix-hip code objects.
  • ptx_emu_test.hip: PTX-EMU OK. Relative error ≤1.2e-6, and 0 of 256 e4m3 codes decode wrong.

Not verified

  • AMD serving at main: the same change is on amd/ling-3.2-air, where DevLab Strix serve runs pass.
  • GB10: nothing to check, because the edit sits entirely inside #if defined(__HIP_PLATFORM_AMD__).

🤖 Generated with Claude Code

…d broken since #397)

#397 added a raw mma.sync.m16n8k16 asm block to the shared vision encoder
(kernels/gb10/qwen3.6-35b-a3b/nvfp4/vision_encoder.cu). hipcc rejects the
'+f' constraint, so every strix-hip build of main fails at atlas-kernels.

Add crates/atlas-kernels/hip/compat/atlas_ptx_emu.h: wave32 stand-ins for
mma.sync.m16n8k16 (bf16/f16 -> f32), ldmatrix(.trans), cp.async, e2m1 and
e4m3 that reproduce the PTX fragment layouts lane for lane, so kernels keep
their fragment code and only the instruction changes under
__HIP_PLATFORM_AMD__. hip/tests/ptx_emu_test.hip checks them against a CPU
reference on gfx1151 (rel err <= 1.2e-6). NVIDIA code is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant