Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2012 10:05:49 GMT
From:      Oliver Hartmann <ohartman@zedat.fu-berlin.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/171914: New port: devel/pocl: Portable open source OpenCL 1.2 implementation 
Message-ID:  <201209241005.q8OA5np9069101@red.freebsd.org>
Resent-Message-ID: <201209241010.q8OAA69Y029442@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         171914
>Category:       ports
>Synopsis:       New port: devel/pocl: Portable open source OpenCL 1.2 implementation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 24 10:10:06 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Hartmann
>Release:        FreeBSD 10.0-CURRENT/amd64 CLANG & FreeBSD 9.1-PRE/amd64 CLANG
>Organization:
FU Berlin
>Environment:
>Description:
FreeBSD lacks in prefessional OpenCL/GPGPU support. Apart from the lack of suitable driver support from the GPU vendors, OpenCL also provides support for tha CPU as a "native" target.

To provide even FreeBSD users, develeopers and scientists to develop software for OpenCL 1.2, it is necessary to have a working library to start with.

The project "POCL", Portable OpenCL, provides via LLVM backend such a library for at least the "native" CPU target, as their website states:


"Portable OpenCL is an open source implementation of the OpenCL standard which can be easily adapted for new targets. One of the goals of the project is improving performance portability of OpenCL programs, avoiding the need for target-dependent manual optimizations. A "native" target is included, which allows running OpenCL kernels on the host (CPU)."

Source: https://launchpad.net/pocl
>How-To-Repeat:
This port has been successfully compiled on a most recent FreeBSD 10.0-CURRENT/amd64 system which has been completely compiled with CLANG 3.2 and LLVM 3.2 installed from ports devel/llvm-devel.

The port also has been successfully compiled and installed on FreeBSD 9.1-PRE/amd64, also completely compiled with the CLANG (v 3.1) aboard and LLVM 3.1 installed from the port devel/llvm.

The usefulness hasn't been approved, nor did I do benchmarks for the "native" CPU target.

