Skip to content

feat(vpto): add L1 fill intrinsic support - #1234

Draft
erhsh wants to merge 1 commit into
hw-native-sys:mainfrom
erhsh:cj/main_feat_pto_l1_fill
Draft

feat(vpto): add L1 fill intrinsic support#1234
erhsh wants to merge 1 commit into
hw-native-sys:mainfrom
erhsh:cj/main_feat_pto_l1_fill

Conversation

@erhsh

@erhsh erhsh commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Motivation

This PR adds a low-level PTO/VPTO operation for filling an L1 (MAT/CBUF) region with a repeated 16-bit or 32-bit value. The intent is to expose the hardware create_cbuf_matrix capability directly so that callers can initialize L1 without first materializing data in GM or UB and issuing a separate copy.

What changes

  • Adds pto.mte_fill_l1 to the PTO dialect and documents its semantics.
  • Adds verifier checks for the L1 destination, fill word width, byte offset, and constant configuration fields.
  • Lowers the operation in both VPTO LLVM emitter paths to:
    • llvm.hivm.CREATE.CBUF.MATRIX.v3.u16
    • llvm.hivm.CREATE.CBUF.MATRIX.v3.u32
  • Exposes the operation through PTODSL as pto.mte_fill_l1(...).
  • Adds lowering, verifier, PTODSL surface, and public-export coverage.

Parameter mapping

The hardware configuration operand is assembled as:

config = repeat_times
       | (block_num_32b << 16)
       | (dst_gap_32b << 32)

Each field is 15 bits. byte_offset is applied to the destination pointer before calling the intrinsic, and the low 16 or 32 bits of raw_value provide the repeated fill pattern.

Semantically, each repeat fills block_num_32b consecutive 32-byte blocks, skips dst_gap_32b blocks, and then starts the next repeat.

Reviewer notes

The main points worth checking are:

  1. Whether the intrinsic names and argument order match the CANN 9.0 and default VPTO emitter conventions.
  2. Whether the packed field positions and 15-bit masks match create_cbuf_matrix.
  3. Whether the exposed PTODSL parameter names make the hardware units (bytes vs. 32-byte blocks) sufficiently clear.

@erhsh
erhsh force-pushed the cj/main_feat_pto_l1_fill branch from 1358419 to 06372ab Compare August 12, 2026 09:24
@erhsh
erhsh force-pushed the cj/main_feat_pto_l1_fill branch from 06372ab to c629920 Compare August 13, 2026 08:54
@erhsh erhsh changed the title wip(vpto): add L1 fill intrinsic support feat(vpto): add L1 fill intrinsic support Aug 13, 2026
@erhsh
erhsh marked this pull request as draft August 13, 2026 11:43
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