Skip to content

Commit

Permalink
lang/pocl: Update to POCL 3.1
Browse files Browse the repository at this point in the history
PR:		271159
Reported by:	ohartmann@walstatt.org (maintainer)
  • Loading branch information
O. Hartmann authored and fernape committed May 3, 2023
1 parent 0eb6406 commit be729ef
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 39 deletions.
26 changes: 12 additions & 14 deletions lang/pocl/Makefile
@@ -1,11 +1,11 @@
PORTNAME= pocl
PORTVERSION= 1.8
DISTVERSIONPREFIX=v
DISTVERSIONPREFIX= v
DISTVERSION= 3.1
CATEGORIES= lang

MAINTAINER= ohartmann@freebsd-de.org
MAINTAINER= ohartmann@walstatt.org
COMMENT= POrtable Computing Language (POCL)
WWW= http://portablecl.org/
WWW= http://portablecl.org/

LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
Expand All @@ -14,16 +14,15 @@ ONLY_FOR_ARCHS= aarch64 amd64 i386 powerpc64 powerpc64le
ONLY_FOR_ARCHS_REASON= only tested on ${ONLY_FOR_ARCHS:tW:S/ /, /g}
BROKEN_i386= Unable to access file /wrkdirs/usr/ports/lang/pocl/work/stage/usr/local/share/pocl/kernel-i386-portbld-freebsd13.0-avx.bc:No such file or directory

BUILD_DEPENDS= llvm${LLVM_VERSION}>=10:devel/llvm${LLVM_VERSION} \
opencl>=2.2:devel/opencl
BUILD_DEPENDS= llvm${LLVM_VERSION}>=14:devel/llvm${LLVM_VERSION} \
opencl>=3:devel/opencl
LIB_DEPENDS= libhwloc.so:devel/hwloc2 libOpenCL.so:devel/ocl-icd
RUN_DEPENDS= ${BUILD_DEPENDS}

USES= cmake localbase:ldflags ncurses pkgconfig
USE_GITHUB= yes
USE_LDCONFIG= yes

LLVM_VERSION= ${MESA_LLVM_VER:U13}
LLVM_VERSION= ${MESA_LLVM_VER:U15}
CMAKE_ARGS= -DWITH_LLVM_CONFIG="${LOCALBASE}/llvm${LLVM_VERSION}/bin/llvm-config" \
-DPOCL_INSTALL_PKGCONFIG_DIR="${PREFIX}/libdata/pkgconfig" \
-DSINGLE_LLVM_LIB=ON \
Expand All @@ -38,21 +37,21 @@ PLIST_SUB= CONFIGURE_TARGET=${CONFIGURE_TARGET:S/amd64/x86_64/}

OPTIONS_DEFINE= DOCS

DOCS_DESC= Build documentation (needs sphinx)
DOCS_CMAKE_OFF= -DENABLE_DOCS=OFF
DOCS_DESC= Build documentation (needs textproc/py-sphinx)
DOCS_CMAKE_ON= -DENABLE_DOCS=ON
DOCS_CMAKE_OFF= -DENABLE_DOCS=OFF
DOCS_USES= python:3.6+
DOCS_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>=0,1:textproc/py-sphinx@${PY_FLAVOR}
DOCS_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sphinx>=0:textproc/py-sphinx@${PY_FLAVOR}

.include <bsd.port.options.mk>

.if ${ARCH} == aarch64
PLIST_SUB+= AARCH64=""
PLIST_SUB+= AARCH64=""
PLIST_SUB+= PPC64="@comment "
PLIST_SUB+= PPC64LE="@comment "
PLIST_SUB+= X86="@comment "
.elif ${ARCH} == amd64 || ${ARCH} == i386
PLIST_SUB+= AARCH64="@comment "
PLIST_SUB+= AARCH64="@comment "
PLIST_SUB+= PPC64="@comment "
PLIST_SUB+= PPC64LE="@comment "
PLIST_SUB+= X86=""
Expand All @@ -67,6 +66,5 @@ PLIST_SUB+= PPC64="@comment "
PLIST_SUB+= PPC64LE=""
PLIST_SUB+= X86="@comment "
.endif
PLIST_SUB+= CONFIGURE_TARGET=${CONFIGURE_TARGET:S/amd64/x86_64/}

