| [IR] Rework textual IR for load, store, dot, and other ops (#3587)
The initial motivation for this change was that tt.dot's inputPrecision
value was printed in textual IR not as a string (e.g. "tf32") but as an
opaque number. The trick to fixing this is to explicitly list the attr
in the assemblyFormat, instead of relying on attr-dict. attr-dict prints
the attr as an integer, but if we list it explicitly, it will be printed
as a string.
But when I fixed this, I realized that many other ops, such as load and
store, also had enums which were printed as numbers rather than strings.
So I had to fix those, too. I also added reasonable defaults for most of
the arguments to make the textual IR more concise.
I then noticed that load and store had complicated asm parsers to handle
the fact usually the pointer type was not specified, but sometimes it
was necessary. This is because given e.g. load : tensor<128xf32> the
pointer may be either tensor<128x!tt.ptr<f32>> (the default) or
!tt.ptr<tensor<128xf32>> (for block pointers).
So I fixed this too. Now load and store specify the *pointer* type
instead of the value type. This lets us use the built-in asm parser and
delete a bunch of code.
I also noticed that we had a bunch of dead ttgir tests (actually it
seems like these were never enabled); rather than attempt to update
them, without any way to test it, I just deleted them.
Thanks to @joker-eph for suggesting the solution here -- I never would
have figured this out on my own. | 2 年前 |