Skip to content

Instantly share code, notes, and snippets.

View tmcdonell's full-sized avatar
🐙
coalescing

Trevor L. McDonell tmcdonell

🐙
coalescing
View GitHub Profile
import Prelude as P
import Data.Array.Accelerate as A
import Similar
import Data.Array.Accelerate.CUDA as C
import Data.Array.Accelerate.Interpreter as I
main :: IO ()
main = do
@tmcdonell
tmcdonell / dotp.ll
Created February 24, 2014 22:37
dotp.ll
; ModuleID = 'dotp.ll'
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-apple-macosx10.9.0"
; Function Attrs: nounwind readonly ssp uwtable
define double @dotp(double* noalias nocapture readonly %xs, double* noalias nocapture readonly %ys, i32 %n) #0 {
entry:
%cmp5 = icmp sgt i32 %n, 0
br i1 %cmp5, label %for.body, label %for.end
@tmcdonell
tmcdonell / Test.hs
Created February 24, 2014 23:02
dotp-vectorize
import Control.Monad.Error
import LLVM.General.Context
import LLVM.General.Module
import LLVM.General.Target
import LLVM.General.Target.Options
import LLVM.General.PassManager
import LLVM.General.Transforms
import LLVM.General.Diagnostic
import LLVM.General.CommandLine
import Prelude as P
import Data.Array.Accelerate as A
import Data.Array.Accelerate.CUDA as C
import Data.Array.Accelerate.Interpreter as I
import Data.Array.Accelerate.Array.Sugar
input :: Acc (Vector Int32)
input = use $ fromList (Z :. 59) [3214586,-22955798,24117958,-20242782,-18004116,3985569,1024273,-32729186,-30502029,-5017248,3166066,4277396,4405509,19375005,24465845,21106830,-16052075,13200861,-27493632,17784659,4138004,16501551,25998396,2146684,13413209,-25369899,-25241634,-14754912,-28861012,-10508167,21070625,-29990464,16694578,-24171913,-2266914,-18248338,-24717578,18032912,-11713204,-3853636,25922588,-26181472,4306350,14492894,22005937,1681278,-27479141,29397304,19498557,-16341281,-26789977,-30407265,-7861545,10902053,31949840,27671411,30285084,3983719,11323650]
; ModuleID = 'map'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-f32:32:32-f64:64:64-n16:32:64"
target triple = "nvptx64-nvidia-cuda"
; Function Attrs: nounwind
define void @map(i64* noalias nocapture %out.ad0, i64 %out.sh0, i64* noalias nocapture readonly %fv0.ad0, i64 %fv0.sh0) #0 {
entry:
%0 = trunc i64 %out.sh0 to i32
%1 = tail call i32 @llvm.nvvm.read.ptx.sreg.nctaid.x() #2
%2 = tail call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() #2
//
// Generated by LLVM NVPTX Back-End
//
.version 3.1
.target sm_20
.address_size 64
// .globl map
// @map
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Prelude as P
import Data.Array.Accelerate as A
ok :: Acc (Vector (Point Float))
-> Acc (Vector (Cluster Float))
-> Acc (Vector (Cluster Float))
//
// Generated by LLVM NVPTX Back-End
//
.version 3.1
.target sm_30
.address_size 64
// .globl __nv_fminf
.visible .func (.param .b32 func_retval0) fminf
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- {-# OPTIONS_GHC -fdefer-type-errors #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Ghostbuster where
@tmcdonell
tmcdonell / gist:b385e1b8676348509dc8
Created July 7, 2015 06:03
lowerDicts $ ghostbuster feldspar_gadt nothing
-- pretty :: PP.Pretty a => a -> String
-- pretty = PP.prettyPrintStyleMode style mode
-- where
-- mode = PP.defaultMode { PP.classIndent = 2, PP.whereIndent = 2, PP.caseIndent = 2, PP.layout = PP.PPOffsideRule }
-- style = PP.style { PP.mode = PP.PageMode, PP.lineLength = 1000 }
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -Wall #-}