From owner-freebsd-questions@FreeBSD.ORG Sun Jul 6 09:10:25 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E1D8DDF for ; Sun, 6 Jul 2014 09:10:25 +0000 (UTC) Received: from nm18-vm4.bullet.mail.ir2.yahoo.com (nm18-vm4.bullet.mail.ir2.yahoo.com [212.82.96.228]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02B432F5E for ; Sun, 6 Jul 2014 09:10:24 +0000 (UTC) Received: from [212.82.98.54] by nm18.bullet.mail.ir2.yahoo.com with NNFMP; 06 Jul 2014 09:07:48 -0000 Received: from [46.228.39.82] by tm7.bullet.mail.ir2.yahoo.com with NNFMP; 06 Jul 2014 09:07:48 -0000 Received: from [127.0.0.1] by smtp119.mail.ir2.yahoo.com with NNFMP; 06 Jul 2014 09:07:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s1024; t=1404637668; bh=aXQ62J/VBl25fNzufZA0+X8Iqgq7QRV/zTUnGw1i13k=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References:X-Mailer:Disposition-Notification-To:Mime-Version:Content-Type:Content-Transfer-Encoding; b=U07UqXs4l5tAHoPCCRMcMPpNDmTAXmXNaY80hjAWxMLr5rjm1gcMTbD+Cn1RvuWw5C2zNlsG8ycTwXyy6j2B92HpvgADJAlHnawCMIxJ2CbO/J3bY3vwZyExKT6ywYOC744nx4K2IOjpPEENSZ4mP4k3qMDXL6wIpyVv79anu7o= X-Yahoo-Newman-Id: 830108.32544.bm@smtp119.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-5 X-YMail-OSG: bnh4ys8VM1leNgmZEpCVDiKZOSRHY5HLs3BI2C423XZyzcF 5_pEOS4Tk_CSYLYLo2G5NHbX3Wp8zmZSz1gFtzbFQlwySeUXB8XBjNlbGJZE A0UuBTYp4NG0WWKz_ybRN5ovGuJcgEHbZkEnrYivuwhq3CrK3kzYUq9_xDG0 4Kb44_6jduGxOqC35D3B1S1WFy_hxiYeuwFaokihQjVVOKkfWUuqKzRCtNvC H1xxmN15ZKVblIQpxVrlPrbvnI1UTTXSMrnBfWpz.Q9FKlv_nQjr_eudjWeX yj_mkYSqo7vvlJckVBNkRPhLa5DvmD7e4m9KXa4PTkX52NeEX1sslbBuEPad 7NFaOPFrofQ4XqlZriGufMi4m4keKk3g8Qc95A4KNXrYuX7QAo4rQmJBL6zX x2.LX.pPlr1P50w75j.zXfFctbahXalFZ8JmwYg1dVosHMp._vWtxPP4e._p usJRwpkkK8xZWoy_CtBS.aHURxDIfv64yMyKQmroOWaSoncPiXyHEEGyv.Vf CyLQ88bwsv4jUrBNxx2BVyWVOBS9_nYNEC0gXRIf2k39mT7EGIb__pl_TqPn DqhcKLoj2BtMGyhgBm5QjQAX2k8bhKZM0Cj5y7TKD_e6UdPYIq6fIRCJYw24 CUNippNkG9strYuhLguJM4SaHZVsbAJX1ZhDYs7JCIZvEdalpjKIm6k9O0A5 SwGQghTRuKzUFNU8daD1SQvNOkmM7Hglr8kJrhFfZqMJz3pqJY.tvpINFA7l 3AD0GXv_fleXIvd8Q5w-- X-Yahoo-SMTP: mX392iiswBAeJNdO_s.EW62LZDJR X-Rocket-Received: from localhost (emorrasg@212.21.233.80 with plain [98.138.105.21]) by smtp119.mail.ir2.yahoo.com with SMTP; 06 Jul 2014 09:07:48 +0000 UTC Date: Sun, 6 Jul 2014 11:08:00 +0200 From: Eduardo Morras To: Shane Ambler Subject: Re: OpenCL under FreeBSD-10? Message-Id: <20140706110800.d93a5993ddb05af2e8253844@yahoo.es> In-Reply-To: <53B7901F.3020909@ShaneWare.Biz> References: <1404438060.76015.15.camel@btw.pki2.com> <20140705004936.86a175a89bd607eddb879eed@yahoo.es> <53B7901F.3020909@ShaneWare.Biz> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.22; amd64-portbld-freebsd9.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: sfourman@gmail.com, freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2014 09:10:25 -0000 On Sat, 05 Jul 2014 15:11:51 +0930 Shane Ambler wrote: > On 05/07/2014 08:31, Sam Fourman Jr. wrote: > > I am also interested in this.. > > > > > > On Fri, Jul 4, 2014 at 5:49 PM, Eduardo Morras > > wrote: > > > >> On Thu, 03 Jul 2014 18:41:00 -0700 > >> Dennis Glatting wrote: > >> > >>> Is there a working version of OpenCL somewhere for FreeBSD10? > >>> freeocl is broken, badly. > >> > >> Googling a bit shows llvm libclc project that outputs PTX (Nvidia) > >> code. Clang+llvm is part of the system, don't know if this piece > >> of llvm project has been ported too. > >> > >> http://llvm.org > >> > >> http://libclc.llvm.org/ > > According to http://llvm.org/docs/doxygen/html/Triple_8h_source.html > llvm supports spir and spir64 for "standard portable IR for OpenCL" > > Unfortunately we don't appear to have this enabled on freebsd. > From a ports installed llvm - `llc33 --version` > (base installed llc is a shorter list of only supported host cpu's) > > LLVM (http://llvm.org/): > LLVM version 3.3 > Optimized build. > Built Mar 21 2014 (05:38:50). > Default target: amd64-portbld-freebsd9.2 > Host CPU: corei7-avx > > Registered Targets: > nvptx - NVIDIA PTX 32-bit > nvptx64 - NVIDIA PTX 64-bit Then the target for nvidia assembler is enabled. My output for llc33 and llc34 --version shows the same results. This permit us to convert from llvm IR to nvidia PTX. Digging a bit more I found this page: http://steckdenis.be/post-2011-05-02-using-clang-to-compile-opencl-kernels.html Following it's examples show me: camibar% clang -v FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 Target: x86_64-unknown-freebsd9.2 Thread model: posix %mkdir opencl %cd opencl create file test.cl /* Header to make Clang compatible with OpenCL */ #define __global __attribute__((address_space(1))) int get_global_id(int index); /* Test kernel */ __kernel void test(__global float *in, __global float *out) { int index = get_global_id(0); out[index] = 3.14159f * in[index] + in[index]; } %clang -S -emit-llvm -o test.ll -x cl test.cl %ls test.cl test.ll %more test.ll ; ModuleID = 'test.cl' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-unknown-freebsd9.2" ; Function Attrs: nounwind uwtable define void @test(float addrspace(1)* nocapture %in, float addrspace(1)* nocapture %out) #0 { entry: %call = tail call i32 @get_global_id(i32 0) #3 %idxprom = sext i32 %call to i64 %arrayidx = getelementptr inbounds float addrspace(1)* %in, i64 %idxprom %0 = load float addrspace(1)* %arrayidx, align 4, !tbaa !1 ... So, clang3.3 in FreeBSD can compile opencl code to llvm assm (llvm IR). Will dig more when I'll have more time. Feel free to expand this mail thread. --- --- Eduardo Morras