Skip to content

feat(hip): what a model engine needs from the runtime: graphs, device copies, mapped memory, device queries - #611

Merged
ashhart merged 3 commits into
ashhart:mainfrom
BlivionIaG:hip-runtime-ext
Oct 10, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
BlivionIaG:hip-runtime-ext

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

What a model engine needs from #463's runtime, on its own types, the runtime slice tracked in #491:

  • DeviceBuffer: device-to-device copies and 32-bit word fills (blocking and on a stream), address(offset) for kernel arguments, fromHost.
  • HostBuffer.allocMapped and device(): pinned host memory a kernel reads and writes with no copy.
  • memory.usage: bytes held on the device and pinned on the host, with the device peak, for admission.
  • Module.global, Function.attribute and Function.occupancy; cooperative launches (Config.cooperative).
  • Context.attribute and Context.name; Runtime.errorName.
  • graph.zig: stream capture, explicit kernel nodes with edges, instantiate, upload, replay, in-place node updates and whole-exec updates. A refused update returns HIP's verdict and leaves the exec unchanged; a cooperative launch has no node form and is refused.

No kernel or model code. Stacks on #609 (its two commits are included here until they land); review the last commit.

Receipt

  • Environment: base main at c37d0a4 (+ build(hip): -Dhip-arch accepts gfx1030 (RDNA2) and gfx1100 (RDNA3) #607, feat(hip): a caps table from RDNA2 to RDNA4, keyed by exact gfx name #609), head 89fd9ec. Zig 0.17.0, HIP 7.14.60850 (TheRock), Linux 7.1.7.
  • Exactness: every new GPU test checks each output exactly (copies, fills, a kernel writing mapped host memory, a module global read back, captured and explicit graph replays and updates, a cooperative grid of one block a compute unit); hip-affine-test is unchanged.
  • Decode and prompt speed: not applicable (no model path).
  • Tests run, fresh Zig cache:
    • Radeon PRO W7800 (gfx1100): hip-host-test 37/37, hip-gpu-test 30/30, hip-affine-test 27/27.
    • Radeon PRO V620 (gfx1030): hip-gpu-test 30/30, hip-affine-test 27/27.
    • Host tests on HIP's mock: word fills refuse partial words and synchronize only the blocking path; addresses and device copies stay inside the buffer; usage counts held bytes and the peak; graph nodes refuse cooperative launches, bad geometry and foreign functions; a refused exec update is a verdict, not an error; a cooperative launch takes HIP's cooperative entry point.
    • macOS: zig build test test-golden -Dcpu=apple_m1 133/133 steps; Linux zig build test 31/31 steps, 304/304 tests. zig fmt --check clean. lean_check.py: 544 problems, the same as main.
  • Not run, and why: RDNA3.5 and RDNA4 hardware (none here); Metal and CUDA (sources untouched).

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. (No model path touched.)
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (No model path touched.)
  • No precision traded for speed. No bits change.
  • Prompt processing is no slower than the last release. (No prompt path touched.)
  • The description says which platforms I ran and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. GPU tests need a HIP device; the host tests run on the mock.
  • 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.

The runtime and the affine row kernel need no change: the reduction is 32 lanes wide on any wave size, and the
loader takes only the device's exact object. On a Radeon PRO W7800 (gfx1100), hip-gpu-test passes 16/16 and
hip-affine-test 22/22; a gfx1151 object on it is refused with UnsupportedArchitecture.
Each generation's row lists its parts and the instructions kernels test (dot2 f16/bf16, sdot4/8, the WMMA
layout, the activation type); kernels will read these, never the GPU's name. -Dhip-arch now takes any exact
name in the table, and the GPU test checks the device's own name is in it. On a W7800 (gfx1100): hip-gpu-test
19/19, hip-affine-test 22/22 with its bits unchanged.
… copies, mapped memory, device queries

On ashhart#463's types: device-to-device copies and 32-bit word fills (blocking and on a stream), device addresses for
kernel arguments, pinned host memory mapped into the device, held-bytes counters with a device peak, module
globals, function attributes and occupancy, cooperative launches, device attributes and name, HIP's error names,
and graphs (stream capture, explicit kernel nodes with edges, instantiate, upload, replay, in-place node and
whole-exec updates; a refused update is HIP's verdict, not an error). Host tests run on HIP's mock; on a
W7800 (gfx1100) hip-gpu-test passes 36/36, the new tests checking every output exactly.
@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you, @BlivionIaG. This is merged into main (56150e6), your commit as it was, and it ships in 1.0.6. It only touches the HIP tree. With it in, the Mac host gates pass, the Linux tests pass 423 of 423 and hip-host-test 37 of 37, and the default builds are unchanged. We have no AMD GPU, so the device side rests on your W7800 and V620 receipts. Graph updates that return HIP's verdict and leave the exec unchanged are the behaviour we want.

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.

2 participants