I'd like to adopt the pocl package.
- Update to latest upstream release.
- Enable CUDA support.
--
Takashi Yano
inherit clang cmake
NAME="pocl"
VERSION=3.1
RELEASE=1
CATEGORY="Libs"
# The entire code is under MIT
# include/utlist.h which is under BSD-1-Clause (unbundled)
# lib/kernel/vecmath which is under GPL-3.0-or-later OR LGPL-3.0-or-later
LICENSE="MIT, BSD-1-Clause, GPL-3.0-or-later OR LGPL-3.0-or-later"
SUMMARY="OpenCL backend implementation"
DESCRIPTION="Portable Computing Language (pocl) aims to become a MIT-licensed
open source implementation of the OpenCL standard which can be easily adapted
for new targets and devices, both for homogeneous CPU and heterogenous GPUs/
accelerators. pocl uses Clang as an OpenCL C frontend and LLVM for the kernel
compiler implementation, and as a portability layer."
HOMEPAGE="http://portablecl.org/";
SRC_URI="https://github.com/pocl/pocl/archive/v${VERSION}/pocl-v${VERSION}.tar.gz";
PKG_NAMES="libpocl2 libpocl-common libpocl-devel"
libpocl2_REQUIRES="clang libpocl-common"
libpocl2_CONTENTS="
usr/bin/cygpocl-2.dll
usr/bin/libpocl-devices-basic.so
usr/bin/libpocl-devices-cuda.so
usr/bin/libpocl-devices-pthread.so
"
libpocl_common_CONTENTS="
etc/OpenCL/vendors/pocl.icd
usr/share/doc/pocl/
usr/share/pocl/
"
libpocl_devel_OBSOLETES="libpoclu-devel"
libpocl_devel_REQUIRES="libpocl-common"
libpocl_devel_CONTENTS="
usr/bin/poclcc.exe
usr/lib/libpocl.dll.a
usr/lib/pkgconfig/pocl.pc
usr/lib/pocl/cygllvmopencl.dll
usr/lib/libpocl-devices-basic.dll.a
usr/lib/libpocl-devices-cuda.dll.a
usr/lib/libpocl-devices-pthread.dll.a
"
DIFF_EXCLUDES="cl.hpp* testsuite"
CYGCMAKE_ARGS="
-DPOCL_INSTALL_ICD_VENDORDIR=/etc/OpenCL/vendors
-DPOCL_ICD_ABSOLUTE_PATH=OFF
-DENABLE_ICD=ON
-DENABLE_LIBLLVMOPENCL=ON
-DENABLE_CUDA=ON
-DCMAKE_INSTALL_PREFIX=/usr
"
--- origsrc/pocl-3.1/CMakeLists.txt 2022-12-05 21:36:08.0 +0900
+++ src/pocl-3.1/CMakeLists.txt 2024-01-02 08:55:53.483796100 +0900
@@ -817,9 +819,9 @@ endif()
# constant addrspace variables, and stack protector likely slows
# down the kernels, so it needs to be determined whether it's worth
# the trouble.
-set(DEFAULT_KERNEL_CL_FLAGS "-xcl -fno-stack-protector -fPIC
${FLOATCONV_FLAG} ${OPAQUE_PTR_FLAGS}")
-set(DEFAULT_KERNEL_C_FLAGS "-xc -std=c11 -D__CBUILD__ -fno-math-errno
-fno-stack-protector -fPIC ${FLOATCONV_FLAG} ${OPAQUE_PTR_FLAGS}")
-set(DEFAULT_KERNEL_CXX_FLAGS "-xc++ -std=c++11 -fno-stack-protector -fPIC
${FLOATCONV_FLAG} ${OPAQUE_PTR_FLAGS}")
+set(DEFAULT_KERNEL_CL_FLAGS "-xcl -fno-stack-protector ${FLOATCONV_FLAG}
${OPAQUE_PTR_FLAGS}")
+set(DEFAULT_KERNEL_C_FLAGS "-xc -std=c11 -D__CBUILD__ -fno-math-errno
-fno-stack-protector ${FLOATCONV_FLAG} ${OPAQUE_PTR_FLAGS}")
+set(DEFAULT_KERNEL_CXX_FLAGS "-xc++ -std=c++11 -fno-stack-protector
${FLOATCONV_FLAG} ${OPAQUE_PTR_FLAGS}")
set(EXTRA_KERNEL_FLAGS "" CACHE STRING "Extra arguments to all kernel
compilation commands (defaults to empty)")
@@ -883,11 +885,12 @@ if(ENABLE_SPIR)
endif()
# required for the wrapper generator
- if(CMAKE_VERSION VERSION_LESS 3.12.0)
-find_program(Python3_EXECUTABLE NAMES "python3" REQUIRED)
- else()
-find_package(Python3 REQUIRED COMPONENTS Interpreter)
- endif()
+ #if(CMAKE_VERSION VERSION_LESS 3.12.0)
+ # find_program(Python3_EXECUTABLE NAMES "python3" REQUIRED)
+ #else()
+ # find_package(Python3 REQUIRED COMPONENTS Interpreter)
+ #endif()
+ set(Python3_EXECUTABLE "/usr/bin/python3")
endif()
--- origsrc/pocl-3.1/cmake/LLVM.cmake 2022-12-05 21:36:08.0 +0900
+++ src/pocl-3.1/cmake/LLVM.cmake 2024-01-02 08:17:57.230897700 +0900
@@ -287,7 +287,7 @@ endforeach()
macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)
find_program(${OUTPUT_VAR}
-NAMES "${PROG_NAME}${LLVM_BINARY_SUFFIX}${CMAKE_EXECUTABLE_SUFFIX}"
"${PROG_NAME}${CMAKE_EXECUTABLE_SUFFIX}"
+NAMES "${PROG_NAME}${LLVM_BINARY_SUFFIX}" "${PROG_NAME}"
HINTS "${LLVM_BINDIR}" "${LLVM_CONFIG_LOCATION}" "${LLVM_PREFIX}"
"${LLVM_PREFIX_BIN}"
DOC "${DOCSTRING}"
NO_CMAKE_PATH
--- origsrc/pocl-3.1/lib/CL/CMakeLists.txt 2022-12-05 21:36:08.0
+0900
+++ src/pocl-3.1/lib/CL/CMakeLists.txt 2024-01-02 08:17:57.233896100 +0900
@@ -294,9 +294,10 @@ set_target_properties("${POCL_LIBRARY_NA
target_link_libraries("${POCL_LIBRARY_NAME}" PRIVATE ${POCL_PRIVATE_LINK_LIST})
install(TARGETS "${POCL_LIBRARY_NAME}"
-ARCHIVE DESTINATION ${POCL_INSTALL_PUBLIC_LIBDIR}/static
+ARCHIVE DESTINATION ${POCL_INSTALL_PUBLIC_LIBDIR}
COMPONENT "dev"
LIBRARY DESTINATION ${POCL_INSTALL_PUBLIC_LIBDIR}
+RUNTIME DESTINATION ${POCL_INSTALL_PUBLIC_BINDIR}
COMPONENT "lib"
)
--- origsrc/pocl-3.1/lib/CL/devices/cuda/CMakeLists.txt 2022-12-05
21:36:08.0 +0900
+++ src/pocl-3.1/lib/CL/devices/cuda/CMake