hrx-rs 0.8.7

Owned native AMD GPU and NPU execution with Loom compilation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# Validation

## Native refresh and runtime corrections, 0.8.6 — 2026-09-23

All 94 CPU/doctests and 83 hardware checks pass with upstream `468508b9e`
and six compiler patches. Deterministic controls reproduce stale instruction
execution, incomplete event-prefix retirement and premature completion
publication before their fixes. Eight clients pass 297 CPU/doctests and strict
Clippy, 156 selected GPU/model gates, 22 Krea GPU checks and five NPU shapes.
The final correctness and paired performance campaigns record no GPU resets.
ArcFace/SCRFD compiler slowdowns are resolved without changing numerical
references or tolerances. See [qualification and measurements](docs/NATIVE-REFRESH.md)
for exact binaries, unavailable optional fixtures and scope.

## Client graph composition, 0.8.5 — 2026-09-23

The unchanged native bundle passes all 81 hardware tests. New recordable image
and finite-check helpers support composed FaceSwap stages; SCRFD composes its
resident CNN/decoder path. Five alternating pairs retain exact captured outputs:
FaceSwap improves 4–22%, SCRFD resident canvases 10–20%, and Krea generation
5.3% versus its prior 0.8.3 runtime. Standalone INSwapper/GPEN remain effectively
unchanged. Rejected placement experiments and qualification limits are retained
in [the composition report](docs/CLIENT-COMPOSITION.md). Consum is excluded.

## Budgeted native command reuse, 0.8.4 — 2026-09-22

All 92 CPU/doctests and 81 hardware tests pass with the unchanged 0.8.3 native
bundle. Cache replay, capacity eviction, foreign ownership, backing release
and pending budget charges are checked on hardware. H3 retains its frozen
pipeline outputs through cancellation, eviction and reload. Five alternating
pairs measure H3 audio at 298.476 ms versus 430.811 ms and Qwen attention at
2.2791 ms versus 2.9430 ms. See [the client follow-up](docs/CLIENT-FOLLOWUP.md).

## Cached system memory, 0.8.3 — 2026-09-22

The rebuilt Ubuntu libamdf passes 80 ignored hardware tests, including repeated
changed host inputs, partial host writes after GPU updates, GPU graphs,
coherent completion fences, aliases, scratch,
and GPU/NPU visibility. All 92 CPU/doctests pass. Loom and the native bridge
hashes are identical to the qualified 0.8.2 bundle; the compiler qualification
therefore applies to the same compiler bytes. See
[hrxdb measurements](docs/HRXDB-PERFORMANCE.md) for the three-arm performance
comparison and exact output checks. hrxdb passes 38 hardware correctness tests
(including large shard boundaries) and 17 CPU/doctests. The final byte-write
acquire refinement also passes the repeated cache-line preservation test.

## Native 0.8 migration, 2026-09-22

Qualified on gfx1151 and Strix Halo NPU5 (`1022:17f0:11`), Linux 7.2.4.
The three release libraries were built in the pinned Ubuntu 26.04 image.
The source tree was reconstructed from the pristine revision and recorded
patches; every tracked source file matched the build tree.

- 77 ignored native tests passed against the final Ubuntu libraries: GPU and
  XDNA arithmetic, six compiler/import tests, inference, concurrent graphs,
  shared aliases, private scratch, budgets, malformed ELF rejection, and
  mixed C++/Loom NPU execution. Native tests run serially on the shared hardware.
- 91 CPU/doctests passed, plus the new report CLI test. Fault injection covers
  scheduler failure, cancellation, timeout ownership, and quarantine retaining
  budgets. Native driver cleanup failures are not artificially injected.
- Rust 1.91 all-target check, default/NPU feature matrix, all-target Clippy with warnings denied, rustdoc
  with warnings denied, formatting, and verified Cargo packaging passed.
- The local archive installed into an empty cache, then doctor, GPU compilation,
  and report show/diff ran offline. A clean Ubuntu 26.04 container also
  compiled GPU and NPU kernels using only the bundle and host libstdc++. Packing twice produced identical bytes.
- `ldd` admits only host C/C++ libraries. Maximum symbol requirements are
  GLIBC_2.43 and GLIBCXX_3.4.32. No ROCr/XRT library is loaded.
- Native 8x8 BF16/BFP16 matrix multiplication matches a nonuniform CPU oracle
  across concurrent requests and changed inputs. The GPU→NPU GEMM→GPU example
  reports zero copied bytes and stable allocation/import counts after preparation.

The applied compiler set is 0001/0003/0005/0007/0009. See the
[paired compiler qualification](docs/PATCH-QUALIFICATION.md) for 50-pair
comparisons and retained-patch results. Large production NPU GEMM/model
throughput and other devices/driver versions are not qualified here.

### Runtime migration measurements

Thirty completed process pairs compare the preserved 0.7.1 executable/bundle
with 0.8. Two additional baseline invocations hung in the old HRX semaphore wait;
one was inspected and terminated, the other hit a 60-second deadline. Successful
pair statistics condition on completion. Concurrent CPU validation introduces
additional noise. These timings document tradeoffs, not a universal speedup.

| Metric | 0.7.1 median | 0.8 median |
| --- | --- | --- |
| `allocate_drop_ns` | 391.10 | 60.28 |
| `dispatch_complete_ns` | 2157.26 | 1452.71 |
| `dispatch_enqueue_ns` | 162.98 | 725.43 |
| `graph_complete_ns_per_kernel` | 2785.18 | 858.29 |
| `graph_enqueue_ns_per_replay` | 1098.98 | 573.74 |
| `graph_independent_ns_per_kernel` | 1326.22 | 201.66 |
| `queued_upload_gib_s` | 20.99 | 17.69 |
| `scratch_reuse_ns` | 47.58 | 47.52 |

Allocation, graph submission, and graph completion improve in this sample.
Individual dispatch enqueue and large uploads regress. Applications dominated
by these paths should measure their workloads before migrating. Full raw data,
paired intervals, and bundle identities are in
[the runtime results](docs/qualification/runtime-results.json).

### Downstream migration checks

Disposable committed krea2-hrx and h3-hrx snapshots were checked with their
copied Cargo requirement changed to 0.8. Both need source migration: boolean
report settings become `ReportMode`, report text becomes serialized structured
JSON, and old `CompilerOptions` literals need `processor_mode`. Krea's optional
NPU fusion also uses the removed IRON/xclbin APIs. No downstream source checkout
was changed, and full model execution is not claimed. The library's GPU/inference
integration suite passes. See [the migration guide](docs/GPU-NPU.md).

## Historical 0.7 validation

The remaining sections describe earlier backends and are retained as history.


## Upstream native update, 2026-09-22

