/* Returns the cpu name as reported by LLVM. */
POCL_EXPORT
char *pocl_get_llvm_cpu_name ();
+
+ /* For distro builds, return the kernellib name based on the host CPU */
+ POCL_EXPORT
+ const char *pocl_get_distro_kernellib_name ();
+
/* Returns if the cpu supports FMA instruction (uses LLVM). */
int cpu_has_fma ();
/* for "distro" style kernel libs, return which kernellib to use, at runtime */
#ifdef KERNELLIB_HOST_DISTRO_VARIANTS
-const char *getX86KernelLibName() {
+const char *pocl_get_distro_kernellib_name() {
StringMap<bool> Features;
const char *res = NULL;
if (!llvm::sys::getHostCPUFeatures(Features)) {
- POCL_MSG_WARN ("getX86KernelLibName(): LLVM can't get host CPU flags!\n");
- /* getX86KernelLibName should only ever be enabled
- on x86-64, which always has sse2 */
- return "sse2";
+ POCL_MSG_WARN("LLVM can't get host CPU flags!\n");
+ return NULL;
}
+#if defined(__x86_64__)
if (Features["sse2"])
res = "sse2";
- else
- POCL_ABORT("Pocl on x86_64 requires at least SSE2\n");
if (Features["ssse3"] && Features["cx16"])
res = "ssse3";
if (Features["sse4.1"] && Features["cx16"])
res = "avx2";
if (Features["avx512f"] )
res = "avx512";
+#endif
+
+ if (!res)
+ POCL_MSG_WARN("Can't find a kernellib supported by the host CPU (%s)\n",
+ llvm::sys::getHostCPUName());
return res;
}
if (is_host) {
kernellib += '-';
#ifdef KERNELLIB_HOST_DISTRO_VARIANTS
- kernellib += getX86KernelLibName();
+ kernellib += pocl_get_distro_kernellib_name();
#elif defined(HOST_CPU_FORCED)
kernellib += OCL_KERNEL_TARGET_CPU;
#else