This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Enhance AccessChainOp index type handling
ClosedPublic

Authored by Hazem on Jun 12 2020, 1:31 PM.

Details

Summary

This patch extends the AccessChainOp index type handling to be able to deal with all Integer type indices (i.e., all bit-widths and signedness symantics).

There were two ways of achieving this:
1- Backward compatible: The new way of handling the indices will assume that an index type is i32 by default if not specified in the assembly format, this way all the old tests would pass correctly.
2- Enforce the format: This unifies the spv.AccessChain Op format and all the old tests had to be updated to reflect this change or else they fail.

I picked option-2 to unify the Op format and avoid having optional index-type fields that can lead to somewhat confusing tests format and multiple representations for the same Op with undocumented assumption that an index is i32 unless stated. Nonetheless, reverting to option-1 should be straightforward if
preferred or needed.

Diff Detail

Event Timeline

Hazem created this revision.Jun 12 2020, 1:31 PM
Herald added a reviewer: herhut. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
rriddle added inline comments.Jun 15 2020, 1:34 PM
mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
801

nit: diagnostics implicitly convert to failure.

return emitError(...)

812

Same here.

832

nit: printer << op.indices().getTypes()

antiagainst requested changes to this revision.Jun 15 2020, 2:34 PM

Cool! Looks good to me; just one more nit.

mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
811

I think only indicesTypes.size() != indicesInfo.size() will suffice here?

This revision now requires changes to proceed.Jun 15 2020, 2:34 PM
Hazem updated this revision to Diff 271388.Jun 17 2020, 9:16 AM
Hazem marked 4 inline comments as done.
  • address revision comments
Hazem added a comment.EditedJun 17 2020, 1:52 PM

Does anyone know why the pre-merge test fails? It is pointing out to line "mlir/lib/Dialect/SPIRV/SPIRVOps.cpp:798" and it is not clear to me from the diagnostics what is the problem that needs to be fixed. Thanks!

Does anyone know why the pre-merge test fails? It is pointing out to line "mlir/lib/Dialect/SPIRV/SPIRVOps.cpp:798" and it is not clear to me from the diagnostics what is the problem that needs to be fixed. Thanks!

Did you accidentally reverted the majority of the changes in this patch? I'm only seeing changes to SPIRVOps.cpp now..

Hazem updated this revision to Diff 271516.Jun 17 2020, 4:19 PM
  • Fix unintentional files remove from patch
Hazem added a comment.Jun 17 2020, 5:33 PM

I fixed it now. Thanks!

Does anyone know why the pre-merge test fails? It is pointing out to line "mlir/lib/Dialect/SPIRV/SPIRVOps.cpp:798" and it is not clear to me from the diagnostics what is the problem that needs to be fixed. Thanks!

Did you accidentally reverted the majority of the changes in this patch? I'm only seeing changes to SPIRVOps.cpp now..

Hello @antiagainst

After submitting this patch, do you know how can I update the documentation? (https://mlir.llvm.org/docs/Dialects/SPIR-V/#spvaccesschain-spirvaccesschainop)

I fixed it now. Thanks!

Does anyone know why the pre-merge test fails? It is pointing out to line "mlir/lib/Dialect/SPIRV/SPIRVOps.cpp:798" and it is not clear to me from the diagnostics what is the problem that needs to be fixed. Thanks!

Did you accidentally reverted the majority of the changes in this patch? I'm only seeing changes to SPIRVOps.cpp now..

antiagainst accepted this revision.Jun 22 2020, 7:13 AM

Thanks @Hazem!

Hello @antiagainst

After submitting this patch, do you know how can I update the documentation? (https://mlir.llvm.org/docs/Dialects/SPIR-V/#spvaccesschain-spirvaccesschainop)

The documentation is autogenerated (see https://github.com/llvm/mlir-www for more details). So don't worry about it. :)

This revision is now accepted and ready to land.Jun 22 2020, 7:13 AM
This revision was automatically updated to reflect the committed changes.