Skip to content

fix(cml): transpose MatrixReg blocks for MSCT - #37

Closed
Gs-ygc wants to merge 1 commit into
masterfrom
fix/msct-block-transpose
Closed

fix(cml): transpose MatrixReg blocks for MSCT#37
Gs-ygc wants to merge 1 commit into
masterfrom
fix/msct-block-transpose

Conversation

@Gs-ygc

@Gs-ygc Gs-ygc commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Transpose each MatrixReg bank/lane block before the LLC reorder path for MSCT.
  • Keep the existing data order unchanged for non-transposed MSC stores.

Problem

MSCT already walks scratchpad addresses in transposed order, but each MatrixReg read response was still interpreted as a row-grouped block. The block-local layout was therefore not transposed: for a 64 x 64 e32 matrix, the value at [0, 1] was stored at linear index 1 instead of transposed index 64.

This makes the isolated MLC + MSCT test fail and causes a later Q8_0 matrix result to diverge from NEMU under difftest.

Fix

Interpret the FIFO response as a Matrix_MN x Matrix_MN block of ResultWidth elements. When IsStoreTranspose is set, transpose that block before feeding the existing LLC reorder registers.

Validation

  • make comp in XSAI:
    • xiangshan.compile passed
    • xiangshan.test.compile passed
  • MinimalMatrixConfig / OpenLLC Apple GSIM with NEMU difftest:
    • MLC + MSCT: mismatch before the fix; Load/StoreT Test passed and GOOD TRAP after the fix
    • MLC + MSC regression: GOOD TRAP
    • Q8_0 M=1024, N=128, K=2048: GOOD TRAP at 2.354 M cycles, 23.308% MFU

Scope

This PR fixes the MSCT output layout only. The independently observed MLCT forward-progress problem is not changed here.

@Wonicon

Wonicon commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Included in #38

@Wonicon Wonicon closed this Aug 18, 2026
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.

4 participants