radv: remove radv_device::physical_device
Get the logical device object using the base object. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28500>
This commit is contained in:
committed by
Marge Bot
parent
310597cab6
commit
896c9cf486
@@ -501,12 +501,13 @@ apply_layout_to_tex(nir_builder *b, apply_layout_state *state, nir_tex_instr *te
|
||||
void
|
||||
radv_nir_apply_pipeline_layout(nir_shader *shader, struct radv_device *device, const struct radv_shader_stage *stage)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
apply_layout_state state = {
|
||||
.gfx_level = device->physical_device->info.gfx_level,
|
||||
.address32_hi = device->physical_device->info.address32_hi,
|
||||
.gfx_level = pdev->info.gfx_level,
|
||||
.address32_hi = pdev->info.address32_hi,
|
||||
.disable_aniso_single_level = device->instance->drirc.disable_aniso_single_level,
|
||||
.has_image_load_dcc_bug = device->physical_device->info.has_image_load_dcc_bug,
|
||||
.disable_tg4_trunc_coord = !device->physical_device->info.conformant_trunc_coord && !device->disable_trunc_coord,
|
||||
.has_image_load_dcc_bug = pdev->info.has_image_load_dcc_bug,
|
||||
.disable_tg4_trunc_coord = !pdev->info.conformant_trunc_coord && !device->disable_trunc_coord,
|
||||
.args = &stage->args,
|
||||
.info = &stage->info,
|
||||
.layout = &stage->layout,
|
||||
|
||||
@@ -72,6 +72,8 @@ radv_nir_lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask)
|
||||
void
|
||||
radv_nir_lower_io(struct radv_device *device, nir_shader *nir)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
nir_assign_io_var_locations(nir, nir_var_shader_in, &nir->num_inputs, MESA_SHADER_FRAGMENT);
|
||||
}
|
||||
@@ -89,7 +91,7 @@ radv_nir_lower_io(struct radv_device *device, nir_shader *nir)
|
||||
|
||||
NIR_PASS(_, nir, nir_io_add_const_offset_to_base, nir_var_shader_in | nir_var_shader_out);
|
||||
|
||||
if (device->physical_device->use_ngg_streamout && nir->xfb_info) {
|
||||
if (pdev->use_ngg_streamout && nir->xfb_info) {
|
||||
NIR_PASS_V(nir, nir_io_add_intrinsic_xfb_info);
|
||||
|
||||
/* The total number of shader outputs is required for computing the pervertex LDS size for
|
||||
@@ -133,6 +135,7 @@ radv_map_io_driver_location(unsigned semantic)
|
||||
bool
|
||||
radv_nir_lower_io_to_mem(struct radv_device *device, struct radv_shader_stage *stage)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const struct radv_shader_info *info = &stage->info;
|
||||
ac_nir_map_io_driver_location map_input = info->inputs_linked ? NULL : radv_map_io_driver_location;
|
||||
ac_nir_map_io_driver_location map_output = info->outputs_linked ? NULL : radv_map_io_driver_location;
|
||||
@@ -144,35 +147,33 @@ radv_nir_lower_io_to_mem(struct radv_device *device, struct radv_shader_stage *s
|
||||
info->vs.tcs_temp_only_input_mask);
|
||||
return true;
|
||||
} else if (info->vs.as_es) {
|
||||
NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, map_output, device->physical_device->info.gfx_level,
|
||||
info->esgs_itemsize);
|
||||
NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, map_output, pdev->info.gfx_level, info->esgs_itemsize);
|
||||
return true;
|
||||
}
|
||||
} else if (nir->info.stage == MESA_SHADER_TESS_CTRL) {
|
||||
NIR_PASS_V(nir, ac_nir_lower_hs_inputs_to_mem, map_input, info->vs.tcs_in_out_eq);
|
||||
NIR_PASS_V(nir, ac_nir_lower_hs_outputs_to_mem, map_output, device->physical_device->info.gfx_level,
|
||||
info->tcs.tes_inputs_read, info->tcs.tes_patch_inputs_read, info->tcs.num_linked_outputs,
|
||||
info->tcs.num_linked_patch_outputs, info->wave_size, false, false);
|
||||
NIR_PASS_V(nir, ac_nir_lower_hs_outputs_to_mem, map_output, pdev->info.gfx_level, info->tcs.tes_inputs_read,
|
||||
info->tcs.tes_patch_inputs_read, info->tcs.num_linked_outputs, info->tcs.num_linked_patch_outputs,
|
||||
info->wave_size, false, false);
|
||||
|
||||
return true;
|
||||
} else if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||
NIR_PASS_V(nir, ac_nir_lower_tes_inputs_to_mem, map_input);
|
||||
|
||||
if (info->tes.as_es) {
|
||||
NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, map_output, device->physical_device->info.gfx_level,
|
||||
info->esgs_itemsize);
|
||||
NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, map_output, pdev->info.gfx_level, info->esgs_itemsize);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
|
||||
NIR_PASS_V(nir, ac_nir_lower_gs_inputs_to_mem, map_input, device->physical_device->info.gfx_level, false);
|
||||
NIR_PASS_V(nir, ac_nir_lower_gs_inputs_to_mem, map_input, pdev->info.gfx_level, false);
|
||||
return true;
|
||||
} else if (nir->info.stage == MESA_SHADER_TASK) {
|
||||
ac_nir_lower_task_outputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES, device->physical_device->task_info.num_entries,
|
||||
ac_nir_lower_task_outputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES, pdev->task_info.num_entries,
|
||||
info->cs.has_query);
|
||||
return true;
|
||||
} else if (nir->info.stage == MESA_SHADER_MESH) {
|
||||
ac_nir_lower_mesh_inputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES, device->physical_device->task_info.num_entries);
|
||||
ac_nir_lower_mesh_inputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES, pdev->task_info.num_entries);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -648,6 +648,7 @@ lower_rq_terminate(nir_builder *b, nir_def *index, nir_intrinsic_instr *instr, s
|
||||
bool
|
||||
radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
bool progress = false;
|
||||
struct hash_table *query_ht = _mesa_pointer_hash_table_create(NULL);
|
||||
|
||||
@@ -655,7 +656,7 @@ radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device
|
||||
if (!var->data.ray_query)
|
||||
continue;
|
||||
|
||||
lower_ray_query(shader, var, query_ht, device->physical_device->max_shared_size);
|
||||
lower_ray_query(shader, var, query_ht, pdev->max_shared_size);
|
||||
|
||||
progress = true;
|
||||
}
|
||||
@@ -670,7 +671,7 @@ radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device
|
||||
if (!var->data.ray_query)
|
||||
continue;
|
||||
|
||||
lower_ray_query(shader, var, query_ht, device->physical_device->max_shared_size);
|
||||
lower_ray_query(shader, var, query_ht, pdev->max_shared_size);
|
||||
|
||||
progress = true;
|
||||
}
|
||||
|
||||
@@ -297,11 +297,12 @@ build_addr_to_node(nir_builder *b, nir_def *addr)
|
||||
static nir_def *
|
||||
build_node_to_addr(struct radv_device *device, nir_builder *b, nir_def *node, bool skip_type_and)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
nir_def *addr = skip_type_and ? node : nir_iand_imm(b, node, ~7ull);
|
||||
addr = nir_ishl_imm(b, addr, 3);
|
||||
/* Assumes everything is in the top half of address space, which is true in
|
||||
* GFX9+ for now. */
|
||||
return device->physical_device->info.gfx_level >= GFX9 ? nir_ior_imm(b, addr, 0xffffull << 48) : addr;
|
||||
return pdev->info.gfx_level >= GFX9 ? nir_ior_imm(b, addr, 0xffffull << 48) : addr;
|
||||
}
|
||||
|
||||
nir_def *
|
||||
@@ -477,6 +478,7 @@ radv_test_flag(nir_builder *b, const struct radv_ray_traversal_args *args, uint3
|
||||
nir_def *
|
||||
radv_build_ray_traversal(struct radv_device *device, nir_builder *b, const struct radv_ray_traversal_args *args)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
nir_variable *incomplete = nir_local_variable_create(b->impl, glsl_bool_type(), "incomplete");
|
||||
nir_store_var(b, incomplete, nir_imm_true(b), 0x1);
|
||||
|
||||
@@ -568,7 +570,7 @@ radv_build_ray_traversal(struct radv_device *device, nir_builder *b, const struc
|
||||
nir_def *global_bvh_node = nir_iadd(b, nir_load_deref(b, args->vars.bvh_base), nir_u2u64(b, bvh_node));
|
||||
|
||||
nir_def *intrinsic_result = NULL;
|
||||
if (!radv_emulate_rt(device->physical_device)) {
|
||||
if (!radv_emulate_rt(pdev)) {
|
||||
intrinsic_result =
|
||||
nir_bvh64_intersect_ray_amd(b, 32, desc, nir_unpack_64_2x32(b, global_bvh_node),
|
||||
nir_load_deref(b, args->vars.tmax), nir_load_deref(b, args->vars.origin),
|
||||
|
||||
@@ -1524,6 +1524,7 @@ radv_build_traversal(struct radv_device *device, struct radv_ray_tracing_pipelin
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, bool monolithic, nir_builder *b,
|
||||
struct rt_variables *vars, bool ignore_cull_mask, struct radv_ray_tracing_stage_info *info)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
nir_variable *barycentrics =
|
||||
nir_variable_create(b->shader, nir_var_ray_hit_attrib, glsl_vector_type(GLSL_TYPE_FLOAT, 2), "barycentrics");
|
||||
barycentrics->data.driver_location = 0;
|
||||
@@ -1602,7 +1603,7 @@ radv_build_traversal(struct radv_device *device, struct radv_ray_tracing_pipelin
|
||||
.tmin = nir_load_var(b, vars->tmin),
|
||||
.dir = nir_load_var(b, vars->direction),
|
||||
.vars = trav_vars_args,
|
||||
.stack_stride = device->physical_device->rt_wave_size * sizeof(uint32_t),
|
||||
.stack_stride = pdev->rt_wave_size * sizeof(uint32_t),
|
||||
.stack_entries = MAX_STACK_ENTRY_COUNT,
|
||||
.stack_base = 0,
|
||||
.ignore_cull_mask = ignore_cull_mask,
|
||||
@@ -1638,7 +1639,7 @@ radv_build_traversal(struct radv_device *device, struct radv_ray_tracing_pipelin
|
||||
hit_attribs[i] =
|
||||
nir_local_variable_create(nir_shader_get_entrypoint(b->shader), glsl_uint_type(), "ahit_attrib");
|
||||
|
||||
lower_hit_attribs(b->shader, hit_attribs, device->physical_device->rt_wave_size);
|
||||
lower_hit_attribs(b->shader, hit_attribs, pdev->rt_wave_size);
|
||||
}
|
||||
|
||||
/* Initialize follow-up shader. */
|
||||
@@ -1702,6 +1703,7 @@ radv_build_traversal_shader(struct radv_device *device, struct radv_ray_tracing_
|
||||
const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
|
||||
struct radv_ray_tracing_stage_info *info)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const VkPipelineCreateFlagBits2KHR create_flags = vk_rt_pipeline_create_flags(pCreateInfo);
|
||||
|
||||
/* Create the traversal shader as an intersection shader to prevent validation failures due to
|
||||
@@ -1709,8 +1711,8 @@ radv_build_traversal_shader(struct radv_device *device, struct radv_ray_tracing_
|
||||
nir_builder b = radv_meta_init_shader(device, MESA_SHADER_INTERSECTION, "rt_traversal");
|
||||
b.shader->info.internal = false;
|
||||
b.shader->info.workgroup_size[0] = 8;
|
||||
b.shader->info.workgroup_size[1] = device->physical_device->rt_wave_size == 64 ? 8 : 4;
|
||||
b.shader->info.shared_size = device->physical_device->rt_wave_size * MAX_STACK_ENTRY_COUNT * sizeof(uint32_t);
|
||||
b.shader->info.workgroup_size[1] = pdev->rt_wave_size == 64 ? 8 : 4;
|
||||
b.shader->info.shared_size = pdev->rt_wave_size * MAX_STACK_ENTRY_COUNT * sizeof(uint32_t);
|
||||
struct rt_variables vars = create_rt_variables(b.shader, device, create_flags, false);
|
||||
|
||||
if (info->tmin.state == RADV_RT_CONST_ARG_STATE_VALID)
|
||||
@@ -1773,6 +1775,7 @@ lower_rt_instruction_monolithic(nir_builder *b, nir_instr *instr, void *data)
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
|
||||
struct lower_rt_instruction_monolithic_state *state = data;
|
||||
const struct radv_physical_device *pdev = radv_device_physical(state->device);
|
||||
struct rt_variables *vars = state->vars;
|
||||
|
||||
switch (intr->intrinsic) {
|
||||
@@ -1800,8 +1803,8 @@ lower_rt_instruction_monolithic(nir_builder *b, nir_instr *instr, void *data)
|
||||
nir_store_var(b, vars->stack_ptr, nir_iadd_imm(b, stack_ptr, b->shader->scratch_size), 0x1);
|
||||
|
||||
radv_build_traversal(state->device, state->pipeline, state->pCreateInfo, true, b, vars, ignore_cull_mask, NULL);
|
||||
b->shader->info.shared_size = MAX2(b->shader->info.shared_size, state->device->physical_device->rt_wave_size *
|
||||
MAX_STACK_ENTRY_COUNT * sizeof(uint32_t));
|
||||
b->shader->info.shared_size =
|
||||
MAX2(b->shader->info.shared_size, pdev->rt_wave_size * MAX_STACK_ENTRY_COUNT * sizeof(uint32_t));
|
||||
|
||||
nir_store_var(b, vars->stack_ptr, stack_ptr, 0x1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user