CANN/pto-isa非ISA运算规范

📅 2026/7/9 23:09:48 👁️ 阅读次数 📝 编程学习
CANN/pto-isa非ISA运算规范

Non-ISA Operations

【免费下载链接】pto-isaParallel Tile Operation (PTO) is a virtual instruction set architecture designed by Ascend CANN, focusing on tile-level operations. This repository offers high-performance, cross-platform tile operations across Ascend platforms.项目地址: https://gitcode.com/cann/pto-isa

1. Scope

This page specifies PTO AS operations from~/pto-isa.txtthat are not represented as ISA instruction pages.

  • Level-1: SSA form, compiler-managed allocation/synchronization.
  • Level-2: DPS form, explicit buffer reuse and synchronization primitives.

2. View Operations

2.1make_tensor_view

// L1 %dst = pto.make_tensor_view %ptr, shape = [sh1,sh2,sh3,sh4,sh5] strides = [st1,st2,st3,st4,st5] : !pto.tensor_view<sh1xsh2xsh3xsh4xsh5xdtype>

2.2partition_view

// L1 %dst = pto.partition_view %src, offsets = [of1,of2,of3,of4,of5], sizes = [sh1,sh2,sh3,sh4,sh5] : !pto.tensor_view<sh1xsh2xsh3xsh4xsh5xdtype> -> !pto.partition_tensor_view<sh1xsh2xsh3xsh4xsh5xdtype>

3. Tile Allocation

3.1alloc_tile(static parameters)

// L2 %dst = pto.alloc_tile : !pto.tile_buf<loc, dtype, rows, cols, v_row, v_col, blayout, slayou, fractal, pad>

3.2alloc_tile(dynamic valid region)

// L2 %dst = pto.alloc_tile valid_row = %vr valid_col = %vc : !pto.tile_buf<loc, dtype, rows, cols, v_row=?, v_col=?, blayout, slayou, fractal, pad>

4. Kernel Parameter Queries

4.1get_block_idx

// L1 / L2 %idx = pto.get_block_idx

4.2get_subblock_idx

// L1 / L2 %idx = pto.get_subblock_idx

4.3get_block_num

// L1 / L2 %num = pto.get_block_num

4.4get_subblock_num

// L1 / L2 %num = pto.get_subblock_num

5. Pointer and Scalar Access

5.1addptr

// L2 %ptr_new = pto.addptr %ptr, %offset

5.2tgetval

// L2 pto.tgetval ins(%src, %index : !pto.tile_buf<...>, dtype) outs(%val : dtype)

5.3tsetval

// L2 pto.tsetval ins(%index, %val : dtype, dtype) outs(%dst : !pto.tile_buf<...>)

6. Synchronization Primitives (Level-2)

6.1record_event

pto.record_event[src_op, dst_op, eventID]

Supported ops in current table:TLOAD,TSTORE_ACC,TSTORE_VEC,TMOV_M2L,TMOV_M2S,TMOV_M2B,TMOV_M2V,TMOV_V2M,TMATMUL,TVEC.

6.2wait_event

pto.wait_event[src_op, dst_op, eventID]

Supported ops in current table:TLOAD,TSTORE_ACC,TSTORE_VEC,TMOV_M2L,TMOV_M2S,TMOV_M2B,TMOV_M2V,TMOV_V2M,TMATMUL,TVEC.

6.3barrier

pto.barrier(op)

Supported ops in current table:TVEC,TMATMUL.

7. Consistency Notes

  • Non-ISA PTO AS operations are documented in this section and are intentionally separate fromdocs/isa/manifest-driven instruction entries.
  • TSYNCinstruction pages indocs/isa/remain the canonical ISA-level synchronization semantics.
  • When table content in~/pto-isa.txtchanges, this page should be updated in the same change set.

【免费下载链接】pto-isaParallel Tile Operation (PTO) is a virtual instruction set architecture designed by Ascend CANN, focusing on tile-level operations. This repository offers high-performance, cross-platform tile operations across Ascend platforms.项目地址: https://gitcode.com/cann/pto-isa

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考