[Mesa-dev] [PATCH 3/3] radv: Incorporate GPU family into cache UUID.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Nov 22 11:15:59 UTC 2016


The cache is actually stored by the application, and the UUID of the
cache is application visible, so it should be able to store multiple
caches. We might want to use different files for the driver cache of
builtin shaders though.

And as I'm writing this, I realized that PCI vendor and device are
also stored in the cache header, so this patch is probably redundant
...

- Bas

On Tue, Nov 22, 2016 at 9:49 AM, Mike Lothian <mike at fireburn.co.uk> wrote:
> Would it be possible to have a cache for each family? I imagine this might
> cause issues when someone has multiple cards in their system
>
> On Tue, 22 Nov 2016 at 01:20 Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> wrote:
>>
>> Invalidates the cache when someone switches cards.
>>
>> Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
>> ---
>>  src/amd/vulkan/radv_device.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
>> index 04c0bdc..8595973 100644
>> --- a/src/amd/vulkan/radv_device.c
>> +++ b/src/amd/vulkan/radv_device.c
>> @@ -61,9 +61,10 @@ radv_get_function_timestamp(void *ptr, uint32_t*
>> timestamp)
>>  }
>>
>>  static int
>> -radv_device_get_cache_uuid(void *uuid)
>> +radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
>>  {
>>         uint32_t mesa_timestamp, llvm_timestamp;
>> +       uint16_t f = family;
>>         memset(uuid, 0, VK_UUID_SIZE);
>>         if (radv_get_function_timestamp(radv_device_get_cache_uuid,
>> &mesa_timestamp) ||
>>             radv_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo,
>> &llvm_timestamp))
>> @@ -71,7 +72,8 @@ radv_device_get_cache_uuid(void *uuid)
>>
>>         memcpy(uuid, &mesa_timestamp, 4);
>>         memcpy((char*)uuid + 4, &llvm_timestamp, 4);
>> -       snprintf((char*)uuid + 8, VK_UUID_SIZE - 8, "radv");
>> +       memcpy((char*)uuid + 8, &f, 2);
>> +       snprintf((char*)uuid + 10, VK_UUID_SIZE - 10, "radv");
>>         return 0;
>>  }
>>
>> @@ -120,7 +122,7 @@ radv_physical_device_init(struct radv_physical_device
>> *device,
>>                 goto fail;
>>         }
>>
>> -       if (radv_device_get_cache_uuid(device->uuid)) {
>> +       if (radv_device_get_cache_uuid(device->rad_info.family,
>> device->uuid)) {
>>                 radv_finish_wsi(device);
>>                 device->ws->destroy(device->ws);
>>                 goto fail;
>> --
>> 2.10.2
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list