Skip to content

test: use block_dim=0 (auto) instead of hardcoded platform max#1309

Open
doraemonmj wants to merge 1 commit into
hw-native-sys:mainfrom
doraemonmj:blockdim-auto
Open

test: use block_dim=0 (auto) instead of hardcoded platform max#1309
doraemonmj wants to merge 1 commit into
hw-native-sys:mainfrom
doraemonmj:blockdim-auto

Conversation

@doraemonmj

Copy link
Copy Markdown
Contributor

What

Many scene tests hardcoded the runtime config block_dim to the platform
maximum — 24 on a2a3, 36 on a5. That literal is exactly what block_dim=0
already resolves to.

block_dim=0 is the CallConfig auto sentinel: DeviceRunner resolves it
at run() time to the stream's max block capacity.

  • Onboard: queries the actual cube/vector core counts via
    aclrtGetStreamResLimit and caps at PLATFORM_MAX_BLOCKDIM.
  • Sim: uses PLATFORM_MAX_BLOCKDIM directly (a2a3=24, a5=36).

Change

Zero out the a2a3 (24) and a5 (36) config block_dim values so these
tests follow the hardware's actual available core count instead of pinning a
literal that happens to equal today's platform max.

  • Scope: only CASES[*]["config"]["block_dim"].
  • Kernel-side params.block_dim (a tiling arg, e.g. in
    spmd_paged_attention_highperf) is left untouched.
  • Non-max intentional values (a2a3 9/3, a5 SPMD/PA cases pinned to 24,
    block_dim 1/2) are left untouched.

26 files, 70 config values → 0.

Many scene tests hardcoded the runtime config block_dim to the platform
maximum (24 on a2a3, 36 on a5). That value is exactly what block_dim=0
resolves to: DeviceRunner treats 0 as the CallConfig auto sentinel and
resolves it at run() time to the stream's max capacity (onboard queries
the actual cube/vector core counts via aclrtGetStreamResLimit and caps at
PLATFORM_MAX_BLOCKDIM; sim uses PLATFORM_MAX_BLOCKDIM directly).

Zero out the a2a3 (24) and a5 (36) config block_dim values so the tests
follow the hardware's actual available core count instead of pinning a
literal. Kernel-side params.block_dim (tiling arg) is left untouched.
@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change updates block_dim values in test case configuration dictionaries across numerous example and system test files under tensormap_and_ringbuffer, host_build_graph, and spmd_* suites. All affected cases previously set block_dim to 24 or 36 and now set it to 0, with other configuration fields unchanged.

Changes

block_dim configuration reset

Layer / File(s) Summary
Example test suites
examples/a2a3/tensormap_and_ringbuffer/benchmark_bgemm/test_benchmark_bgemm.py, examples/a2a3/tensormap_and_ringbuffer/paged_attention*/test_paged_attention*.py, examples/a5/tensormap_and_ringbuffer/paged_attention_unroll_manual_scope/test_paged_attention_unroll.py
Multiple CASES entries across bgemm and paged-attention example tests change config.block_dim from 24 (or 36 in a5) to 0.
Host build graph tests
tests/st/a2a3/host_build_graph/bgemm/test_bgemm.py, tests/st/a2a3/host_build_graph/paged_attention/test_paged_attention.py
config.block_dim changes from 24 to 0 for host build graph bgemm and paged-attention cases.
ST tensormap_and_ringbuffer core tests
tests/st/a2a3/tensormap_and_ringbuffer/alternating_matmul_add/..., batch_paged_attention/..., fanin_lookup_perf/..., multi_round_paged_attention/..., paged_attention_unroll/..., paged_attention_unroll_4dims/..., tests/st/a5/tensormap_and_ringbuffer/paged_attention_unroll/test_paged_attention_unroll.py
CASES entries across these core ST test suites change block_dim from 24 (or 36 in a5) to 0.
ST spmd test suites
tests/st/a2a3/tensormap_and_ringbuffer/spmd_basic/..., spmd_batch_dispatch_oob/..., spmd_multiblock_aiv/..., spmd_multiblock_mix/..., spmd_paged_attention/..., spmd_paged_attention_highperf/..., spmd_starvation/..., spmd_sync_start*/...
CASES entries across SPMD test suites change config.block_dim from 24 to 0.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • hw-native-sys/simpler#899: Related to the SPMD paged-attention highperf suite where block_dim is read by orchestration logic to set launch block counts.
  • hw-native-sys/simpler#1076: Both PRs edit the same TestSpmdPagedAttentionHighPerf.CASES configuration for overlapping highperf paged-attention test cases.
  • hw-native-sys/simpler#1265: Both PRs touch tests/st/a2a3/tensormap_and_ringbuffer/spmd_paged_attention/test_spmd_paged_attention.py, one adjusting pytestmark, the other config.block_dim.

