-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new data type that adds an abstraction to a region as AoS or SoA (
#272) * Add a new data type that adds an abstraction to a region as AoS or SoA * fix L2 examples * buildable commit * ir examples * potential IR for mkList (SOA) * add1 list ir example * edit * edit * use type alias for descriptive names
- Loading branch information
1 parent
480a9e6
commit 086c20f
Showing
17 changed files
with
256 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
-- AoS list representation of add1 | ||
{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False}} | ||
add1 :: List -> List | ||
{locvars [LRM {lrmLoc = Single "loc_154", | ||
lrmReg = AoSR (VarR "r_156"), | ||
lrmMode = Input}, | ||
LRM {lrmLoc = Single "loc_155", | ||
lrmReg = AoSR (VarR "r_157"), | ||
lrmMode = Output}], | ||
effs: [], | ||
locrets: [], | ||
parallel: False} | ||
add1 lst_17_96_134 = | ||
letloc (Single "loc_218") = ((Single "loc_155") + 1) in | ||
letloc (Single "loc_219") = ((Single "loc_218") + 8) in | ||
case lst_17_96_134 of | ||
Nil -> | ||
(Nil (Single "loc_155")) | ||
Cons i_18_97_135::(Single "case_213") rst_19_98_136::(Single "case_214") -> | ||
let i1_20_99_137 :: Int = i_18_97_135 + 1 in | ||
let fltPkd_102_138 :: (Packed List (Single "loc_219")) = (add1 [(Single "case_214"),(Single "loc_219")] rst_19_98_136) in | ||
(Cons (Single "loc_155") i1_20_99_137 fltPkd_102_138) | ||
|
||
-- SoA list representation of add1 | ||
{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False}} | ||
add1 :: List -> List | ||
{locvars [LRM {lrmLoc = SoA "loc_154" [(("Cons", 0), "loc_156")], | ||
lrmReg = SoAR (VarR "r_156") [(("Cons", 0)), (VarR "r_158")], | ||
lrmMode = Input}, | ||
LRM {lrmLoc = SoA "loc_155" [(("Cons", 0), "loc_157")] , | ||
lrmReg = SoAR (VarR "r_157") [(("Cons", 0), (VarR "r_159"))], | ||
lrmMode = Output}], | ||
effs: [], | ||
locrets: [], | ||
parallel: False} | ||
add1 lst_17_96_134 = | ||
letloc (SoA "loc_218" [(("Cons", 0), "loc_219")]) = (SoA ("loc_155" + 1) [(("Cons", 0), ("loc_157" + 8))]) in | ||
case lst_17_96_134 of | ||
Nil -> | ||
(Nil (SoA "loc_155" [(("Cons", 0), "loc_157")])) | ||
Cons i_18_97_135::(Single "case_213") rst_19_98_136::(Single "case_214") -> | ||
let i1_20_99_137 :: Int = i_18_97_135 + 1 in | ||
let fltPkd_102_138 :: (Packed List (SoA "loc_218" [(("Cons", 0), "loc_219")])) = (add1 [(Single "case_213"), (Single "case_214"),(SoA "loc_218" [(("Cons", 0), "loc_219")])] rst_19_98_136) in | ||
(Cons (SoA "loc_155" [(("Cons", 0), "loc_157")]) i1_20_99_137 fltPkd_102_138) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
-- AoS IR representation | ||
{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False}} | ||
mkList :: Int -> List | ||
{locvars [LRM {lrmLoc = Single "loc_140", | ||
lrmReg = AoSR (VarR "r_141"), | ||
lrmMode = Output}], | ||
effs: [], | ||
locrets: [], | ||
parallel: False} | ||
mkList length_14_82_117 = | ||
letloc (Single "loc_175") = ((Single "loc_140") + 1) in | ||
letloc (Single "loc_176") = ((Single "loc_175") + 8) in | ||
let fltIf_97_118 :: Bool = <=(length_14_82_117, 0) in | ||
if fltIf_97_118 | ||
then (Nil (Single "loc_140")) | ||
else let fltAppE_98_119 :: Int = length_14_82_117 - 1 in | ||
let rst_15_83_120 :: (Packed List (Single "loc_176")) = (mkList [(Single "loc_176")] fltAppE_98_119) in | ||
(Cons (Single "loc_140") length_14_82_117 rst_15_83_120) | ||
|
||
|
||
-- SoA IR representation | ||
{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False}} | ||
mkList :: Int -> List | ||
{locvars [LRM {lrmLoc = SoA "loc_140" [(("Cons", 0), "loc_141")], | ||
lrmReg = SoAR (VarR "r_141") [("Cons", 0), (VarR "r_142")], | ||
lrmMode = Output}], | ||
effs: [], | ||
locrets: [], | ||
parallel: False} | ||
mkList length_14_82_117 = | ||
-- This may need a new IR primitive?? to increment an SoA loc. | ||
letloc (SoA "loc_175" [(("Cons", 0), "loc_176")]) = (SoA ("loc_175" + 1) [(("Cons", 0), ("loc_141" + 8))]) in | ||
let fltIf_97_118 :: Bool = <=(length_14_82_117, 0) in | ||
if fltIf_97_118 | ||
then (Nil (SoA "loc_140" [(("Cons", 0), "loc_141")])) | ||
else let fltAppE_98_119 :: Int = length_14_82_117 - 1 in | ||
let rst_15_83_120 :: (Packed List (SoA "loc_175" [(("Cons", 0), "loc_176")])) = (mkList [(SoA "loc_175" [(("Cons", 0), "loc_176")])] fltAppE_98_119) in | ||
(Cons (SoA "loc_140" [(("Cons", 0), "loc_141")]) length_14_82_117 rst_15_83_120) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.