Skip to content

build(hip): opt-in -Dhip-relax-branches for gfx1100 under clang 21 - #1542

Merged
ashhart merged 2 commits into
ashhart:mainfrom
AbrahamCete:fix/hip-relax-branches
Oct 29, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
AbrahamCete:fix/hip-relax-branches

Conversation

@AbrahamCete

Copy link
Copy Markdown
Contributor

What this changes

Adds an opt-in build option, -Dhip-relax-branches=true, that passes -mllvm -amdgpu-s-branch-bits=15 to the gfx1100 kernel code objects, so Ubuntu's clang 21 hipcc can build affine_dot2_stream_relu2_pair<Dot, 6, 1, 8> for gfx1100. It is off by default, declared on every target, and noted in docs/known-issues.md. Closes #1521.

The flag goes in compile() in zig/build/hip.zig, which builds every kernel group and the contract's code objects. The two probe --genco compiles (runtime_tests.hip, affine.hip) do not include the stream tiles, so they are unchanged.

Receipt

  • Environment: TensorFold main 1b9a987, Ubuntu 26.04, Zig 0.17.0, Ryzen AI Max+ 395 (gfx1151). Compilers: Ubuntu clang 21.1.8 hipcc, and ROCm 7.13 (AMD clang 23) from TheRock.
  • Exactness: build-only change. With the option off, every target's code objects are byte-identical to main's, built at the same tree path (clang embeds a path-derived id, so two checkouts at different paths differ even on the same commit):
    • ROCm 7.13, hip-kernel-contract-objects: all 48 objects (11 groups and the controls for gfx1030, gfx1100, gfx1151, gfx1201) identical.
    • clang 21, the 11 group objects for gfx1030, gfx1151 and gfx1201: identical. gfx1100 fails on main and on this branch with the same "branch size exceeds simm16".
  • With the option on: clang 21 builds all 11 gfx1100 groups; ROCm 7.13 builds all four chips.
  • Decode speed before and after: n/a, the default code objects are unchanged.
  • Prompt speed before and after: n/a, the default code objects are unchanged.
  • Tests run: python3 -m unittest discover -s tools/zig -p build_options_test.py 5 passed, 0 failed, 0 skipped; tools/zig/lean_check.py 426 problems on both main and this branch (none new); zig fmt --check zig/build/hip.zig clean.
  • Not run: hip-kernel-test, hip-affine-test and a served A/B on gfx1100 with the option on. I have no gfx1100 card, which is why the option is off by default.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Default code objects unchanged.)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (Branch encoding only, on gfx1100 when opted in.)
  • A new or changed GPU kernel is registered with the kernel contract (docs/kernel-contract.md); each backend's SUMMARY line is in the receipt. (No kernel changes.)
  • Prompt processing is no slower than the last release. (Default unchanged.)
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not. (Builds only, on Linux; no Metal, CUDA or gfx1100 runs.)
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (No new test: the existing build options test covers the declaration.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

AbrahamCete and others added 2 commits October 29, 2026 12:54
Ubuntu's clang 21 hipcc leaves a branch of
affine_dot2_stream_relu2_pair<Dot, 6, 1, 8> past simm16 on gfx1100.
-Dhip-relax-branches=true adds -mllvm -amdgpu-s-branch-bits=15 to the
gfx1100 kernel code objects; it is off by default, so every target's
default build is unchanged. Known issue noted (ashhart#1521).
@ashhart
ashhart force-pushed the fix/hip-relax-branches branch from 79da622 to 5ec4c37 Compare October 29, 2026 12:54
@ashhart
ashhart merged commit db46ffd into ashhart:main Oct 29, 2026
@ashhart

ashhart commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thanks @AbrahamCete, landed as 12c1184. With the option off, every HIP compile command is the same as main's, so default builds are unchanged; hip-host-test passes both ways. We don't have a gfx1100 either, so the changelog and known issues say it hasn't run on one yet. If anyone builds and serves with -Dhip-relax-branches=true on an RX 7900-class card, a receipt on #1521 (the kernel tests, hip-kernel-contract-limits, and served tokens against a ROCm 7.13 build) would let us say it works.

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.

HIP: dot2_tiles.hip fails to compile for gfx1100 with Ubuntu clang 21.1.8 ("branch size exceeds simm16")

2 participants