This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][SPIRVToLLVM] Additional conversions for spirv-runner
ClosedPublic

Authored by georgemitenkov on Aug 17 2020, 2:23 PM.

Details

Summary

This patch adds more op/type conversion support
necessary for spirv-runner.

  • EntryPoint/ExecutionMode: currently removed since we assume

having only one kernel function in the kernel module.

  • StorageBuffer storage class is now supported. We are not

concerned with multithreading so this is fine for now.

  • Type conversion enhanced, now regular offsets and strides

for structs and arrays are supported (based on
VulkanLayoutUtils).

  • Support of spc.AccessChain that is modelled with GEP op

in LLVM dialect.

Diff Detail

Event Timeline

georgemitenkov created this revision.Aug 17 2020, 2:23 PM
georgemitenkov requested review of this revision.Aug 17 2020, 2:23 PM
mravishankar requested changes to this revision.Aug 17 2020, 11:44 PM

Thanks George! Just some minor comments.

mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
35

nit typo : s/invokation/invocation .

604–605

I dont follow why this is needed, as opposed to just adding

storageClass != spirv::StorageClass::StorageBuffer &&`

to the check that existed earlier.

mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
29

This should be a CHECK-NEXT to actually check that the llvm.return is the only statement in the function.

This revision now requires changes to proceed.Aug 17 2020, 11:44 PM
georgemitenkov marked 3 inline comments as done.

Removed unnecessary utility and added a CHECK-NEXT in entry point tests.

mravishankar accepted this revision.Aug 18 2020, 8:06 AM
mravishankar added inline comments.
mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir
3

Nit: A more meaningful error message here might be useful. Something that say conversion failed since only conversion of struct with default layout is supported.

This revision is now accepted and ready to land.Aug 18 2020, 8:06 AM
georgemitenkov marked an inline comment as done.Aug 18 2020, 9:06 AM
georgemitenkov added inline comments.
mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir
3

That's a good point, thanks! I think it's a general pattern to return llvm::None for unsupported cases, so that the op conversion fails on type conversion step. I will then add a separate patch for more meaningful error messages during type conversion.

This revision was landed with ongoing or failed builds.Aug 18 2020, 9:10 AM
This revision was automatically updated to reflect the committed changes.
georgemitenkov marked an inline comment as done.