Skip to content

TileOP: fix RedRows per-PE semantics for Local-A/Shared-B groupM - #86

Merged
VV0003 merged 1 commit into
linxfrom
fix/groupm-per-pe-rows
Sep 8, 2026
Merged

TileOP: fix RedRows per-PE semantics for Local-A/Shared-B groupM#86
VV0003 merged 1 commit into
linxfrom
fix/groupm-per-pe-rows

Conversation

@VV0003

@VV0003 VV0003 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes the group_M assertion failure reported for TMATMUL(d, a, b, options, groupM) with CubeM32 tiles and group_M=128.

Root cause

The explicit-groupM overloads computed the reduction/output row count as:

RedRows = cooperative ? cooperative_group_m_rows_per_pe(EffectiveM) : EffectiveM;

For Local-A/Shared-B, EffectiveM = A::ValidRow which already is the per-PE shard size (M_per_PE per ADR-0100) — each PE holds a full [M_per_PE, K] block. Feeding it back through rows_per_pe():

  • M_per_PE=32 (CubeM32, group_M ∈ 65..128) → rows_per_pe(32)=16 → 32 != 16the reported compile failure
  • M_per_PE=16 (CubeM16, group_M ≤ 64) → rows_per_pe(16)=16 → passed only by coincidence, masking the bug

Fix

Only Shared-A (where EffectiveM is the core-total group_M) derives its per-PE block via rows_per_pe(); Local-A uses the shard size directly:

RedRows = is_shared_tile_v<A> ? rows_per_pe(EffectiveM) : EffectiveM;

Verification

  • CubeM32 Local-A + Shared-B + group_M=128: compiles; disassembly shows LB0 carrying the runtime group_M (register), N/K immediate-form (C.B.DIMI)
  • CubeM16 + group_M=64: unchanged
  • GroupMatmul / SharedMatmul / TMatmulAccFullOptions / PostProcessCombos / TGEMVAllOptions fixtures and unittest 40/40 all clean

Fixes the assertion analyzed in the linked report (Local-A/Shared-B explicit-groupM path).

The explicit-groupM TMATMUL overloads computed the reduction/output row
count as cooperative_group_m_rows_per_pe(EffectiveM) for every
cooperative form. For Local-A/Shared-B, EffectiveM is A::ValidRow which
already IS the per-PE shard size (M_per_PE, per ADR-0100) — feeding it
back through rows_per_pe() maps M_per_PE=32 (CubeM32, group_M>64) to 16
and fails the D::ValidRow == RedRows assertion, blocking the
CubeM32 + group_M=128 configuration entirely. CubeM16 passed only by
coincidence (rows_per_pe(16)==16).

Now only Shared-A (where EffectiveM is the core-total group_M) derives
its per-PE block through rows_per_pe(); Local-A uses the shard size
directly.

Verified:
- CubeM32 Local-A + Shared-B + group_M=128: compiles, LB0 carries the
  runtime group_M, N/K immediate-form
- CubeM16 + group_M=64: unchanged
- GroupMatmul/SharedMatmul/TMatmulAcc*/PostProcessCombos/TGEMV*
  fixtures and unittest 40/40 all clean
@VV0003
VV0003 merged commit 331a091 into linx Sep 8, 2026
2 checks passed
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