diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/compiler/brw_compiler.c | 1 | ||||
-rw-r--r-- | src/intel/compiler/brw_fs_nir.cpp | 46 | ||||
-rw-r--r-- | src/intel/compiler/brw_nir.c | 1 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index 397c8cccf90..39a8237ff07 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -57,6 +57,7 @@ static const struct nir_shader_compiler_options scalar_nir_options = { .lower_unpack_snorm_4x8 = true, .lower_unpack_unorm_2x16 = true, .lower_unpack_unorm_4x8 = true, + .lower_subgroup_masks = true, .max_unroll_iterations = 32, }; diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index 491f5184e39..74f90dabeac 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -4103,6 +4103,10 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr break; } + case nir_intrinsic_load_subgroup_size: + bld.MOV(retype(dest, BRW_REGISTER_TYPE_D), brw_imm_d(dispatch_width)); + break; + case nir_intrinsic_load_subgroup_invocation: { fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_UW); dest = retype(dest, BRW_REGISTER_TYPE_UD); @@ -4118,6 +4122,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr break; } + case nir_intrinsic_load_subgroup_eq_mask: + case nir_intrinsic_load_subgroup_ge_mask: + case nir_intrinsic_load_subgroup_gt_mask: + case nir_intrinsic_load_subgroup_le_mask: + case nir_intrinsic_load_subgroup_lt_mask: + unreachable("not reached"); + case nir_intrinsic_vote_any: { const fs_builder ubld = bld.exec_all(); @@ -4168,6 +4179,41 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr bld.SEL(dest, dest, brw_imm_d(0))); break; } + + case nir_intrinsic_ballot: { + const fs_reg value = retype(get_nir_src(instr->src[0]), + BRW_REGISTER_TYPE_UD); + const struct brw_reg flag = retype(brw_flag_reg(0, 0), + BRW_REGISTER_TYPE_UD); + + bld.exec_all().MOV(flag, brw_imm_ud(0u)); + bld.CMP(bld.null_reg_ud(), value, brw_imm_ud(0u), BRW_CONDITIONAL_NZ); + + dest.type = BRW_REGISTER_TYPE_UQ; + bld.MOV(dest, flag); + break; + } + + case nir_intrinsic_read_invocation: { + const fs_reg value = get_nir_src(instr->src[0]); + const fs_reg invocation = get_nir_src(instr->src[1]); + fs_reg tmp = bld.vgrf(value.type); + + bld.exec_all().emit(SHADER_OPCODE_BROADCAST, tmp, value, + component(invocation, 0)); + + bld.MOV(retype(dest, BRW_REGISTER_TYPE_D), + fs_reg(component(tmp, 0))); + break; + } + + case nir_intrinsic_read_first_invocation: { + const fs_reg value = get_nir_src(instr->src[0]); + bld.MOV(retype(dest, BRW_REGISTER_TYPE_D), + bld.emit_uniformize(value)); + break; + } + default: unreachable("unknown intrinsic"); } diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index cede77fbc88..ce21c016699 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -620,6 +620,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir) OPT(nir_lower_tex, &tex_options); OPT(nir_normalize_cubemap_coords); + OPT(nir_lower_read_invocation_to_scalar); OPT(nir_lower_global_vars_to_local); |