Skip to content

hrx: res_scale_pair without a runtime divisor, with Loom check cases - #37

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/res-scale-loom-cases
Sep 29, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/res-scale-loom-cases

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

This follows Ben Vanik's Loom workflow (https://gist.github.com/benvanik/de81be5ae7caa6c7873be856c4b16c80): correctness cases in the .loom source, run under the access sanitizer on real hardware.

What was wrong. Doing that for #35's kernel found a real portability bug. Newer Loom (hrx-system 244cd38) has two rules the engine's pinned Loom doesn't enforce:

  • AMDGPU lowers integer division only for constant divisors;
  • memory ops must be provably in bounds.

The kernel's index.rem by the runtime row size was rejected (TARGET/003, then SUBRANGE/024), so it would have broken at the next HRX bump.

The fix.

  • The kernel launches a 2-D grid: x over a row's channels, y over rows, via a new row_count parameter. No thread divides.
  • An explicit bounds guard.
  • The matcher passes row_count, and the manifest declares it.

Cases (check.case, periodic iotas so each checks the per-channel broadcast):

  • bias + addend;
  • per-channel scale;
  • plain mode, where b and y are filled with 100 and must not be read.

All three pass under iree-test-loom --device=amdgpu --sanitizer=access --config=... with hrx-system 244cd38. The --config values are listed in the file.

Engine JIT (current pin): ZAYA1-8B HRX0 output is identical (288/288 greedy tokens, max |Δlogprob| 0). Decode is 66.5 -> 66.6 tok/s, i.e. unchanged.

🤖 Generated with Claude Code

Newer Loom (hrx-system 244cd38) lowers integer division only for constant
divisors on AMDGPU and requires memory ops to be provably in bounds, so the
kernel's index.rem by the runtime row size stopped compiling there
(TARGET/003); the engine's pinned Loom still accepted it. The launch is now a
2-D grid (x over a row's channels, y over rows, new row_count parameter) with
an explicit bounds guard, so no thread divides.

Adds three check.case differentials (bias + addend, per-channel scale, and
plain mode where b and y must not be read). All pass under
iree-test-loom --device=amdgpu --sanitizer=access with hrx-system 244cd38.
ZAYA1-8B HRX0: output identical (288/288 greedy tokens, max |dlogprob| 0),
decode 66.5 -> 66.6 tok/s (unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the ggml label Sep 29, 2026
@bong-water-water-bong
bong-water-water-bong merged commit 1162dda into 1bit/hrx-vulkan-patched Sep 29, 2026
10 of 24 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/res-scale-loom-cases branch November 12, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant