Adds more support for SpecConstantOperation by defining a custom
syntax for the op and implementing its parsing and printing.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
15,770 ms | x64 debian > LLVM.Bindings/Go::go.test | |
60 ms | x64 windows > LLVM.CodeGen/XCore::threads.ll |
Event Timeline
This custom assembly format is okay but I think we can further simplify it given we have very rigid structure inside the region. What about something like
%result = spv.SpecConstantOperation wraps "spv.IAdd"(%lhs, %rhs) : (i32, i32) -> i32
?
The spv.mlir.yield can then be implicitly constructed during parsing and omitted during printing.
We have examples for this in TensorFlow: tf_executor.island. See its parsing and printing function here:
- https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.cc#L357-L371
- https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.cc#L321-L335
And examples here: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/mlir/tensorflow/tests/executor_island_coarsening.mlir#L183-L188
Let me know how do you think. :)
Thanks for the patch and sorry for the delay. Thanks @antiagainst for reviewing it. Just a minor comment above, but looks good to me.
mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td | ||
---|---|---|
648–649 | Why not add this tag SingleBlockImplicitTerminator<"SPIRV::YieldOp"> |
That makes the syntax more concise and almost reduces it to its essence. Thanks for links. Followed a similar approach to TF.
mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td | ||
---|---|---|
648–649 | Thanks for bringing my attention to this, didn't know it existed. Add it and HasParent<SpecConstantOperationOp> as well. |
Probably this hits a CI bug: https://github.com/google/llvm-premerge-checks/issues/268.
Why not add this tag SingleBlockImplicitTerminator<"SPIRV::YieldOp">