[Mlir-commits] [mlir] 2442aa3 - [mlir][spirv] Add extensions implied by SPIR-V 1.6

Jakub Kuderski llvmlistbot at llvm.org
Mon Dec 5 14:41:43 PST 2022


Author: Jakub Kuderski
Date: 2022-12-05T17:40:29-05:00
New Revision: 2442aa3447706405898b2072c649377ac2f302d8

URL: https://github.com/llvm/llvm-project/commit/2442aa3447706405898b2072c649377ac2f302d8
DIFF: https://github.com/llvm/llvm-project/commit/2442aa3447706405898b2072c649377ac2f302d8.diff

LOG: [mlir][spirv] Add extensions implied by SPIR-V 1.6

This adds existing extensions as implied by SPIR-V 1.6.

Also clean up the surrounding code.

Fixes: https://github.com/llvm/llvm-project/issues/59348.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D139369

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
    mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
index 8fa89a121bdd..3c993cbc7744 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
@@ -340,6 +340,8 @@ def SPV_KHR_fragment_shader_barycentric      : I32EnumAttrCase<"SPV_KHR_fragment
 def SPV_KHR_ray_cull_mask                    : I32EnumAttrCase<"SPV_KHR_ray_cull_mask", 26>;
 def SPV_KHR_uniform_group_instructions       : I32EnumAttrCase<"SPV_KHR_uniform_group_instructions", 27>;
 def SPV_KHR_subgroup_rotate                  : I32EnumAttrCase<"SPV_KHR_subgroup_rotate", 28>;
+def SPV_KHR_non_semantic_info                : I32EnumAttrCase<"SPV_KHR_non_semantic_info", 29>;
+def SPV_KHR_terminate_invocation             : I32EnumAttrCase<"SPV_KHR_terminate_invocation", 30>;
 
 def SPV_EXT_demote_to_helper_invocation  : I32EnumAttrCase<"SPV_EXT_demote_to_helper_invocation", 1000>;
 def SPV_EXT_descriptor_indexing          : I32EnumAttrCase<"SPV_EXT_descriptor_indexing", 1001>;
@@ -430,6 +432,7 @@ def SPIRV_ExtensionAttr :
       SPV_KHR_ray_tracing, SPV_KHR_subgroup_uniform_control_flow, SPV_KHR_linkonce_odr,
       SPV_KHR_fragment_shader_barycentric, SPV_KHR_ray_cull_mask,
       SPV_KHR_uniform_group_instructions, SPV_KHR_subgroup_rotate,
+      SPV_KHR_non_semantic_info, SPV_KHR_terminate_invocation,
       SPV_EXT_demote_to_helper_invocation, SPV_EXT_descriptor_indexing,
       SPV_EXT_fragment_fully_covered, SPV_EXT_fragment_invocation_density,
       SPV_EXT_fragment_shader_interlock, SPV_EXT_physical_storage_buffer,

diff  --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
index a9b97c212394..8ce56ece4747 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
@@ -12,11 +12,8 @@
 
 #include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
 
-#include "mlir/IR/BuiltinTypes.h"
-
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
 
 #include <iterator>
 
@@ -54,25 +51,37 @@ ArrayRef<spirv::Extension> spirv::getImpliedExtensions(spirv::Version version) {
       Extension::SPV_KHR_physical_storage_buffer,                              \
       Extension::SPV_KHR_vulkan_memory_model
 
+#define V_1_6_IMPLIED_EXTS                                                     \
+  Extension::SPV_KHR_non_semantic_info,                                        \
+      Extension::SPV_KHR_integer_dot_product,                                  \
+      Extension::SPV_KHR_terminate_invocation,                                 \
+      Extension::SPV_EXT_demote_to_helper_invocation
+
   switch (version) {
   default:
     return {};
   case Version::V_1_3: {
     // The following manual ArrayRef constructor call is to satisfy GCC 5.
     static const Extension exts[] = {V_1_3_IMPLIED_EXTS};
-    return ArrayRef<spirv::Extension>(exts, std::size(exts));
+    return exts;
   }
   case Version::V_1_4: {
     static const Extension exts[] = {V_1_3_IMPLIED_EXTS, V_1_4_IMPLIED_EXTS};
-    return ArrayRef<spirv::Extension>(exts, std::size(exts));
+    return exts;
   }
   case Version::V_1_5: {
     static const Extension exts[] = {V_1_3_IMPLIED_EXTS, V_1_4_IMPLIED_EXTS,
                                      V_1_5_IMPLIED_EXTS};
-    return ArrayRef<spirv::Extension>(exts, std::size(exts));
+    return exts;
+  }
+  case Version::V_1_6: {
+    static const Extension exts[] = {V_1_3_IMPLIED_EXTS, V_1_4_IMPLIED_EXTS,
+                                     V_1_5_IMPLIED_EXTS, V_1_6_IMPLIED_EXTS};
+    return exts;
   }
   }
 
+#undef V_1_6_IMPLIED_EXTS
 #undef V_1_5_IMPLIED_EXTS
 #undef V_1_4_IMPLIED_EXTS
 #undef V_1_3_IMPLIED_EXTS


        


More information about the Mlir-commits mailing list