[PATCH 28/42] 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>
Mon, 14 Aug 2023 13:53:17 +0000 (14:53 +0100)
Gbp-Pq: Name 0028-add-llvm_cpu-to-the-long-device-name.patch

lib/CL/devices/cpuinfo.c

index 8e3cda6346b7e6670e789e8ab960061a847b7ef9..a5330b6031c8c3a340392544dc38d37174245ba1 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