Skip to content

TileOP: explicit-groupM overloads across the TMATMUL family - #87

Merged
VV0003 merged 1 commit into
linxfrom
feat/matmul-groupm-overloads
Sep 8, 2026
Merged

TileOP: explicit-groupM overloads across the TMATMUL family#87
VV0003 merged 1 commit into
linxfrom
feat/matmul-groupm-overloads

Conversation

@VV0003

@VV0003 VV0003 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Extends the cooperative Local-A/Shared-B explicit-groupM pattern (ADR-0100) from TMATMUL to the full matrix family, mirroring:

  • TMATMUL(d, local_a, shared_b, groupM)
  • TMATMUL(d, local_a, shared_b, options, groupM)

New overloads

TMATMUL_ACC(d, c, a, b, groupM)
TMATMUL_BIAS(d, a, b, bias, groupM)
TMATMUL_MX(d, a, sa, b, sb, groupM)
TMATMUL_MX_ACC(d, c, a, sa, b, sb, groupM)
TMATMUL_MX_BIAS(d, a, sa, b, sb, bias, groupM)

All share one helper namespace (pto_matmul_groupm_detail) enforcing:

  • Local-A/Shared-B only (Shared-A derives group_M from its own descriptor)
  • D (and C) valid rows equal the per-PE A shard size (M_per_PE)
  • runtime group_M ∈ 1..128 (printf + trap, mirroring the ASL dispatch)

Options overloads (options, groupM) already exist for TMATMUL (from #72) and work through the same emit chain; the ACC/BIAS/MX family's basic (parameter-free) forms get the same capability here.

Pre-existing MX bugs fixed (surfaced by the Shared-scale paths)

  1. Basic TMATMUL_MX/MX_ACC/MX_BIAS constrained scale operands to is_tile_data_v, rejecting SharedTile scales the options overloads already accept → relaxed to typename.
  2. The Local-A/Shared-B emitters bound a Shared scale with "Tr"(scale.data())SharedTile has no data() — and emitted B.IOT for it → now "Sr"(handle()) and B.IOS, matching the options-version convention (PTO_FIXP_MX_SB_SRC).
  3. The 5SRC helper mis-ordered B.IOT %[ScaleB], %[Extra] into one binder; now emits B.IOS scale then B.IOT Extra.

Verification (fixture CoopGroupMOverloads)

  • TMATMUL_ACC/BIAS with CubeM16 (group_M=64) and CubeM32 (group_M=128): disassembly shows LB0 carrying the runtime group_M (B.DIM reg, 0), N/K immediate-form (C.B.DIMI)
  • TMATMUL_MX/MX_ACC/MX_BIAS with Local e4m3 A + Shared B + Shared e8m0 scale: B.IOS S1 scale binder + runtime LB0
  • MXScaleVariants / GroupMatmul / SharedMatmul / TMatmulAcc* / PostProcessCombos / HiF4X2MatmulMX / TGEMV* and unittest 40/40 all clean
  • TMatmulAllOptions retains 3 pre-existing match errors — identical on the unmodified baseline (verified via stash)

Note: TGEMV family is intentionally excluded — per ADR-0100 it only allows Local operands and has no cooperative group_M.

Extend the cooperative Local-A/Shared-B explicit-groupM pattern (ADR-0100)
from TMATMUL to the rest of the matrix family:

  TMATMUL_ACC(d, c, a, b, groupM)
  TMATMUL_BIAS(d, a, b, bias, groupM)
  TMATMUL_MX(d, a, sa, b, sb, groupM)
  TMATMUL_MX_ACC(d, c, a, sa, b, sb, groupM)
  TMATMUL_MX_BIAS(d, a, sa, b, sb, bias, groupM)

All share one helper namespace (pto_matmul_groupm_detail) enforcing:
- Local-A/Shared-B only (Shared-A derives group_M from its own shape)
- D (and C) valid rows equal the per-PE A shard size
- runtime group_M in 1..128 (printf + trap, mirroring the ASL dispatch)

Also fixes pre-existing MX bugs surfaced by the Shared-scale paths:
- basic TMATMUL_MX/MX_ACC/MX_BIAS constrained scale operands to
  is_tile_data_v, rejecting SharedTile scales that the options overloads
  already accept; relaxed to typename to match
- the Local-A/Shared-B emitters bound a Shared scale with "Tr"(scale.data())
  (SharedTile has no data()) and emitted B.IOT for it; now "Sr"(handle())
  and B.IOS, matching the options-version convention (PTO_FIXP_MX_SB_SRC)
- the 5SRC helper additionally mis-ordered a B.IOT with the Shared scale
  and the Extra binder; now emits B.IOS scale then B.IOT Extra

Verified (fixture CoopGroupMOverloads):
- TMATMUL_ACC/BIAS CubeM16 (group_M=64) and CubeM32 (group_M=128):
  LB0 carries the runtime group_M (B.DIM reg, 0), N/K immediate-form
- TMATMUL_MX/MX_ACC/MX_BIAS with Local e4m3 A + Shared B + Shared e8m0
  scale: B.IOS S1 scale binder, runtime LB0
- MXScaleVariants/GroupMatmul/SharedMatmul/TMatmulAcc*/PostProcessCombos/
  HiF4X2MatmulMX/TGEMV* fixtures and unittest 40/40 all clean
  (TMatmulAllOptions retains 3 pre-existing match errors, identical on
  the unmodified baseline)
@VV0003
VV0003 merged commit 7b7779d into linx Sep 8, 2026
2 checks passed
VV0003 pushed a commit that referenced this pull request Sep 8, 2026
…e same PR

Records the working convention (applied in #87/#93): any public-header
interface change must update the corresponding docs/tileop-usage pages
(signature block with template declarations, parameter table, overload
selection), plus options.md / migration entries for cross-cutting
changes, verified by the docs freshness unittest.
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