microsoft/compiler: Pass deref modes to unaligned pass and handle push const
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21029>
This commit is contained in:
@@ -888,7 +888,7 @@ clc_spirv_to_dxil(struct clc_libclc *lib,
|
||||
|
||||
NIR_PASS_V(nir, dxil_nir_lower_deref_ssbo);
|
||||
|
||||
NIR_PASS_V(nir, dxil_nir_split_unaligned_loads_stores);
|
||||
NIR_PASS_V(nir, dxil_nir_split_unaligned_loads_stores, nir_var_all);
|
||||
|
||||
assert(nir->info.cs.ptr_size == 64);
|
||||
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_ssbo,
|
||||
@@ -948,7 +948,7 @@ clc_spirv_to_dxil(struct clc_libclc *lib,
|
||||
}
|
||||
|
||||
NIR_PASS_V(nir, clc_nir_lower_kernel_input_loads, inputs_var);
|
||||
NIR_PASS_V(nir, dxil_nir_split_unaligned_loads_stores);
|
||||
NIR_PASS_V(nir, dxil_nir_split_unaligned_loads_stores, nir_var_mem_ubo);
|
||||
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_ubo,
|
||||
nir_address_format_32bit_index_offset);
|
||||
NIR_PASS_V(nir, clc_nir_lower_system_values, work_properties_var);
|
||||
|
||||
@@ -2219,7 +2219,7 @@ split_unaligned_store(nir_builder *b, nir_intrinsic_instr *intrin, unsigned alig
|
||||
}
|
||||
|
||||
bool
|
||||
dxil_nir_split_unaligned_loads_stores(nir_shader *shader)
|
||||
dxil_nir_split_unaligned_loads_stores(nir_shader *shader, nir_variable_mode modes)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
@@ -2239,6 +2239,8 @@ dxil_nir_split_unaligned_loads_stores(nir_shader *shader)
|
||||
intrin->intrinsic != nir_intrinsic_store_deref)
|
||||
continue;
|
||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||
if (!nir_deref_mode_may_be(deref, modes))
|
||||
continue;
|
||||
|
||||
unsigned align_mul = 0, align_offset = 0;
|
||||
nir_get_explicit_deref_align(deref, true, &align_mul, &align_offset);
|
||||
@@ -2248,7 +2250,8 @@ dxil_nir_split_unaligned_loads_stores(nir_shader *shader)
|
||||
/* We can load anything at 4-byte alignment, except for
|
||||
* UBOs (AKA CBs where the granularity is 16 bytes).
|
||||
*/
|
||||
if (alignment >= (deref->modes == nir_var_mem_ubo ? 16 : 4))
|
||||
unsigned req_align = (nir_deref_mode_is_one_of(deref, nir_var_mem_ubo | nir_var_mem_push_const) ? 16 : 4);
|
||||
if (alignment >= req_align)
|
||||
continue;
|
||||
|
||||
nir_ssa_def *val;
|
||||
|
||||
@@ -77,7 +77,7 @@ bool dxil_nir_ensure_position_writes(nir_shader *s);
|
||||
bool dxil_nir_lower_sample_pos(nir_shader *s);
|
||||
bool dxil_nir_lower_subgroup_id(nir_shader *s);
|
||||
bool dxil_nir_lower_num_subgroups(nir_shader *s);
|
||||
bool dxil_nir_split_unaligned_loads_stores(nir_shader *shader);
|
||||
bool dxil_nir_split_unaligned_loads_stores(nir_shader *shader, nir_variable_mode modes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user