refactor(qwen3): move the report harness out of the library API - #983
Open
onenewcode wants to merge 1 commit into
Open
refactor(qwen3): move the report harness out of the library API#983onenewcode wants to merge 1 commit into
onenewcode wants to merge 1 commit into
Conversation
`pegainfer-qwen3` exposed `pub mod kernel_bench` (1112 lines) as public
API, so every normal library and server build compiled report-only
benchmark code and shipped its types in the crate's public surface.
Move the harness to `src/bin/report_support/`, split across five modules,
and `#[path]`-include it from the two `kernel-report` binaries. It is now
compiled per binary and never as part of the library.
- `qwen3_kernel_report` takes the whole tree; `qwen3_model_report` needs
only `common::L2CacheClear` and includes that module alone, with the
`#[allow(dead_code)]` on its own `mod` declaration so the other four
modules stay dead-code-checked by the kernel report's build.
- The model report now imports production primitives from their owning
crates: `build_split_kv_csr` from `pegainfer_core::ops` and
`split_qkv_into` from `pegainfer_kernels::ops`, instead of reaching
through a harness re-export. This also fixes a pre-existing build
break: `qwen3_model_report` did not compile under `--features
kernel-report` at HEAD, because `split_qkv_into` is not re-exported by
`pegainfer-core`.
- `SplitKvConfig::{new, label}` widen to `pub`. `parse` was already
public and calls `new`, so a private constructor only pushed external
callers to the unchecked struct-literal path; `label` is `parse`'s
inverse and restating its format in the harness would silently break
the round-trip contract.
- `SPLIT_KV_CHUNK_TOKENS` / `SPLIT_KV_TUNED_MAX_CHUNKS` are re-exported
through `runtime` so the harness keeps deriving the Tuned split width
from the runtime constants, as it did before the move, rather than
restating 64x64 where a retune would silently desync `split_tmp_*`.
Report schemas, CLI flags, benchmark cases, numeric policy, and kernel
selection are unchanged; both binaries' `--help` output is identical.
Verified on RTX 5090 (sm_120):
cargo check -p pegainfer-qwen3 --lib 0 warnings
cargo check -p pegainfer-qwen3 --all-targets --features kernel-report pass
cargo clippy -p pegainfer-qwen3 --all-targets --features kernel-report -D warnings pass
cargo test -p pegainfer-qwen3 --lib 88 passed
cargo build --features kernel-report --bin qwen3_kernel_report --bin qwen3_model_report both link
cargo fmt --check pass
Closes pegainfer-project#944
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #944.
pegainfer-qwen3exposedpub mod kernel_bench(1112 lines) as public API. Every normal library and server build compiled report-only benchmark code and shipped its types in the crate's public surface.The harness moves to
pegainfer-qwen3/src/bin/report_support/, split across five modules, and is#[path]-included by the twokernel-reportbinaries. It is now compiled per binary and never as part of the library.qwen3_kernel_reporttakes the whole tree.qwen3_model_reportneeds onlycommon::L2CacheClearand includes that module alone, with the#[allow(dead_code)]on its ownmoddeclaration rather than inside the shared module — so the other four modules stay dead-code-checked by the kernel report's build. Removing the allow and buildingqwen3_kernel_reportalone yields 0 dead-code warnings, confirming the allow covers only the model report's narrower use.build_split_kv_csrfrompegainfer_core::ops,split_qkv_intofrompegainfer_kernels::ops, instead of reaching through a harness re-export.SplitKvConfig::{new, label}widen topub.parsewas already public and callsnew, so a private constructor only pushed external callers onto the unchecked struct-literal path;labelisparse's inverse, and restating its format in the harness would silently break the round-trip contract thatlabel_parse_round_tripsguards.SPLIT_KV_CHUNK_TOKENS/SPLIT_KV_TUNED_MAX_CHUNKSare re-exported throughruntimeso the harness keeps deriving the Tuned split width from the runtime constants exactly as it did before the move, rather than restating64x64where a later retune would silently desync the report'ssplit_tmp_*sizing.Report schemas, CLI flags, benchmark cases, numeric policy, and kernel selection are unchanged; both binaries'
--helpoutput is identical.Incidental fix.
qwen3_model_reportdid not compile under--features kernel-reportatmain: it calledops::split_qkv_into, whichpegainfer-coredoes not re-export. This was invisible because no CI job enableskernel-report— the two binaries carryrequired-features = ["kernel-report"], andqwen3-cuda-clippydoes not pass it (the feature pullspegainfer-cupti, excluded atci.yml:300for missing CUPTI headers in the CI toolkit). Worth a follow-up: this PR does not create that gap, but it does move ~1500 more lines behind it.Docs.
docs/models/qwen3/roadmap.mdcleanup ledger strikes thekernel_bench.rsfile-size entry.docs/subsystems/kernels/kernel-op-reports.mdTL;DR records the new home and notes that paths in its Execution Log are historical — those are dated past-tense step records (Step 1 still uses the pre-flatteningcrates/layout), so rewriting them to today's paths would falsify the record rather than fix it.Type of Change
qwen3_model_reportcompile break described abovepub mod kernel_bench. No runtime behavior changes and no in-workspace consumer breaks; flagged because Move the Qwen3 benchmark harness out of the library public API #944 mandates the removal with no compatibility shim, so any out-of-tree user of that path is affected.Checklist
docs/conventions/coding-style.md).CLAUDE.md).Run locally on RTX 5090 (sm_120), driver 610.57.04:
cargo check --release -p pegainfer-qwen3 --libcargo check --release -p pegainfer-qwen3 --all-targets --features kernel-reportcargo clippy --release -p pegainfer-qwen3 --all-targets --features kernel-report -- -D warningscargo test --release -p pegainfer-qwen3 --libcargo build --release -p pegainfer-qwen3 --features kernel-report --bin qwen3_kernel_report --bin qwen3_model_reportcargo fmt --check