Add Qwen3 A8W8 L2 runner foundation#61
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR adds a new NPU runner module ChangesQwen3-14B A8W8 NPU Runner
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant Qwen314BA8W8ModelRunner
participant L2Worker
participant KVCache
Caller->>Qwen314BA8W8ModelRunner: run_prefill(model, batch)
Qwen314BA8W8ModelRunner->>Qwen314BA8W8ModelRunner: _prepare_prefill_inputs(batch)
Qwen314BA8W8ModelRunner->>KVCache: _validate_kv_cache_bounds(block_table)
loop per transformer-layer chunk
Qwen314BA8W8ModelRunner->>L2Worker: _run_l2_program(prefill chunk)
L2Worker-->>Qwen314BA8W8ModelRunner: chunk hidden states
end
Qwen314BA8W8ModelRunner->>Qwen314BA8W8ModelRunner: _project_logits_host()
Qwen314BA8W8ModelRunner-->>Caller: PrefillResult(logits)
Caller->>Qwen314BA8W8ModelRunner: run_decode(model, batch)
Qwen314BA8W8ModelRunner->>Qwen314BA8W8ModelRunner: _prepare_decode_inputs(batch)
Qwen314BA8W8ModelRunner->>KVCache: _validate_kv_cache_bounds(padded block_table)
Qwen314BA8W8ModelRunner->>L2Worker: _run_l2_program(decode fused)
L2Worker-->>Qwen314BA8W8ModelRunner: logits buffer, hidden states
Qwen314BA8W8ModelRunner-->>Caller: DecodeResult(trimmed logits)
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Split the A8W8 serving integration so the reusable L2 runner infrastructure can be reviewed independently. This adds the Qwen3-14B A8W8 ModelRunner and the WorkerTensor adapter needed to pass worker-owned allocations into Simpler L2 orchestration calls.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
examples/model/qwen3_14b/runner/npu_runner_a8w8.py (1)
559-588: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unused helper or reuse it in
close()._release_l2_child_allocs()has no callers, andclose()duplicates the same per-allocationworker.free(...)loop; consolidating that cleanup path would keep the release logic in one place.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/model/qwen3_14b/runner/npu_runner_a8w8.py` around lines 559 - 588, _Remove the dead helper or wire it into the shutdown path._ `_release_l2_child_allocs()` is currently unused, and `close()` repeats the same per-allocation `worker.free(...)` and cache cleanup logic; refactor `close()` to call `_release_l2_child_allocs()` for each runtime or fold the shared release logic into that helper so the L2 allocation cleanup lives in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@examples/model/qwen3_14b/runner/npu_runner_a8w8.py`:
- Around line 559-588: _Remove the dead helper or wire it into the shutdown
path._ `_release_l2_child_allocs()` is currently unused, and `close()` repeats
the same per-allocation `worker.free(...)` and cache cleanup logic; refactor
`close()` to call `_release_l2_child_allocs()` for each runtime or fold the
shared release logic into that helper so the L2 allocation cleanup lives in one
place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3634c0c9-d693-4a1b-8f68-647c6eeea064
📒 Files selected for processing (2)
examples/model/qwen3_14b/runner/npu_runner_a8w8.pypython/runtime/worker.py
e447dc0 to
8c0b8f9
Compare
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Summary
This is part 1 of splitting the native Qwen3-14B A8W8 serving integration into reviewable PRs under 1000 changed lines.
This PR adds the reusable L2 runtime foundation for the Qwen3-14B A8W8 path:
Qwen314BA8W8ModelRunnerModelRunnerAPIWorkerTensor.to_continuous_tensor()so worker-owned allocations can be passed into L2 orchestration callsThis PR does not register the A8W8 model format or change the user-facing
npu_generate.pyCLI. That wiring is intentionally left to the follow-up PR so each diff stays below 1000 lines.Split Plan
pto_isa_commitplumbing, and tests.Current size:
Related
Part of #52.
Related PRs:
Validation
Also validated through the stacked follow-up branch: