-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][spirv]: Add Image to Vulkan Storage Class Map #144899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-mlir Author: Jack Frankland (FranklandJack) ChangesExtend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list. Full diff: https://github.com/llvm/llvm-project/pull/144899.diff 1 Files Affected:
diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
index 4cbc3dfdae223..1fbc5a03987e8 100644
--- a/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
+++ b/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
@@ -59,7 +59,8 @@ using namespace mlir;
MAP_FN(spirv::StorageClass::UniformConstant, 8) \
MAP_FN(spirv::StorageClass::Input, 9) \
MAP_FN(spirv::StorageClass::Output, 10) \
- MAP_FN(spirv::StorageClass::PhysicalStorageBuffer, 11)
+ MAP_FN(spirv::StorageClass::PhysicalStorageBuffer, 11) \
+ MAP_FN(spirv::StorageClass::Image, 12)
std::optional<spirv::StorageClass>
spirv::mapMemorySpaceToVulkanStorageClass(Attribute memorySpaceAttr) {
|
@llvm/pr-subscribers-mlir-spirv Author: Jack Frankland (FranklandJack) ChangesExtend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list. Full diff: https://github.com/llvm/llvm-project/pull/144899.diff 1 Files Affected:
diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
index 4cbc3dfdae223..1fbc5a03987e8 100644
--- a/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
+++ b/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
@@ -59,7 +59,8 @@ using namespace mlir;
MAP_FN(spirv::StorageClass::UniformConstant, 8) \
MAP_FN(spirv::StorageClass::Input, 9) \
MAP_FN(spirv::StorageClass::Output, 10) \
- MAP_FN(spirv::StorageClass::PhysicalStorageBuffer, 11)
+ MAP_FN(spirv::StorageClass::PhysicalStorageBuffer, 11) \
+ MAP_FN(spirv::StorageClass::Image, 12)
std::optional<spirv::StorageClass>
spirv::mapMemorySpaceToVulkanStorageClass(Attribute memorySpaceAttr) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we test this?
So I did have a look at the lit tests for this pass. Seems we only test the storage classes that map from memory spaces that are common to the OpenCL and Vulkan environments. The way the lit test is defined at the moment means it needs to be run in both OpenCL and Vulkan modes which I think is going to cause the CL path to fail since the index |
Can we add a new test for vulkan only? |
2d7d21d
to
3bf9d0e
Compare
Yep, added a VK specific file for the indices which have no mapping in OpenCL's address spaces. I've also extended the existing tests to check some of the missing memory spaces that are common to both backends and addeda missing checkline since I think some of the tests at the end of the file were not actually being checked. |
3bf9d0e
to
ee49c8a
Compare
Extend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list. Extend the pass testing to include missing memory scopes and add a new test file for the memory address indices which only support a mapping in the Vuklan environment. It appears that previously there was a missing CHECK line for the default pass behavior so that has been added. Signed-off-by: Jack Frankland <[email protected]>
ee49c8a
to
9e7a5f1
Compare
Extend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list. Signed-off-by: Jack Frankland <[email protected]>
Extend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list. Signed-off-by: Jack Frankland <[email protected]>
Extend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list. Signed-off-by: Jack Frankland <[email protected]>
Extend the "storage class" <-> "memory space" map for the Vulkan SPIR-V environment to include the Image class. 12 is chosen as the next available value in the MemRef memory space list.