From 1f490c836b64817ac6aa7c411da65031ee6a698b Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 5 Aug 2025 16:16:51 +0200 Subject: [PATCH] ac/gpu_info,radv: use the maximum virtual address from the kernel Instead of hardcoding it. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/common/ac_gpu_info.c | 3 +++ src/amd/common/ac_gpu_info.h | 1 + src/amd/vulkan/radv_physical_device.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c index 9f956ffb1cb..cb12dd0015b 100644 --- a/src/amd/common/ac_gpu_info.c +++ b/src/amd/common/ac_gpu_info.c @@ -703,6 +703,8 @@ ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info, /* Add some margin of error, though this shouldn't be needed in theory. */ info->all_vram_visible = info->vram_size_kb * 0.9 < info->vram_vis_size_kb; + info->virtual_address_max = device_info.virtual_address_max; + /* Set chip identification. */ info->pci_id = device_info.device_id; info->pci_rev_id = device_info.pci_rev; @@ -1990,6 +1992,7 @@ void ac_print_gpu_info(const struct radeon_info *info, FILE *f) fprintf(f, " address32_hi = 0x%x\n", info->address32_hi); fprintf(f, " has_dedicated_vram = %u\n", info->has_dedicated_vram); fprintf(f, " all_vram_visible = %u\n", info->all_vram_visible); + fprintf(f, " virtual_address_max = %" PRIx64 "\n", info->virtual_address_max); fprintf(f, " max_tcc_blocks = %i\n", info->max_tcc_blocks); fprintf(f, " tcc_cache_line_size = %u\n", info->tcc_cache_line_size); fprintf(f, " tcc_rb_non_coherent = %u\n", info->tcc_rb_non_coherent); diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h index d3067cce550..4d1eef7e845 100644 --- a/src/amd/common/ac_gpu_info.h +++ b/src/amd/common/ac_gpu_info.h @@ -180,6 +180,7 @@ struct radeon_info { uint32_t address32_hi; bool has_dedicated_vram; bool all_vram_visible; + uint64_t virtual_address_max; bool has_l2_uncached; bool r600_has_virtual_memory; uint32_t max_tcc_blocks; diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 7e9a7cb1bc1..514ba4f3d74 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -1492,7 +1492,7 @@ radv_get_physical_device_properties(struct radv_physical_device *pdev) .maxMemoryAllocationCount = UINT32_MAX, .maxSamplerAllocationCount = 64 * 1024, .bufferImageGranularity = 1, - .sparseAddressSpaceSize = (1ull << (pdev->info.gfx_level >= GFX9 ? 48 : 40)), + .sparseAddressSpaceSize = pdev->info.virtual_address_max, .maxBoundDescriptorSets = MAX_SETS, .maxPerStageDescriptorSamplers = max_descriptor_set_size, .maxPerStageDescriptorUniformBuffers = max_descriptor_set_size,