.include <bsd.port.mk>
6 changes: 3 additions & 3 deletions lang/pocl/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1634367852
SHA256 (pocl-pocl-v1.8_GH0.tar.gz) = 0f63377ae1826e16e90038fc8e7f65029be4ff6f9b059f6907174b5c0d1f8ab2
SIZE (pocl-pocl-v1.8_GH0.tar.gz) = 1614545
TIMESTAMP = 1670346593
SHA256 (pocl-pocl-v3.1_GH0.tar.gz) = 82314362552e050aff417318dd623b18cf0f1d0f84f92d10a7e3750dd12d3a9a
SIZE (pocl-pocl-v3.1_GH0.tar.gz) = 1928607
10 changes: 5 additions & 5 deletions lang/pocl/files/patch-CMakeLists.txt
@@ -1,12 +1,12 @@
--- CMakeLists.txt.orig 2020-12-16 13:02:13 UTC
--- CMakeLists.txt.orig 2022-06-10 10:09:05 UTC
+++ CMakeLists.txt
@@ -398,6 +398,9 @@ endif()


@@ -394,6 +394,9 @@ find_package(Hwloc)
set(ENABLE_HWLOC ON CACHE BOOL "Hwloc" FORCE)
endif()

+include(CheckIncludeFiles)
+check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYSCTL_H)
+

######################################################################################
include(sanitizers)

4 changes: 2 additions & 2 deletions lang/pocl/files/patch-config.h.in.cmake
@@ -1,6 +1,6 @@
--- config.h.in.cmake.orig 2020-12-16 13:02:13 UTC
--- config.h.in.cmake.orig 2022-06-10 10:09:05 UTC
+++ config.h.in.cmake
@@ -39,6 +39,8 @@
@@ -57,6 +57,8 @@

#cmakedefine HAVE_VFORK

Expand Down
16 changes: 8 additions & 8 deletions lang/pocl/files/patch-lib_CL_devices_cpuinfo.c
@@ -1,5 +1,5 @@
--- lib/CL/devices/cpuinfo.c.orig 2021-10-12 16:33:15.000000000 +0200
+++ lib/CL/devices/cpuinfo.c 2021-10-16 09:29:13.414668000 +0200
--- lib/CL/devices/cpuinfo.c.orig 2022-06-10 10:09:05 UTC
+++ lib/CL/devices/cpuinfo.c
@@ -34,6 +34,12 @@
#include "config.h"
#include "cpuinfo.h"
Expand All @@ -13,7 +13,7 @@
static const char* cpuinfo = "/proc/cpuinfo";
#define MAX_CPUINFO_SIZE 64*1024
//#define DEBUG_POCL_CPUINFO
@@ -41,9 +47,6 @@
@@ -41,9 +47,6 @@ static const char* cpufreq_file="/sys/devices/system/c
//Linux' cpufrec interface
static const char* cpufreq_file="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq";

Expand All @@ -23,7 +23,7 @@
/* Strings to parse in /proc/cpuinfo. Else branch is for x86, x86_64 */
#if defined __powerpc__
#define FREQSTRING "clock"
@@ -156,8 +159,51 @@
@@ -156,8 +159,51 @@ pocl_cpuinfo_detect_max_clock_frequency()
}
return -1;
}
Expand Down Expand Up @@ -75,7 +75,7 @@
/**
* Detects the number of parallel hardware threads supported by
* the CPU by parsing the cpuinfo.
@@ -235,6 +281,19 @@
@@ -235,6 +281,19 @@ pocl_cpuinfo_detect_compute_unit_count()
}
return -1;
}
Expand All @@ -95,15 +95,15 @@

#if __arm__ || __aarch64__
enum
@@ -302,6 +361,7 @@
@@ -302,6 +361,7 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi
* short_name is in the .data anyways.*/
device->long_name = device->short_name;

