Skip to content

et-backend: Q4_0 matrix-engine GEMM rewrite for prefill#24

Open
RehanQasim-dev wants to merge 1 commit into
aifoundry-org:etfrom
RehanQasim-dev:upstream-q4_0-tensor-gemm
Open

et-backend: Q4_0 matrix-engine GEMM rewrite for prefill#24
RehanQasim-dev wants to merge 1 commit into
aifoundry-org:etfrom
RehanQasim-dev:upstream-q4_0-tensor-gemm

Conversation

@RehanQasim-dev

Copy link
Copy Markdown

Overview

Rewrites the Q4_0 matrix-engine mul_mat kernel with static-reuse dequant across N-tiles, K-splitting and a materialized register-resident path for deep reuse, plus software-pipelined activation prefetch and hart-sync fixes. Adds flush_to_l2_multi to work around the 16-line cap of a single FlushVA.

Prefill improves roughly 3x on Llama-3.2-1B. Decode is unchanged since decode (N=1) always routes to the vecdot kernel, not the matrix-engine path this PR touches.

Additional information

Performance (Llama-3.2-1B-Instruct, ET-SoC-1):

Prefill t/s

N master optimized speedup
100 175.7 533.9 3.04x
220 221.6 794.2 3.58x
512 231.1 743.8 3.22x
700 220.4 694.2 3.15x
900 216.0 693.5 3.21x

Verified with llama-cli on ET-SoC-1 hardware (Llama-3.2-1B-Instruct).

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES - the optimization strategies and design decisions are my own. AI assisted with understanding the hardware reference manual, some pieces of code implementation and guided debugging. I have thoroughly reviewed the code.

Static-reuse dequant across N-tiles with K-splitting and a materialized
register-resident path for deep reuse, plus software-pipelined activation
prefetch and hart-sync fixes. Adds flush_to_l2_multi to work around the
16-line cap of a single FlushVA.

Co-authored-by: Rehan Qasim <rehan.qasim@10xengineers.ai>

@marty1885 marty1885 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.

Tested and I can replicate the performance. Decode is still coherent. Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants