radv: add a flag to indicate ray tracing support

Determine whether the device has hardware raytracing support early, and
then use this result where needed, instead of checking for `gfx_level`
every time.

This is a prerequisite for CYAN_SKILLFISH chip enablement. This chip is
still GFX10, not GFX10_3, but has hardware support for accelerated
`image_bvh{,64}_intersect_ray` instructions. Just checking for `gfx_level`
is insufficient for it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33109>
This commit is contained in:
Ivan Avdeev 2024-12-29 21:37:51 -05:00 committed by Marge Bot
parent cc7be2b2b3
commit 14e3231b56
4 changed files with 9 additions and 2 deletions

View file

@ -1691,6 +1691,8 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
info->has_set_sh_pairs_packed = info->register_shadowing_required;
}
info->has_image_bvh_intersect_ray = info->gfx_level >= GFX10_3;
set_custom_cu_en_mask(info);
const char *ib_filename = debug_get_option("AMD_PARSE_IB", NULL);

View file

@ -315,6 +315,11 @@ struct radeon_info {
uint32_t csa_alignment;
} fw_based_mcbp;
bool has_fw_based_shadowing;
/* Device supports hardware-accelerated raytracing using
* image_bvh*_intersect_ray instructions
*/
bool has_image_bvh_intersect_ray;
};
bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,

View file

@ -575,7 +575,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 (pdev->info.gfx_level >= GFX10_3 && !radv_emulate_rt(pdev)) {
if (pdev->info.has_image_bvh_intersect_ray && !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),

View file

@ -111,7 +111,7 @@ radv_filter_minmax_enabled(const struct radv_physical_device *pdev)
bool
radv_enable_rt(const struct radv_physical_device *pdev)
{
if (pdev->info.gfx_level < GFX10_3 && !radv_emulate_rt(pdev))
if (!pdev->info.has_image_bvh_intersect_ray && !radv_emulate_rt(pdev))
return false;
if (pdev->use_llvm)