spirv: fix lowering of OpGroupNonUniformAllEqual
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 11 Nov 2019 09:15:01 +0000 (10:15 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 19 Nov 2019 18:01:13 +0000 (18:01 +0000)
It should rely on the source type, not on the return type which
is always a boolean anyways, so vote_feq was never selected. For
OpSubgroupAllEqualKHR it's always an integer comparison.

This fixes some VK_KHR_shader_subgroup_extended_types tests with RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/compiler/spirv/vtn_subgroup.c

index 8339b1a4862c131d9855a39b57e8253e3a709aa5..eb255c4106cd2f47db02f54718f1fdc9d010a783 100644 (file)
@@ -213,15 +213,22 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
       case SpvOpSubgroupAnyKHR:
          op = nir_intrinsic_vote_any;
          break;
+      case SpvOpSubgroupAllEqualKHR:
+         op = nir_intrinsic_vote_ieq;
+         break;
       case SpvOpGroupNonUniformAllEqual:
-      case SpvOpSubgroupAllEqualKHR: {
-         switch (glsl_get_base_type(val->type->type)) {
+         switch (glsl_get_base_type(vtn_ssa_value(b, w[4])->type)) {
          case GLSL_TYPE_FLOAT:
+         case GLSL_TYPE_FLOAT16:
          case GLSL_TYPE_DOUBLE:
             op = nir_intrinsic_vote_feq;
             break;
          case GLSL_TYPE_UINT:
          case GLSL_TYPE_INT:
+         case GLSL_TYPE_UINT8:
+         case GLSL_TYPE_INT8:
+         case GLSL_TYPE_UINT16:
+         case GLSL_TYPE_INT16:
          case GLSL_TYPE_UINT64:
          case GLSL_TYPE_INT64:
          case GLSL_TYPE_BOOL:
@@ -231,7 +238,6 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
             unreachable("Unhandled type");
          }
          break;
-      }
       default:
          unreachable("Unhandled opcode");
       }