Skip to content

NPU runtime: npu_rt_api::bo::address() for add-ons; runtime pin ce9fa59a - #479

Merged
bong-water-water-bong merged 2 commits into
mainfrom
1bit/npu-rt-bo-address
Oct 20, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
1bit/npu-rt-bo-address

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

The public NPU header gains uint64_t bo::address() const (the buffer's device address, for add-ons that write it into config buffers). npu-lax needs it to build on npu/rt.h instead of the real XRT headers (npu-kernels branch npu-lax/npu-rt-api). Runtime pin -> private 1bit-MONSTER ce9fa59a (one forwarding line, merged into npu/npu-rt-full); tests/npu_rt_shim_test.cpp's link check calls it. The header rule stays: only calls the engine and its add-ons make; an opaque address reveals nothing of the runtime.

Evidence (ryzen builds, strixhalo NPU, 20 Oct): 1bit with -DONEBIT_NPU=ON -DONEBIT_NPU_PRIVATE (npu-lax) links in both runtime modes (ONEBIT_NPU_RT_DIR / ONEBIT_NPU_RT_LIB), ctest 38/38 each, no libxrt in ldd. NPU: dx check 24/24 with M5 PASS in all 6 runs (logits md5 identical to #467's check); lax decode (Qwen3.6-35B-A3B) parity corr >= 0.999993 with matching argmax at 3 positions in both modes, chat "The capital of France is Paris." at 16.3 tok/s; kernel log clean. libnpu_rt_api.a: 76 global T symbols, all npu_rt_api, no npu_rt names in strings.

🤖 Generated with Claude Code

The private npu-lax add-on (the Qwen3.6-35B-A3B NPU route) writes each layer pool's device
address into its layer config buffers, so the public interface gains bo::address() const.
npu_rt_shim covers it. config/npu-runtime.config moves to 1bit-MONSTER/1bit-MONSTER
ce9fa59a (branch npu_rt/bo-address on 0fb58e1e), which forwards it to the runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong bong-water-water-bong added the hw-gate Run the HRX hardware gate on Strix Halo (docs/hw-gate.md) label Oct 20, 2026
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

467 - Partially compliant

Compliant requirements:

  • Public header npu/npu_rt_api.h is created with opaque handles and only necessary API calls
  • Prebuilt library libnpu_rt_api.a is introduced as an alternative build option
  • Test tests/npu_rt_shim_test.cpp now calls the new address() function to verify symbol linkage
  • Runtime pin is updated to commit ce9fa59adf957343c16c60c4dae59c1e5dc8857e

Non-compliant requirements:

  • The PR description mentions that the NPU check on Strix Halo has not yet run, which is a requirement for moving the runtime pin

Requires further human verification:

  • Verification that the NPU check on Strix Halo passes with the new runtime pin
  • Confirmation that the runtime pin update is correctly applied and validated
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

New API Function

The new address() function in the bo class returns the device address of a buffer. While this is useful for add-ons, it's important to ensure that this function doesn't expose internal implementation details or create potential security concerns by revealing memory layout information. The function is marked as const and returns a uint64_t, which is appropriate for an opaque handle.

uint64_t address() const;
Test Coverage

The test now calls the new address() function, which is good for ensuring the symbol is available in the library. However, it's important to verify that this call is actually tested for correctness, not just linkage. The test currently only prints the address, so it doesn't validate that the returned value is correct or meaningful.

std::printf("%llu\n", static_cast<unsigned long long>(act->address()));

@bong-water-water-bong
bong-water-water-bong merged commit 3817587 into main Oct 20, 2026
8 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/npu-rt-bo-address branch October 20, 2026 21:43
bong-water-water-bong added a commit that referenced this pull request Nov 21, 2026
… guard halves (#3192)

Moves the fork gitlink to the head that carries engine#3122's fix. None of the three
commits is in main's pin; all are on the fork's line.

  third_party/llama.cpp:  a87cc5a74e83dc1b0b15210814b242cea7b22d58
                       -> a9c849c6a225cfeae813f425d1497c630f2790a2
  registry/architectures.json: the same sha, as every bump does

fork line above the old pin:
  a9c849c6a  test-hrx-ops: the #3122 control row is mutation-tested, and belongs in the host tier (#482)
  d9d9502e6  test-hrx-ops: the other direction of the #3122 exemption, so dropping it cannot be the cheap fix (#479)
  2e010548d  hrx: a requested output that a fused match consumes inside itself is not exempt (engine#3122) (#478)
  a87cc5a74  hrx-ops-test: the two layouts the swiglu rows choose between must differ (#477)   <- what main pins today

Ancestry of all three against the new pin: yes, yes, yes
(`git merge-base --is-ancestor <commit> a9c849c6a`).

## What it fixes

The two `get_rows_scale_f32.*` rows read `actual=0` against a non-zero reference because
`first_covered_requested_output` exempted the match's ROOT on the grounds that "a match
always writes its root's output" -- false for a match that extends past its root, where the
root's value lives only inside the fused program. The exemption now applies only when
nothing inside `covered_nodes` consumes the root's output.

The other two commits are what keeps that fix from being undone cheaply: #479 pins the
other direction (a confined match keeps its exemption) and #482 mutation-tests it -- with
`root_output_confined_to_match()` forced to false the row fails, so deleting the exemption
cannot make the rows green -- and moves the row to the host tier, so a run without a device
executes it instead of skipping it (measured: `ROCR_VISIBLE_DEVICES=none` still schedules
and passes).

## Verified

  config_pin_check.py --check                 rc 0 (5 sha pins are 40 lowercase hex)
  submodule_pin_check.py --check              rc 0 (1 submodule at its pinned commit)
  pre-pr-checks.sh --base origin/main --tree-only
        12 green, 2 skipped, 2 could not be told (both git-history rows, this clone is
        shallow -- CI with fetch-depth: 0 answers them), 2 open-PR rows not run

Refs #3122. The add-on route for these shapes is engine#3085's family, not this issue.

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hw-gate Run the HRX hardware gate on Strix Halo (docs/hw-gate.md) Review effort 3/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant