spirv: Implement SpvCapabilitySubgroupBufferBlockIOINTEL

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7448>
This commit is contained in:
Caio Marcelo de Oliveira Filho 2020-10-05 14:49:15 -07:00 committed by Marge Bot
parent dd39e311b3
commit eb03f29655
3 changed files with 38 additions and 0 deletions

View File

@ -95,6 +95,7 @@ struct spirv_supported_capabilities {
bool amd_image_gather_bias_lod;
bool intel_subgroup_shuffle;
bool intel_subgroup_buffer_block_io;
};
typedef struct shader_info {

View File

@ -4397,6 +4397,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(intel_subgroup_shuffle, cap);
break;
case SpvCapabilitySubgroupBufferBlockIOINTEL:
spv_check_supported(intel_subgroup_buffer_block_io, cap);
break;
default:
vtn_fail("Unhandled capability: %s (%u)",
spirv_capability_to_string(cap), cap);
@ -5040,6 +5044,8 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpConvertUToPtr:
case SpvOpGenericCastToPtrExplicit:
case SpvOpGenericPtrMemSemantics:
case SpvOpSubgroupBlockReadINTEL:
case SpvOpSubgroupBlockWriteINTEL:
vtn_handle_variables(b, opcode, w, count);
break;

View File

@ -2424,6 +2424,37 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
break;
}
case SpvOpSubgroupBlockReadINTEL: {
struct vtn_type *res_type = vtn_get_type(b, w[1]);
nir_deref_instr *src = vtn_nir_deref(b, w[3]);
nir_intrinsic_instr *load =
nir_intrinsic_instr_create(b->nb.shader,
nir_intrinsic_load_deref_block_intel);
load->src[0] = nir_src_for_ssa(&src->dest.ssa);
nir_ssa_dest_init_for_type(&load->instr, &load->dest,
res_type->type, NULL);
load->num_components = load->dest.ssa.num_components;
nir_builder_instr_insert(&b->nb, &load->instr);
vtn_push_nir_ssa(b, w[2], &load->dest.ssa);
break;
}
case SpvOpSubgroupBlockWriteINTEL: {
nir_deref_instr *dest = vtn_nir_deref(b, w[1]);
nir_ssa_def *data = vtn_ssa_value(b, w[2])->def;
nir_intrinsic_instr *store =
nir_intrinsic_instr_create(b->nb.shader,
nir_intrinsic_store_deref_block_intel);
store->src[0] = nir_src_for_ssa(&dest->dest.ssa);
store->src[1] = nir_src_for_ssa(data);
store->num_components = data->num_components;
nir_builder_instr_insert(&b->nb, &store->instr);
break;
}
default:
vtn_fail_with_opcode("Unhandled opcode", opcode);
}