Index: lang/pocl/Makefile =================================================================== --- lang/pocl/Makefile +++ 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,31 @@ 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 +USE_CXXSTD= gnu++11 +USES= cmake localbase:ldflags ncurses pkgconfig -OPTIONS_GROUP= TEST -OPTIONS_GROUP_TEST= OCLBOOK +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/} -OCLBOOK_DESC= Tests from the OpenCL book -DEBUG_DESC= Debug build of pocl +OPTIONS_DEFINE= TEST -OCLBOOK_CONFIGURE_ENABLE= enable_testsuites="opencl-book-samples,cloverleaf,opencl_book_samples,halide,vexcl" -OCLBOOK_ALL_TARGET= check +TEST_DESC= Tests from the OpenCL book +TEST_CMAKE_OFF= -DENABLE_TESTSUITES="" +TEST_CMAKE_ON= -DENABLE_TESTSUITES="all" +TEST_TARGET= test -DEBUG_CONFIGURE_ENABLE= debug +post-patch: + @${REINPLACE_CMD} -e 's/AMD64/amd64/' ${WRKSRC}/CMakeLists.txt -TEST_TARGET= check +pre-install-TEST-on: do-test .include Index: lang/pocl/distinfo =================================================================== --- lang/pocl/distinfo +++ 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: lang/pocl/files/patch-Makefile.in =================================================================== --- lang/pocl/files/patch-Makefile.in +++ /dev/null @@ -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: lang/pocl/files/patch-lib_CL_devices_cpuinfo.c =================================================================== --- lang/pocl/files/patch-lib_CL_devices_cpuinfo.c +++ lang/pocl/files/patch-lib_CL_devices_cpuinfo.c @@ -1,5 +1,5 @@ ---- 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 +--- lib/CL/devices/cpuinfo.c.orig 2017-04-05 14:15:40 UTC ++++ lib/CL/devices/cpuinfo.c @@ -31,9 +31,13 @@ # include "vccompat.hpp" #endif @@ -10,81 +10,100 @@ #include "config.h" #include "cpuinfo.h" -+#if 0 - const char* cpuinfo = "/proc/cpuinfo"; ++#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 +157,41 @@ 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_compute_unit_count() ++int ++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); ++ 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)) ++ { ++ sscanf(value, "%d/%*d", &clockrate); ++ } ++ else ++ { ++ size = sizeof(clockrate); ++ sysctlbyname(mib2, (void*)&clockrate, &size, NULL, 0); ++ } ++ if (value) ++ free(value); ++ return clockrate; ++ } ++#endif -+ return nocpus; -+} -+ -+#if 0 ++#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 +269,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 +320,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 +369,22 @@ 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 ++#else ++ 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 ++ device->long_name = model; ++#endif } + void Index: lang/pocl/files/patch-lib_CL_pocl__binary.c =================================================================== --- /dev/null +++ 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: lang/pocl/files/patch-scripts_Makefile.in =================================================================== --- lang/pocl/files/patch-scripts_Makefile.in +++ /dev/null @@ -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: lang/pocl/files/patch-tests_regression_test__issue__445.cpp =================================================================== --- /dev/null +++ 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: lang/pocl/pkg-plist =================================================================== --- lang/pocl/pkg-plist +++ 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