microsoft / triton-shared

Shared Middle-Layer for Triton Compilation
MIT License
142 stars 27 forks source link

Several errors in triton-to-linalg pass #7

Closed yuanfz98 closed 9 months ago

yuanfz98 commented 10 months ago

Hello,

We are trying to convert from ttirs to linalg in nanoGPT model and have encountered some edge cases that triton-to-linalg pass failed to lower.

https://drive.google.com/drive/folders/1oBIJFhdL8TQO2PIF_PsUaMJRPVMPJ6G7?usp=sharing

Thank you for your help.

manbearian commented 10 months ago

Thank you for the report. it looks like there are a number of unfinished/incomplete items you're running into with this collection of inputs.

here's a log of all the failures: bugs.log

I'm seeing the following unique failures:

  1. bad cast: decltype(auto) llvm::cast(const From&) [with To = mlir::MemRefType; From = mlir::Type]
  2. "Only asserts on scalars are currently supported"
  3. "Only support lowering reduction with body containing 1 maxf or addf."
  4. "Scalar load is currently not supported"
  5. failed to legalize operation 'tt.load'
  6. "other value used in masked load produced by unsupported instruction"
  7. "UNREACHABLE executed at src/triton/third_party/triton_shared/lib/Analysis/PtrAnalysis.cpp:377!

These all indicated not yet supported cases.

Of the known issues (2,3,4,7): 3, 4, and 7 are likely to be addressed soon (next updated perhaps, not sure yet of our schedule on this) while item 2 is not on our planned set of features right now.

makslevental commented 9 months ago

@manbearian if you create a tracking issue (or whatever) for these (and others), I'm sure some of us adoring fans would be glad to pitch in (including appropriate RFC and design discussion and etc. of course). At least I know I would.

manbearian commented 9 months ago

@manbearian if you create a tracking issue (or whatever) for these (and others), I'm sure some of us adoring fans would be glad to pitch in (including appropriate RFC and design discussion and etc. of course). At least I know I would.

done!

From the items i created supporting additional reductions seem the most straightforward if you're looking for a nice on ramp :)

nhat-nguyen commented 9 months ago

Hello,

We are trying to convert from ttirs to linalg in nanoGPT model and have encountered some edge cases that triton-to-linalg pass failed to lower.

https://drive.google.com/drive/folders/1oBIJFhdL8TQO2PIF_PsUaMJRPVMPJ6G7?usp=sharing

Thank you for your help.

@yuanfz98 Thanks for sharing these! Would you mind also sharing us the triton code that produces these IR? It would help us a lot in understanding the usage of certain triton language features.