radv: add a helper to know whether compute queue is enabled

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34144>
This commit is contained in:
Samuel Pitoiset 2025-03-18 12:30:38 +01:00 committed by Marge Bot
parent c39c304e32
commit b1818a3ca9
3 changed files with 17 additions and 9 deletions

View file

@ -69,8 +69,8 @@ radv_taskmesh_enabled(const struct radv_physical_device *pdev)
if (instance->debug_flags & RADV_DEBUG_NO_MESH_SHADER)
return false;
return pdev->use_ngg && !pdev->use_llvm && pdev->info.gfx_level >= GFX10_3 &&
!(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE) && pdev->info.has_gang_submit;
return pdev->use_ngg && !pdev->use_llvm && pdev->info.gfx_level >= GFX10_3 && radv_compute_queue_enabled(pdev) &&
pdev->info.has_gang_submit;
}
static bool
@ -86,6 +86,14 @@ radv_transfer_queue_enabled(const struct radv_physical_device *pdev)
return pdev->info.gfx_level >= GFX9;
}
bool
radv_compute_queue_enabled(const struct radv_physical_device *pdev)
{
const struct radv_instance *instance = radv_physical_device_instance(pdev);
return pdev->info.ip[AMD_IP_COMPUTE].num_queues > 0 && !(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE);
}
static bool
radv_vrs_attachment_enabled(const struct radv_physical_device *pdev)
{
@ -224,7 +232,6 @@ radv_get_device_uuid(const struct radeon_info *gpu_info, void *uuid)
static void
radv_physical_device_init_queue_table(struct radv_physical_device *pdev)
{
const struct radv_instance *instance = radv_physical_device_instance(pdev);
int idx = 0;
pdev->vk_queue_to_radv[idx] = RADV_QUEUE_GENERAL;
idx++;
@ -232,7 +239,7 @@ radv_physical_device_init_queue_table(struct radv_physical_device *pdev)
for (unsigned i = 1; i < RADV_MAX_QUEUE_FAMILIES; i++)
pdev->vk_queue_to_radv[i] = RADV_MAX_QUEUE_FAMILIES + 1;
if (pdev->info.ip[AMD_IP_COMPUTE].num_queues > 0 && !(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE)) {
if (radv_compute_queue_enabled(pdev)) {
pdev->vk_queue_to_radv[idx] = RADV_QUEUE_COMPUTE;
idx++;
}
@ -2352,10 +2359,10 @@ static void
radv_get_physical_device_queue_family_properties(struct radv_physical_device *pdev, uint32_t *pCount,
VkQueueFamilyProperties **pQueueFamilyProperties)
{
const struct radv_instance *instance = radv_physical_device_instance(pdev);
int num_queue_families = 1;
int idx;
if (pdev->info.ip[AMD_IP_COMPUTE].num_queues > 0 && !(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE))
if (radv_compute_queue_enabled(pdev))
num_queue_families++;
if (pdev->video_decode_enabled) {
@ -2397,7 +2404,7 @@ radv_get_physical_device_queue_family_properties(struct radv_physical_device *pd
idx++;
}
if (pdev->info.ip[AMD_IP_COMPUTE].num_queues > 0 && !(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE)) {
if (radv_compute_queue_enabled(pdev)) {
VkQueueFlags compute_flags = VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT | VK_QUEUE_SPARSE_BINDING_BIT;
if (*pCount > idx) {
*pQueueFamilyProperties[idx] = (VkQueueFamilyProperties){

View file

@ -266,4 +266,6 @@ VkResult create_drm_physical_device(struct vk_instance *vk_instance, struct _drm
void radv_physical_device_destroy(struct vk_physical_device *vk_pdev);
bool radv_compute_queue_enabled(const struct radv_physical_device *pdev);
#endif /* RADV_PHYSICAL_DEVICE_H */

View file

@ -264,7 +264,6 @@ static bool
radv_sqtt_init_queue_event(struct radv_device *device)
{
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
VkCommandPool cmd_pool;
VkResult result;
@ -279,7 +278,7 @@ radv_sqtt_init_queue_event(struct radv_device *device)
device->sqtt_command_pool[0] = vk_command_pool_from_handle(cmd_pool);
if (!(instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE)) {
if (radv_compute_queue_enabled(pdev)) {
const VkCommandPoolCreateInfo create_comp_info = {
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
.queueFamilyIndex = RADV_QUEUE_COMPUTE,