Skip to content

Instantly share code, notes, and snippets.

View tmcdonell's full-sized avatar
🐙
coalescing

Trevor L. McDonell tmcdonell

🐙
coalescing
View GitHub Profile
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
import Data.Array.Accelerate as A hiding ((!!), length)
import Data.Array.Accelerate.Debug as A
import Data.Array.Accelerate.Numeric.LinearAlgebra as A
import Data.Array.Accelerate.LLVM.Native as CPU
import Control.DeepSeq
{-# LANGUAGE OverloadedStrings #-}
import Text.Printf
import Foreign.Ptr
import Foreign.LibFFI -- package: libffi
import LLVM.Linking
import LLVM.OrcJIT
import LLVM.Internal.ObjectFile ( withObjectFile )
import qualified LLVM.Internal.OrcJIT.LinkingLayer as LL
\a0 -> let a1 =
fold
(\x0 x1 -> x0 + x1)
0
(delayed
((intersect
(intersect
(intersect
(indexSlice Z :. 0 :. 0 :. All (shape a0))
(indexSlice Z :. 1 :. 0 :. All (shape a0)))
import Data.Array.Accelerate as A
import Data.Array.Accelerate.Data.Bits as A
import Data.Array.Accelerate.Interpreter as I
import Prelude as P
-- simple test
test = gather (segmentedIndices info) vec
Scalar Z [1.6636479e16]
0.440618967s
1.6636479e16
0.22351678s
1.6636479e16
0.23023065s
\a0 a1 -> let a2 =
fold
(\x0 x1 -> x0 + x1)
0.0
a.out: file format elf64-x86-64
Disassembly of section .init:
0000000000400408 <_init>:
400408: 48 83 ec 08 sub $0x8,%rsp
40040c: 48 8b 05 e5 0b 20 00 mov 0x200be5(%rip),%rax # 600ff8 <__gmon_start__>
400413: 48 85 c0 test %rax,%rax
400416: 74 02 je 40041a <_init+0x12>
; ModuleID = 'map_1bf1a791bb25369d'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: nounwind
define void @map_1bf1a791bb25369d(i64 %ix.start, i64 %ix.end, double* noalias nocapture %out.ad0, double* noalias nocapture readonly %fv0.ad0) local_unnamed_addr #0 {
entry:
%0 = icmp slt i64 %ix.start, %ix.end
br i1 %0, label %while1.top.preheader, label %while1.exit
; ModuleID = 'map_1bf1a791bb25369d'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin15.6.0"
; Function Attrs: nounwind
define void @map_1bf1a791bb25369d(i64 %ix.start, i64 %ix.end, double* noalias nocapture %out.ad0, double* noalias nocapture readonly %fv0.ad0) local_unnamed_addr #0 {
entry:
%0 = icmp slt i64 %ix.start, %ix.end
br i1 %0, label %while1.top.preheader, label %while1.exit
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module ExtractSurface (extractSurface') where
import qualified Prelude as P
import Data.Word
import Data.Array.Accelerate
s333 :: Stencil3x3x3 Bool -> Exp Word8
-- lib/Lib.hs
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fplugin=Data.Array.Accelerate.LLVM.Native.Plugin #-}
module Lib where
import Data.Array.Accelerate as A
import Data.Array.Accelerate.LLVM.Native as CPU
dotp :: Vector Float -> Vector Float -> Scalar Float