This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Add support for OpPtrCastToGeneric
Needs RevisionPublic

Authored by alexbatashev on Feb 19 2022, 4:13 AM.

Details

Reviewers
antiagainst
Summary

OpPtrCastToGeneric converts pointer's storage class to Generic.

Diff Detail

Event Timeline

alexbatashev created this revision.Feb 19 2022, 4:13 AM
alexbatashev requested review of this revision.Feb 19 2022, 4:13 AM
antiagainst requested changes to this revision.Feb 21 2022, 6:11 PM

Thanks for adding this!

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOCLOps.td
515

This is an op in the core spec so it should not be placed in SPIRVOCLOps.td. Please define it in SPIRVCastOps.td.

543

Can use SPV_AnyPtr here.

547

Can use SPV_AnyPtr here.

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

You can define

let assemblyFormat = "$pointer attr-dict `:` type($pointer) `to` type($result)";

in ODS to autogen the parser and printer.

4464

This will be autogen'ed with SPV_AnyPtr in the ODS.

4468

I think you want to check Workgroup, CrossWorkgroup, or Function here?

4472

This won't be needed with SPV_AnyPtr in the ODS.

mlir/test/Dialect/SPIRV/IR/ocl-ops.mlir
194

This should be // CHECK: to actually checking it.

196

Please add negative tests triggering validation errors.

Also please add a test for (de)serialization in https://github.com/llvm/llvm-project/blob/main/mlir/test/Target/SPIRV/cast-ops.mlir.

This revision now requires changes to proceed.Feb 21 2022, 6:11 PM