radv: add helpers for capturing shaders and statistics
Instead of duplicating the logic everywhere. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20990>
This commit is contained in:

committed by
Marge Bot

parent
e1bc8b0b21
commit
d1b36b01a2
@@ -3384,6 +3384,21 @@ radv_pipeline_create_ps_epilog(struct radv_graphics_pipeline *pipeline,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
radv_pipeline_capture_shaders(const struct radv_device *device, VkPipelineCreateFlags flags)
|
||||||
|
{
|
||||||
|
return (flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) ||
|
||||||
|
device->keep_shader_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
radv_pipeline_capture_shader_stats(const struct radv_device *device, VkPipelineCreateFlags flags)
|
||||||
|
{
|
||||||
|
return (flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) ||
|
||||||
|
(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) ||
|
||||||
|
device->keep_shader_info;
|
||||||
|
}
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
radv_graphics_pipeline_compile(struct radv_pipeline *pipeline,
|
radv_graphics_pipeline_compile(struct radv_pipeline *pipeline,
|
||||||
struct radv_pipeline_layout *pipeline_layout,
|
struct radv_pipeline_layout *pipeline_layout,
|
||||||
@@ -3400,12 +3415,8 @@ radv_graphics_pipeline_compile(struct radv_pipeline *pipeline,
|
|||||||
struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL};
|
struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL};
|
||||||
struct radv_shader_binary *gs_copy_binary = NULL;
|
struct radv_shader_binary *gs_copy_binary = NULL;
|
||||||
unsigned char hash[20];
|
unsigned char hash[20];
|
||||||
bool keep_executable_info =
|
bool keep_executable_info = radv_pipeline_capture_shaders(pipeline->device, flags);
|
||||||
(flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) ||
|
bool keep_statistic_info = radv_pipeline_capture_shader_stats(pipeline->device, flags);
|
||||||
device->keep_shader_info;
|
|
||||||
bool keep_statistic_info = (flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) ||
|
|
||||||
(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) ||
|
|
||||||
device->keep_shader_info;
|
|
||||||
struct radv_pipeline_stage stages[MESA_VULKAN_SHADER_STAGES] = {0};
|
struct radv_pipeline_stage stages[MESA_VULKAN_SHADER_STAGES] = {0};
|
||||||
VkPipelineCreationFeedback pipeline_feedback = {
|
VkPipelineCreationFeedback pipeline_feedback = {
|
||||||
.flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT,
|
.flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT,
|
||||||
@@ -5372,12 +5383,8 @@ radv_compute_pipeline_compile(struct radv_pipeline *pipeline,
|
|||||||
{
|
{
|
||||||
struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL};
|
struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL};
|
||||||
unsigned char hash[20];
|
unsigned char hash[20];
|
||||||
bool keep_executable_info =
|
bool keep_executable_info = radv_pipeline_capture_shaders(pipeline->device, flags);
|
||||||
(flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) ||
|
bool keep_statistic_info = radv_pipeline_capture_shader_stats(pipeline->device, flags);
|
||||||
device->keep_shader_info;
|
|
||||||
bool keep_statistic_info = (flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) ||
|
|
||||||
(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) ||
|
|
||||||
device->keep_shader_info;
|
|
||||||
struct radv_pipeline_stage cs_stage = {0};
|
struct radv_pipeline_stage cs_stage = {0};
|
||||||
VkPipelineCreationFeedback pipeline_feedback = {
|
VkPipelineCreationFeedback pipeline_feedback = {
|
||||||
.flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT,
|
.flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT,
|
||||||
|
@@ -258,9 +258,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache,
|
|||||||
struct radv_ray_tracing_pipeline *rt_pipeline = NULL;
|
struct radv_ray_tracing_pipeline *rt_pipeline = NULL;
|
||||||
uint8_t hash[20];
|
uint8_t hash[20];
|
||||||
nir_shader *shader = NULL;
|
nir_shader *shader = NULL;
|
||||||
bool keep_statistic_info =
|
bool keep_statistic_info = radv_pipeline_capture_shader_stats(device, pCreateInfo->flags);
|
||||||
(pCreateInfo->flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) ||
|
|
||||||
(device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) || device->keep_shader_info;
|
|
||||||
|
|
||||||
if (pCreateInfo->flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR)
|
if (pCreateInfo->flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR)
|
||||||
return radv_rt_pipeline_library_create(_device, _cache, pCreateInfo, pAllocator, pPipeline);
|
return radv_rt_pipeline_library_create(_device, _cache, pCreateInfo, pAllocator, pPipeline);
|
||||||
|
@@ -2270,6 +2270,9 @@ VkResult radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
|
|||||||
const VkAllocationCallbacks *pAllocator,
|
const VkAllocationCallbacks *pAllocator,
|
||||||
VkPipeline *pPipeline, bool is_internal);
|
VkPipeline *pPipeline, bool is_internal);
|
||||||
|
|
||||||
|
bool radv_pipeline_capture_shader_stats(const struct radv_device *device,
|
||||||
|
VkPipelineCreateFlags flags);
|
||||||
|
|
||||||
void radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline,
|
void radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline,
|
||||||
const VkAllocationCallbacks *allocator);
|
const VkAllocationCallbacks *allocator);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user