llvm-project/mlir/tools/mlir-spirv-cpu-runner
Lei Zhang 89b595e141 [mlir][spirv] Detach memory space mapping from type conversion
This commit moves MemRef memory space to SPIR-V storage class
conversion out of the main SPIR-V type converter. Now the mapping
should happen as a prelimiary step before performing the final
conversion to SPIR-V. Flows are expect to write their own memory
space mappings like the `MapMemRefStorageClassPass` to handle
memory space mappings according to their needs.

This is needed because SPIR-V is serving multiple client APIs,
including Vulkan and OpenCL. Different client APIs might want
to use different storage classes for buffers in a particular
memory space, e.g., `StorageBuffer` for Vulkan vs. `CrossWorkgroup`
for OpenCL when converting the default 0 memory space.  Hardcoding
a specific mapping makes that hard. While it's possible to embed
selection logic further inside the main type converter, it will
make the main type converter even complicated. So it's better to
separate the concerns, as mapping the memory space is really
concretizing the meaning of those numeric memory spaces in the
particular context of SPIR-V lowering.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D131410
2022-08-09 14:30:43 -04:00
..
CMakeLists.txt [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore 2022-07-21 19:04:00 +00:00
mlir-spirv-cpu-runner.cpp [mlir][spirv] Detach memory space mapping from type conversion 2022-08-09 14:30:43 -04:00