+#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)
@@ -404,7 +464,26 @@
@@ -404,7 +464,26 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi
char *new_name = (char*)malloc (len);
snprintf (new_name, len, "%s-%s", device->short_name, start);
device->long_name = new_name;
Expand All @@ -130,7 +130,7 @@
/* 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,13 +494,23 @@
@@ -415,13 +494,23 @@ pocl_cpuinfo_get_cpu_name_and_vendor(cl_device_id devi
*/
if (!device->vendor_id)
{
Expand Down
13 changes: 13 additions & 0 deletions lang/pocl/files/patch-lib_CL_pocl__timing.c
@@ -0,0 +1,13 @@
--- lib/CL/pocl_timing.c.orig 2022-06-10 10:09:05 UTC
+++ lib/CL/pocl_timing.c
@@ -69,8 +69,8 @@ uint64_t pocl_gettimemono_ns() {
struct timespec timespec;
# ifdef CLOCK_MONOTONIC_RAW /* Linux */
clock_gettime(CLOCK_MONOTONIC_RAW, &timespec);
-# elif defined(CLOCK_UPTIME_FAST) /* FreeBSD, DragonFlyBSD, etc */
- clock_gettime(CLOCK_UPTIME_FAST, &timespec);
+# elif defined(CLOCK_MONOTONIC_FAST) /* FreeBSD, DragonFlyBSD, etc */
+ clock_gettime(CLOCK_MONOTONIC_FAST, &timespec);
# elif defined(CLOCK_MONOTONIC) /* POSIX 2008, NetBSD, etc */
clock_gettime(CLOCK_MONOTONIC, &timespec);
# else /* older POSIX didn't define CLOCK_MONOTONIC */
21 changes: 16 additions & 5 deletions lang/pocl/pkg-descr
@@ -1,17 +1,28 @@
Portable OpenCL aims to be an efficient open source (MIT-licensed)
implementation of the OpenCL 1.2 standard.
[
{ type: install
message: <<EOM
Portable OpenCL (pocl)
----------------------

Portable OpenCL (>= 3.0) aims to be an efficient open source
(MIT-licensed) implementation of the OpenCL 2.X standard with
adaptions of OpenCL 3.0.

In addition to producing an easily portable open source OpenCL
implementation, another major goal of the project is improving
performance portability of OpenCL programs with compiler
optimizations, reducing the need for target-dependent manual
optimizations. At the core of POCL is a set of LLVM passes used
to statically parallelize multiple work-items with the kernel
optimizations. At the core of pocl is a set of LLVM passes
used to statically parallelize multiple work-items with the kernel
compiler, even in the presence of work-group barriers. This enables
parallelization of the fine-grained static concurrency in the work
groups in multiple ways (SIMD, VLIW, superscalar, ...).
groups in multiple ways (SIMD, VLIW, superscalar,...).

The code base is modularized to allow easy adding of new "device drivers"
in the host-device layer. A generic multithreaded "target driver" is
included. It allows running OpenCL applications on a host that supports
the pthread library with multithreading at the work group granularity.

EOM
}
]
18 changes: 18 additions & 0 deletions lang/pocl/pkg-message
@@ -0,0 +1,18 @@
[
{ type: install
message: <<EOM

Deadlocks (freezes) on FreeBSD:

OpenCL applications using pocl on FreeBSD must be compiled with
options CFLAGS+=-pthread or CXXFLAGS+=-pthread, otherwise someone risk
that a library may not initialize the threading on BSD independently,
even if an ICD loader is used.

See:
http://www.freebsd.org/cgi/query-pr.cgi?pr=163512

(Source: http://portablecl.org/docs/html/faq.html?highlight=freebsd)
EOM
}
]
3 changes: 1 addition & 2 deletions lang/pocl/pkg-plist
Expand Up @@ -2,8 +2,7 @@ bin/poclcc
etc/OpenCL/vendors/pocl.icd
lib/libpocl.so
lib/libpocl.so.2
lib/libpocl.so.2.8.0
lib/pocl/libllvmopencl.so
lib/libpocl.so.2.10.0
lib/pocl/libpocl-devices-basic.so
lib/pocl/libpocl-devices-pthread.so
libdata/pkgconfig/pocl.pc
Expand Down

0 comments on commit be729ef

Please sign in to comment.