From 3e05c5fd48494cea7063cf34337203bf15b7adba Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 19 Dec 2020 17:55:59 +0000 Subject: [PATCH] lang/pocl: update to 1.6 Changes: http://portablecl.org/pocl-1.6.html PR: 251958 Submitted by: O. Hartmann (maintainer) --- lang/pocl/Makefile | 12 ++-- lang/pocl/distinfo | 8 +-- .../pocl/files/patch-lib_CL_devices_cpuinfo.c | 56 +++++++++++++++---- lang/pocl/pkg-plist | 5 +- 4 files changed, 56 insertions(+), 25 deletions(-) diff --git a/lang/pocl/Makefile b/lang/pocl/Makefile index b8e814cce9f0..afff6a05051f 100644 --- a/lang/pocl/Makefile +++ b/lang/pocl/Makefile @@ -1,14 +1,10 @@ # $FreeBSD$ PORTNAME= pocl -PORTVERSION= 1.5 +PORTVERSION= 1.6 DISTVERSIONPREFIX= v -PORTREVISION= 1 CATEGORIES= lang -PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ -PATCHFILES+= 9ba33d2a570c.patch:-p1 # https://github.com/pocl/pocl/pull/879 - MAINTAINER= ohartmann@walstatt.org COMMENT= POrtable Computing Language (POCL) @@ -19,12 +15,12 @@ ONLY_FOR_ARCHS= amd64 i386 ONLY_FOR_ARCHS_REASON= only tested on x86 BUILD_DEPENDS= llvm${LLVM_VERSION}>=0:devel/llvm${LLVM_VERSION} \ - opencl>=2.1:devel/opencl + opencl>=2.2:devel/opencl LIB_DEPENDS= libhwloc.so:devel/hwloc \ libOpenCL.so:devel/ocl-icd RUN_DEPENDS= ${BUILD_DEPENDS} -LLVM_VERSION= ${MESA_LLVM_VER:U10} +LLVM_VERSION= ${MESA_LLVM_VER:U11} USES= cmake localbase:ldflags ncurses pkgconfig @@ -34,7 +30,7 @@ USE_LDCONFIG= yes CMAKE_ARGS= -DWITH_LLVM_CONFIG="${LOCALBASE}/llvm${LLVM_VERSION}/bin/llvm-config" \ -DPOCL_INSTALL_PKGCONFIG_DIR="${PREFIX}/libdata/pkgconfig" \ -DKERNELLIB_HOST_CPU_VARIANTS="distro" \ - -DSINGLE_LLVM_LIB=OFF + -DSINGLE_LLVM_LIB=ON PLIST_SUB= CONFIGURE_TARGET=${CONFIGURE_TARGET:S/amd64/x86_64/} diff --git a/lang/pocl/distinfo b/lang/pocl/distinfo index bea4e753af3c..f34173a78d88 100644 --- a/lang/pocl/distinfo +++ b/lang/pocl/distinfo @@ -1,5 +1,3 @@ -TIMESTAMP = 1585922230 -SHA256 (pocl-pocl-v1.5_GH0.tar.gz) = 4fcf4618171727d165fc044d465a66e3119217bb4577a97374f94fcd8aed330e -SIZE (pocl-pocl-v1.5_GH0.tar.gz) = 1575635 -SHA256 (9ba33d2a570c.patch) = ebbf503a5e1b9e6676d66c8839a785bcd26667a0aa881fb68b74883e07e3a139 -SIZE (9ba33d2a570c.patch) = 744 +TIMESTAMP = 1608358712 +SHA256 (pocl-pocl-v1.6_GH0.tar.gz) = b0a4c0c056371b6f0db726b88fbb76bbee94948fb2abd4dbc8d958f7c42f766c +SIZE (pocl-pocl-v1.6_GH0.tar.gz) = 1595212 diff --git a/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c b/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c index 388e9bbcd8a4..efcae5a27cbe 100644 --- a/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c +++ b/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c @@ -1,5 +1,5 @@ ---- lib/CL/devices/cpuinfo.c.orig 2019-04-04 12:06:59 UTC -+++ lib/CL/devices/cpuinfo.c +--- lib/CL/devices/cpuinfo.c.orig 2020-12-16 14:02:13.000000000 +0100 ++++ lib/CL/devices/cpuinfo.c 2020-12-19 10:46:13.846666000 +0100 @@ -34,6 +34,12 @@ #include "config.h" #include "cpuinfo.h" @@ -13,7 +13,17 @@ static const char* cpuinfo = "/proc/cpuinfo"; #define MAX_CPUINFO_SIZE 64*1024 //#define DEBUG_POCL_CPUINFO -@@ -153,8 +159,51 @@ pocl_cpuinfo_detect_max_clock_frequency() +@@ -41,9 +47,6 @@ + //Linux' cpufrec interface + static const char* cpufreq_file="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; + +-// Vendor of PCI root bus +-static const char *pci_bus_root_vendor_file = "/sys/bus/pci/devices/0000:00:00.0/vendor"; +- + /* Strings to parse in /proc/cpuinfo. Else branch is for x86, x86_64 */ + #if defined __powerpc__ + #define FREQSTRING "clock" +@@ -156,8 +159,51 @@ } return -1; } @@ -54,7 +64,7 @@ +/** + * Unimplemented for other platforms. + */ -+ int ++int +pocl_cpuinfo_detect_max_clock_frequency() +{ + return 0; @@ -65,7 +75,7 @@ /** * Detects the number of parallel hardware threads supported by * the CPU by parsing the cpuinfo. -@@ -232,6 +281,19 @@ pocl_cpuinfo_detect_compute_unit_count() +@@ -235,6 +281,19 @@ } return -1; } @@ -83,9 +93,9 @@ +} +#endif - #ifdef POCL_ANDROID - -@@ -326,6 +388,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi + #if __arm__ || __aarch64__ + enum +@@ -302,6 +361,7 @@ * short_name is in the .data anyways.*/ device->long_name = device->short_name; @@ -93,7 +103,7 @@ /* default vendor and vendor_id, in case it cannot be found by other means */ device->vendor = cpuvendor_default; if (device->vendor_id == 0) -@@ -425,6 +488,25 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi +@@ -404,7 +464,26 @@ char *new_name = (char*)malloc (len); snprintf (new_name, len, "%s-%s", device->short_name, start); device->long_name = new_name; @@ -101,7 +111,7 @@ + int mib[2]; + size_t len = 0; + char *model; -+ + + mib[0] = CTL_HW; + mib[1] = HW_MODEL; + if (sysctl(mib, 2, NULL, &len, NULL, 0)) @@ -116,6 +126,30 @@ + device->long_name = model; + } +#endif ++ + /* If the vendor_id field is still empty, we should get the PCI ID associated + * with the CPU vendor (if there is one), to be ready for the (currently + * provisional) OpenCL 3.0 specification that has finally clarified the +@@ -415,10 +494,20 @@ + */ + if (!device->vendor_id) + { +- f = fopen (pci_bus_root_vendor_file, "r"); +- num_read = fscanf (f, "%x", &device->vendor_id); ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) ++ /* ++ * Future work: try to extract vendor ID from PCI root bus from MIB ++ */ ++#elif defined(__linux__) ++ FILE *f = fopen (pci_bus_root_vendor_file, "r"); ++ int num_read = fscanf (f, "%x", &device->vendor_id); + fclose (f); + /* no error checking, if it failed we just won't have the info */ ++#else ++ /* ++ * Other aliens ... ++ */ ++#endif + } } - /* diff --git a/lang/pocl/pkg-plist b/lang/pocl/pkg-plist index e3a68e37ecf8..7ca227b75991 100644 --- a/lang/pocl/pkg-plist +++ b/lang/pocl/pkg-plist @@ -2,8 +2,10 @@ bin/poclcc etc/OpenCL/vendors/pocl.icd lib/libpocl.so lib/libpocl.so.2 -lib/libpocl.so.2.5.0 +lib/libpocl.so.2.6.0 lib/pocl/libllvmopencl.so +lib/pocl/libpocl-devices-basic.so +lib/pocl/libpocl-devices-pthread.so libdata/pkgconfig/pocl.pc %%DATADIR%%/include/_builtin_renames.h %%DATADIR%%/include/_clang_opencl.h @@ -11,6 +13,7 @@ libdata/pkgconfig/pocl.pc %%DATADIR%%/include/_kernel.h %%DATADIR%%/include/_kernel_c.h %%DATADIR%%/include/_kernel_constants.h +%%DATADIR%%/include/_libclang_versions_checks.h %%DATADIR%%/include/opencl-c-base.h %%DATADIR%%/include/opencl-c.h %%DATADIR%%/include/pocl.h