[PATCH 1008/1017] add llvm_cpu to the long device name
authorAndreas Beckmann <anbe@debian.org>
Wed, 14 Dec 2022 17:28:36 +0000 (18:28 +0100)
committerAndreas Beckmann <anbe@debian.org>
Tue, 17 Jan 2023 13:11:18 +0000 (13:11 +0000)
Gbp-Pq: Name 1008-add-llvm_cpu-to-the-long-device-name.patch

lib/CL/devices/cpuinfo.c

index 6a91997a3e522e1333ffdfe188f9f8bcd8b6637e..57397d7cb83c713fbe032031bf4fc85c4390f0a0 100644 (file)
@@ -400,9 +400,12 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id device)
 #endif
 
   /* create the descriptive long_name for device */
-  int len = strlen (device->short_name) + (end-start) + 2;
+  int len = strlen (device->short_name) + 1
+            + (device->llvm_cpu ? strlen (device->llvm_cpu) : 0) + 1
+            + (end - start) + 1;
   char *new_name = (char*)malloc (len);
-  snprintf (new_name, len, "%s-%s", device->short_name, start);
+  snprintf (new_name, len, "%s-%s-%s", device->short_name,
+            (device->llvm_cpu ? device->llvm_cpu : ""), start);
   device->long_name = new_name;
 
   /* If the vendor_id field is still empty, we should get the PCI ID associated