Poem

A hop, a skip, through configs I dash,
Twenty-four to zero, no more block clash 🐇
From bgemm to spmd, cases align,
Every block_dim now reads a clean zero line.
Thump-thump goes my heart, tests pass with glee!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the PR's main change: replacing hardcoded platform-max block_dim values with auto mode.
Description check ✅ Passed The description accurately explains the block_dim=0 change, scope, and exclusions, and matches the file-level updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/st/a2a3/tensormap_and_ringbuffer/spmd_basic/test_spmd_basic.py (1)

74-86: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Case1 and Case2_AutoBlockDim are now functionally equivalent.

Case1 explicitly sets block_dim: 0 and Case2_AutoBlockDim omits block_dim (defaulting to 0 via _build_config). Both resolve to the same CallConfig, making the two cases redundant in terms of runtime configuration. If the intent is to test both the explicit-0 and omitted paths as distinct regression cases, consider adding a comment to Case1 clarifying that distinction. Otherwise, Case2_AutoBlockDim could be removed.

🤖 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 `@tests/st/a2a3/tensormap_and_ringbuffer/spmd_basic/test_spmd_basic.py` around
lines 74 - 86, Case1 and Case2_AutoBlockDim are redundant because both end up
using the same CallConfig through block_dim=0. Update the table entry in
test_spmd_basic to either remove Case2_AutoBlockDim or add a clear comment near
Case1 and Case2 explaining that one exercises the explicit block_dim=0 path and
the other exercises the omitted-field path via _build_config, so the distinction
is intentional.
🤖 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 `@tests/st/a2a3/tensormap_and_ringbuffer/spmd_basic/test_spmd_basic.py`:
- Around line 74-86: Case1 and Case2_AutoBlockDim are redundant because both end
up using the same CallConfig through block_dim=0. Update the table entry in
test_spmd_basic to either remove Case2_AutoBlockDim or add a clear comment near
Case1 and Case2 explaining that one exercises the explicit block_dim=0 path and
the other exercises the omitted-field path via _build_config, so the distinction
is intentional.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9a577d69-2578-4554-831e-3134c73b3635

📥 Commits

Reviewing files that changed from the base of the PR and between 29595b1 and 06417ee.

📒 Files selected for processing (26)
  • examples/a2a3/tensormap_and_ringbuffer/benchmark_bgemm/test_benchmark_bgemm.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention/test_paged_attention.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention_manual_scope/test_paged_attention.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention_ringbuffer/test_paged_attention_ringbuffer.py
  • examples/a2a3/tensormap_and_ringbuffer/paged_attention_unroll_manual_scope/test_paged_attention_unroll.py
  • examples/a5/tensormap_and_ringbuffer/paged_attention_unroll_manual_scope/test_paged_attention_unroll.py
  • tests/st/a2a3/host_build_graph/bgemm/test_bgemm.py
  • tests/st/a2a3/host_build_graph/paged_attention/test_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/alternating_matmul_add/test_alternating_matmul_add.py
  • tests/st/a2a3/tensormap_and_ringbuffer/batch_paged_attention/test_batch_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/fanin_lookup_perf/test_fanin_lookup_perf.py
  • tests/st/a2a3/tensormap_and_ringbuffer/multi_round_paged_attention/test_multi_round_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/paged_attention_unroll/test_paged_attention_unroll.py
  • tests/st/a2a3/tensormap_and_ringbuffer/paged_attention_unroll_4dims/test_paged_attention_unroll_4dims.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_basic/test_spmd_basic.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_batch_dispatch_oob/test_spmd_batch_dispatch_oob.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_multiblock_aiv/test_spmd_multiblock_aiv.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_multiblock_mix/test_spmd_multiblock_mix.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_paged_attention/test_spmd_paged_attention.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_paged_attention_highperf/test_spmd_paged_attention_highperf.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_starvation/test_spmd_starvation.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start/test_spmd_sync_start.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_aiv/test_spmd_sync_start_aiv.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_edge/test_spmd_sync_start_edge.py
  • tests/st/a2a3/tensormap_and_ringbuffer/spmd_sync_start_stress/test_spmd_sync_start_stress.py
  • tests/st/a5/tensormap_and_ringbuffer/paged_attention_unroll/test_paged_attention_unroll.py

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