This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][GPUToSPIRV] Passing gpu module name to SPIR-V module
ClosedPublic

Authored by georgemitenkov on Aug 21 2020, 4:04 PM.

Details

Summary

This patch allows to pass the gpu module name to SPIR-V
module during conversion. This has many benefits as we can lookup
converted to SPIR-V kernel in the symbol table.

In order to avoid symbol conflicts, "__spv__" is added to the
gpu module name to form the new one.

Diff Detail

Event Timeline

georgemitenkov created this revision.Aug 21 2020, 4:04 PM
georgemitenkov requested review of this revision.Aug 21 2020, 4:04 PM
mravishankar accepted this revision.Aug 25 2020, 3:01 PM
mravishankar added inline comments.
mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
22

Make this

static constexpr const char kSPIRVModule[] = "__spv__";

That should fix the clang-tidy error below.

This revision is now accepted and ready to land.Aug 25 2020, 3:01 PM
georgemitenkov marked an inline comment as done.

Fixed the clang-tidy error.

This revision was landed with ongoing or failed builds.Aug 26 2020, 11:20 PM
This revision was automatically updated to reflect the committed changes.
rriddle added inline comments.Aug 27 2020, 6:06 PM
mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
291

This is an asan failure, StringRef does not own any of the storage. Please ensure that when you are using reference types(StringRef, Twine, ArrayRef, etc.) that the lifetime of the data outlives the lifetime of the reference.

mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
291

Thank you, I will! I had issues with this recently and fixed the other patch related to the spirv-cpu-runner. I think the issue has been fixed in here.