nir/vtn: add caps for some cl related capabilities
authorRob Clark <robdclark@gmail.com>
Mon, 26 Feb 2018 23:01:02 +0000 (18:01 -0500)
committerKarol Herbst <kherbst@redhat.com>
Mon, 21 Jan 2019 19:36:41 +0000 (20:36 +0100)
vtn supports these, so don't squalk if user is happy with enabling
these.

v2: add new members sorted

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/compiler/shader_info.h
src/compiler/spirv/spirv_to_nir.c
src/compiler/spirv/vtn_variables.c

index 87a2c805d378cbe9a1f5f4b79fabf31150f84936..7af36a66d1338bb7d4552561f13fb8c66a00441a 100644 (file)
@@ -33,6 +33,7 @@ extern "C" {
 #endif
 
 struct spirv_supported_capabilities {
+   bool address;
    bool atomic_storage;
    bool descriptor_array_dynamic_indexing;
    bool device_group;
@@ -43,9 +44,11 @@ struct spirv_supported_capabilities {
    bool image_ms_array;
    bool image_read_without_format;
    bool image_write_without_format;
+   bool int8;
    bool int16;
    bool int64;
    bool int64_atomics;
+   bool kernel;
    bool min_lod;
    bool multiview;
    bool post_depth_coverage;
index 4e5be79c9d71b67107606c1c53c54b223a8cb686..19e4319bd24ef6877c36ae730ba32dd48b138c90 100644 (file)
@@ -820,8 +820,10 @@ struct_member_decoration_cb(struct vtn_builder *b,
    case SpvDecorationFPRoundingMode:
    case SpvDecorationFPFastMathMode:
    case SpvDecorationAlignment:
-      vtn_warn("Decoration only allowed for CL-style kernels: %s",
-               spirv_decoration_to_string(dec->decoration));
+      if (b->shader->info.stage != MESA_SHADER_KERNEL) {
+         vtn_warn("Decoration only allowed for CL-style kernels: %s",
+                  spirv_decoration_to_string(dec->decoration));
+      }
       break;
 
    case SpvDecorationHlslSemanticGOOGLE:
@@ -3521,7 +3523,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
       case SpvCapabilityVector16:
       case SpvCapabilityFloat16Buffer:
       case SpvCapabilityFloat16:
-      case SpvCapabilityInt8:
       case SpvCapabilitySparseResidency:
          vtn_warn("Unsupported SPIR-V capability: %s",
                   spirv_capability_to_string(cap));
@@ -3555,6 +3556,9 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
 
       case SpvCapabilityInt64Atomics:
          spv_check_supported(int64_atomics, cap);
+
+      case SpvCapabilityInt8:
+         spv_check_supported(int8, cap);
          break;
 
       case SpvCapabilityStorageImageMultisample:
@@ -3562,7 +3566,13 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
          break;
 
       case SpvCapabilityAddresses:
+         spv_check_supported(address, cap);
+         break;
+
       case SpvCapabilityKernel:
+         spv_check_supported(kernel, cap);
+         break;
+
       case SpvCapabilityImageBasic:
       case SpvCapabilityImageReadWrite:
       case SpvCapabilityImageMipmap:
index ced02fd6f7ea918bd20a92b347e0d0377fa3dd89..b6a5880090e8c767379c5f838476a05400a2d2e4 100644 (file)
@@ -1511,8 +1511,10 @@ apply_var_decoration(struct vtn_builder *b,
    case SpvDecorationFPRoundingMode:
    case SpvDecorationFPFastMathMode:
    case SpvDecorationAlignment:
-      vtn_warn("Decoration only allowed for CL-style kernels: %s",
-               spirv_decoration_to_string(dec->decoration));
+      if (b->shader->info.stage != MESA_SHADER_KERNEL) {
+         vtn_warn("Decoration only allowed for CL-style kernels: %s",
+                  spirv_decoration_to_string(dec->decoration));
+      }
       break;
 
    case SpvDecorationHlslSemanticGOOGLE: