anv: Advertise ray-tracing on DG2

Also disable ray-tracing support if with_intel_vk_rt is not set.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16970>
This commit is contained in:
Jason Ekstrand 2020-05-13 15:45:06 -05:00 committed by Marge Bot
parent 9c6ed40925
commit 4c0dbe6420
5 changed files with 61 additions and 18 deletions

View file

@ -192,6 +192,8 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_8bit_storage = true,
.KHR_16bit_storage = true,
.KHR_acceleration_structure = device->info.has_ray_tracing,
.KHR_acceleration_structure = ANV_SUPPORT_RT &&
device->info.has_ray_tracing,
.KHR_bind_memory2 = true,
.KHR_buffer_device_address = true,
.KHR_copy_commands2 = true,
@ -231,7 +233,10 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_pipeline_executable_properties = true,
.KHR_pipeline_library = true,
.KHR_push_descriptor = true,
.KHR_ray_query = device->info.has_ray_tracing,
.KHR_ray_query =
ANV_SUPPORT_RT && device->info.has_ray_tracing,
.KHR_ray_tracing_pipeline =
ANV_SUPPORT_RT && device->info.has_ray_tracing,
.KHR_relaxed_block_layout = true,
.KHR_sampler_mirror_clamp_to_edge = true,
.KHR_sampler_ycbcr_conversion = true,
@ -1344,12 +1349,13 @@ void anv_GetPhysicalDeviceFeatures2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR: {
VkPhysicalDeviceAccelerationStructureFeaturesKHR *features = (void *)ext;
features->accelerationStructure = pdevice->info.has_ray_tracing;
features->accelerationStructure =
ANV_SUPPORT_RT && pdevice->info.has_ray_tracing;
features->accelerationStructureCaptureReplay = false; /* TODO */
features->accelerationStructureIndirectBuild = false; /* TODO */
features->accelerationStructureHostCommands = false;
features->descriptorBindingAccelerationStructureUpdateAfterBind =
pdevice->info.has_ray_tracing;
ANV_SUPPORT_RT && pdevice->info.has_ray_tracing;
break;
}
@ -1549,7 +1555,17 @@ void anv_GetPhysicalDeviceFeatures2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR: {
VkPhysicalDeviceRayQueryFeaturesKHR *features = (void *)ext;
features->rayQuery = pdevice->info.has_ray_tracing;
features->rayQuery = ANV_SUPPORT_RT && pdevice->info.has_ray_tracing;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: {
VkPhysicalDeviceRayTracingPipelineFeaturesKHR *features = (void *)ext;
features->rayTracingPipeline = pdevice->info.has_ray_tracing;
features->rayTracingPipelineShaderGroupHandleCaptureReplay = false;
features->rayTracingPipelineShaderGroupHandleCaptureReplayMixed = false;
features->rayTracingPipelineTraceRaysIndirect = true;
features->rayTraversalPrimitiveCulling = false;
break;
}
@ -2559,6 +2575,22 @@ void anv_GetPhysicalDeviceProperties2(
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR: {
VkPhysicalDeviceRayTracingPipelinePropertiesKHR *props = (void *)ext;
/* TODO */
props->shaderGroupHandleSize = 32;
props->maxRayRecursionDepth = 31;
/* MemRay::hitGroupSRStride is 16 bits */
props->maxShaderGroupStride = UINT16_MAX;
/* MemRay::hitGroupSRBasePtr requires 16B alignment */
props->shaderGroupBaseAlignment = 16;
props->shaderGroupHandleAlignment = 16;
props->shaderGroupHandleCaptureReplaySize = 32;
props->maxRayDispatchInvocationCount = 1U << 30; /* required min limit */
props->maxRayHitAttributeSize = BRW_RT_SIZEOF_HIT_ATTRIB_DATA;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT: {
VkPhysicalDeviceRobustness2PropertiesEXT *properties = (void *)ext;
properties->robustStorageBufferAccessSizeAlignment =
@ -3461,7 +3493,7 @@ VkResult anv_CreateDevice(
/* TODO(RT): Do we want some sort of data structure for this? */
memset(device->rt_scratch_bos, 0, sizeof(device->rt_scratch_bos));
if (device->info->has_ray_tracing) {
if (ANV_SUPPORT_RT && device->info->has_ray_tracing) {
/* The docs say to always allocate 128KB per DSS */
const uint32_t btd_fifo_bo_size =
128 * 1024 * intel_device_info_dual_subslice_id_bound(device->info);
@ -3523,7 +3555,7 @@ VkResult anv_CreateDevice(
fail_default_pipeline_cache:
vk_pipeline_cache_destroy(device->default_pipeline_cache, NULL);
fail_btd_fifo_bo:
if (device->info->has_ray_tracing)
if (ANV_SUPPORT_RT && device->info->has_ray_tracing)
anv_device_release_bo(device, device->btd_fifo_bo);
fail_trivial_batch_bo_and_scratch_pool:
anv_scratch_pool_finish(device, &device->scratch_pool);
@ -3595,7 +3627,7 @@ void anv_DestroyDevice(
vk_pipeline_cache_destroy(device->internal_cache, NULL);
vk_pipeline_cache_destroy(device->default_pipeline_cache, NULL);
if (device->info->has_ray_tracing)
if (ANV_SUPPORT_RT && device->info->has_ray_tracing)
anv_device_release_bo(device, device->btd_fifo_bo);
#ifdef HAVE_VALGRIND

View file

@ -227,8 +227,8 @@ anv_shader_stage_to_nir(struct anv_device *device,
.post_depth_coverage = true,
.runtime_descriptor_array = true,
.float_controls = true,
.ray_query = pdevice->info.has_ray_tracing,
.ray_tracing = pdevice->info.has_ray_tracing,
.ray_query = ANV_SUPPORT_RT && pdevice->info.has_ray_tracing,
.ray_tracing = ANV_SUPPORT_RT && pdevice->info.has_ray_tracing,
.shader_clock = true,
.shader_viewport_index_layer = true,
.stencil_export = true,

View file

@ -1510,7 +1510,7 @@ void genX(CmdCopyQueryPoolResults)(
}
}
#if GFX_VERx10 >= 125
#if GFX_VERx10 >= 125 && ANV_SUPPORT_RT
#include "grl/include/GRLRTASCommon.h"
#include "grl/grl_metakernel_postbuild_info.h"

View file

@ -37,7 +37,7 @@
#include "vk_standard_sample_locations.h"
#if GFX_VERx10 >= 125
#if GFX_VERx10 >= 125 && ANV_SUPPORT_RT
#include "grl/genX_grl.h"
#endif
@ -235,7 +235,7 @@ init_common_queue_state(struct anv_queue *queue, struct anv_batch *batch)
#endif
#if GFX_VERx10 >= 125
if (device->info->has_ray_tracing) {
if (ANV_SUPPORT_RT && device->info->has_ray_tracing) {
anv_batch_emit(batch, GENX(3DSTATE_BTD), btd) {
/* TODO: This is the timeout after which the bucketed thread
* dispatcher will kick off a wave of threads. We go with the
@ -471,7 +471,7 @@ void
genX(init_physical_device_state)(ASSERTED struct anv_physical_device *pdevice)
{
assert(pdevice->info.verx10 == GFX_VERx10);
#if GFX_VERx10 >= 125
#if GFX_VERx10 >= 125 && ANV_SUPPORT_RT
genX(grl_load_rt_uuid)(pdevice->rt_uuid);
#endif
}

View file

@ -27,7 +27,15 @@ anv_flags = [
anv_cpp_flags = []
subdir('grl')
if with_intel_vk_rt
subdir('grl')
optional_libgrl = [libgrl]
anv_flags += '-DANV_SUPPORT_RT=1'
else
idep_grl = null_dep
optional_libgrl = []
anv_flags += '-DANV_SUPPORT_RT=0'
endif
anv_entrypoints = custom_target(
'anv_entrypoints',
@ -80,7 +88,6 @@ endif
libanv_per_hw_ver_libs = []
anv_per_hw_ver_files = files(
'genX_acceleration_structure.c',
'genX_blorp_exec.c',
'genX_cmd_buffer.c',
'genX_gpu_memcpy.c',
@ -88,6 +95,10 @@ anv_per_hw_ver_files = files(
'genX_query.c',
'genX_state.c',
)
if with_intel_vk_rt
anv_per_hw_ver_files += files('genX_acceleration_structure.c',)
endif
foreach g : [['90', ['gfx8_cmd_buffer.c']],
['110', ['gfx8_cmd_buffer.c']],
['120', ['gfx8_cmd_buffer.c']],
@ -193,7 +204,7 @@ libvulkan_intel = shared_library(
include_directories : [
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel, inc_compiler,
],
link_whole : [libanv_common, libanv_per_hw_ver_libs, libgrl],
link_whole : [libanv_common, libanv_per_hw_ver_libs] + optional_libgrl,
link_with : [
libintel_compiler, libintel_dev, libisl, libblorp, libintel_perf,
],
@ -231,9 +242,9 @@ if with_tests
],
link_whole : libanv_common,
link_with : [
libanv_per_hw_ver_libs, libgrl, libintel_compiler, libintel_common, libintel_dev,
libanv_per_hw_ver_libs, libintel_compiler, libintel_common, libintel_dev,
libisl, libblorp, libintel_perf,
],
] + optional_libgrl,
dependencies : [
dep_thread, dep_dl, dep_m, anv_deps,
idep_nir, idep_vulkan_util, idep_vulkan_wsi, idep_vulkan_runtime,