Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
239 commits
Select commit Hold shift + click to select a range
2576b2e
wip
athas Oct 14, 2022
ec42c3a
Merge branch 'master' into flattening
athas Oct 22, 2022
f871257
More half-baked work.
athas Nov 3, 2022
23269ab
Merge branch 'master' into flattening
athas Nov 4, 2022
8c87f3e
Fix offset calculation.
athas Nov 6, 2022
eb10d91
Fix some things.
athas Nov 13, 2022
7fe28ad
Merge branch 'master' into flattening
athas Nov 16, 2022
d58ba99
Use full flattening in GPU pipelines.
athas Nov 16, 2022
138ceca
Irregular slice now works.
athas Nov 16, 2022
8e946a2
This always works.
athas Nov 16, 2022
fb21c05
Reshape and further Index fixes.
athas Nov 16, 2022
35669f9
Handle the most general case of Iota.
athas Nov 16, 2022
f2a79e4
Remove some warnings.
athas Nov 16, 2022
1682d88
More foldable.
athas Nov 16, 2022
ef35b71
Hacky initial support for flattening nested maps.
athas Nov 17, 2022
d2d7c7f
Flatten redomaps.
athas Nov 18, 2022
e9f778e
Merge branch 'master' into flattening
athas Dec 19, 2022
2496205
Merge branch 'master' into flattening
athas Jan 4, 2023
4945cd1
starting out
CKuke Jan 10, 2023
1e801d9
[WIP] `Update` flattening case
cornelius-sevald Jan 11, 2023
3fc3e0e
[WIP] Further work on `Update` flattening
cornelius-sevald Jan 13, 2023
ff6ceb3
test case
Jan 16, 2023
c05cc91
update1 test update
CKuke Jan 16, 2023
1768e8f
Fix `Update` flattening for single dimension slice
cornelius-sevald Jan 16, 2023
31e86dd
Irregular flattening `Update` fixed dimension
cornelius-sevald Jan 16, 2023
effa353
[WIP] Unhandled multi-dim `Update` test case
cornelius-sevald Jan 16, 2023
6e35c60
Format code
cornelius-sevald Jan 16, 2023
19c0eea
Merge branch 'master' into flattening
athas Jan 18, 2023
1640e0f
Merge branch 'master' into flattening
athas Jan 18, 2023
1d303c0
Move `Update` tests to `tests/flattening/`
cornelius-sevald Jan 18, 2023
84e3e85
Fully flatten replicated `elemArr` result
cornelius-sevald Jan 18, 2023
d1caa94
More `Update` flattening tests
cornelius-sevald Jan 18, 2023
450a5d5
futhark implementation of rule
Jan 18, 2023
ca0ddbb
Flatten `Update` fully irregular test case
cornelius-sevald Jan 18, 2023
1fe9ee8
More `Update` flattening test cases
cornelius-sevald Jan 18, 2023
e9bd637
updated futhark seg update
Jan 19, 2023
5c7e039
Variant stride in `update_fully_irregular.fut` test
cornelius-sevald Jan 19, 2023
cf924d6
Rename variables
cornelius-sevald Jan 19, 2023
42237f2
Merge branch 'master' into flattening
athas Feb 1, 2023
e7b5536
Merge commit 'cf924d6d9777915dfd4032b2b34fd4be6dad7e92' into flattening
athas Feb 1, 2023
63cae72
Disable for now.
athas Feb 1, 2023
5b01fa1
Refactor to use readInputs.
athas Feb 1, 2023
49227a2
Refactor slightly.
athas Feb 1, 2023
8b916b3
Perhaps this makes multiple dimensions work.
athas Feb 1, 2023
211effa
Handle general Updates.
athas Feb 1, 2023
8d4ea72
Catch this error.
athas Feb 2, 2023
71da6de
Merge branch 'master' into flattening
athas Feb 17, 2023
9658a97
Handle array results.
athas Feb 17, 2023
7d264e4
Flattening of Copy.
athas Feb 17, 2023
7f53214
Merge branch 'master' into flattening
athas Feb 25, 2023
44c8439
Merge branch 'master' into flattening
athas Mar 15, 2023
f9e5bc6
Incomplete work on nested maps.
athas Mar 15, 2023
30583cd
More work on nested maps.
athas Mar 15, 2023
c63c1fa
Merge branch 'master' into flattening
athas Mar 20, 2023
fd9fc78
All these SegOps should be virtualised.
athas Mar 20, 2023
04a2baa
Merge branch 'master' into flattening
athas Mar 22, 2023
df5a916
Merge branch 'master' into flattening
athas Apr 13, 2023
1224c48
Merge branch 'master' into flattening
athas Apr 13, 2023
4674db5
More work, including nonfunctional test.
athas Apr 13, 2023
442975f
Merge branch 'master' into flattening
athas Apr 14, 2023
62f5612
Merge branch 'master' into flattening
athas Apr 15, 2023
5d6c27f
Start of work on Replicate.
athas Apr 15, 2023
29af946
Further work on replicate.
athas Apr 16, 2023
b7de81a
Merge branch 'master' into flattening
athas Apr 16, 2023
ffda3c8
More work; not really working.
athas Apr 18, 2023
3ef7442
Merge branch 'master' into flattening
athas Apr 30, 2023
7f72edd
Merge branch 'master' into flattening
athas May 17, 2023
70b904d
Merge branch 'master' into flattening
athas May 21, 2023
024e6c7
Handle free irregular arrays in nested map.
athas May 21, 2023
29dacc5
Another test.
athas May 22, 2023
2b5809b
Handle free irregular arrays in nested maps.
athas May 22, 2023
e0dc387
Merge branch 'master' into flattening
athas May 30, 2023
9c8351b
Handle distribution of free and identity results.
athas May 30, 2023
d112f20
Start function flattening (#1870)
cornelius-sevald Jun 15, 2023
c5d7c03
Merge branch 'master' into flattening
athas Jun 15, 2023
2e37824
Merge branch 'master' into flattening
athas Jul 11, 2023
03cb09e
Merge branch 'master' into flattening
athas Jul 18, 2023
cb277e0
Merge branch 'master' into flattening
athas Jul 18, 2023
76b90a8
Merge branch 'master' into flattening
athas Sep 16, 2023
d8ef766
Merge branch 'master' into flattening
athas Sep 16, 2023
acb7caf
Flattening rearranges.
athas Sep 16, 2023
d14cf71
Add failing test.
athas Sep 16, 2023
daaf815
Merge branch 'master' into flattening
athas Dec 17, 2023
4bdf0e3
Fix type annotation.
athas Dec 17, 2023
aae4bd1
Better test data.
athas Dec 17, 2023
068a16e
Fix typo.
athas Dec 17, 2023
647e4fe
This seems wrong.
athas Dec 17, 2023
8aff0d5
New formatting.
athas Dec 17, 2023
9738c47
Document nomenclature.
athas Dec 17, 2023
db81070
Use nomenclature.
athas Dec 17, 2023
eb443bb
Style fixes.
athas Dec 17, 2023
8c224e4
More nomenclature.
athas Dec 17, 2023
9871516
Revert "This seems wrong."
athas Dec 17, 2023
e7ea05c
Maybe like this.
athas Dec 17, 2023
533ada3
Merge branch 'master' into flattening
athas Dec 29, 2023
c8ba2a7
Merge branch 'master' into flattening
athas Apr 11, 2024
8fcf415
Merge branch 'master' into flattening
athas Jul 19, 2024
a711470
Merge branch 'master' into flattening
athas Nov 23, 2024
3912379
Merge branch 'master' into flattening
athas Dec 4, 2024
be27284
Strangle some warnings.
athas Dec 4, 2024
f71c51e
Merge branch 'master' into flattening
athas Dec 6, 2024
41f7431
Merge branch 'master' into flattening
athas Dec 6, 2024
332c83b
Embellish comment.
athas Dec 6, 2024
76439b4
Style fixes.
athas Dec 6, 2024
25fc164
Reverse the regular dimensions here.
athas Dec 6, 2024
0ded15d
Progress.
athas Dec 11, 2024
f0782fb
Finally fix this demon.
athas Dec 11, 2024
9e5a132
Kill warnings.
athas Dec 16, 2024
6d7bcea
Merge branch 'master' into flattening
athas Jan 6, 2025
cfb0cf5
Flatten concat (#2215)
athas Jan 28, 2025
17bb870
Merge branch 'master' into flattening
athas May 7, 2025
ac787b6
Merge remote-tracking branch 'origin/flattening' into flattening
athas May 7, 2025
800e4f7
Fix final reshape.
athas May 8, 2025
fc1da2b
Merge branch 'master' into flattening
athas Jul 3, 2025
a77dd6f
Merge branch 'master' into flattening
athas Aug 8, 2025
0f5dbdf
Merge branch 'master' into flattening
athas Sep 12, 2025
d14bb73
Merge branch 'master' into flattening
athas Oct 6, 2025
482424b
Merge branch 'master' into flattening
athas Oct 14, 2025
86fc080
Merge branch 'master' into flattening
athas Feb 1, 2026
7bd102a
Merge branch 'master' into flattening
athas Feb 5, 2026
2203c53
Merge branch 'master' into flattening
athas Feb 12, 2026
5a29872
Hack.
athas Feb 12, 2026
9d952f6
Address reduction operator special case.
athas Feb 13, 2026
7d48bfe
Add sequentialisation fallback.
athas Feb 13, 2026
528f074
Fix update with constant value
AmirSpurs Feb 13, 2026
75a5940
Add basic support for array literals?
AmirSpurs Feb 15, 2026
59e73b1
Add const it for-loop
AmirSpurs Feb 17, 2026
2cc4f29
Fix scope
AmirSpurs Feb 18, 2026
3a065ca
Better tag handling
AmirSpurs Feb 19, 2026
8d1b1b4
Add messy while
AmirSpurs Feb 22, 2026
bc40e6c
Add messy while
AmirSpurs Feb 22, 2026
2038fc9
Add filter
AmirSpurs Feb 23, 2026
39a5794
filter instead of doPartition
AmirSpurs Feb 23, 2026
32d7bef
Fallback to doPartition
AmirSpurs Feb 24, 2026
0f3c1ab
add infinite loop
AmirSpurs Feb 24, 2026
1ca08f9
Add generalised IF
AmirSpurs Feb 25, 2026
a45ba12
Allow multiple output bindings
AmirSpurs Feb 25, 2026
7218605
Fix transformInnerMap bug
AmirSpurs Mar 1, 2026
e65f49f
Add Scan SOAC and lots of traceM
AmirSpurs Mar 3, 2026
ea709c0
Add Scratch, fall back WithAcc, and more traceM
AmirSpurs Mar 4, 2026
a753372
Merge branch 'master' into flattening
athas Mar 5, 2026
81120cb
Merge branch 'flattening' into amir-full-flattening
athas Mar 5, 2026
4c22194
Fix concatIrreg type bug
AmirSpurs Mar 5, 2026
61007bb
Add messy test cases
AmirSpurs Mar 5, 2026
559613f
cleanup
AmirSpurs Mar 8, 2026
696842c
Merge remote-tracking branch 'origin/master' into amir-full-flattening
AmirSpurs Mar 8, 2026
e937c8f
Lift for array param smarter
AmirSpurs Mar 10, 2026
6ee670b
Add initial avoidance
AmirSpurs Mar 11, 2026
8a453ef
Add another replicate test.
athas Mar 12, 2026
9501ed3
Add multi-dim-constant replicate
AmirSpurs Mar 13, 2026
c588779
lambda param result might be DistInput
AmirSpurs Mar 13, 2026
a875f57
Change in inner maps handling, add some tests
AmirSpurs Mar 13, 2026
1d13e15
Add multi-dim-var replicate
AmirSpurs Mar 16, 2026
743a9f9
Add basic support for flattening of regular WithAcc.
athas Mar 16, 2026
fe07d00
Merge branch 'master' into flattening
athas Mar 16, 2026
8fafd44
Refactor flattening pass into multiple modules.
athas Mar 16, 2026
bb5cc2e
Add Better isScalarDistStm
AmirSpurs Mar 16, 2026
4b36e25
Add multi-dim replicate tests
AmirSpurs Mar 16, 2026
595b041
Add outer Certs to scalar statements
AmirSpurs Mar 17, 2026
86b44bc
Better function naming
AmirSpurs Mar 17, 2026
a2a6dc4
Add Inner map failing tests
AmirSpurs Mar 19, 2026
c153ce3
Better DistStm classification strategy
AmirSpurs Mar 19, 2026
1b681ba
Fix name collision in readInputs
AmirSpurs Mar 19, 2026
12452e7
Start pretending to handle multiple segment dims.
athas Mar 19, 2026
f08ac64
Kill warnings.
athas Mar 19, 2026
6447417
Cleanup this code.
athas Mar 19, 2026
85ea180
Allow distribution over multiple dimensions.
athas Mar 19, 2026
80208c2
Add messy fix for inner map problem
AmirSpurs Mar 19, 2026
d929e8b
Adjust expected error.
athas Mar 20, 2026
2cdd647
Reformat.
athas Mar 20, 2026
1842c05
Merge branch 'master' into flattening
athas Mar 21, 2026
55bc177
Clean up
AmirSpurs Mar 22, 2026
414ba10
Add first support for regular maps
AmirSpurs Mar 24, 2026
730df2f
Some progress on multi-dim segs
AmirSpurs Mar 25, 2026
0636d56
Reformat
AmirSpurs Mar 25, 2026
c4da12b
Add highly irregular case - currently fails.
athas Mar 25, 2026
5907217
Matches can be parallel.
athas Mar 26, 2026
70ac9b7
Handle builtins.
athas Mar 26, 2026
30d808c
Flatten inside non-top-level statements.
athas Mar 26, 2026
87d3f17
Refactoring
AmirSpurs Mar 26, 2026
1fa1ef5
Clean up transformDistributed
AmirSpurs Mar 27, 2026
b16e28e
Fix scope bug in distributeAndTransformInnerMap
AmirSpurs Mar 27, 2026
1e90d14
Fix inner map result ordering
AmirSpurs Mar 27, 2026
68e518d
Add test for inner map result ordering
AmirSpurs Mar 27, 2026
f3ba162
Reject variant neutral elements in scan/reduce
AmirSpurs Mar 27, 2026
ebc12be
Fix name collision in readInputs again
AmirSpurs Mar 27, 2026
da5d172
read current dims for irregular rearrange and update
AmirSpurs Mar 30, 2026
428d0bb
Add generalized concat
AmirSpurs Mar 30, 2026
0f9e667
Add preprocessing to get rid of Stream
AmirSpurs Mar 31, 2026
2a72cf6
Add more general Reshape
AmirSpurs Mar 31, 2026
1d1ccd7
Get rid of complex Screma in pre process
AmirSpurs Mar 31, 2026
e921566
Add complex-screma test case
AmirSpurs Mar 31, 2026
c9a04a2
Interchanging reduce/scans with inner maps
AmirSpurs Apr 1, 2026
ad08178
MultiDim path can still have irregular result
AmirSpurs Apr 2, 2026
13aa026
Assume 1D IrregularD in onMapInputArr
AmirSpurs Apr 2, 2026
a9c70b9
Add irregular inputs handling in multidim path
AmirSpurs Apr 2, 2026
48f0a57
Reformat
AmirSpurs Apr 2, 2026
eefcfc9
Clean up with onMapIrregularInputArr
AmirSpurs Apr 2, 2026
589318d
No more trying to be smart, actually replicate in onMapFreeVar
AmirSpurs Apr 2, 2026
65cd3e7
Add parallel irreg arraylit
AmirSpurs Apr 4, 2026
7b0928d
Fix num_segments in ArrayLit
AmirSpurs Apr 4, 2026
d3c71d5
Add non-variant arraylit
AmirSpurs Apr 4, 2026
0e1281a
Add missing isAcc check in transformDistributedInnerMap
AmirSpurs Apr 4, 2026
ba14b65
Merge branch 'master' into flattening
athas Apr 6, 2026
64435ed
Add ArrayVal
AmirSpurs Apr 5, 2026
a1adf4b
classify some basicOps as parallel
AmirSpurs Apr 5, 2026
51e5014
Switch back to simpler classifier
AmirSpurs Apr 7, 2026
f5e742f
Add multi-dim support for unifrom for loops
AmirSpurs Apr 7, 2026
9090043
don't create empty scalars
AmirSpurs Apr 7, 2026
99a48bc
make the loop param/result shapes agree
AmirSpurs Apr 7, 2026
c93cbe0
Support for invariant ifs
AmirSpurs Apr 8, 2026
2168892
add multi-dim variant if
AmirSpurs Apr 8, 2026
770ce00
test case
AmirSpurs Apr 8, 2026
7329d6e
clean up
AmirSpurs Apr 9, 2026
ec8e6f4
do not lift every array to irreg in while loops
AmirSpurs Apr 10, 2026
a412494
Reformat
AmirSpurs Apr 10, 2026
bd47bbf
Clean up
AmirSpurs Apr 10, 2026
e1f9373
don't force irregualr for Match
AmirSpurs Apr 11, 2026
a953d63
clean up
AmirSpurs Apr 11, 2026
81c4067
more clean up
AmirSpurs Apr 11, 2026
73399fa
multi-dim support for transformFortoWhile
AmirSpurs Apr 11, 2026
28d5560
Use liftSubExpRegular in transformMatch
AmirSpurs Apr 13, 2026
0587aaf
Back to not replicating irregular free vars
AmirSpurs Apr 15, 2026
19441f9
Add IrregularKind to support replicated irregs
AmirSpurs Apr 15, 2026
041b06e
Some progress on replication avoidance
AmirSpurs Apr 15, 2026
ffb94b5
Merge branch 'master' into flattening
athas Apr 16, 2026
23d8412
Fix irregular array representation comment
AmirSpurs Apr 17, 2026
1eb0e42
Modify how we make our segops input ready
AmirSpurs Apr 20, 2026
982a02e
Clean up
AmirSpurs Apr 20, 2026
b2e45f2
Add segscan with pre map
AmirSpurs Apr 21, 2026
98b1bff
Add genSegRedomap
AmirSpurs Apr 21, 2026
b017db7
Add integrated redomap/scanomap
AmirSpurs Apr 21, 2026
74af6d5
Add MaposcanomapSOAC support
AmirSpurs Apr 22, 2026
5d06c26
Add multi-dim seg support for functions
AmirSpurs Apr 22, 2026
71444db
Use withacc new inputs instead of old inps
AmirSpurs Apr 23, 2026
502e7af
Add basic incremental flattening for inner maps
AmirSpurs Apr 23, 2026
7f5e4e1
Fix maposcanomap post map irregular rep problem
AmirSpurs Apr 23, 2026
df7baa1
Merge branch 'master' into flattening
athas Apr 23, 2026
8361e05
Merge branch 'master' into flattening
athas Apr 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions futhark.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,14 @@ library
Futhark.Pass.ExtractKernels.ToGPU
Futhark.Pass.ExtractMulticore
Futhark.Pass.FirstOrderTransform
Futhark.Pass.Flatten
Futhark.Pass.Flatten.Builtins
Futhark.Pass.Flatten.PreProcess
Futhark.Pass.Flatten.ISRWIM
Futhark.Pass.Flatten.Distribute
Futhark.Pass.Flatten.Match
Futhark.Pass.Flatten.Monad
Futhark.Pass.Flatten.WithAcc
Futhark.Pass.LiftAllocations
Futhark.Pass.LowerAllocations
Futhark.Pass.Simplify
Expand Down Expand Up @@ -490,6 +498,7 @@ library
, lsp-types >= 2.4.0.0
, mainland-pretty >=0.7.1
, cmark-gfm >=0.2.1
, OneTuple
, megaparsec >=9.0.0
, mtl >=2.2.1
, neat-interpolation >=0.3
Expand Down
36 changes: 36 additions & 0 deletions rewritefut/segupdate.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-- Flat-Parallel Segmented Update
-- ==
-- compiled input { [1i64,2i64,3i64,1i64,2i64,1i64,2i64,3i64,4i64] [3i64,2i64,4i64] [0i64,0i64,0i64,0i64,0i64] [2i64,1i64,2i64] [0i64, 1i64, 0i64] [1i64, 1i64, 2i64] } output { [0i64,0i64,3i64,1i64,0i64,0i64,2i64,0i64,4i64] }

let sgmSumI64 [n] (flg : [n]i64) (arr : [n]i64) : [n]i64 =
let flgs_vals =
scan ( \ (f1, x1) (f2,x2) ->
let f = f1 | f2 in
if f2 != 0 then (f, x2)
else (f, x1 + x2) )
(0, 0i64) (zip flg arr)
let (_, vals) = unzip flgs_vals
in vals

let mkFlagArray [m] (aoa_shp: [m]i64) (zero: i64)
(aoa_val: [m]i64) : []i64 =
let shp_rot = map(\i -> if i==0i64 then 0i64 else aoa_shp[i-1]) (iota m)
let shp_scn = scan (+) 0i64 shp_rot
let aoa_len = shp_scn[m-1]+aoa_shp[m-1]
let shp_ind = map2 (\shp ind -> if shp==0 then -1i64 else ind) aoa_shp shp_scn
in scatter (replicate aoa_len zero) shp_ind aoa_val

let segUpdate [n][m][t] (xss_val : *[n]i64) (shp_xss : [t]i64) (vss_val : [m]i64)
(shp_vss : [t]i64) (bs : [t]i64) (ss : [t]i64): [n]i64 =
let fvss = (mkFlagArray shp_vss 0 (1...t :> [t]i64)) :> [m]i64
let II1 = sgmSumI64 fvss fvss |> map (\x -> x - 1)
let shp_xss_rot = map(\i -> if i==0i64 then 0i64 else shp_xss[i-1]) (iota t)
let bxss = scan (+) 0 shp_xss_rot
let II2 = sgmSumI64 fvss (replicate m 1) |> map (\x -> x - 1)
let iss = map (\i -> bxss[II1[i]] + bs[II1[i]] + (II2[i] * ss[II1[i]])) (iota m)
in scatter xss_val iss vss_val


let main [n][m][t] (xss_val : *[n]i64) (shp_xss : [t]i64) (vss_val : [m]i64)
(shp_vss : [t]i64) (bs : [t]i64) (ss : [t]i64): [n]i64 =
segUpdate xss_val shp_xss vss_val shp_vss bs ss
2 changes: 2 additions & 0 deletions src/Futhark/CLI/Dev.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import Futhark.Pass.ExplicitAllocations.Seq qualified as Seq
import Futhark.Pass.ExtractKernels
import Futhark.Pass.ExtractMulticore
import Futhark.Pass.FirstOrderTransform
import Futhark.Pass.Flatten (flattenSOACs)
import Futhark.Pass.LiftAllocations as LiftAllocations
import Futhark.Pass.LowerAllocations as LowerAllocations
import Futhark.Pass.Simplify
Expand Down Expand Up @@ -723,6 +724,7 @@ commandLineOptions =
sinkOption [],
kernelsPassOption reduceDeviceSyncs [],
typedPassOption soacsProg GPU extractKernels [],
typedPassOption soacsProg GPU flattenSOACs [],
typedPassOption soacsProg MC extractMulticore [],
allocateOption "a",
kernelsMemPassOption doubleBufferGPU [],
Expand Down
1 change: 1 addition & 0 deletions src/Futhark/IR/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Futhark.IR.Pretty
( prettyTuple,
prettyTupleLines,
prettyString,
prettyRet,
PrettyRep (..),
)
where
Expand Down
13 changes: 6 additions & 7 deletions src/Futhark/IR/TypeCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import Futhark.Analysis.PrimExp
import Futhark.Construct (instantiateShapes)
import Futhark.IR.Aliases hiding (lookupAliases)
import Futhark.Util
import Futhark.Util.Pretty (align, docText, indent, ppTuple', pretty, (<+>), (</>))
import Futhark.Util.Pretty hiding (width)

-- | Information about an error during type checking. The 'Show'
-- instance for this type produces a human-readable description.
Expand Down Expand Up @@ -738,7 +738,7 @@ checkSubExp (Var ident) = context ("In subexp " <> prettyText ident) $ do
lookupType ident

checkCerts :: (Checkable rep) => Certs -> TypeM rep ()
checkCerts (Certs cs) = mapM_ (requireI (Prim Unit)) cs
checkCerts = mapM_ lookupType . unCerts

checkSubExpRes :: (Checkable rep) => SubExpRes -> TypeM rep Type
checkSubExpRes (SubExpRes cs se) = do
Expand Down Expand Up @@ -1028,9 +1028,9 @@ checkExp (Apply fname args rettype_annot _) = do
when (rettype_derived /= rettype_annot) $
bad . TypeError . docText $
"Expected apply result type:"
</> indent 2 (pretty $ map fst rettype_derived)
</> indent 2 (braces $ commasep $ map prettyRet rettype_derived)
</> "But annotation is:"
</> indent 2 (pretty $ map fst rettype_annot)
</> indent 2 (braces $ commasep $ map prettyRet rettype_annot)
consumeArgs paramtypes argflows
checkExp (Loop merge form loopbody) = do
let (mergepat, mergeexps) = unzip merge
Expand Down Expand Up @@ -1258,9 +1258,8 @@ checkStm ::
TypeM rep a ->
TypeM rep a
checkStm stm@(Let pat aux e) m = do
let Certs cs = stmAuxCerts aux
(_, dec) = stmAuxDec aux
context "When checking certificates" $ mapM_ (requireI $ Prim Unit) cs
let (_, dec) = stmAuxDec aux
context "When checking certificates" $ checkCerts $ stmAuxCerts aux
context "When checking expression annotation" $ checkExpDec dec
context ("When matching\n" <> message " " pat <> "\nwith\n" <> message " " e) $
matchPat pat e
Expand Down
4 changes: 4 additions & 0 deletions src/Futhark/Pass/ExtractKernels/ToGPU.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Futhark.Pass.ExtractKernels.ToGPU
segThread,
soacsLambdaToGPU,
soacsStmToGPU,
soacsExpToGPU,
scopeForGPU,
scopeForSOACs,
injectSOACS,
Expand Down Expand Up @@ -74,6 +75,9 @@ injectSOACS f =
soacsStmToGPU :: Stm SOACS -> Stm GPU
soacsStmToGPU = runIdentity . rephraseStm (injectSOACS OtherOp)

soacsExpToGPU :: Exp SOACS -> Exp GPU
soacsExpToGPU = runIdentity . rephraseExp (injectSOACS OtherOp)

soacsLambdaToGPU :: Lambda SOACS -> Lambda GPU
soacsLambdaToGPU = runIdentity . rephraseLambda (injectSOACS OtherOp)

Expand Down
Loading
Loading