Cambricon / triton-linalg

Development repository for the Triton-Linalg conversion
Apache License 2.0
131 stars 10 forks source link

Issue converting tt.load to linalg #18

Closed JoeLi12345 closed 1 month ago

JoeLi12345 commented 1 month ago

I'm trying to use the triton-linalg tool to convert a basic matrix multiplication MLIR to Linalg. The MLIR is here: https://github.com/microsoft/triton-shared/blob/main/test/Conversion/TritonToLinalg/kernel-03-matrix-multiplication.mlir.

However, I'm getting the following issue with tt.load. (example.mlir is just my local file name for the matrix-mul mlir file I linked above.) Any fix to this?

example.mlir:69:13: error: failed to legalize operation 'tt.load' that was explicitly marked illegal
      %71 = tt.load %arg14 : tensor<128x64x!tt.ptr<bf16>>
            ^
example.mlir:69:13: note: see current operation: %154 = "tt.load"(<<UNKNOWN SSA VALUE>>) <{boundaryCheck = array<i32>, cache = 1 : i32, evict = 1 : i32, isVolatile = false, operandSegmentSizes = array<i32: 1, 0, 0>}> : (tensor<128x64x!tt.ptr<bf16>>) -> tensor<128x64xbf16>
triton-linalg-opt: /home/runner/work/triton/triton/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList<mlir::OpOperand>::~IRObjectWithUseList() [OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./triton-linalg-opt --convert-triton-to-linalg example.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  triton-linalg-opt 0x000056399d7d4da7
1  triton-linalg-opt 0x000056399d7d28ce
2  triton-linalg-opt 0x000056399d7d545f
3  libpthread.so.0   0x00007facfca8f420
4  libc.so.6         0x00007facfc56200b gsignal + 203
5  libc.so.6         0x00007facfc541859 abort + 299
6  libc.so.6         0x00007facfc541729
7  libc.so.6         0x00007facfc552fd6
8  triton-linalg-opt 0x000056399d668b8b
9  triton-linalg-opt 0x000056399d4d9769
10 triton-linalg-opt 0x000056399d4c134b
11 triton-linalg-opt 0x000056399d4c7799
12 triton-linalg-opt 0x000056399d4ce56b
13 triton-linalg-opt 0x0000563999349d07
14 triton-linalg-opt 0x000056399b318a46
15 triton-linalg-opt 0x000056399b3191e1
16 triton-linalg-opt 0x000056399b31b6db
17 triton-linalg-opt 0x000056399b314c4c
18 triton-linalg-opt 0x000056399b31487d
19 triton-linalg-opt 0x000056399d71f176
20 triton-linalg-opt 0x000056399b30f48c
21 triton-linalg-opt 0x000056399b30f730
22 triton-linalg-opt 0x000056399b30fb16
23 triton-linalg-opt 0x00005639991460df
24 libc.so.6         0x00007facfc543083 __libc_start_main + 243
25 triton-linalg-opt 0x00005639991f06fe
sethbrin commented 1 month ago

You may refer to https://github.com/Cambricon/triton-linalg/issues/12. Use triton-linalg-opt --triton-to-linalg example.mlir instead.