Skip to content

fix(projection_asm): correct single-pass matmul emission#62

Merged
booth-algo merged 1 commit into
mainfrom
kev/linear
Jul 2, 2026
Merged

fix(projection_asm): correct single-pass matmul emission#62
booth-algo merged 1 commit into
mainfrom
kev/linear

Conversation

@booth-algo

Copy link
Copy Markdown
Collaborator

Two correctness fixes in the single-pass (num_k_tiles <= MAX_K_TILES) projection path. Required by PLENA_RTL kev/linear (PR AICrossSim/PLENA_RTL#44) to bring the linear workload to a passing state.

  • Remove three stray breaks that truncated the K-loop to a single tile, so the matmul only computed 1 of N K-tiles.
  • Row-align the within-group weight-row offset: matrix SRAM is row-granular (one output feature per row), so the offset must be in rows — (wr % (mlen//blen)) * blen * mlen, not * blen (element units, which got dropped by the SRAM's row-granular address translation and made the BLEN output features of a group alias to the same weights).

Testing

Verified end-to-end via PLENA_RTL just rtl-sim linear → PASSED (95.31%).

Two fixes in the single-pass (num_k_tiles <= MAX_K_TILES) path:
- Remove three stray `break`s that truncated the K-loop to a single tile, so the
  matmul only computed 1 of N K-tiles.
- Scale the within-group weight-row offset by MLEN. Matrix SRAM is row-granular
  (one output feature per row), so the offset must be in rows
  ((wr % (mlen//blen)) * blen * mlen), not elements — otherwise the BLEN output
  features in a group aliased to the same weights.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@booth-algo booth-algo merged commit db14142 into main Jul 2, 2026
3 checks passed
@booth-algo booth-algo deleted the kev/linear branch July 2, 2026 00:00
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