This commit added stride support in runtime array types. It also
adjusted the assembly form for the stride from [N] to stride=N.
This makes the IR more readable, especially for the cases where
one mix array types and struct types.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp | ||
---|---|---|
555 | Oops, good catch! I meant to reuse the stride value in the following line. Fixed. :) |
Sorry, just getting to this for review.
See comments below.
mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h | ||
---|---|---|
157 | Seems to be a mismatch here. elementCount and stride should be size_t. Of course on many devices unsigned is enough, but when possible we might need to support objects of large sizes. Maybe better to make both size_t? | |
mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp | ||
231 | This makes it too verbose. Why change the parsing/printing? |
I know this is already committed, but I just wanted to reopen this (posted comments here). Didnt get around to reviewing it till now
mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h | ||
---|---|---|
157 | SGTM to be future proof. I used unsigned here to be consistent; better to change them together. (The serialization/deserialization side we need to be careful; the array stride is directly embedded as a literal there. I wonder whether all the drivers support non-32-bit cases nicely though. ;-P) | |
mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp | ||
231 | It makes the IR more readable. Otherwise if you have structs containing arrays, everything (struct member offsets, array strides) are represented as [N]. It's really hard to differentiate. And I typically think [N] is more naturally for indexing; thus good for offsets. |
mlir/test/Dialect/SPIRV/structure-ops.mlir | ||
---|---|---|
61 | You don't need the %<num> = part. In any case, please don't use numbers in such places. |
mlir/test/Dialect/SPIRV/structure-ops.mlir | ||
---|---|---|
61 | Good point! Thanks for the catch! Fixed with https://github.com/llvm/llvm-project/commit/f83d502febb54b2cf3866ebea247380cd6263f13. |
Seems to be a mismatch here. elementCount and stride should be size_t. Of course on many devices unsigned is enough, but when possible we might need to support objects of large sizes. Maybe better to make both size_t?