Skip to content

[Bug] partion_tensor_view在高维tensor场景下会触发pto-isa assert #453

@werewb

Description

@werewb

Component

PTO Dialect / ODS (include/PTO/IR)

Description

一个4维tensor,shape为[B,S,N,D],现在想从S维和D维取一个切片,则partion_tensor_view的shape为[1, tile_s, 1, tile_d], strides为[stride[0], stride[1], stride[2], stride[3]], 这在表示上没啥问题,但是pto-isa要求tload/tstore时,tensor除了低2维以外的其它shape必须为1,所以上述的partion_tensor虽然表述上没有问题,但是无法使用,会触发pto-isa的assert,正确的做法应该是生成shape为[1, 1, tile_s, tile_d], strides为[stride[0], stride[2], stride[1], stride[3]]的partion_tensor

Image

Reproduction (minimal)

见附件的pto文件

Expected behavior

能生成正确的pto-isa代码,并可以编译成功

Actual behavior / error logs

pto/npu/a2a3/TLoad.hpp:379:5: error: static assertion failed due to requirement 'GlobalTensor<half, pto::Shape<1, 1, 128, 1, 128>, pto::Stride<-1, -1, -1, -1, 1>, pto::Layout::ND>::staticShape[0] == 1 && GlobalTensor<half, pto::Shape<1, 1, 128, 1, 128>, pto::Stride<-1, -1, -1, -1, 1>, pto::Layout::ND>::staticShape[1] == 1 && GlobalTensor<half, pto::Shape<1, 1, 128, 1, 128>, pto::Stride<-1, -1, -1, -1, 1>, pto::Layout::ND>::staticShape[2] == 1': Fix: GlobalTensor ony support 2 dim when ND2NZ!

Git commit

eb419fa

Host platform

None

Target Ascend arch (if relevant)

None

kernel_pto.txt

PTOAS build level (if relevant)

None

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions