Index: head/lang/pocl/Makefile =================================================================== --- head/lang/pocl/Makefile +++ head/lang/pocl/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ PORTNAME= pocl -PORTVERSION= 0.13 -PORTREVISION= 1 +PORTVERSION= 0.14 CATEGORIES= lang MASTER_SITES= SF/pocl \ http://portablecl.org/downloads/ @@ -10,7 +9,7 @@ MAINTAINER= ohartman@zedat.fu-berlin.de COMMENT= POrtable Computing Language (POCL) -LICENSE= GPLv3 +LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= llvm${LLVM_VERSION}>=0:devel/llvm${LLVM_VERSION} \ @@ -20,46 +19,28 @@ libltdl.so:devel/libltdl RUN_DEPENDS= llvm${LLVM_VERSION}>=0:devel/llvm${LLVM_VERSION} -CONFLICTS= freeocl[0-9]* - BROKEN_FreeBSD_10= pocl is not supported on 10.x -ONLY_FOR_ARCHS= amd64 -ONLY_FOR_ARCHS_REASON_amd64= only tested on amd64 +ONLY_FOR_ARCHS= i386 amd64 +ONLY_FOR_ARCHS_REASON= only tested on x86 -LLVM_VERSION= 38 +LLVM_VERSION= ${MESA_LLVM_VER:U40} -GNU_CONFIGURE= yes USE_LDCONFIG= yes -USE_GL= yes -USES= gmake localbase ncurses pathfix pkgconfig libtool:keepla - -INSTALL_TARGET= install-strip - -MAKE_ARGS+= PKGCONFIGDIR=${PREFIX}/libdata/pkgconfig - -CONFIGURE_ENV= LLVM_CONFIG="${LOCALBASE}/llvm${LLVM_VERSION}/bin/llvm-config" \ - CLANGXX_FLAGS=-std=gnu++11 -# needed for the libltdl configure check -LDFLAGS+= -L${LOCALBASE}/lib -PLIST_SUB= OPSYS=${OPSYS:tl} ARCH=${ARCH} - -ALL_TARGET= all - -OCL_ICD_VENDORS?= ${PREFIX}/etc/OpenCL/vendors - -OPTIONS_DEFINE= DEBUG - -OPTIONS_GROUP= TEST -OPTIONS_GROUP_TEST= OCLBOOK - -OCLBOOK_DESC= Tests from the OpenCL book -DEBUG_DESC= Debug build of pocl - -OCLBOOK_CONFIGURE_ENABLE= enable_testsuites="opencl-book-samples,cloverleaf,opencl_book_samples,halide,vexcl" -OCLBOOK_ALL_TARGET= check +USE_CXXSTD= gnu++11 +USES= cmake localbase:ldflags ncurses pkgconfig -DEBUG_CONFIGURE_ENABLE= debug +CMAKE_ARGS= -DWITH_LLVM_CONFIG="${LOCALBASE}/llvm${LLVM_VERSION}/bin/llvm-config" \ + -DPOCL_INSTALL_PKGCONFIG_DIR="${PREFIX}/libdata/pkgconfig" \ + -DKERNELLIB_HOST_CPU_VARIANTS="distro" +PLIST_SUB= OPSYS=${OPSYS:tl} ARCH=${ARCH:S/amd64/x86_64/} + +OPTIONS_DEFINE= TEST + +TEST_DESC= Tests from the OpenCL book +TEST_CMAKE_OFF= -DENABLE_TESTSUITES="" +TEST_CMAKE_ON= -DENABLE_TESTSUITES="all" +TEST_TARGET= test -TEST_TARGET= check +pre-install-TEST-on: do-test .include Index: head/lang/pocl/distinfo =================================================================== --- head/lang/pocl/distinfo +++ head/lang/pocl/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1479738879 -SHA256 (pocl-0.13.tar.gz) = a17f37d8f26819c0c8efc6de2b57f67a0c8a81514fc9cd5005434e49d67499f9 -SIZE (pocl-0.13.tar.gz) = 1901208 +TIMESTAMP = 1491868935 +SHA256 (pocl-0.14.tar.gz) = 2127bf925a91fbbe3daf2f1bac0da5c8aceb16e2a9434977a3057eade974106a +SIZE (pocl-0.14.tar.gz) = 1231630 Index: head/lang/pocl/files/patch-CMakeLists.txt =================================================================== --- head/lang/pocl/files/patch-CMakeLists.txt +++ head/lang/pocl/files/patch-CMakeLists.txt @@ -0,0 +1,21 @@ +--- CMakeLists.txt.orig 2017-04-05 14:15:40 UTC ++++ CMakeLists.txt +@@ -70,7 +70,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "a + set(ARMV6 1) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + set(ARM64 1) +-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(i.86|AMD64|x86_64)") ++elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(i.86|amd64|AMD64|x86_64)") + if(POCL_DEVICE_ADDRESS_BITS MATCHES "32") + set(I386 1) + else() +@@ -318,6 +318,9 @@ include(CheckFunctionExists) + check_function_exists(fork HAVE_FORK) + check_function_exists(vfork HAVE_VFORK) + ++include(CheckIncludeFiles) ++check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYSCTL_H) ++ + ###################################################################################### + + if(NOT DEFINED DEFAULT_USE_VECMATHLIB) Index: head/lang/pocl/files/patch-Makefile.in =================================================================== --- head/lang/pocl/files/patch-Makefile.in +++ head/lang/pocl/files/patch-Makefile.in @@ -1,25 +0,0 @@ -First part: this is false, this was due to a libtool bug, which is fixed now -Second part: cmp --quiet is long for the -s option, use that since FreeBSD -cmp doesn't have the long option. - ---- Makefile.in.orig 2016-09-13 22:57:13.327123000 +0200 -+++ Makefile.in 2016-09-13 23:01:18.738696000 +0200 -@@ -116,8 +116,7 @@ - @POCL_ANDROID_FALSE@am__append_1 = scripts examples tests - - #TODO: this naming scheme is used on other platforms (primarly BSDs?) too --@BUILD_ICD_TRUE@@FREEBSD_HOST_OS_TRUE@am__append_2 = -e 's,so.VER,so.$(LIB_CURRENT_VERSION),g' --@BUILD_ICD_TRUE@@FREEBSD_HOST_OS_FALSE@am__append_3 = -e 's,so.VER,so.$(LIB_FIRST_VERSION).$(LIB_AGE_VERSION).$(LIB_REVISION_VERSION),g' -+@BUILD_ICD_TRUE@am__append_3 = -e 's,so.VER,so.$(LIB_FIRST_VERSION).$(LIB_AGE_VERSION).$(LIB_REVISION_VERSION),g' - @BUILD_ICD_TRUE@am__append_4 = pocl.icd - @BUILD_ICD_TRUE@am__append_5 = pocl.icd - subdir = . -@@ -1076,7 +1075,7 @@ - echo "#define PKGDATADIR \"${pkgdatadir}\"" > $@.new - echo "#define PKGLIBEXECDIR \"${pkglibexecdir}\"" >> $@.new - echo "#define PKGINCLUDEDIR \"${pkgincludedir}\"" >> $@.new -- @if cmp --quiet $@.new $@ ; then \ -+ @if cmp -s $@.new $@ ; then \ - : "Paths not changed" ;\ - $(RM) $@.new ;\ - else \ Index: head/lang/pocl/files/patch-config.h.in.cmake =================================================================== --- head/lang/pocl/files/patch-config.h.in.cmake +++ head/lang/pocl/files/patch-config.h.in.cmake @@ -0,0 +1,11 @@ +--- config.h.in.cmake.orig 2017-04-05 14:15:40 UTC ++++ config.h.in.cmake +@@ -44,6 +44,8 @@ + + #cmakedefine HAVE_VFORK + ++#cmakedefine HAVE_SYSCTL_H ++ + #cmakedefine HAVE_CLOCK_GETTIME + + #cmakedefine HAVE_LTTNG_UST Index: head/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c =================================================================== --- head/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c +++ head/lang/pocl/files/patch-lib_CL_devices_cpuinfo.c @@ -1,90 +1,121 @@ ---- lib/CL/devices/cpuinfo.c.orig 2016-11-20 11:31:19.521203000 +0100 -+++ lib/CL/devices/cpuinfo.c 2016-11-20 11:29:24.502817000 +0100 -@@ -31,9 +31,13 @@ - # include "vccompat.hpp" - #endif - -+#include -+#include -+ +--- lib/CL/devices/cpuinfo.c.orig 2017-04-05 14:15:40 UTC ++++ lib/CL/devices/cpuinfo.c +@@ -34,6 +34,12 @@ #include "config.h" #include "cpuinfo.h" -+#if 0 - const char* cpuinfo = "/proc/cpuinfo"; ++#ifdef HAVE_SYSCTL_H ++# include ++# include ++#endif ++ ++#ifdef __linux__ + static const char* cpuinfo = "/proc/cpuinfo"; #define MAX_CPUINFO_SIZE 64*1024 //#define DEBUG_POCL_CPUINFO -@@ -152,8 +156,29 @@ pocl_cpuinfo_detect_max_clock_frequency( +@@ -153,8 +159,51 @@ pocl_cpuinfo_detect_max_clock_frequency( } return -1; } -+#endif -+ ++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +/** -+ * Detects the number of parallel hardware threads supported by -+ * the CPU. ++ * Detects the maximum clock frequency of the CPU. + * -+ * @return The number of hardware threads. ++ * Assumes all cores have the same max clock freq. ++ * ++ * @return The clock frequency in MHz. ++ */ ++int ++pocl_cpuinfo_detect_max_clock_frequency() ++{ ++ const char mib1[] = "dev.cpu.0.freq_levels"; ++ const char mib2[] = "hw.clockrate"; ++ int clockrate = 0; ++ size_t size = 0; ++ char *value = NULL; + ++ if (!sysctlbyname(mib1, NULL, &size, NULL, 0) && ++ (value = (char*)malloc(++size)) && ++ !sysctlbyname(mib1, (void*)value, &size, NULL, 0)) ++ { ++ value[size] = '\0'; ++ sscanf(value, "%d/%*d", &clockrate); ++ } ++ else ++ { ++ size = sizeof(clockrate); ++ sysctlbyname(mib2, (void*)&clockrate, &size, NULL, 0); ++ } ++ if (value) ++ free(value); ++ return clockrate; ++} ++#else ++/** ++ * Unimplemented for other platforms. + */ + int -+pocl_cpuinfo_detect_compute_unit_count() ++pocl_cpuinfo_detect_max_clock_frequency() +{ -+ int mib[2], nocpus; -+ size_t len; - -+ mib[0] = CTL_HW; -+ mib[1] = HW_NCPU; -+ len = sizeof(nocpus); -+ sysctl(mib, 2, &nocpus, &len, NULL, 0); - -+ return nocpus; ++ return 0; +} -+ -+#if 0 ++#endif + ++#ifdef __linux__ /** * Detects the number of parallel hardware threads supported by * the CPU by parsing the cpuinfo. -@@ -231,6 +256,27 @@ pocl_cpuinfo_detect_compute_unit_count() +@@ -232,6 +281,19 @@ pocl_cpuinfo_detect_compute_unit_count() } return -1; } -+#endif -+ ++#else +/** -+ * Detects the maximum clock frequency of the CPU. -+ * -+ * Assumes all cores have the same max clock freq. ++ * Detects the number of parallel hardware threads supported by ++ * the CPU. + * -+ * @return The clock frequency in MHz. ++ * @return The number of hardware threads. + */ -+int -+pocl_cpuinfo_detect_max_clock_frequency() ++ int ++pocl_cpuinfo_detect_compute_unit_count() +{ -+ //XXX PLEASE NOTE, THIS IS NOT TOO PORTABLE (AND/OR ACCURATE)! -+ const char mib[] = "hw.clockrate"; -+ size_t size = sizeof(int); -+ int clockrate; -+ -+ sysctlbyname(mib, (void *)&clockrate, &size, NULL, 0); -+ -+ return clockrate; -+ } ++ return sysconf(_SC_NPROCESSORS_ONLN); ++} ++#endif #ifdef POCL_ANDROID -@@ -269,6 +315,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ +@@ -270,6 +332,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ * short_name is in the .data anyways.*/ device->long_name = device->short_name; -+#if 0 ++#ifdef __linux__ /* default vendor and vendor_id, in case it cannot be found by other means */ device->vendor = cpuvendor_default; if (device->vendor_id == 0) -@@ -317,6 +364,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ +@@ -318,7 +381,25 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_ char *new_name = (char*)malloc (len); snprintf (new_name, len, "%s-%s", device->short_name, start); device->long_name = new_name; -+#endif ++#elif defined(HAVE_SYSCTL_H) ++ 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)) ++ return; ++ if (!(model = (char*)malloc(++len))) ++ return; ++ if (sysctl(mib, 2, (void*)model, &len, NULL, 0)) ++ free(model); ++ else ++ { ++ model[len] = '\0'; ++ device->long_name = model; ++ } ++#endif } + void Index: head/lang/pocl/files/patch-lib_CL_pocl__binary.c =================================================================== --- head/lang/pocl/files/patch-lib_CL_pocl__binary.c +++ head/lang/pocl/files/patch-lib_CL_pocl__binary.c @@ -0,0 +1,11 @@ +--- lib/CL/pocl_binary.c.orig 2017-04-05 14:15:40 UTC ++++ lib/CL/pocl_binary.c +@@ -36,7 +36,7 @@ + #include + + #ifndef __APPLE__ +- #include ++ #include + #else + #include + #define htole16(x) OSSwapHostToLittleInt16(x) Index: head/lang/pocl/files/patch-scripts_Makefile.in =================================================================== --- head/lang/pocl/files/patch-scripts_Makefile.in +++ head/lang/pocl/files/patch-scripts_Makefile.in @@ -1,21 +0,0 @@ -dirty hack, pocl-standalone will be installed into stage with -r-xr-xr-x permissions. So writing to it is problemetic. give the file write -permission and take it away after. - -Upstream (pre 0.14) will be using cmake so this hack is only temporary. - ---- scripts/Makefile.in.orig 2016-09-13 22:10:48.091956000 +0200 -+++ scripts/Makefile.in 2016-09-13 22:13:33.388168000 +0200 -@@ -651,10 +651,11 @@ - - install-exec-hook: $(bin_SCRIPTS) - for f in $(bin_SCRIPTS) ; do \ -+ chmod +w "$(DESTDIR)$(bindir)/$$f" ; \ - sed -e '/^# BEGIN REMOVE ONCE INSTALLED$$/,/^# END REMOVE ONCE INSTALLED$$/d' \ - > "$(DESTDIR)$(bindir)/$$f" \ - < "$$f" && \ -- chmod +x "$(DESTDIR)$(bindir)/$$f" ; \ -+ chmod +x-w "$(DESTDIR)$(bindir)/$$f" ; \ - done - - # Tell versions [3.59,3.63) of GNU make to not export all variables. Index: head/lang/pocl/files/patch-tests_regression_test__issue__445.cpp =================================================================== --- head/lang/pocl/files/patch-tests_regression_test__issue__445.cpp +++ head/lang/pocl/files/patch-tests_regression_test__issue__445.cpp @@ -0,0 +1,11 @@ +--- tests/regression/test_issue_445.cpp.orig 2017-04-05 14:15:40 UTC ++++ tests/regression/test_issue_445.cpp +@@ -29,7 +29,7 @@ private_local_array(__global int *__rest + } + )CLC"; + +-int main(int, char *) ++int main(int, char **) + { + try { + int N = 9; Index: head/lang/pocl/pkg-plist =================================================================== --- head/lang/pocl/pkg-plist +++ head/lang/pocl/pkg-plist @@ -1,27 +1,25 @@ -bin/pocl-standalone +bin/poclcc etc/OpenCL/vendors/pocl.icd include/poclu.h -lib/libpocl.a -lib/libpocl.la lib/libpocl.so lib/libpocl.so.1 -lib/libpocl.so.1.6.0 -lib/libpoclu.a -lib/libpoclu.la +lib/libpocl.so.1.7.0 lib/libpoclu.so lib/libpoclu.so.1 -lib/libpoclu.so.1.6.0 -lib/pocl/llvmopencl.a -lib/pocl/llvmopencl.la -lib/pocl/llvmopencl.so -lib/pocl/llvmopencl.so.7 -lib/pocl/llvmopencl.so.7.0.0 +lib/libpoclu.so.1.7.0 +lib/pocl/libllvmopencl.so libdata/pkgconfig/pocl.pc +%%DATADIR%%/include/_enable_all_exts.h %%DATADIR%%/include/_kernel.h %%DATADIR%%/include/_kernel_c.h %%DATADIR%%/include/_kernel_constants.h %%DATADIR%%/include/pocl.h %%DATADIR%%/include/pocl_device.h -%%DATADIR%%/include/pocl_tests.h %%DATADIR%%/include/pocl_types.h -%%DATADIR%%/kernel-%%ARCH%%-portbld-%%OPSYS%%%%OSREL%%.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-avx.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-avx2.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-avx512.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-avx_fma4.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-sse2.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-sse41.bc +%%DATADIR%%/kernel-%%ARCH%%-unknown-%%OPSYS%%%%OSREL%%-ssse3.bc