import Data.Array.Accelerate as A import qualified Data.Array.Accelerate.LLVM.PTX as PTX import qualified Prelude as P xs :: Vector Int xs = fromList (Z :. 8) $ P.cycle [0, 1, 2, 3] -- | The lookup table corresponding to 'incMod4'. incMod4Table :: Vector Int incMod4Table = fromList (Z :. 4) [1, 2, 3, 4] -- | Use the indices from the second argument to look up eleemtns from the -- lookup table. lookup :: (Elt a, Shape sh) => Acc (Vector a) -> Acc (Array sh Int) -> Acc (Array sh a) lookup table = map (table !!) main :: P.IO () main = P.print P.$! PTX.runN lookup incMod4Table xs
clangon the command line to compile, rather than linking directly to the LLVM library, since you can get that binary directly from llvm.org. But I’m not sure if it would improve things substantially enough (at all?) to bother with the change.
gotoin C, and works fine with NVIDIA, but often triggers compiler bugs on AMD.
Exp awas actually evaluating the expression, not just pretty-printing it)