Patch adds a new operation for the SIMD construct. The op is designed to be very similar to the existing wsloop operation, so that the CanonicalLoopInfo of OpenMPIRBuilder can be used.
Details
Diff Detail
Event Timeline
You may need one test case in mlir/test/Target/LLVMIR/openmp-llvm.mlir.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
314 | 2.9.3 is for simd directives. I think you are implementing simd contruct [2.9.3.1]. No construct called simd loop contruct. In addition, simd loop is kind of confusing since someone may think of it as worksharing-loop simd contruct. |
Thanks for the patch @arnamoy10. Requesting a few changes.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
345 | The current head has removed such definitions of parsers/printers in favor of fields hasCustomAssemblyFormat and hasVerifier (It is a minor change). Can you please rebase and use them? Another point is, can we use assemblyFormat for this? We can have a custom parser/printer for loop bounds if assembly format does not allow separating region arguments from the region itself. (@kiranchandramohan @clementval FYI, I was planning on doing the same with WSLoop assemblyFormat.) Thoughts? | |
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp | ||
884 | There are no test for this. The tests should be added to mlir/test/Target/LLVMIR/openmp-llvm.mlir. | |
888 | Can we instead move it to the verifier right away instead of adding a TODO. | |
891–896 | There is a constructor for LocationDescription that just takes an IRBuilderBase. That can be used here. |
Also, please run git-clang-format HEAD~ before submitting it to eliminate formatting related errors.
Addressing reviewers' comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
314 | I think SimdLoopOp is OK. for worksharing-loop simd contruct, we can call the Op WsSimdLoopOp | |
345 | Thanks, did the mods. For Assemblyformat addition I will wait until your patch for the wsloop | |
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp | ||
888 | Thanks, added. | |
891–896 | Thanks for the suggestion. However, I will be needing the diLoc in later code, therefore I need to keep the subprogram and diLoc variables. |
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
314 | OK. Agree. |
Thanks for addressing the comments @arnamoy10. Generally looks good. A few nits and comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
325 | Nit: This line has over 80 characters. | |
352 | Nit: This line has over 80 characters. | |
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | ||
1089 | Nit: Can we please put this closer to the parser/printer? | |
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp | ||
888 | I think we can safely remove this from here now, as it will be checked in verifier. | |
891–896 | You can use ompLoc.DL for that as done here. | |
mlir/test/Dialect/OpenMP/ops.mlir | ||
317 | Can we please have one test with multiple arguments in this syntax? More than one (%lb, %ub and %step). | |
mlir/test/Target/LLVMIR/openmp-llvm.mlir | ||
668 | Same here. Can we please have one test with multiple arguments in this syntax? More than one (%lb, %ub and %step). |
Addressing reviewers' comments
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
325 | No, just 78. It is also clang-formatted | |
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | ||
1089 | Done, thank you | |
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp | ||
888 | Done, thank you | |
891–896 | Thanks, done | |
mlir/test/Dialect/OpenMP/ops.mlir | ||
317 | Thanks done | |
mlir/test/Target/LLVMIR/openmp-llvm.mlir | ||
668 | Thanks, done |
LGTM.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | ||
---|---|---|
325 | I still see it as 82 characters (78 text + 4 spaces at the beginning). Unfortunately, clang-format does not format tablegen files so we have to do this manually. |
2.9.3 is for simd directives. I think you are implementing simd contruct [2.9.3.1]. No construct called simd loop contruct. In addition, simd loop is kind of confusing since someone may think of it as worksharing-loop simd contruct.