I hope this [roject, due to its LLVM backend, could gain more assistance and more attention. 
>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	pocl
#	pocl/pkg-plist
#	pocl/Makefile
#	pocl/pkg-descr
#	pocl/pkg-message
#	pocl/distinfo
#	pocl/files
#	pocl/files/patch-lib-llvmopencl-Workgroup.cc
#	pocl/files/patch-lib-llvmopencl-WorkitemReplication.cc
#	pocl/files/patch-lib-llvmopencl-ParallelRegion.cc
#	pocl/files/patch-lib-llvmopencl-BarrierTailReplication.cc
#
echo c - pocl
mkdir -p pocl > /dev/null 2>&1
echo x - pocl/pkg-plist
sed 's/^X//' >pocl/pkg-plist << '65441bb25370d2620f90060889f3703b'
Xbin/pocl-build
Xbin/pocl-kernel
Xbin/pocl-standalone
Xbin/pocl-workgroup
Xetc/OpenCL/vendors/pocl.icd
Xinclude/CL/cl.h
Xinclude/CL/cl.hpp
Xinclude/CL/cl_ext.h
Xinclude/CL/cl_gl.h
Xinclude/CL/cl_gl_ext.h
Xinclude/CL/cl_platform.h
Xinclude/CL/opencl.h
Xinclude/OpenCL/cl.h
Xinclude/OpenCL/cl.hpp
Xinclude/OpenCL/cl_ext.h
Xinclude/OpenCL/cl_gl.h
Xinclude/OpenCL/cl_gl_ext.h
Xinclude/OpenCL/cl_platform.h
Xinclude/OpenCL/opencl.h
Xinclude/pocl/_kernel.h
Xinclude/pocl/amd64-portbld-freebsd10.0/types.h
Xinclude/pocl/arm/types.h
Xinclude/pocl/bufalloc.h
Xinclude/pocl/pocl.h
Xinclude/pocl/pocl_device.h
Xinclude/pocl/poclu.h
Xinclude/pocl/tce/types.h
Xinclude/pocl/utlist.h
Xinclude/pocl/x86_64/types.h
Xinclude/poclu.h
Xlib/libOpenCL.so
Xlib/libpocl-icd.a
Xlib/libpocl-icd.la
Xlib/libpocl-icd.so
Xlib/libpocl-icd.so.0
Xlib/libpocl.a
Xlib/libpocl.la
Xlib/libpocl.so
Xlib/libpocl.so.0
Xlib/libpoclu.a
Xlib/libpoclu.la
Xlib/libpoclu.so
Xlib/libpoclu.so.0
Xlib/pkgconfig/pocl.pc
Xlib/pocl/amd64-portbld-freebsd10.0/libkernel.a
Xlib/pocl/arm/libkernel.a
Xlib/pocl/llvmopencl.a
Xlib/pocl/llvmopencl.la
Xlib/pocl/llvmopencl.so
Xlib/pocl/llvmopencl.so.0
Xlib/pocl/tce/libkernel.a
Xlib/pocl/x86_64/libkernel.a
X@dirrm lib/pocl/x86_64
X@dirrm lib/pocl/tce
X@dirrm lib/pocl/arm
X@dirrm lib/pocl/amd64-portbld-freebsd10.0
X@dirrm lib/pocl
X@dirrm lib/pkgconfig
X@dirrm include/pocl/x86_64
X@dirrm include/pocl/tce
X@dirrm include/pocl/arm
X@dirrm include/pocl/amd64-portbld-freebsd10.0
X@dirrm include/pocl
X@dirrm include/OpenCL
X@dirrm include/CL
X@dirrm etc/OpenCL/vendors
X@dirrm etc/OpenCL
65441bb25370d2620f90060889f3703b
echo x - pocl/Makefile
sed 's/^X//' >pocl/Makefile << '8e78b7c9a055a3d4bfba7a854d434ffe'
XPORTNAME=		pocl
XPORTVERSION=		0.6.0
XCATEGORIES=             devel
X
XMAINTAINER=             ohartman@zedat.fu-berlin.de
XCOMMENT=		Portable OpenCL - an efficient open source (MIT-licensed) implementation of the OpenCL 1.2 standard.
X
XMASTER_SITES=		https://launchpad.net/pocl/${PORTVERSION:C/\.[0-9]$//}/${PORTVERSION}/+download/
XDISTNAME=		${PORTNAME}-${PORTVERSION:C/\.[0-9]$//}
X
XCONFLICTS=		opencl* freeocl
X
XCLANG_DEVEL_DEC=	Use developmnet port (i.e. devel/llvm-devel)
XOPTIONS_SINGLE=		LANG
XOPTIONS_SINGLE_LANG=	COMP_CLANG COMP_GCC
XOPTIONS_DEFAULT=	COMP_CLANG
X
XCOMP_CLANG_DESC=	Use LLVM/CLANG compiler
XCOMP_GCC_DESC=		Use GNU GCC compiler
X
X.include <bsd.port.options.mk>
X
X.if ${PORT_OPTIONS:MCOMP_GCC}
XUSE_GCC=		4.6+
X.endif
X
X.if  ${PORT_OPTIONS:MCOMP_CLANG}
XCPPFLAGS+=		-I${LOCALBASE}/include
XLDFLAGS+=		-L${LOCALBASE}/lib
X.endif
X
XBUILD_DEPENDS=		${LOCALBASE}/bin/llvm-config:${PORTSDIR}/devel/llvm
X
XUSE_GMAKE=		yes
XUSE_GL=			yes
XUSE_LDCONFIG=		yes
XUSE_AUTOTOOLS=		libltdl
XGNU_CONFIGURE=		yes
X
X.include <bsd.port.mk>
8e78b7c9a055a3d4bfba7a854d434ffe
echo x - pocl/pkg-descr
sed 's/^X//' >pocl/pkg-descr << '0187823860a03d7e58b96da67fc37bba'
XPortable OpenCL - an efficient open source (MIT-licensed) implementation of the OpenCL 1.2 standard. 
0187823860a03d7e58b96da67fc37bba
echo x - pocl/pkg-message
sed 's/^X//' >pocl/pkg-message << 'ba52724629db76913ff2181e048060d1'
XPortable OpenCL (pocl)
X----------------------
X
XPortable OpenCL aims to be an efficient open source (MIT-licensed) 
Ximplementation of the OpenCL 1.2 standard. 
X
XIn addition to producing an easily portable open source OpenCL
Ximplementation, another major goal of the project is improving 
Xperformance portability of OpenCL programs with compiler 
Xoptimizations, reducing the need for target-dependent manual 
Xoptimizations. At the core of pocl is a set of LLVM passes 
Xused to statically parallelize multiple work-items with the kernel
Xcompiler, even in the presence of work-group barriers. This enables 
Xparallelization of the fine-grained static concurrency in the work 
Xgroups in multiple ways (SIMD, VLIW, superscalar,...).
X
XThe code base is modularized to allow easy adding of new "device drivers"
Xin the host-device layer. A generic multithreaded "target driver" is 
Xincluded. It allows running OpenCL applications on a host that supports 
Xthe pthread library with multithreading at the work group granularity.
X
XAn optimized kernel library is provided for x86_64. The generic
Xunoptimized (no instruction set extensions used) version has been 
Xsuccessfully tested with an ARMv7 CPU under MeeGo, and with several 
Xapplication-specific TTA processors designed using the TCE toolset.
X
XOther feature highlights include (experimental) work group 
Xautovectorization (create vector instructions out of multiple
Xwork-items) and a customized kernel buffer allocator.
X
XEven though the OpenCL 1.2 standard is not yet implemented fully and
Xit contains known bugs, we now consider pocl ready for wider scale testing. 
Xpocl 0.6 compiles and runs successfully most of the Rodinia benchmark, 
Xall of ViennaCL test cases, and most of the OpenCL Programming Guide 
Xsamples. 
X
XLinks
X-----
XDownload:          https://launchpad.net/pocl/+milestone/0.6.0
XHome page/wiki:    http://pocl.sourceforge.net/
XIRC:               #pocl @ irc.oftc.net
X
ba52724629db76913ff2181e048060d1
echo x - pocl/distinfo
sed 's/^X//' >pocl/distinfo << '609904714841652d308359205a13b397'
XSHA256 (pocl-0.6.tar.gz) = 53836a257e1a6aaf3c552d14dfe47b78c7347c002fe0eecbc980c0eec6993202
XSIZE (pocl-0.6.tar.gz) = 791283
609904714841652d308359205a13b397
echo c - pocl/files
mkdir -p pocl/files > /dev/null 2>&1
echo x - pocl/files/patch-lib-llvmopencl-Workgroup.cc
sed 's/^X//' >pocl/files/patch-lib-llvmopencl-Workgroup.cc << '0202eb3ee1cafbb4cbc3a9fffd6a1728'
X--- lib/llvmopencl/Workgroup.cc.orig	2012-05-31 10:32:04.000000000 +0200
X+++ lib/llvmopencl/Workgroup.cc	2012-09-23 14:46:49.000000000 +0200
X@@ -34,8 +34,14 @@
X #include "llvm/Module.h"
X #include "llvm/Pass.h"
X #include "llvm/Support/CommandLine.h"
X+#include "config.h"
X+#ifdef LLVM_3_1
X #include "llvm/Support/IRBuilder.h"
X #include "llvm/Support/TypeBuilder.h"
X+#else
X+#include "llvm/IRBuilder.h"
X+#include "llvm/TypeBuilder.h"
X+#endif
X #include "llvm/Support/raw_ostream.h"
X #include "llvm/Transforms/Utils/Cloning.h"
X #include "llvm/Transforms/Utils/Local.h"
0202eb3ee1cafbb4cbc3a9fffd6a1728
echo x - pocl/files/patch-lib-llvmopencl-WorkitemReplication.cc
sed 's/^X//' >pocl/files/patch-lib-llvmopencl-WorkitemReplication.cc << '76b7b6fad331835ef09c36146f3f52b0'
X--- lib/llvmopencl/WorkitemReplication.cc.orig	2012-09-23 14:26:51.000000000 +0200
X+++ lib/llvmopencl/WorkitemReplication.cc	2012-09-23 14:27:45.000000000 +0200
X@@ -32,7 +32,12 @@
X #include "llvm/Instructions.h"
X #include "llvm/Module.h"
X #include "llvm/Support/CommandLine.h"
X+#include "config.h"
X+#ifdef LLVM_3_1
X #include "llvm/Support/IRBuilder.h"
X+#else
X+#include "llvm/IRBuilder.h"
X+#endif
X #include "llvm/Target/TargetData.h"
X #include "llvm/Transforms/Utils/BasicBlockUtils.h"
X #include "llvm/ValueSymbolTable.h"
76b7b6fad331835ef09c36146f3f52b0
echo x - pocl/files/patch-lib-llvmopencl-ParallelRegion.cc
sed 's/^X//' >pocl/files/patch-lib-llvmopencl-ParallelRegion.cc << 'dada9dd98761a55b653b8eae63ffa300'
X--- ./lib/llvmopencl/ParallelRegion.cc.orig	2012-08-08 10:09:49.000000000 +0200
X+++ ./lib/llvmopencl/ParallelRegion.cc	2012-09-23 14:49:57.000000000 +0200
X@@ -24,7 +24,12 @@
X 
X #include "ParallelRegion.h"
X #include "Barrier.h"
X+#include "config.h"
X+#ifdef LLVM_3_1
X #include "llvm/Support/IRBuilder.h"
X+#else
X+#include "llvm/IRBuilder.h"
X+#endif
X #include "llvm/Transforms/Utils/BasicBlockUtils.h"
X #include "llvm/Transforms/Utils/Cloning.h"
X #include "llvm/ValueSymbolTable.h"
dada9dd98761a55b653b8eae63ffa300
echo x - pocl/files/patch-lib-llvmopencl-BarrierTailReplication.cc
sed 's/^X//' >pocl/files/patch-lib-llvmopencl-BarrierTailReplication.cc << '3f67e4644ea50c471a6071de4e047dac'
X--- lib/llvmopencl/BarrierTailReplication.cc.orig	2012-09-23 14:20:57.000000000 +0200
X+++ lib/llvmopencl/BarrierTailReplication.cc	2012-09-23 14:21:14.000000000 +0200
X@@ -21,6 +21,7 @@
X // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
X // THE SOFTWARE.
X 
X+#include "config.h"
X #include "BarrierTailReplication.h"
X #include "Barrier.h"
X #include "Workgroup.h"
X@@ -198,7 +199,13 @@
X         // We have modified the function. Possibly created new loops.
X         // Update analysis passes.
X         DT->runOnFunction(*f);
X+        #ifdef LLVM_3_1
X         LI->getBase().Calculate(DT->getBase());
X+        #else
X+        // The algorithm has changed - Calculate is removed, Analyze used in stead.
X+        // See LLVM commit c9b1e25493b393013b28e5d457f2fb2845a4dd9f
X+        LI->getBase().Analyze(DT->getBase());
X+        #endif
X       }
X   }
X   processed_bbs.insert(subgraph_entry);
3f67e4644ea50c471a6071de4e047dac
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209241005.q8OA5np9069101>