This is an archive of the discontinued LLVM Phabricator instance.

[mlir] spirv: Add some atomic ops
ClosedPublic

Authored by Hardcode84 on Oct 29 2021, 6:01 AM.

Diff Detail

Event Timeline

Hardcode84 created this revision.Oct 29 2021, 6:01 AM
Hardcode84 requested review of this revision.Oct 29 2021, 6:01 AM

fix gcc build

antiagainst requested changes to this revision.Nov 1 2021, 7:47 AM

Thanks for adding these!

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAtomicOps.td
157

This should be SPIRV_AnyPtr.

161

$value and $comparator should be SPV_Integer per the spec.

166

This should be SPIRV_Integer.

320

This should be SPV_AnyPtr.

323

$value and $result should be SPV_Numerical per the spec.

mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
1270

FYI: you can directly use let parser = in the TD file to override and call parseAtomicCompareExchangeImpl to avoid this extra level of function call. Similarly for the printer / verifier.

1340

Could you also add tests in test/Dialect/SPIRV/IR/atomic-ops.mlir for the error cases? Generally if the verification is enforced by autogenerated TD rules, we don't need to check them in IR tests. But for the rules manually implemented in C++, we need to check them with new IR tests.

This revision now requires changes to proceed.Nov 1 2021, 7:47 AM
Hardcode84 updated this revision to Diff 384078.Nov 2 2021, 6:56 AM

address review comments

Hardcode84 marked 7 inline comments as done.Nov 2 2021, 6:57 AM
antiagainst accepted this revision.Nov 2 2021, 6:58 AM

Cool, thanks!

This revision is now accepted and ready to land.Nov 2 2021, 6:58 AM
This revision was automatically updated to reflect the committed changes.