39fe8c4c9b
Add upstream reproducible.patch to make build result independent of build system CPU (boo#1110722) OBS-URL: https://build.opensuse.org/request/show/645732 OBS-URL: https://build.opensuse.org/package/show/science/pocl?expand=0&rev=43
81 lines
2.6 KiB
Diff
81 lines
2.6 KiB
Diff
https://bugzilla.opensuse.org/show_bug.cgi?id=1110722
|
|
commit e99f4ca98bee7c59d8869a1b1d0aa764ffd5ec28
|
|
Author: Michal Babej <michal.babej@tut.fi>
|
|
Date: Thu Oct 11 13:16:43 2018 +0300
|
|
|
|
Fix PR #667
|
|
|
|
diff --git a/lib/CL/devices/basic/basic.c b/lib/CL/devices/basic/basic.c
|
|
index a64680f0..048f0008 100644
|
|
--- a/lib/CL/devices/basic/basic.c
|
|
+++ b/lib/CL/devices/basic/basic.c
|
|
@@ -354,9 +354,6 @@ pocl_init_cpu_device_infos (cl_device_id dev)
|
|
dev->llvm_cpu = get_llvm_cpu_name ();
|
|
#endif
|
|
|
|
- if(dev->llvm_cpu && (!strcmp(dev->llvm_cpu, "(unknown)")))
|
|
- dev->llvm_cpu = OCL_KERNEL_TARGET_CPU;
|
|
-
|
|
#else /* No compiler, no CPU info */
|
|
dev->llvm_cpu = NULL;
|
|
dev->llvm_target_triplet = "";
|
|
diff --git a/lib/CL/pocl_llvm_build.cc b/lib/CL/pocl_llvm_build.cc
|
|
index fda6e3a2..7b7001f8 100644
|
|
--- a/lib/CL/pocl_llvm_build.cc
|
|
+++ b/lib/CL/pocl_llvm_build.cc
|
|
@@ -839,16 +839,14 @@ static llvm::Module* getKernelLibrary(cl_device_id device)
|
|
kernellib += device->llvm_target_triplet;
|
|
if (is_host) {
|
|
kernellib += '-';
|
|
+#ifdef KERNELLIB_HOST_DISTRO_VARIANTS
|
|
+ kernellib += getX86KernelLibName();
|
|
+#else
|
|
kernellib_fallback = kernellib;
|
|
kernellib_fallback += OCL_KERNEL_TARGET_CPU;
|
|
kernellib_fallback += ".bc";
|
|
-#ifdef KERNELLIB_HOST_DISTRO_VARIANTS
|
|
- if (triple.getArch() == Triple::x86_64 ||
|
|
- triple.getArch() == Triple::x86)
|
|
- kernellib += getX86KernelLibName();
|
|
- else
|
|
+ kernellib += device->llvm_cpu;
|
|
#endif
|
|
- kernellib += device->llvm_cpu;
|
|
}
|
|
kernellib += ".bc";
|
|
|
|
@@ -861,6 +859,7 @@ static llvm::Module* getKernelLibrary(cl_device_id device)
|
|
}
|
|
else
|
|
{
|
|
+#ifndef KERNELLIB_HOST_DISTRO_VARIANTS
|
|
if (is_host && pocl_exists(kernellib_fallback.c_str()))
|
|
{
|
|
POCL_MSG_WARN("Using fallback %s as the built-in lib.\n",
|
|
@@ -868,6 +867,7 @@ static llvm::Module* getKernelLibrary(cl_device_id device)
|
|
lib = parseModuleIR(kernellib_fallback.c_str());
|
|
}
|
|
else
|
|
+#endif
|
|
POCL_ABORT("Kernel library file %s doesn't exist.\n", kernellib.c_str());
|
|
}
|
|
assert (lib != NULL);
|
|
diff --git a/lib/CL/pocl_llvm_utils.cc b/lib/CL/pocl_llvm_utils.cc
|
|
index feb88424..163304fe 100644
|
|
--- a/lib/CL/pocl_llvm_utils.cc
|
|
+++ b/lib/CL/pocl_llvm_utils.cc
|
|
@@ -134,11 +134,13 @@ get_llvm_cpu_name ()
|
|
}
|
|
#endif
|
|
|
|
+#ifndef KERNELLIB_HOST_DISTRO_VARIANTS
|
|
if (r.str() == "generic") {
|
|
POCL_MSG_WARN("LLVM does not recognize your cpu, trying to use "
|
|
OCL_KERNEL_TARGET_CPU " for -target-cpu\n");
|
|
r = llvm::StringRef(OCL_KERNEL_TARGET_CPU);
|
|
}
|
|
+#endif
|
|
|
|
assert(r.size() > 0);
|
|
char *cpu_name = (char *)malloc(r.size() + 1);
|