This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Add client-api option to -convert-spirv-to-llvm
ClosedPublic

Authored by victor-eds on Aug 23 2023, 8:34 AM.

Details

Summary

Option to express that spirv StorageClasses should be mapped to LLVM
address spaces in the conversion process. This mapping will be
client-dependent.

The client API cannot be taken from the code as more than one module
could be present, resulting in more than one VCE triple and different
StorageClass to address space mappings. This information would not be
available during type conversion.

A specific mapping for the OpenCL client is defined, based on the OpenCL Extended Instruction Set
and this mapping.

Signed-off-by: Victor Perez <victor.perez@codeplay.com>

Diff Detail

Event Timeline

victor-eds created this revision.Aug 23 2023, 8:34 AM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a reviewer: kuhar. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
victor-eds requested review of this revision.Aug 23 2023, 8:34 AM
kuhar accepted this revision.Aug 23 2023, 8:58 AM

LGTM but please wait for thumbs up from @antiagainst before submitting

mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
36

nit: could you confirm that this name conforms with the coding style? In other spir-v-related code I saw kVariableName used, but I think a more general policy is VariableName?
nit: static is redundant here, constexpr in the namespace/global scope already has internal linkage

This revision is now accepted and ready to land.Aug 23 2023, 8:58 AM
mehdi_amini added inline comments.Aug 23 2023, 10:30 AM
mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
36

This is conform to MLIR coding style I believe. The k prefix is a habit from googlers, and VariableName is the general LLVM convention that MLIR diverges from (for historical reasons).

antiagainst accepted this revision.Aug 23 2023, 9:27 PM

Drop static

victor-eds marked 2 inline comments as done.Aug 24 2023, 1:45 AM
victor-eds added inline comments.
mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
36

Nice catch. Dropped static

This revision was landed with ongoing or failed builds.Aug 24 2023, 1:49 AM
This revision was automatically updated to reflect the committed changes.