Skip to content

Support: add l2-orchestrator-standalone bench for the L2 submit path - #1903

Open
network4agent wants to merge 1 commit into
hw-native-sys:perf/hbg-orchfrom
network4agent:l2-orch-bench
Open

Support: add l2-orchestrator-standalone bench for the L2 submit path#1903
network4agent wants to merge 1 commit into
hw-native-sys:perf/hbg-orchfrom
network4agent:l2-orch-bench

Conversation

@network4agent

Copy link
Copy Markdown

Host-only bench and profile for the four lines that build an L2 task graph
(runtime_maker.cpp:538-541). Adds one new top-level directory,
l2-orchestrator-standalone/ (24 files), and changes no existing file.

It needs no CANN, SDK or NPU: host_build_graph already runs this orchestrator
on the host into an SM mirror and only H2Ds the populated image, so the harness
stops before the H2D, the GM heap becomes a host allocation, and the dlopen'd
entry is linked in through the same framework_bind_runtime.

It compiles the engine in place

There is no copy of the runtime in this package. The 8 engine TUs are
build_config.py's host target minus host/ (runtime_maker and its CANN
dependencies), compiled straight out of src/, so the bench measures the
runtime of whatever revision it sits on and there is nothing to keep in sync.
scripts/check_extraction.sh asserts that correspondence still holds and that
every path CMakeLists.txt names resolves. The one engine-side file the package
owns is src/host_shim/host_shim.cpp — the 9 diagnostic symbols the AICPU
binary would otherwise provide.

What it measures

One payload — qwen3_dynamic_tensormap.h at QWEN3_SPMD_TIER=0, compiled
unmodified as C through an esl_proxy C-ABI shim. 3096 kernel submits + 779
framework allocs = 3875 engine tasks. The tier is pinned because it changes the
DAG, and a task count quoted without its tier is meaningless.

Four profiling levels, none of which modifies engine source: driver
brackets, a copied rt->ops table, and the engine's own per-STEP and TensorMap
counters behind their existing SIMPLER_ORCH_PROFILING /
SIMPLER_TENSORMAP_PROFILING flags.

Result on this branch (Kunpeng-920, -O3, pinned)

condition four-line block per task throughput
cold 11.42 ms 2.95 µs ~339 k tasks/s
prefaulted 4.71–4.90 ms 1.22–1.26 µs ~790–820 k tasks/s

Reading it requires the cold/warm split. Cold, STEP 5 looks like 65% of submit
cost — but 95% of that is first touch of the SM mirror (39.8 MB of payload ring
at --task-window=8192, and STEP 5 is merely the first writer of each slot).
Prefaulted, the bottleneck is STEP 3, the TensorMap lookup, at 73%.

The cause is pinned to same-address sub-views rather than table pressure:
PTO2_TENSORMAP_NUM_BUCKETS is 4096 and this case makes only 4002 inserts, yet
the average walked chain is 13.4 — and 98.2% of walked entries share the
probe's buffer.addr. That is pto_tensormap.h:30-34 working as specified
("Hash only by base_ptr… ALL sub-regions of the same base tensor MUST be in the
SAME hash bucket"), which is what makes byte-range overlap detection possible
at all. Reducing it means a secondary order on start_offset, not a bigger
table.

Full report, with a file:line citation for every measured quantity:
reports/perf-report-perf-hbg-orch-qwen3-dyn.md.

Caveat that bounds every number

Nothing is ever reclaimed: no scheduler, no completion, so the ring's watermark
reclaim never fires, the task window and heap must hold the whole graph, and the
reclaim paths are never entered. This measures the fast submit path only.

Verification

  • ctest 4/4 (includes a prefault test asserting the graph size is unchanged)
  • scripts/check_extraction.sh 3/3, negative-tested against a broken include path
  • clean under ASAN+UBSAN, both modes
  • 0 warnings from hand-written code under -Wall -Wextra
  • ldd shows no CANN

Host-only bench and profile for the four lines that build an L2 task
graph (runtime_maker.cpp:538-541). It needs no CANN, SDK or NPU because
host_build_graph already runs this orchestrator on the host into an SM
mirror and only H2Ds the populated image; the harness stops before the
H2D, so the GM heap becomes a host allocation and the dlopen'd entry is
linked in through the same framework_bind_runtime.

- The engine is compiled in place out of ../src, not copied, so the
  bench measures the runtime of whatever revision it sits on and there
  is nothing to keep in sync. The 8 engine TUs are build_config.py's
  `host` target minus host/ (runtime_maker and its CANN dependencies);
  check_extraction.sh asserts that correspondence still holds and that
  every path CMake names resolves. The one engine-side file the package
  owns is src/host_shim/, which defines the 9 diagnostic symbols the
  AICPU binary would otherwise provide.
- One payload, qwen3_dynamic_tensormap.h at QWEN3_SPMD_TIER=0, compiled
  unmodified as C through the esl_shim C ABI. The tier is pinned because
  it changes the DAG, and a task count without its tier is meaningless.
- Profiling has four levels, none of which modifies engine source:
  driver brackets, a copied rt->ops table, and the engine's own per-STEP
  and TensorMap counters behind their existing build flags.

Baseline for perf/hbg-orch is in reports/. Reading it requires the
cold/warm split: STEP 5 looks like 65% of submit cost, but 95% of that is
first touch of the SM mirror. Prefaulted, the bottleneck is STEP 3, the
TensorMap lookup, at 73%. The cause is not table pressure -- 4002 inserts
over 4096 buckets -- but same-address sub-views: 98.2% of walked entries
share the probe's buffer.addr, which pto_tensormap.h:30-34 requires so
byte-range overlap detection works at all.

Bounding caveat: nothing is ever reclaimed here. There is no scheduler
and no completion, so the ring's watermark reclaim never fires, the task
window and heap must hold the whole graph, and the reclaim paths are
never entered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8536d75e-cb17-48e1-9570-0691e8cc58cd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant