mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 14:50:10 +01:00
radv: add a helper to know if device fault detection is enabled
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27293>
This commit is contained in:
parent
f9c4e25483
commit
7a20946579
7 changed files with 29 additions and 21 deletions
|
|
@ -336,7 +336,7 @@ radv_update_buffer_cp(struct radv_cmd_buffer *cmd_buffer, uint64_t va, const voi
|
|||
radeon_emit(cmd_buffer->cs, va >> 32);
|
||||
radeon_emit_array(cmd_buffer->cs, data, words);
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_cmd_buffer_trace_emit(cmd_buffer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@ radv_cmd_buffer_after_draw(struct radv_cmd_buffer *cmd_buffer, enum radv_cmd_flu
|
|||
}
|
||||
}
|
||||
|
||||
if (unlikely(device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(device))
|
||||
radv_cmd_buffer_trace_emit(cmd_buffer);
|
||||
}
|
||||
|
||||
|
|
@ -2004,7 +2004,7 @@ radv_emit_graphics_pipeline(struct radv_cmd_buffer *cmd_buffer)
|
|||
}
|
||||
}
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_save_pipeline(cmd_buffer, &pipeline->base);
|
||||
|
||||
cmd_buffer->state.emitted_graphics_pipeline = pipeline;
|
||||
|
|
@ -4014,7 +4014,7 @@ radv_emit_vertex_input(struct radv_cmd_buffer *cmd_buffer)
|
|||
|
||||
cmd_buffer->state.emitted_vs_prolog = prolog;
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_save_vs_prolog(cmd_buffer, prolog);
|
||||
}
|
||||
|
||||
|
|
@ -4623,7 +4623,7 @@ radv_flush_descriptors(struct radv_cmd_buffer *cmd_buffer, VkShaderStageFlags st
|
|||
|
||||
assert(cmd_buffer->cs->cdw <= cdw_max);
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_save_descriptors(cmd_buffer, bind_point);
|
||||
}
|
||||
|
||||
|
|
@ -4965,7 +4965,7 @@ radv_flush_vertex_descriptors(struct radv_cmd_buffer *cmd_buffer)
|
|||
cmd_buffer->state.vb_size = vb_desc_alloc_size;
|
||||
cmd_buffer->state.prefetch_L2_mask |= RADV_PREFETCH_VBO_DESCRIPTORS;
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_save_vertex_descriptors(cmd_buffer, (uintptr_t)vb_ptr);
|
||||
|
||||
cmd_buffer->state.dirty &= ~RADV_CMD_DIRTY_VERTEX_BUFFER;
|
||||
|
|
@ -5843,7 +5843,7 @@ radv_BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBegi
|
|||
cmd_buffer->state.dirty |= RADV_CMD_DIRTY_OCCLUSION_QUERY;
|
||||
}
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_cmd_buffer_trace_emit(cmd_buffer);
|
||||
|
||||
radv_describe_begin_cmd_buffer(cmd_buffer);
|
||||
|
|
@ -6299,7 +6299,7 @@ radv_emit_compute_pipeline(struct radv_cmd_buffer *cmd_buffer, struct radv_compu
|
|||
}
|
||||
}
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_save_pipeline(cmd_buffer, &pipeline->base);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,12 @@ radv_spm_trace_enabled(struct radv_instance *instance)
|
|||
debug_get_bool_option("RADV_THREAD_TRACE_CACHE_COUNTERS", true);
|
||||
}
|
||||
|
||||
bool
|
||||
radv_device_fault_detection_enabled(const struct radv_device *device)
|
||||
{
|
||||
return device->instance->debug_flags & RADV_DEBUG_HANG;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_GetMemoryHostPointerPropertiesEXT(VkDevice _device, VkExternalMemoryHandleTypeFlagBits handleType,
|
||||
const void *pHostPointer,
|
||||
|
|
@ -873,7 +879,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
|
|||
*/
|
||||
device->dispatch_initiator_task = device->dispatch_initiator | S_00B800_DISABLE_DISP_PREMPT_EN(1);
|
||||
|
||||
if (device->instance->debug_flags & RADV_DEBUG_HANG) {
|
||||
if (radv_device_fault_detection_enabled(device)) {
|
||||
/* Enable GPU hangs detection and dump logs if a GPU hang is
|
||||
* detected.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3609,6 +3609,8 @@ radv_uses_image_float32_atomics(const struct radv_device *device)
|
|||
device->vk.enabled_features.sparseImageFloat32AtomicMinMax;
|
||||
}
|
||||
|
||||
bool radv_device_fault_detection_enabled(const struct radv_device *device);
|
||||
|
||||
#define RADV_FROM_HANDLE(__radv_type, __name, __handle) VK_FROM_HANDLE(__radv_type, __name, __handle)
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(radv_cmd_buffer, vk.base, VkCommandBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER)
|
||||
|
|
|
|||
|
|
@ -1510,14 +1510,14 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
|
|||
}
|
||||
|
||||
const unsigned cmd_buffer_count = submission->command_buffer_count;
|
||||
const unsigned max_cs_submission = queue->device->trace_bo ? 1 : cmd_buffer_count;
|
||||
const unsigned max_cs_submission = radv_device_fault_detection_enabled(queue->device) ? 1 : cmd_buffer_count;
|
||||
const unsigned cs_array_size = (use_ace ? 2 : 1) * MIN2(max_cs_submission, cmd_buffer_count);
|
||||
|
||||
struct radeon_cmdbuf **cs_array = malloc(sizeof(struct radeon_cmdbuf *) * cs_array_size);
|
||||
if (!cs_array)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
if (queue->device->trace_bo)
|
||||
if (radv_device_fault_detection_enabled(queue->device))
|
||||
simple_mtx_lock(&queue->device->trace_mtx);
|
||||
|
||||
for (uint32_t j = 0; j < submission->command_buffer_count; j++) {
|
||||
|
|
@ -1616,7 +1616,7 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
|
|||
bool submit_ace = false;
|
||||
unsigned num_submitted_cs = 0;
|
||||
|
||||
if (queue->device->trace_bo)
|
||||
if (radv_device_fault_detection_enabled(queue->device))
|
||||
*queue->device->trace_id_ptr = 0;
|
||||
|
||||
struct radeon_cmdbuf *chainable = NULL;
|
||||
|
|
@ -1665,7 +1665,7 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
|
|||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
if (queue->device->trace_bo) {
|
||||
if (radv_device_fault_detection_enabled(queue->device)) {
|
||||
radv_check_gpu_hangs(queue, &submit);
|
||||
}
|
||||
|
||||
|
|
@ -1685,7 +1685,7 @@ fail:
|
|||
free(cs_array);
|
||||
if (waits != submission->waits)
|
||||
free(waits);
|
||||
if (queue->device->trace_bo)
|
||||
if (radv_device_fault_detection_enabled(queue->device))
|
||||
simple_mtx_unlock(&queue->device->trace_mtx);
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -2563,7 +2563,7 @@ radv_create_rt_prolog(struct radv_device *device)
|
|||
struct radv_nir_compiler_options options = {0};
|
||||
radv_fill_nir_compiler_options(&options, device, NULL, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_DUMP_PROLOGS, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_HANG, false);
|
||||
radv_device_fault_detection_enabled(device), false);
|
||||
struct radv_shader_info info = {0};
|
||||
info.stage = MESA_SHADER_COMPUTE;
|
||||
info.loads_push_constants = true;
|
||||
|
|
@ -2628,7 +2628,7 @@ radv_create_vs_prolog(struct radv_device *device, const struct radv_vs_prolog_ke
|
|||
struct radv_nir_compiler_options options = {0};
|
||||
radv_fill_nir_compiler_options(&options, device, NULL, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_DUMP_PROLOGS, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_HANG, false);
|
||||
radv_device_fault_detection_enabled(device), false);
|
||||
|
||||
struct radv_shader_info info = {0};
|
||||
info.stage = MESA_SHADER_VERTEX;
|
||||
|
|
@ -2695,7 +2695,7 @@ radv_create_ps_epilog(struct radv_device *device, const struct radv_ps_epilog_ke
|
|||
struct radv_nir_compiler_options options = {0};
|
||||
radv_fill_nir_compiler_options(&options, device, NULL, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_DUMP_EPILOGS, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_HANG, false);
|
||||
radv_device_fault_detection_enabled(device), false);
|
||||
|
||||
struct radv_shader_info info = {0};
|
||||
info.stage = MESA_SHADER_FRAGMENT;
|
||||
|
|
@ -2754,7 +2754,7 @@ radv_create_tcs_epilog(struct radv_device *device, const struct radv_tcs_epilog_
|
|||
struct radv_nir_compiler_options options = {0};
|
||||
radv_fill_nir_compiler_options(&options, device, NULL, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_DUMP_EPILOGS, false,
|
||||
device->instance->debug_flags & RADV_DEBUG_HANG, false);
|
||||
radv_device_fault_detection_enabled(device), false);
|
||||
|
||||
struct radv_shader_info info = {0};
|
||||
info.stage = MESA_SHADER_TESS_CTRL;
|
||||
|
|
|
|||
|
|
@ -1507,7 +1507,7 @@ radv_emit_cache_flush(struct radv_cmd_buffer *cmd_buffer)
|
|||
&cmd_buffer->gfx9_fence_idx, cmd_buffer->gfx9_fence_va, radv_cmd_buffer_uses_mec(cmd_buffer),
|
||||
cmd_buffer->state.flush_bits, &cmd_buffer->state.sqtt_flush_bits, cmd_buffer->gfx9_eop_bug_va);
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_cmd_buffer_trace_emit(cmd_buffer);
|
||||
|
||||
if (cmd_buffer->state.flush_bits & RADV_CMD_FLAG_INV_L2)
|
||||
|
|
@ -1665,7 +1665,7 @@ radv_emit_cp_dma(struct radv_cmd_buffer *cmd_buffer, uint64_t dst_va, uint64_t s
|
|||
cmd_buffer->state.dma_is_busy = false;
|
||||
}
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_cmd_buffer_trace_emit(cmd_buffer);
|
||||
}
|
||||
|
||||
|
|
@ -1711,7 +1711,7 @@ radv_cp_dma_prefetch(struct radv_cmd_buffer *cmd_buffer, uint64_t va, unsigned s
|
|||
{
|
||||
radv_cs_cp_dma_prefetch(cmd_buffer->device, cmd_buffer->cs, va, size, cmd_buffer->state.predicating);
|
||||
|
||||
if (unlikely(cmd_buffer->device->trace_bo))
|
||||
if (radv_device_fault_detection_enabled(cmd_buffer->device))
|
||||
radv_cmd_buffer_trace_emit(cmd_buffer);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue