Skip to content

[Bug] 输出全是 0,说明 DMA mte_gm_l1_frac (nd2nz 模式) 不支持 M=1同时将M向16对齐pto.cpp 文件中 pto.tgemv 检查左边矩阵(lhs)的valid_shape[0]是否等于1 或是动态值。 #475

Description

@yuqiha

Component

PTO Dialect / ODS (include/PTO/IR)

Description

tgemv 算子 m=1,在pto.cpp 中 进行了限制:/home/wujiajun/llvm-workspace/PTOAS_matmul0/lib/PTO/IR/PTO.cpp 3799 行,但是这时候会结果都为0,agent定位如下:

Image

如果对齐到 16 ,/home/wujiajun/llvm-workspace/PTOAS_matmul0/lib/PTO/IR/PTO.cpp 3799 行不兼容(pto-isa中没有对齐到16)
Image

对应代码:https://github.com/yuqiha/PTOAS_fork/tree/matmul_1

Reproduction (minimal)

python3 test/tilelang_st/script/run_st.py -r sim -v a5 -t tgemv

Expected behavior

pass

Actual behavior / error logs

M=1时

Model RUN TIME: 109682 ms
[INFO] Total tick: 10022
[INFO] Model stopped successfully.
run command: cp testcase/st_common.py build/testcase/tgemv/st_common.py
run command: cp testcase/tgemv/cases.py build/testcase/tgemv/cases.py
run command: cp testcase/tgemv/gen_data.py build/testcase/tgemv/gen_data.py
run command: cp testcase/tgemv/compare.py build/testcase/tgemv/compare.py
run command: /usr/bin/python3 compare.py
[ERROR] Mismatch: max diff=11.883535385131836 at flat idx=32 (golden=-11.883535385131836, output=0.0)
[ERROR] gemv_f16_1x300x60: compare failed
[ERROR] Mismatch: max diff=18.262971878051758 at flat idx=18 (golden=18.262971878051758, output=0.0)
[ERROR] gemv_bias_f16_1x512x85: compare failed
run command failed with return code 2
compare failed: Command '['/usr/bin/python3', 'compare.py']' returned non-zero exit status 2.
run failed: Command '['/usr/bin/python3', 'compare.py']' returned non-zero exit status 2.

M对齐到 16:
CMake Error at /home/wujiajun/llvm-workspace/PTOAS_matmul0/test/tilelang_st/npu/a5/src/st/testcase/run_ptoas_to_file.cmake:51 (message):
  ptoas failed while generating
  /home/wujiajun/llvm-workspace/PTOAS_matmul0/test/tilelang_st/npu/a5/src/st/build/testcase/tgemv/tgemv_kernel.o:



  loc("/home/wujiajun/llvm-workspace/PTOAS_matmul0/test/tilelang_st/npu/a5/src/st/testcase/tgemv/tgemv.pto":73:5):
  error: 'pto.tgemv' op expects lhs valid_shape[0] to be 1 for tgemv


  loc("/home/wujiajun/llvm-workspace/PTOAS_matmul0/test/tilelang_st/npu/a5/src/st/testcase/tgemv/tgemv.pto":160:5):
  error: 'pto.tgemv.bias' op expects lhs valid_shape[0] to be 1 for tgemv

  Error: Failed to parse MLIR.


make[2]: *** [testcase/tgemv/CMakeFiles/tgemv_kernel.dir/build.make:75: testcase/tgemv/tgemv_kernel.o] Error 1
make[2]: Leaving directory '/home/wujiajun/llvm-workspace/PTOAS_matmul0/test/tilelang_st/npu/a5/src/st/build'
make[1]: *** [CMakeFiles/Makefile2:114: testcase/tgemv/CMakeFiles/tgemv_kernel.dir/all] Error 2
make[1]: Leaving directory '/home/wujiajun/llvm-workspace/PTOAS_matmul0/test/tilelang_st/npu/a5/src/st/build'
make: *** [Makefile:91: all] Error 2

run failed: Command '['make', 'VERBOSE=1', '-j', '64']' returned non-zero exit status 2.
wujiajun@ecs-1030-cba0:~/llvm-workspace/PTOAS_matmul0$ python3 test/tilelang_st/script/run_st.py -r sim -v a5 -t tgemv

Git commit

8a8960d

Host platform

None

Target Ascend arch (if relevant)

None

PTOAS build level (if relevant)

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions