summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2018-01-25 07:59:06 -0500
committerRob Clark <[email protected]>2018-03-14 10:08:42 -0400
commitb617bfcccfd906c638ef6c6eb5adab857e1938e5 (patch)
tree01c44f5b0cf4fa03642d6333b7faa15110581074 /src/compiler/spirv
parentfcf267ba087dd00c48ceaf9277424dac079f9319 (diff)
compiler: int8/uint8 support
OpenCL kernels also have int8/uint8. v2: remove changes in nir_search as Jason posted a patch for that Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Rob Clark <[email protected]> Signed-off-by: Karol Herbst <[email protected]>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c24
-rw-r--r--src/compiler/spirv/vtn_variables.c14
2 files changed, 38 insertions, 0 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 3de45c47371..42a559122a6 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -207,6 +207,8 @@ vtn_const_ssa_value(struct vtn_builder *b, nir_constant *constant,
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_BOOL:
@@ -1009,6 +1011,9 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
case 16:
val->type->type = (signedness ? glsl_int16_t_type() : glsl_uint16_t_type());
break;
+ case 8:
+ val->type->type = (signedness ? glsl_int8_t_type() : glsl_uint8_t_type());
+ break;
default:
vtn_fail("Invalid int bit size");
}
@@ -1283,6 +1288,8 @@ vtn_null_constant(struct vtn_builder *b, const struct glsl_type *type)
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_BOOL:
@@ -1422,6 +1429,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
case 16:
val->constant->values->u16[0] = w[3];
break;
+ case 8:
+ val->constant->values->u8[0] = w[3];
+ break;
default:
vtn_fail("Unsupported SpvOpConstant bit size");
}
@@ -1444,6 +1454,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
case 16:
val->constant->values[0].u16[0] = get_specialization(b, val, w[3]);
break;
+ case 8:
+ val->constant->values[0].u8[0] = get_specialization(b, val, w[3]);
+ break;
default:
vtn_fail("Unsupported SpvOpSpecConstant bit size");
}
@@ -1476,6 +1489,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
case 16:
val->constant->values[0].u16[i] = elems[i]->values[0].u16[0];
break;
+ case 8:
+ val->constant->values[0].u8[i] = elems[i]->values[0].u8[0];
+ break;
default:
vtn_fail("Invalid SpvOpConstantComposite bit size");
}
@@ -1646,6 +1662,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
case 16:
val->constant->values[0].u16[i] = (*c)->values[col].u16[elem + i];
break;
+ case 8:
+ val->constant->values[0].u8[i] = (*c)->values[col].u8[elem + i];
+ break;
default:
vtn_fail("Invalid SpvOpCompositeExtract bit size");
}
@@ -1670,6 +1689,9 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
case 16:
(*c)->values[col].u16[elem + i] = insert->constant->values[0].u16[i];
break;
+ case 8:
+ (*c)->values[col].u8[elem + i] = insert->constant->values[0].u8[i];
+ break;
default:
vtn_fail("Invalid SpvOpCompositeInsert bit size");
}
@@ -1804,6 +1826,8 @@ vtn_create_ssa_value(struct vtn_builder *b, const struct glsl_type *type)
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_BOOL:
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 61caaafa311..b2897407fb1 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -297,6 +297,8 @@ vtn_ssa_offset_pointer_dereference(struct vtn_builder *b,
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
@@ -413,6 +415,8 @@ vtn_pointer_to_deref(struct vtn_builder *b, struct vtn_pointer *ptr)
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
@@ -624,6 +628,8 @@ vtn_pointer_to_offset(struct vtn_builder *b, struct vtn_pointer *ptr,
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
@@ -672,6 +678,8 @@ vtn_type_block_size(struct vtn_builder *b, struct vtn_type *type)
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
@@ -802,6 +810,8 @@ _vtn_block_load_store(struct vtn_builder *b, nir_intrinsic_op op, bool load,
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
@@ -987,6 +997,8 @@ _vtn_variable_load_store(struct vtn_builder *b, bool load,
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
@@ -1071,6 +1083,8 @@ _vtn_variable_copy(struct vtn_builder *b, struct vtn_pointer *dest,
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT: