[PATCH 39/42] allow overriding kernellib_name for distro builds with POCL_KERNELLIB_NAME
authorAndreas Beckmann <anbe@debian.org>
Sat, 9 Apr 2022 14:30:15 +0000 (16:30 +0200)
committerAndreas Beckmann <anbe@debian.org>
Mon, 14 Aug 2023 13:53:17 +0000 (14:53 +0100)
the kernellib_name (and corresponding llvm_cpu) can be overridden
to a target with a subset of the features supported by the current cpu

this will allow running e.g. code generation and tests for sse2 (but no
newer features) on a modern cpu

Gbp-Pq: Name 0039-allow-overriding-kernellib_name-for-distro-builds-wi.patch

lib/CL/pocl_llvm_utils.cc

index dca2ad64f8896a1e1eb13429d85560025e5fa19b..df79e2756e642c770b22c6d4c80610ec2d8d6963 100644 (file)
@@ -205,6 +205,8 @@ const char *pocl_get_distro_kernellib_name() {
     return NULL;
   }
 
+  const char *custom = pocl_get_string_option("POCL_KERNELLIB_NAME", NULL);
+
   const kernellib_features *best_match = NULL;
   for (const kernellib_features *kf = kernellib_feature_map; kf->kernellib_name;
        ++kf) {
@@ -213,6 +215,8 @@ const char *pocl_get_distro_kernellib_name() {
       matches &= Features[*f];
     if (matches) {
       best_match = kf;
+      if (custom && !strcmp(custom, kf->kernellib_name))
+        break;
     }
   }