Source pin: `556c648e8f301ad9656d325687cc93b417ea78ff`, with eight downstream
patches (0001–0005, 0007–0009). The pristine-upstream comparison is recorded in
[the patch audit](patches/loom/README.md#upstream-patch-audit-2026-09-22).
All five original patch-0006 cases pass upstream, so that patch is removed.
VOPD bank, SMEM destination-reuse, and encoding-config regressions still fail
without their fixes. Retained scheduling/repack optimizations have not been
requalified for end-to-end performance on this revision.

The rebuilt runtime uses the pinned Ubuntu 26.04 container and replaces ROCr
with the unmodified library from TheRock run 35670146294. The old ROCr fails
initialization because it lacks `hsa_amd_queue_create`. The remaining AMD
libraries retain their original bytes. All 26 release inputs and eight patch
digests verify; the updated fetch, container-build, staging, and pack commands
complete successfully. Release builds disable test/CTS registration; native
tests run in a separate build with all Loom AMDGPU target defaults enabled.

Validation on gfx1151/XDNA2:

- All-feature Rust tests, documentation tests, formatting, and strict Clippy pass.
- 42 selected native compiler tests and six Python generator/descriptor tests pass.
- Packaged Ubuntu libraries pass 14 GPU, 24 inference, four compiler-embedding,
  three heterogeneous GPU/NPU, and seven compiler/cache/CU-mode tests.
- GPU/NPU sharing includes GPU arithmetic → NPU DMA → GPU arithmetic, exercising
  the rebased buffer-export patch and the newer ROCr together.

Native release: `native-20260922-hrx-update`; the checked-in `bundle.json`
selects the rebuilt runtime. Final packaging preserves all 13 validated library
files byte for byte. Binary archive SHA-256: `66e97e73a73c15d753972c60cd2300900b67a9669a10b487fa1046a84c8df086`.
Matching source archive SHA-256:
`bcb1bd1a8870cb848e56bdce26ff347beec4d87e3b7bf4bb652b640d49da6f6e`.
The NPU runtime manifest retains the separately qualified September 10 bundle.

After publication, anonymous preparation downloaded both default bundles into
an empty cache. Offline diagnostics loaded Loom and both runtimes, detected
gfx1151, and confirmed shared interop ABI 1 without runtime-directory overrides.
All seven compiler/cache tests (including CU/WGP mode isolation) and all three
heterogeneous tests pass against those downloaded bundles. GitHub's uploaded
asset digests match the binary and source archives; the public source URL
returns HTTP 200. The CU/WGP test now requires support from the default bundle,
while permitting explicit rejection by an older developer override.

Detailed build, patch-audit, and test logs are under `artifacts/upstream-update`.

## Upload staging cache replacement, 2026-09-21

Default `cargo test`, strict all-target Clippy and the four ignored
`runtime::staging_tests` GPU tests pass on gfx1151. The new regression starts
with eight small cached uploads, verifies reuse after switching to larger
uploads, checks copied bytes and exercises both cache limits. This change
replaces only completed cache entries; pending-upload retention is unchanged.

## Runtime composition 0.7.1 qualification, 2026-09-17

All-feature CPU and documentation tests pass on Rust 1.91. Stable strict
all-target Clippy and Rustdoc, formatting, and both feature configurations pass.
All 24 inference hardware tests pass on gfx1151, including graph-local private
scratch reuse, packed RGB geometry validation, direct host publication, and
resident row gathering. Model-specific integration crates and benchmarks have
been removed; the runtime has no Cargo dependencies on downstream model crates.
These checks do not qualify downstream model accuracy or application throughput.

## Graph composition 0.7 qualification, 2026-09-16

All-feature CPU and documentation tests, strict all-target Clippy, and 19
inference hardware tests pass. Native GPU (14), coordinated execution (3), and
heterogeneous NPU (3) tests pass; execution Miri checks pass 24 tests with three
intentional-leak cases ignored. Composition tests check retained slots, alias
validation, exact image-operation results, lazy staging retries, and warm replay
without intermediate device copies, graph creation or device allocations.

The broader end-to-end performance targets are not met or fully qualified.
This release does not claim a general latency, throughput, startup or memory
improvement across applications. Graph-wide scratch reuse and further native
pipeline integration remain outside this release.

## Shared inference 0.6 qualification, 2026-09-16

Rust 1.91 all-feature CPU tests and stable strict Clippy pass. GPU-only and NPU
feature configurations build; `npu` is the only optional feature. Miri passes
24 execution/ownership tests with leak checks enabled; three intentional native
quarantine tests run outside Miri. Strict Rustdoc and package verification pass.

On gfx1151/XDNA2, the coordinated, owned-inference and mixed GPU/NPU suites pass,
including cross-lane ordering, retained-output backpressure, cancellation/drain,
native allocation budgets and quarantine. Pinned H3 and Krea pipeline fixtures
retain exact outputs after migration; H3 additionally checks four independent
idle-unit evictions, exact reload, native-stage lane exclusion and zero budget
charges at teardown. Compiler/driver allocations and allocator rounding remain
outside explicit budget accounting. These are correctness and ownership checks,
not a claim of universal speedups or whole-system memory reductions.

## Reviewed native bundle, 2026-09-09

The replacement bundle uses freshly built HRX/Loom and the AMD runtime from
TheRock build 26672984641. Its 13 library files, license texts, inventory, and
source-archive reference are pinned in `bundle.json`.

```text
06000605de874bc972e17e90f94a3816302fdd2a17040cfaf1df1f0b70483cc4
```

The library bytes passed all 27 CPU tests, both Rust doctests, and all 18 ignored
GPU/compiler tests on gfx1151. Installation started with an empty cache and used
no runtime, compiler, or HSA overrides. Every dynamic dependency resolves to the
bundle or a documented host library. The Arch library chain and `loom-compile`
are absent. Source hashes match the recorded upstream manifests; this does not
claim byte-identical reconstruction of AMD's CI build.

The final archive also passed all 13 native tests from an isolated checkout of
commit `2530451`. The public default URL installed into a second empty cache
without GitHub authentication, and `HRX_OFFLINE=1 hrx info` initialized gfx1151.
The source archive returns HTTP 200 anonymously; GitHub reports matching SHA-256
digests for both uploaded archives.

Cargo's publishing dry run passed, packaging 70 files (185.1 KiB compressed) and
successfully compiling the packaged crate. No crates.io upload was performed.

See [native/RELEASE.md](native/RELEASE.md) for source and build evidence.

The View API tests also check nested offsets, parent bounds, empty and overflowing
regions, and unchanged surrounding bytes after stream transfers and graph replay.
A release benchmark run after this change measured 24.3 GiB/s queued uploads,
130 ns host dispatch recording, and 806 ns host recording per 32-kernel replay.
This run uses the reviewed bundle; the historical comparison below uses the
original bundle. Each metric is the median of nine samples after three warmups.

## Original bundle results, 2026-09-09

Tested on Linux x86_64 with a gfx1151 GPU. Archive installation was checked with
an empty cache. Native tests use the verified bundle cache with `HRX_OFFLINE=1`
and without runtime, compiler or HSA library overrides.

| Check | Result |
| --- | --- |
| CPU tests | 27 passed |
| Rust API doctests | 2 passed |
| Ignored runtime and compiler tests | 18 passed |
| Feature matrix | All 8 subsets build, including on Rust 1.88 |
| Clippy | Passes with warnings denied on stable and Rust 1.88 |
| Rustdoc | Passes with warnings denied |
| Package contents | Internal review documents excluded |

The native tests cover queued transfers, staging batching and reuse, event
ordering between streams, moving pending streams between threads, rejection of
shared scratch allocations, argument packing, workgroup validation,
resource retention, graph replay, compiler caching and diagnostics.

The tested archive SHA-256 is:

```text
c151a978eff1c7def5c54b9acfd595cc1e8ca21b793b4613864a18281d846bb1
```

A cached directory matched every file digest in `bundle.json`. Repacking it
reproduced this archive hash and replaced the stale `34591d78…` archive in
`artifacts/`. The anonymous release URL returned 404 during the initial bundle
check. After the repository became public, an unauthenticated HEAD request to
the pinned archive returned HTTP 200 on 2026-09-09. This availability check did
not repeat installation or GPU tests. Dependency provenance and notices remain
incomplete; see [THIRD-PARTY.md](THIRD-PARTY.md).

To repeat the bundle check with an empty cache:

```sh
export XDG_CACHE_HOME="$(mktemp -d)"
unset HRX_RUNTIME_DIR HRX_LOOM_LIBRARY HRX_BUNDLE_MANIFEST
cargo run --all-features --bin hrx -- prepare /path/to/hrx-linux-x86_64-gfx1151.tar.gz
HRX_OFFLINE=1 cargo run --all-features --bin hrx -- info
HRX_OFFLINE=1 cargo test --all-features -- --ignored --test-threads=1
```

These results cover this crate. Consumer model quality and performance were not
retested. Only gfx1151 was exercised; GPU timestamp profiling is not implemented.

## Stream performance

Release builds on the same Ryzen AI MAX+ 395 / Radeon 8060S (gfx1151), using
Rust 1.95.0-nightly (5fb2ff861), Linux 7.2.3 and the bundle above. The baseline is
commit `af2f7c7`; the candidate removes `Gpu`, `compat` and the application C API
helpers. Both run the same [benchmark](examples/stream_bench.rs) through `Stream`.

| Operation | Baseline | Stream after removal |
| --- | ---: | ---: |
| Queued upload, 256 MiB in 4 MiB chunks | 23.80 GiB/s | 24.08 GiB/s |
| Dispatch recording, host time per kernel | 131 ns | 131 ns |
| Dispatch batch through completion, per kernel | 2.158 µs | 2.154 µs |
| Graph replay, host time per 32-kernel replay | 815 ns | 815 ns |
| Graph batch through completion, per kernel | 2.200 µs | 2.194 µs |
| Scratch acquire/recycle, 1 MiB | 43.1 ns | 43.8 ns |
| Allocate/drop, 1 MiB | 367 ns | 361 ns |

Each process discards three warmups and takes the median of nine samples. The
table takes the median of five processes per version, alternating execution
order. Compilation, loading and initial data setup are outside the timed sections.
Each dispatch sample records 2,048 kernels; each graph sample replays 32 kernels
256 times. Samples end with stream synchronization. Upload and kernel outputs
are checked. Scratch samples contain 50,000 acquire/recycle pairs; allocation
samples contain 2,000 allocate/drop pairs.

The measured medians differ by less than 2%. Graph replay reduces host recording
work to roughly 25 ns per kernel here.

## Paired graph schedules, 2026-09-10

The corrected benchmark uses 32 disjoint input/output pairs in both recordings.
One recording chains the kernels and the other declares them independent. Each
sample replays 32 kernels 256 times and waits for completion. After three warmup
pairs it takes nine pairs, alternating chained/independent and
independent/chained order. Every output is checked.

One run on the gfx1151 host above measured:

| Recording | Wall time through completion, per kernel |
| --- | ---: |
| Chained | 4.373 µs |
| Independent | 1.926 µs |

The difference includes scheduling, barriers and possible overlap; it is not a
fixed cost per edge and does not predict model speedups. The reported metric is
`graph_scheduling_difference_ns_per_kernel`. These are CPU wall-clock timings,
not GPU timestamps; unrelated system load can affect them.

The previous Euler independence figures are withdrawn. Those nodes shared an
in/out allocation: a zero timestep did not make concurrent writes safe. The
separate 64-fill probe uses disjoint allocations, but its timing difference also
cannot be extrapolated into a universal edge price.

An empty `join` ends a native recordable partition and adds a queue barrier.
Passing producer nodes directly to a single consumer avoids that extra operation.
Additional native workstreams are considered only after the first 16 recordable
nodes within a partition. A graph's shape and this scheduling policy both matter;
node count alone does not establish concurrent execution. The pinned public API
has no partition, workstream or inserted-barrier counters.

The upload measurement includes the host staging copy on this integrated GPU;
it is not PCIe bandwidth.

To run after preparing the bundle:

```sh
HRX_OFFLINE=1 cargo run --release --example stream_bench
```

To compare another revision, copy `examples/stream_bench.rs` into its checkout,
build both with the same Rust toolchain, and alternate their release binaries.
For older revisions, adapt the transfer signatures using [CHANGELOG.md](CHANGELOG.md).
Keep other GPU work idle and use the same native bundle for both.

## CI

`.github/workflows/ci.yml` runs on pushes and pull requests using stable
Rust and Rust 1.91. It checks formatting, builds all targets, runs clippy, CPU tests
and rustdoc, checks GPU-only and NPU-enabled builds, and lists package contents.

`.github/workflows/gpu.yml` runs on pushes or manual dispatch. It needs a
registered runner with labels `self-hosted`, `linux`, `x64`, and `gfx1151`, access
to `/dev/kfd` and the render node, rustup, curl, and HTTPS access. Runner
registration is still outstanding.

The GPU job provisions an empty cache and runs every ignored test, including
compiler and library tests. It fails if provisioning fails. The optional
repository variable `HRX_BUNDLE_MANIFEST` is an HTTPS URL to a mirror manifest;
the workflow downloads it and sets the process environment variable to its local
path. Without a mirror, the job uses the pinned release.


## Optional CU/WGP compiler profiles (2026-09-22)

Patch 0009 adds the execution-policy extension used by
`loom::CompilerOptions::processor_mode`. The existing bundle remains unchanged;
its compiler explicitly rejects a non-default request. With a locally rebuilt
compiler, the native profile/serialization, descriptor, and occupancy suites all
pass, along with 47 Python target/generator tests. The mode/cache regression
passes with both the new compiler (distinct cache keys and a one-bit descriptor
change) and the old compiler (explicit rejection).

The crate's 76 CPU tests, formatting, and all-target clippy with warnings denied
pass. Qwen's integrated opt-in path produces the fixed 2048×2048, 8-step, seed-42
reference PNG exactly, SHA-256
`4ed22c6835ca51460f142267cf3a00d92da1f3c2eeb6a8023b3caa06937038cc`.
The local compiler SHA-256 is
`7fc156a11946ec6c3766dda6296a50185f15455a08e7ce2fe8cbcfd6d3ac840a`;
it was built in Release mode with gfx1151, gfx1100, gfx942, and gfx11-generic
contracts so the native test fixtures were all available. This does not qualify
a new runtime release or establish an isolated speedup.