knead 1.0.1.1 → 1.0.2
raw patch · 19 files changed
+387/−387 lines, 19 filesdep ~llvm-dsldep ~llvm-extraPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: llvm-dsl, llvm-extra
API changes (from Hackage documentation)
- Data.Array.Knead.Expression: modifyMultiValue :: (Value val, Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (Decomposed T pattern -> a) -> val tuple -> val (Composed a)
- Data.Array.Knead.Expression: modifyMultiValue2 :: (Value val, Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> a) -> val tupleA -> val tupleB -> val (Composed a)
- Data.Array.Knead.Expression: modifyMultiValueM :: (Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (forall r. () => Decomposed T pattern -> CodeGenFunction r a) -> Exp tuple -> Exp (Composed a)
- Data.Array.Knead.Expression: modifyMultiValueM2 :: (Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (forall r. () => Decomposed T patternA -> Decomposed T patternB -> CodeGenFunction r a) -> Exp tupleA -> Exp tupleB -> Exp (Composed a)
- Data.Array.Knead.Shape: instance (Data.Array.Knead.Shape.ToSize w, LLVM.Extra.Multi.Value.Private.Additive w, LLVM.Core.Type.IsInteger w, LLVM.Extra.ScalarOrVector.IntegerConstant w, GHC.Num.Num w, LLVM.Extra.Multi.Value.Private.Repr w GHC.Types.~ LLVM.Core.CodeGen.Value w, LLVM.Core.Instructions.CmpRet w, LLVM.Core.Type.IsPrimitive w, GHC.Enum.Enum e, GHC.Enum.Bounded e) => Data.Array.Knead.Shape.EnumBounded (Data.Enum.Storable.T w e)
- Data.Array.Knead.Shape: instance (GHC.Ix.Ix n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Multi.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.Range n)
- Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Multi.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.Cyclic n)
- Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Multi.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.Shifted n)
- Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Multi.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.ZeroBased n)
- Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Multi.Value.Private.Comparison n) => Data.Array.Knead.Shape.Sequence (Data.Array.Comfort.Shape.ZeroBased n)
- Data.Array.Knead.Shape.Cubic: instance (LLVM.DSL.Expression.Decompose sh, LLVM.DSL.Expression.Decompose s, LLVM.Extra.Multi.Value.Private.Decomposed LLVM.DSL.Expression.Exp s GHC.Types.~ LLVM.DSL.Expression.Exp Data.Array.Knead.Shape.Cubic.Int.Int, LLVM.Extra.Multi.Value.Private.PatternTuple s GHC.Types.~ Data.Array.Knead.Shape.Cubic.Int.Int, LLVM.Extra.Multi.Value.Private.PatternTuple sh GHC.Types.~ Data.Array.Knead.Shape.Cubic.T (Data.Array.Knead.Shape.Cubic.AtomTag sh) (Data.Array.Knead.Shape.Cubic.AtomRank sh), Type.Data.Num.Unary.Natural (Data.Array.Knead.Shape.Cubic.AtomRank sh)) => LLVM.DSL.Expression.Decompose (sh Data.Array.Knead.Shape.Cubic.:. s)
- Data.Array.Knead.Shape.Cubic: instance (Type.Data.Num.Unary.Natural rank, Type.Data.Num.Decimal.Number.Natural (Type.Data.Num.Decimal.Number.FromUnary rank), Type.Data.Num.Decimal.Number.Natural (Type.Data.Num.Decimal.Number.FromUnary rank Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.SizeOf Data.Array.Knead.Shape.Size)) => LLVM.Extra.Multi.Value.Marshal.C (Data.Array.Knead.Shape.Cubic.T tag rank)
- Data.Array.Knead.Shape.Cubic: instance Type.Data.Num.Unary.Natural rank => LLVM.Extra.Multi.Value.Private.C (Data.Array.Knead.Shape.Cubic.T tag rank)
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Marshal.C Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Private.Additive Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Private.C Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Private.Comparison Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Private.IntegerConstant Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Private.PseudoRing Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Multi.Value.Private.Real Data.Array.Knead.Shape.Cubic.Int.Int
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C n, LLVM.Extra.Multi.Value.Marshal.C n, Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Marshal.C sh, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.FoldOuterL n sh a b)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C n, LLVM.Extra.Multi.Value.Marshal.C n, LLVM.Extra.Multi.Value.Private.C acc, LLVM.Extra.Multi.Value.Storable.C final, LLVM.Extra.Multi.Value.Private.C final, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapAccumLSequence n acc final a b)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Marshal.C sh, Data.Array.Knead.Shape.C n, LLVM.Extra.Multi.Value.Marshal.C n, LLVM.Extra.Multi.Value.Private.C acc, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapAccumLSimple sh n acc a b)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Marshal.C sh, Data.Array.Knead.Shape.C n, LLVM.Extra.Multi.Value.Marshal.C n, LLVM.Extra.Multi.Value.Private.C acc, LLVM.Extra.Multi.Value.Storable.C final, LLVM.Extra.Multi.Value.Private.C final, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapAccumL sh n acc final a b)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Marshal.C sh, Data.Array.Knead.Shape.C n, LLVM.Extra.Multi.Value.Marshal.C n, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.AddDimension sh n a b)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Marshal.C sh, LLVM.Extra.Multi.Value.Storable.C a) => Data.Array.Knead.Symbolic.Render.Argument (Data.Array.Knead.Symbolic.Private.Array sh a)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh0, LLVM.Extra.Multi.Value.Marshal.C sh0, Data.Array.Knead.Shape.C sh1, LLVM.Extra.Multi.Value.Marshal.C sh1, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.Scatter sh0 sh1 a)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh0, LLVM.Extra.Multi.Value.Marshal.C sh0, Data.Array.Knead.Shape.C sh1, LLVM.Extra.Multi.Value.Marshal.C sh1, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.ScatterMaybe sh0 sh1 a)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.Sequence n, LLVM.Extra.Multi.Value.Marshal.C n, Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Marshal.C sh, LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.FilterOuter n sh a)
- Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.Sequence n, LLVM.Extra.Multi.Value.Marshal.C n, LLVM.Extra.Multi.Value.Storable.C b, LLVM.Extra.Multi.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapFilter n a b)
- Data.Array.Knead.Symbolic.Render: instance (LLVM.Extra.Multi.Value.Marshal.C sh, Data.Array.Knead.Shape.C sh, LLVM.Extra.Multi.Value.Storable.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.Private.Array sh a)
- Data.Array.Knead.Symbolic.Render: instance (LLVM.Extra.Multi.Value.Storable.C a, LLVM.Extra.Multi.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (LLVM.DSL.Expression.Exp a)
- Data.Array.Knead.Symbolic.Render: instance LLVM.Extra.Multi.Value.Marshal.C a => Data.Array.Knead.Symbolic.Render.Argument (LLVM.DSL.Expression.Exp a)
- Data.Array.Knead.Symbolic.Render: instance LLVM.Extra.Multi.Value.Marshal.C a => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.Render.MarshalExp a)
+ Data.Array.Knead.Expression: modifyNiceValue :: (Value val, Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (Decomposed T pattern -> a) -> val tuple -> val (Composed a)
+ Data.Array.Knead.Expression: modifyNiceValue2 :: (Value val, Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> a) -> val tupleA -> val tupleB -> val (Composed a)
+ Data.Array.Knead.Expression: modifyNiceValueM :: (Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (forall r. () => Decomposed T pattern -> CodeGenFunction r a) -> Exp tuple -> Exp (Composed a)
+ Data.Array.Knead.Expression: modifyNiceValueM2 :: (Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (forall r. () => Decomposed T patternA -> Decomposed T patternB -> CodeGenFunction r a) -> Exp tupleA -> Exp tupleB -> Exp (Composed a)
+ Data.Array.Knead.Shape: instance (Data.Array.Knead.Shape.ToSize w, LLVM.Extra.Nice.Value.Private.Additive w, LLVM.Core.Type.IsInteger w, LLVM.Extra.ScalarOrVector.IntegerConstant w, GHC.Num.Num w, LLVM.Extra.Nice.Value.Private.Repr w GHC.Types.~ LLVM.Core.CodeGen.Value w, LLVM.Core.Instructions.CmpRet w, LLVM.Core.Type.IsPrimitive w, GHC.Enum.Enum e, GHC.Enum.Bounded e) => Data.Array.Knead.Shape.EnumBounded (Data.Enum.Storable.T w e)
+ Data.Array.Knead.Shape: instance (GHC.Ix.Ix n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Nice.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.Range n)
+ Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Nice.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.Cyclic n)
+ Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Nice.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.Shifted n)
+ Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Nice.Value.Private.Comparison n) => Data.Array.Knead.Shape.C (Data.Array.Comfort.Shape.ZeroBased n)
+ Data.Array.Knead.Shape: instance (GHC.Real.Integral n, Data.Array.Knead.Shape.ToSize n, LLVM.Extra.Nice.Value.Private.Comparison n) => Data.Array.Knead.Shape.Sequence (Data.Array.Comfort.Shape.ZeroBased n)
+ Data.Array.Knead.Shape.Cubic: instance (LLVM.DSL.Expression.Decompose sh, LLVM.DSL.Expression.Decompose s, LLVM.Extra.Nice.Value.Private.Decomposed LLVM.DSL.Expression.Exp s GHC.Types.~ LLVM.DSL.Expression.Exp Data.Array.Knead.Shape.Cubic.Int.Int, LLVM.Extra.Nice.Value.Private.PatternTuple s GHC.Types.~ Data.Array.Knead.Shape.Cubic.Int.Int, LLVM.Extra.Nice.Value.Private.PatternTuple sh GHC.Types.~ Data.Array.Knead.Shape.Cubic.T (Data.Array.Knead.Shape.Cubic.AtomTag sh) (Data.Array.Knead.Shape.Cubic.AtomRank sh), Type.Data.Num.Unary.Natural (Data.Array.Knead.Shape.Cubic.AtomRank sh)) => LLVM.DSL.Expression.Decompose (sh Data.Array.Knead.Shape.Cubic.:. s)
+ Data.Array.Knead.Shape.Cubic: instance (Type.Data.Num.Unary.Natural rank, Type.Data.Num.Decimal.Number.Natural (Type.Data.Num.Decimal.Number.FromUnary rank), Type.Data.Num.Decimal.Number.Natural (Type.Data.Num.Decimal.Number.FromUnary rank Type.Data.Num.Decimal.Number.:*: LLVM.Core.Type.SizeOf Data.Array.Knead.Shape.Size)) => LLVM.Extra.Nice.Value.Marshal.C (Data.Array.Knead.Shape.Cubic.T tag rank)
+ Data.Array.Knead.Shape.Cubic: instance Type.Data.Num.Unary.Natural rank => LLVM.Extra.Nice.Value.Private.C (Data.Array.Knead.Shape.Cubic.T tag rank)
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Marshal.C Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Private.Additive Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Private.C Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Private.Comparison Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Private.IntegerConstant Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Private.PseudoRing Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Shape.Cubic.Int: instance LLVM.Extra.Nice.Value.Private.Real Data.Array.Knead.Shape.Cubic.Int.Int
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C n, LLVM.Extra.Nice.Value.Marshal.C n, Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Marshal.C sh, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a, LLVM.Extra.Nice.Value.Storable.C b, LLVM.Extra.Nice.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.FoldOuterL n sh a b)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C n, LLVM.Extra.Nice.Value.Marshal.C n, LLVM.Extra.Nice.Value.Private.C acc, LLVM.Extra.Nice.Value.Storable.C final, LLVM.Extra.Nice.Value.Private.C final, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a, LLVM.Extra.Nice.Value.Storable.C b, LLVM.Extra.Nice.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapAccumLSequence n acc final a b)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Marshal.C sh, Data.Array.Knead.Shape.C n, LLVM.Extra.Nice.Value.Marshal.C n, LLVM.Extra.Nice.Value.Private.C acc, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a, LLVM.Extra.Nice.Value.Storable.C b, LLVM.Extra.Nice.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapAccumLSimple sh n acc a b)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Marshal.C sh, Data.Array.Knead.Shape.C n, LLVM.Extra.Nice.Value.Marshal.C n, LLVM.Extra.Nice.Value.Private.C acc, LLVM.Extra.Nice.Value.Storable.C final, LLVM.Extra.Nice.Value.Private.C final, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a, LLVM.Extra.Nice.Value.Storable.C b, LLVM.Extra.Nice.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapAccumL sh n acc final a b)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Marshal.C sh, Data.Array.Knead.Shape.C n, LLVM.Extra.Nice.Value.Marshal.C n, LLVM.Extra.Nice.Value.Storable.C b, LLVM.Extra.Nice.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.AddDimension sh n a b)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Marshal.C sh, LLVM.Extra.Nice.Value.Storable.C a) => Data.Array.Knead.Symbolic.Render.Argument (Data.Array.Knead.Symbolic.Private.Array sh a)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh0, LLVM.Extra.Nice.Value.Marshal.C sh0, Data.Array.Knead.Shape.C sh1, LLVM.Extra.Nice.Value.Marshal.C sh1, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.Scatter sh0 sh1 a)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.C sh0, LLVM.Extra.Nice.Value.Marshal.C sh0, Data.Array.Knead.Shape.C sh1, LLVM.Extra.Nice.Value.Marshal.C sh1, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.ScatterMaybe sh0 sh1 a)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.Sequence n, LLVM.Extra.Nice.Value.Marshal.C n, Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Marshal.C sh, LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.FilterOuter n sh a)
+ Data.Array.Knead.Symbolic.Render: instance (Data.Array.Knead.Shape.Sequence n, LLVM.Extra.Nice.Value.Marshal.C n, LLVM.Extra.Nice.Value.Storable.C b, LLVM.Extra.Nice.Value.Private.C b) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.PhysicalParametric.MapFilter n a b)
+ Data.Array.Knead.Symbolic.Render: instance (LLVM.Extra.Nice.Value.Marshal.C sh, Data.Array.Knead.Shape.C sh, LLVM.Extra.Nice.Value.Storable.C a) => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.Private.Array sh a)
+ Data.Array.Knead.Symbolic.Render: instance (LLVM.Extra.Nice.Value.Storable.C a, LLVM.Extra.Nice.Value.Private.C a) => Data.Array.Knead.Symbolic.Render.C (LLVM.DSL.Expression.Exp a)
+ Data.Array.Knead.Symbolic.Render: instance LLVM.Extra.Nice.Value.Marshal.C a => Data.Array.Knead.Symbolic.Render.Argument (LLVM.DSL.Expression.Exp a)
+ Data.Array.Knead.Symbolic.Render: instance LLVM.Extra.Nice.Value.Marshal.C a => Data.Array.Knead.Symbolic.Render.C (Data.Array.Knead.Symbolic.Render.MarshalExp a)
- Data.Array.Knead.Expression: class () => Compose multituple where {
+ Data.Array.Knead.Expression: class () => Compose nicetuple where {
- Data.Array.Knead.Expression: compose :: Compose multituple => multituple -> Exp (Composed multituple)
+ Data.Array.Knead.Expression: compose :: Compose nicetuple => nicetuple -> Exp (Composed nicetuple)
- Data.Array.Knead.Expression: type family Composed multituple;
+ Data.Array.Knead.Expression: type family Composed nicetuple;
Files
- knead.cabal +5/−5
- src/Data/Array/Knead/Code.hs +4/−4
- src/Data/Array/Knead/Expression.hs +4/−4
- src/Data/Array/Knead/Shape.hs +98/−98
- src/Data/Array/Knead/Shape/Cubic.hs +43/−43
- src/Data/Array/Knead/Shape/Cubic/Int.hs +24/−24
- src/Data/Array/Knead/Shape/Orphan.hs +95/−95
- src/Data/Array/Knead/Symbolic.hs +5/−5
- src/Data/Array/Knead/Symbolic/Fold.hs +7/−7
- src/Data/Array/Knead/Symbolic/Physical.hs +8/−8
- src/Data/Array/Knead/Symbolic/PhysicalParametric.hs +7/−7
- src/Data/Array/Knead/Symbolic/PhysicalPrivate.hs +35/−35
- src/Data/Array/Knead/Symbolic/Private.hs +12/−12
- src/Data/Array/Knead/Symbolic/Render.hs +22/−22
- src/Data/Array/Knead/Symbolic/Render/Argument.hs +4/−4
- src/Data/Array/Knead/Symbolic/Render/Basic.hs +2/−2
- src/Data/Array/Knead/Symbolic/RenderAlt.hs +2/−2
- src/Data/Array/Knead/Symbolic/Slice.hs +5/−5
- test/Test/Array.hs +5/−5
knead.cabal view
@@ -1,5 +1,5 @@ Name: knead-Version: 1.0.1.1+Version: 1.0.2 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -51,7 +51,7 @@ Makefile Source-Repository this- Tag: 1.0.1.1+ Tag: 1.0.2 Type: darcs Location: https://hub.darcs.net/thielema/knead/ @@ -61,9 +61,9 @@ Library Build-Depends:- llvm-dsl >=0.1.1 && <0.2,- llvm-extra >=0.11 && <0.13,- llvm-tf >=9.0 && <17.1,+ llvm-dsl >=0.2 && <0.3,+ llvm-extra >=0.12.1 && <0.14,+ llvm-tf >=9.0 && <21.1, tfp >=1.0 && <1.1, comfort-array >=0.5 && <0.6, fixed-length >=0.2.1 && <0.3,
src/Data/Array/Knead/Code.hs view
@@ -4,8 +4,8 @@ import qualified Data.Array.Knead.Shape as Shape -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Core as LLVM @@ -17,8 +17,8 @@ getElementPtr :: (Shape.C sh, Shape.Index sh ~ ix, Storable.C a) =>- MultiValue.T sh -> LLVM.Value (Ptr a) ->- MultiValue.T ix ->+ NiceValue.T sh -> LLVM.Value (Ptr a) ->+ NiceValue.T ix -> LLVM.CodeGenFunction r (LLVM.Value (Ptr a)) getElementPtr sh ptr ix = flip Storable.advancePtr ptr =<< LLVM.bitcast =<< Shape.offset sh ix
src/Data/Array/Knead/Expression.hs view
@@ -38,10 +38,10 @@ mapTriple, tuple, untuple,- modifyMultiValue,- modifyMultiValue2,- modifyMultiValueM,- modifyMultiValueM2,+ modifyNiceValue,+ modifyNiceValue2,+ modifyNiceValueM,+ modifyNiceValueM2, Compose(..), Decompose(..), modify,
src/Data/Array/Knead/Shape.hs view
@@ -38,15 +38,15 @@ import qualified LLVM.DSL.Parameter as Param -import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue-import qualified LLVM.Extra.Multi.Iterator as IterMV+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue+import qualified LLVM.Extra.Nice.Iterator as IterNV import qualified LLVM.Extra.Tuple as Tuple import qualified LLVM.Extra.Memory as Memory import qualified LLVM.Extra.Iterator as Iter import qualified LLVM.Extra.ScalarOrVector as SoV import qualified LLVM.Extra.Arithmetic as A-import LLVM.Extra.Multi.Value (atom)+import LLVM.Extra.Nice.Value (atom) import qualified LLVM.Core as LLVM @@ -66,7 +66,7 @@ type Size = Word value :: (C sh, Expr.Value val) => sh -> val sh-value = Expr.lift0 . MultiValue.cons+value = Expr.lift0 . NiceValue.cons paramWith :: (Marshal.C b) =>@@ -75,16 +75,16 @@ (Marshal.C parameters) => (p -> parameters) -> (forall val. (Expr.Value val) =>- MultiValue.T parameters -> val b) ->+ NiceValue.T parameters -> val b) -> a) -> a paramWith p f =- Param.withMulti p (\get val -> f get (Expr.lift0 . val))+ Param.withNice p (\get val -> f get (Expr.lift0 . val)) load :: (Marshal.C sh) => f sh -> LLVM.Value (LLVM.Ptr (Marshal.Struct sh)) ->- LLVM.CodeGenFunction r (MultiValue.T sh)+ LLVM.CodeGenFunction r (NiceValue.T sh) load _ = Memory.load intersect :: (C sh) => Exp sh -> Exp sh -> Exp sh@@ -92,19 +92,19 @@ offset :: (C sh) =>- MultiValue.T sh -> MultiValue.T (Index sh) ->+ NiceValue.T sh -> NiceValue.T (Index sh) -> LLVM.CodeGenFunction r (LLVM.Value Size) offset sh ix = ($ ix) . snd =<< sizeOffset sh -class (MultiValue.C sh, MultiValue.C (Index sh), Shape.Indexed sh) => C sh where+class (NiceValue.C sh, NiceValue.C (Index sh), Shape.Indexed sh) => C sh where {- It would be better to restrict zipWith to matching shapes and turn shape intersection into a bound check. -} intersectCode ::- MultiValue.T sh -> MultiValue.T sh ->- LLVM.CodeGenFunction r (MultiValue.T sh)- size :: MultiValue.T sh -> LLVM.CodeGenFunction r (LLVM.Value Size)+ NiceValue.T sh -> NiceValue.T sh ->+ LLVM.CodeGenFunction r (NiceValue.T sh)+ size :: NiceValue.T sh -> LLVM.CodeGenFunction r (LLVM.Value Size) {- | Result is @(size, offset)@. @size@ must equal the result of 'size'.@@ -112,20 +112,20 @@ -} sizeOffset :: (Index sh ~ ix) =>- MultiValue.T sh ->+ NiceValue.T sh -> LLVM.CodeGenFunction r (LLVM.Value Size,- MultiValue.T ix -> LLVM.CodeGenFunction r (LLVM.Value Size))- iterator :: (Index sh ~ ix) => MultiValue.T sh -> Iter.T r (MultiValue.T ix)+ NiceValue.T ix -> LLVM.CodeGenFunction r (LLVM.Value Size))+ iterator :: (Index sh ~ ix) => NiceValue.T sh -> Iter.T r (NiceValue.T ix) loop :: (Index sh ~ ix, Tuple.Phi state) =>- (MultiValue.T ix -> state -> LLVM.CodeGenFunction r state) ->- MultiValue.T sh -> state -> LLVM.CodeGenFunction r state+ (NiceValue.T ix -> state -> LLVM.CodeGenFunction r state) ->+ NiceValue.T sh -> state -> LLVM.CodeGenFunction r state loop f sh = Iter.mapState_ f (iterator sh) instance C () where- intersectCode _ _ = return $ MultiValue.cons ()+ intersectCode _ _ = return $ NiceValue.cons () size _ = return A.one sizeOffset _ = return (A.one, \_ -> return A.zero) iterator = Iter.singleton@@ -137,34 +137,34 @@ zeroIndex :: (Expr.Value val) => f sh -> val (Index sh) instance Scalar () where- scalar = Expr.lift0 $ MultiValue.Cons ()- zeroIndex _ = Expr.lift0 $ MultiValue.Cons ()+ scalar = Expr.lift0 $ NiceValue.Cons ()+ zeroIndex _ = Expr.lift0 $ NiceValue.Cons () class (C sh,- MultiValue.IntegerConstant (Index sh),- MultiValue.Additive (Index sh)) =>+ NiceValue.IntegerConstant (Index sh),+ NiceValue.Additive (Index sh)) => Sequence sh where sequenceShapeFromIndex ::- MultiValue.T (Index sh) -> LLVM.CodeGenFunction r (MultiValue.T sh)+ NiceValue.T (Index sh) -> LLVM.CodeGenFunction r (NiceValue.T sh) class- (MultiValue.Additive n, MultiValue.Real n, MultiValue.IntegerConstant n) =>+ (NiceValue.Additive n, NiceValue.Real n, NiceValue.IntegerConstant n) => ToSize n where- toSize :: MultiValue.T n -> LLVM.CodeGenFunction r (LLVM.Value Size)+ toSize :: NiceValue.T n -> LLVM.CodeGenFunction r (LLVM.Value Size) -instance ToSize Word8 where toSize (MultiValue.Cons n) = LLVM.ext n-instance ToSize Word16 where toSize (MultiValue.Cons n) = LLVM.ext n-instance ToSize Word32 where toSize (MultiValue.Cons n) = LLVM.adapt n-instance ToSize Word64 where toSize (MultiValue.Cons n) = LLVM.adapt n-instance ToSize Word where toSize (MultiValue.Cons n) = LLVM.adapt n-instance ToSize Int8 where toSize (MultiValue.Cons n) = LLVM.zext n-instance ToSize Int16 where toSize (MultiValue.Cons n) = LLVM.zext n-instance ToSize Int32 where toSize (MultiValue.Cons n) = LLVM.zadapt n-instance ToSize Int64 where toSize (MultiValue.Cons n) = LLVM.zadapt n-instance ToSize Int where toSize (MultiValue.Cons n) = LLVM.zadapt n+instance ToSize Word8 where toSize (NiceValue.Cons n) = LLVM.ext n+instance ToSize Word16 where toSize (NiceValue.Cons n) = LLVM.ext n+instance ToSize Word32 where toSize (NiceValue.Cons n) = LLVM.adapt n+instance ToSize Word64 where toSize (NiceValue.Cons n) = LLVM.adapt n+instance ToSize Word where toSize (NiceValue.Cons n) = LLVM.adapt n+instance ToSize Int8 where toSize (NiceValue.Cons n) = LLVM.zext n+instance ToSize Int16 where toSize (NiceValue.Cons n) = LLVM.zext n+instance ToSize Int32 where toSize (NiceValue.Cons n) = LLVM.zadapt n+instance ToSize Int64 where toSize (NiceValue.Cons n) = LLVM.zadapt n+instance ToSize Int where toSize (NiceValue.Cons n) = LLVM.zadapt n {- |@@ -177,26 +177,26 @@ Maybe we need an additional ZeroBased type for unsigned array sizes. -} instance- (Integral n, ToSize n, MultiValue.Comparison n) => C (ZeroBased n) where+ (Integral n, ToSize n, NiceValue.Comparison n) => C (ZeroBased n) where intersectCode sha shb =- zeroBased <$> MultiValue.min (zeroBasedSize sha) (zeroBasedSize shb)+ zeroBased <$> NiceValue.min (zeroBasedSize sha) (zeroBasedSize shb) size = toSize . zeroBasedSize sizeOffset sh = Monad.lift2 (,) (toSize $ zeroBasedSize sh) (return toSize) iterator sh =- IterMV.take (zeroBasedSize sh) $- Iter.iterate MultiValue.inc MultiValue.zero+ IterNV.take (zeroBasedSize sh) $+ Iter.iterate NiceValue.inc NiceValue.zero instance- (Integral n, ToSize n, MultiValue.Comparison n) =>+ (Integral n, ToSize n, NiceValue.Comparison n) => Sequence (ZeroBased n) where sequenceShapeFromIndex = return . zeroBased rangeSize :: (ToSize n) =>- Range (MultiValue.T n) -> LLVM.CodeGenFunction r (LLVM.Value Size)+ Range (NiceValue.T n) -> LLVM.CodeGenFunction r (LLVM.Value Size) rangeSize (Range from to) =- toSize =<< MultiValue.inc =<< MultiValue.sub to from+ toSize =<< NiceValue.inc =<< NiceValue.sub to from rangeFrom :: (Expr.Value val) => val (Range n) -> val n@@ -208,25 +208,25 @@ range :: (Expr.Value val) => val n -> val n -> val (Range n) range = Expr.lift2 $- \(MultiValue.Cons from) (MultiValue.Cons to) ->- MultiValue.Cons (Range from to)+ \(NiceValue.Cons from) (NiceValue.Cons to) ->+ NiceValue.Cons (Range from to) -instance (Ix n, ToSize n, MultiValue.Comparison n) => C (Range n) where+instance (Ix n, ToSize n, NiceValue.Comparison n) => C (Range n) where intersectCode =- MultiValue.modifyF2 (singletonRange atom) (singletonRange atom) $+ NiceValue.modifyF2 (singletonRange atom) (singletonRange atom) $ \(Range fromN toN) (Range fromM toM) ->- Monad.lift2 Range (MultiValue.max fromN fromM) (MultiValue.min toN toM)+ Monad.lift2 Range (NiceValue.max fromN fromM) (NiceValue.min toN toM) size = rangeSize . unzipRange sizeOffset rngValue = case unzipRange rngValue of rng@(Range from _to) -> Monad.lift2 (,) (rangeSize rng)- (return $ \i -> toSize =<< MultiValue.sub i from)+ (return $ \i -> toSize =<< NiceValue.sub i from) iterator rngValue =- case MultiValue.decompose (singletonRange atom) rngValue of+ case NiceValue.decompose (singletonRange atom) rngValue of Range from to ->- IterMV.takeWhile (MultiValue.cmp LLVM.CmpGE to) $- Iter.iterate MultiValue.inc from+ IterNV.takeWhile (NiceValue.cmp LLVM.CmpGE to) $+ Iter.iterate NiceValue.inc from @@ -239,57 +239,57 @@ shifted :: (Expr.Value val) => val n -> val n -> val (Shifted n) shifted = Expr.lift2 $- \(MultiValue.Cons from) (MultiValue.Cons to) ->- MultiValue.Cons (Shifted from to)+ \(NiceValue.Cons from) (NiceValue.Cons to) ->+ NiceValue.Cons (Shifted from to) -instance (Integral n, ToSize n, MultiValue.Comparison n) => C (Shifted n) where+instance (Integral n, ToSize n, NiceValue.Comparison n) => C (Shifted n) where intersectCode =- MultiValue.modifyF2 (singletonShifted atom) (singletonShifted atom) $+ NiceValue.modifyF2 (singletonShifted atom) (singletonShifted atom) $ \(Shifted startN lenN) (Shifted startM lenM) -> do- start <- MultiValue.max startN startM- endN <- MultiValue.add startN lenN- endM <- MultiValue.add startM lenM- end <- MultiValue.min endN endM- Shifted start <$> MultiValue.sub end start+ start <- NiceValue.max startN startM+ endN <- NiceValue.add startN lenN+ endM <- NiceValue.add startM lenM+ end <- NiceValue.min endN endM+ Shifted start <$> NiceValue.sub end start size = toSize . shiftedSize sizeOffset shapeValue = case unzipShifted shapeValue of Shifted start len -> Monad.lift2 (,) (toSize len)- (return $ \i -> toSize =<< MultiValue.sub i start)+ (return $ \i -> toSize =<< NiceValue.sub i start) iterator rngValue =- case MultiValue.decompose (singletonShifted atom) rngValue of+ case NiceValue.decompose (singletonShifted atom) rngValue of Shifted from len ->- IterMV.take len $ Iter.iterate MultiValue.inc from+ IterNV.take len $ Iter.iterate NiceValue.inc from instance- (Integral n, ToSize n, MultiValue.Comparison n) => C (Cyclic n) where+ (Integral n, ToSize n, NiceValue.Comparison n) => C (Cyclic n) where intersectCode sha shb =- cyclic <$> MultiValue.min (cyclicSize sha) (cyclicSize shb)+ cyclic <$> NiceValue.min (cyclicSize sha) (cyclicSize shb) size = toSize . cyclicSize sizeOffset sh = Monad.lift2 (,) (toSize $ cyclicSize sh) (return toSize) iterator sh =- IterMV.take (cyclicSize sh) $- Iter.iterate MultiValue.inc MultiValue.zero+ IterNV.take (cyclicSize sh) $+ Iter.iterate NiceValue.inc NiceValue.zero -class (IterMV.Enum enum, MultiValue.Bounded enum) => EnumBounded enum where- enumOffset :: MultiValue.T enum -> LLVM.CodeGenFunction r (LLVM.Value Size)+class (IterNV.Enum enum, NiceValue.Bounded enum) => EnumBounded enum where+ enumOffset :: NiceValue.T enum -> LLVM.CodeGenFunction r (LLVM.Value Size) instance- (ToSize w, MultiValue.Additive w,+ (ToSize w, NiceValue.Additive w, LLVM.IsInteger w, SoV.IntegerConstant w, Num w,- MultiValue.Repr w ~ LLVM.Value w,+ NiceValue.Repr w ~ LLVM.Value w, LLVM.CmpRet w, LLVM.IsPrimitive w, Enum e, Bounded e) => EnumBounded (Enum.T w e) where enumOffset ix = toSize =<<- MultiValue.sub- (MultiValue.fromEnum ix)- (MultiValue.fromEnum $ MultiValue.minBound `asTypeOf` ix)+ NiceValue.sub+ (NiceValue.fromEnum ix)+ (NiceValue.fromEnum $ NiceValue.minBound `asTypeOf` ix) instance (Enum enum, Bounded enum, EnumBounded enum) => C (Enumeration enum) where@@ -298,32 +298,32 @@ sizeOffset sh = do sz <- size sh return (sz, enumOffset)- iterator _ = IterMV.enumFromTo MultiValue.minBound MultiValue.maxBound+ iterator _ = IterNV.enumFromTo NiceValue.minBound NiceValue.maxBound plainEnumeration :: val (Enumeration enum) -> Enumeration enum plainEnumeration _ = Enumeration instance (C sh) => C (Tagged tag sh) where- intersectCode = MultiValue.liftTaggedM2 intersectCode- size = size . MultiValue.untag+ intersectCode = NiceValue.liftTaggedM2 intersectCode+ size = size . NiceValue.untag sizeOffset =- fmap (mapSnd (. MultiValue.untag)) . sizeOffset . MultiValue.untag- iterator = fmap MultiValue.tag . iterator . MultiValue.untag+ fmap (mapSnd (. NiceValue.untag)) . sizeOffset . NiceValue.untag+ iterator = fmap NiceValue.tag . iterator . NiceValue.untag instance (C n, C m) => C (n,m) where intersectCode a b =- case (MultiValue.unzip a, MultiValue.unzip b) of+ case (NiceValue.unzip a, NiceValue.unzip b) of ((an,am), (bn,bm)) ->- Monad.lift2 MultiValue.zip+ Monad.lift2 NiceValue.zip (intersectCode an bn) (intersectCode am bm) size nm =- case MultiValue.unzip nm of+ case NiceValue.unzip nm of (n,m) -> Monad.liftJoin2 A.mul (size n) (size m) sizeOffset nm =- case MultiValue.unzip nm of+ case NiceValue.unzip nm of (n,m) -> do (ns, iOffset) <- sizeOffset n (ms, jOffset) <- sizeOffset m@@ -331,35 +331,35 @@ return (sz, \ij ->- case MultiValue.unzip ij of+ case NiceValue.unzip ij of (i,j) -> do il <- iOffset i jl <- jOffset j A.add jl =<< A.mul ms il) iterator nm =- case MultiValue.unzip nm of+ case NiceValue.unzip nm of (n,m) ->- uncurry MultiValue.zip <$>+ uncurry NiceValue.zip <$> Iter.cartesian (iterator n) (iterator m) loop code nm =- case MultiValue.unzip nm of- (n,m) -> loop (\i -> loop (\j -> code (MultiValue.zip i j)) m) n+ case NiceValue.unzip nm of+ (n,m) -> loop (\i -> loop (\j -> code (NiceValue.zip i j)) m) n instance (C n, C m, C l) => C (n,m,l) where intersectCode a b =- case (MultiValue.unzip3 a, MultiValue.unzip3 b) of+ case (NiceValue.unzip3 a, NiceValue.unzip3 b) of ((ai,aj,ak), (bi,bj,bk)) ->- Monad.lift3 MultiValue.zip3+ Monad.lift3 NiceValue.zip3 (intersectCode ai bi) (intersectCode aj bj) (intersectCode ak bk) size nml =- case MultiValue.unzip3 nml of+ case NiceValue.unzip3 nml of (n,m,l) -> Monad.liftJoin2 A.mul (size n) $ Monad.liftJoin2 A.mul (size m) (size l) sizeOffset nml =- case MultiValue.unzip3 nml of+ case NiceValue.unzip3 nml of (n,m,l) -> do (ns, iOffset) <- sizeOffset n (ms, jOffset) <- sizeOffset m@@ -368,21 +368,21 @@ return (sz, \ijk ->- case MultiValue.unzip3 ijk of+ case NiceValue.unzip3 ijk of (i,j,k) -> do il <- iOffset i jl <- jOffset j kl <- kOffset k A.add kl =<< A.mul ls =<< A.add jl =<< A.mul ms il) iterator nml =- case MultiValue.unzip3 nml of+ case NiceValue.unzip3 nml of (n,m,l) ->- fmap (\(a,(b,c)) -> MultiValue.zip3 a b c) $+ fmap (\(a,(b,c)) -> NiceValue.zip3 a b c) $ Iter.cartesian (iterator n) $ Iter.cartesian (iterator m) (iterator l) loop code nml =- case MultiValue.unzip3 nml of+ case NiceValue.unzip3 nml of (n,m,l) -> loop (\i -> loop (\j -> loop (\k ->- code (MultiValue.zip3 i j k))+ code (NiceValue.zip3 i j k)) l) m) n
src/Data/Array/Knead/Shape/Cubic.hs view
@@ -31,14 +31,14 @@ import qualified LLVM.DSL.Parameter as Param -import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue-import qualified LLVM.Extra.Multi.Iterator as IterMV+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue+import qualified LLVM.Extra.Nice.Iterator as IterNV import qualified LLVM.Extra.Iterator as Iter import qualified LLVM.Extra.Arithmetic as A import qualified LLVM.Extra.Tuple as Tuple import qualified LLVM.Extra.Control as C-import LLVM.Extra.Multi.Value (Atom)+import LLVM.Extra.Nice.Value (Atom) import qualified LLVM.Core as LLVM @@ -79,7 +79,7 @@ (Marshal.C parameters) => (p -> parameters) -> (forall val. (Expr.Value val) =>- MultiValue.T parameters -> val (T tag rank)) ->+ NiceValue.T parameters -> val (T tag rank)) -> a) -> a paramWith p f =@@ -91,7 +91,7 @@ Dec.Natural (Dec.FromUnary rank), Dec.Natural (Dec.FromUnary rank Dec.:*: LLVM.SizeOf Shape.Size)) => Param.T p (T tag rank) -> Param.Tunnel p (T tag rank)-tunnel p = Param.tunnel MultiValue.cons p+tunnel p = Param.tunnel NiceValue.cons p data Z = Z@@ -114,22 +114,22 @@ val (T tag rank) -> val Index.Int -> val (T tag (Unary.Succ rank)) cons = Expr.lift2 $- \(MultiValue.Cons t) (MultiValue.Cons h) -> MultiValue.Cons (h!:t)+ \(NiceValue.Cons t) (NiceValue.Cons h) -> NiceValue.Cons (h!:t) z :: (Expr.Value val) => val (T tag Unary.Zero)-z = Expr.lift0 $ MultiValue.Cons FixedLength.end+z = Expr.lift0 $ NiceValue.Cons FixedLength.end head :: (Expr.Value val, Unary.Natural rank) => val (T tag (Unary.Succ rank)) -> val Index.Int head =- Expr.lift1 $ \(MultiValue.Cons sh) -> MultiValue.Cons $ FixedLength.head sh+ Expr.lift1 $ \(NiceValue.Cons sh) -> NiceValue.Cons $ FixedLength.head sh tail :: (Expr.Value val, Unary.Natural rank) => val (T tag (Unary.Succ rank)) -> val (T tag rank) tail =- Expr.lift1 $ \(MultiValue.Cons sh) -> MultiValue.Cons $ FixedLength.tail sh+ Expr.lift1 $ \(NiceValue.Cons sh) -> NiceValue.Cons $ FixedLength.tail sh switchR :: (Unary.Natural rank) =>@@ -144,8 +144,8 @@ instance (tag ~ ShapeTag, rank ~ Unary.Zero) => Shape.Scalar (T tag rank) where- scalar = Expr.lift0 $ MultiValue.Cons FixedLength.end- zeroIndex _ = Expr.lift0 $ MultiValue.Cons FixedLength.end+ scalar = Expr.lift0 $ NiceValue.Cons FixedLength.end+ zeroIndex _ = Expr.lift0 $ NiceValue.Cons FixedLength.end type family AtomRank sh@@ -156,17 +156,17 @@ type instance AtomTag (Atom (T tag rank)) = tag type instance AtomTag (sh:.s) = AtomTag sh -type instance MultiValue.PatternTuple (sh:.s) =+type instance NiceValue.PatternTuple (sh:.s) = T (AtomTag sh) (Unary.Succ (AtomRank sh)) -type instance MultiValue.Decomposed f (sh:.s) =- MultiValue.Decomposed f sh :. f Index.Int+type instance NiceValue.Decomposed f (sh:.s) =+ NiceValue.Decomposed f sh :. f Index.Int instance (Expr.Decompose sh, Expr.Decompose s,- MultiValue.Decomposed Exp s ~ Exp Index.Int,- MultiValue.PatternTuple s ~ Index.Int,- MultiValue.PatternTuple sh ~ T (AtomTag sh) (AtomRank sh),+ NiceValue.Decomposed Exp s ~ Exp Index.Int,+ NiceValue.PatternTuple s ~ Index.Int,+ NiceValue.PatternTuple sh ~ T (AtomTag sh) (AtomRank sh), Unary.Natural (AtomRank sh)) => Expr.Decompose (sh :. s) where decompose (psh:.ps) x =@@ -208,19 +208,19 @@ toFixedList xs = snd $ Trav.mapAccumL (\(y:ys) () -> (ys,y)) xs (pure ()) -instance (Unary.Natural rank) => MultiValue.C (T tag rank) where- type Repr (T tag rank) = FixedLength.T rank (MultiValue.Repr Index.Int)- cons = MultiValue.Cons . fmap (\(Index.Int i) -> LLVM.valueOf i) . decons- undef = constant $ MultiValue.undef- zero = constant $ MultiValue.zero- addPhi bb (MultiValue.Cons a) (MultiValue.Cons b) =+instance (Unary.Natural rank) => NiceValue.C (T tag rank) where+ type Repr (T tag rank) = FixedLength.T rank (NiceValue.Repr Index.Int)+ cons = NiceValue.Cons . fmap (\(Index.Int i) -> LLVM.valueOf i) . decons+ undef = constant $ NiceValue.undef+ zero = constant $ NiceValue.zero+ addPhi bb (NiceValue.Cons a) (NiceValue.Cons b) = Tuple.addPhiFoldable bb a b- phi bb (MultiValue.Cons a) =- fmap MultiValue.Cons . Tuple.phiTraversable bb $ a+ phi bb (NiceValue.Cons a) =+ fmap NiceValue.Cons . Tuple.phiTraversable bb $ a constant ::- (Unary.Natural rank) => MultiValue.T Index.Int -> MultiValue.T (T tag rank)-constant (MultiValue.Cons x) = MultiValue.Cons $ pure x+ (Unary.Natural rank) => NiceValue.T Index.Int -> NiceValue.T (T tag rank)+constant (NiceValue.Cons x) = NiceValue.Cons $ pure x instance (tag ~ ShapeTag, Unary.Natural rank) =>@@ -254,9 +254,9 @@ instance (tag ~ ShapeTag, Unary.Natural rank) => Shape.C (T tag rank) where- size (MultiValue.Cons sh) = Fold.foldlM A.mul A.one sh- intersectCode (MultiValue.Cons sh0) (MultiValue.Cons sh1) =- fmap MultiValue.Cons $ Trav.sequence $ FixedLength.zipWith A.min sh0 sh1+ size (NiceValue.Cons sh) = Fold.foldlM A.mul A.one sh+ intersectCode (NiceValue.Cons sh0) (NiceValue.Cons sh1) =+ fmap NiceValue.Cons $ Trav.sequence $ FixedLength.zipWith A.min sh0 sh1 sizeOffset sh = -- would a joint implementation be more efficient? liftM2 (,) (Shape.size sh) (return $ offsetCode sh)@@ -266,9 +266,9 @@ offsetCode :: (Unary.Natural rank) =>- MultiValue.T (Shape rank) -> MultiValue.T (Index rank) ->+ NiceValue.T (Shape rank) -> NiceValue.T (Index rank) -> LLVM.CodeGenFunction r (LLVM.Value Shape.Size)-offsetCode (MultiValue.Cons sh) (MultiValue.Cons ix) =+offsetCode (NiceValue.Cons sh) (NiceValue.Cons ix) = Fold.foldlM (\off (s,i) -> A.mul off s >>= A.add i) A.zero $ FixedLength.zipWith (,) sh ix @@ -276,12 +276,12 @@ newtype Iterator r rank = Iterator { runIterator ::- MultiValue.T (Shape rank) -> Iter.T r (MultiValue.T (Index rank))+ NiceValue.T (Shape rank) -> Iter.T r (NiceValue.T (Index rank)) } iterator :: (Unary.Natural rank) =>- MultiValue.T (Shape rank) -> Iter.T r (MultiValue.T (Index rank))+ NiceValue.T (Shape rank) -> Iter.T r (NiceValue.T (Index rank)) iterator = runIterator $ Unary.switchNat@@ -290,39 +290,39 @@ fmap (\(ix,i) -> ix#:.i) $ Iter.cartesian (iterator sh)- (IterMV.takeWhile (MultiValue.cmp LLVM.CmpGT n) $- Iter.iterate MultiValue.inc MultiValue.zero))+ (IterNV.takeWhile (NiceValue.cmp LLVM.CmpGT n) $+ Iter.iterate NiceValue.inc NiceValue.zero)) newtype Loop r state rank = Loop { runLoop ::- (MultiValue.T (Index rank) ->+ (NiceValue.T (Index rank) -> state -> LLVM.CodeGenFunction r state) ->- MultiValue.T (Shape rank) ->+ NiceValue.T (Shape rank) -> state -> LLVM.CodeGenFunction r state } loop :: (Unary.Natural rank, Tuple.Phi state) =>- (MultiValue.T (Index rank) ->+ (NiceValue.T (Index rank) -> state -> LLVM.CodeGenFunction r state) ->- MultiValue.T (Shape rank) ->+ NiceValue.T (Shape rank) -> state -> LLVM.CodeGenFunction r state loop = runLoop $ Unary.switchNat (Loop $ \code _z -> code z)- (Loop $ \code -> switchR $ \sh (MultiValue.Cons n) ->+ (Loop $ \code -> switchR $ \sh (NiceValue.Cons n) -> loop (\ix ptrStart -> fmap fst $ C.fixedLengthLoop n (ptrStart, A.zero) $ \(ptr, k) -> liftM2 (,)- (code (ix #:. MultiValue.Cons k) ptr)+ (code (ix #:. NiceValue.Cons k) ptr) (A.inc k)) sh)
src/Data/Array/Knead/Shape/Cubic/Int.hs view
@@ -6,8 +6,8 @@ import qualified Data.Array.Knead.Expression as Expr -import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Extra.Arithmetic as A import qualified LLVM.Core as LLVM@@ -20,10 +20,10 @@ newtype Int = Int Word cons :: (Expr.Value val) => val Word -> val Int-cons = Expr.lift1 $ \(MultiValue.Cons x) -> MultiValue.Cons x+cons = Expr.lift1 $ \(NiceValue.Cons x) -> NiceValue.Cons x decons :: (Expr.Value val) => val Int -> val Word-decons = Expr.lift1 $ \(MultiValue.Cons x) -> MultiValue.Cons x+decons = Expr.lift1 $ \(NiceValue.Cons x) -> NiceValue.Cons x class Single ix where@@ -33,33 +33,33 @@ switchSingle x = x -instance MultiValue.C Int where+instance NiceValue.C Int where type Repr Int = LLVM.Value Word- cons (Int x) = MultiValue.consPrimitive x- undef = MultiValue.undefPrimitive- zero = MultiValue.zeroPrimitive- phi = MultiValue.phiPrimitive- addPhi = MultiValue.addPhiPrimitive+ cons (Int x) = NiceValue.consPrimitive x+ undef = NiceValue.undefPrimitive+ zero = NiceValue.zeroPrimitive+ phi = NiceValue.phiPrimitive+ addPhi = NiceValue.addPhiPrimitive -instance MultiValue.Additive Int where- add = MultiValue.liftM2 A.add- sub = MultiValue.liftM2 A.sub- neg = MultiValue.liftM A.neg+instance NiceValue.Additive Int where+ add = NiceValue.liftM2 A.add+ sub = NiceValue.liftM2 A.sub+ neg = NiceValue.liftM A.neg -instance MultiValue.PseudoRing Int where- mul = MultiValue.liftM2 A.mul+instance NiceValue.PseudoRing Int where+ mul = NiceValue.liftM2 A.mul -instance MultiValue.Real Int where- min = MultiValue.liftM2 A.min- max = MultiValue.liftM2 A.max- abs = MultiValue.liftM A.abs- signum = MultiValue.liftM A.signum+instance NiceValue.Real Int where+ min = NiceValue.liftM2 A.min+ max = NiceValue.liftM2 A.max+ abs = NiceValue.liftM A.abs+ signum = NiceValue.liftM A.signum -instance MultiValue.IntegerConstant Int where+instance NiceValue.IntegerConstant Int where fromInteger' = cons . A.fromInteger' -instance MultiValue.Comparison Int where- cmp mode = MultiValue.liftM2 $ A.cmp mode+instance NiceValue.Comparison Int where+ cmp mode = NiceValue.liftM2 $ A.cmp mode instance Marshal.C Int where
src/Data/Array/Knead/Shape/Orphan.hs view
@@ -10,8 +10,8 @@ Cyclic(Cyclic), Enumeration(Enumeration)) -import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Extra.Memory as Memory import qualified LLVM.Extra.Tuple as Tuple @@ -23,14 +23,14 @@ -unzipZeroBased :: MultiValue.T (ZeroBased n) -> ZeroBased (MultiValue.T n)-unzipZeroBased (MultiValue.Cons (ZeroBased n)) = ZeroBased (MultiValue.Cons n)+unzipZeroBased :: NiceValue.T (ZeroBased n) -> ZeroBased (NiceValue.T n)+unzipZeroBased (NiceValue.Cons (ZeroBased n)) = ZeroBased (NiceValue.Cons n) zeroBasedSize :: (Expr.Value val) => val (ZeroBased n) -> val n zeroBasedSize = Expr.lift1 $ Shape.zeroBasedSize . unzipZeroBased zeroBased :: (Expr.Value val) => val n -> val (ZeroBased n)-zeroBased = Expr.lift1 $ \(MultiValue.Cons n) -> MultiValue.Cons (ZeroBased n)+zeroBased = Expr.lift1 $ \(NiceValue.Cons n) -> NiceValue.Cons (ZeroBased n) instance (Tuple.Undefined n) => Tuple.Undefined (ZeroBased n) where undef = ZeroBased Tuple.undef@@ -43,28 +43,28 @@ type ValueOf (ZeroBased n) = ZeroBased (Tuple.ValueOf n) valueOf (ZeroBased n) = ZeroBased $ Tuple.valueOf n -instance (MultiValue.C n) => MultiValue.C (ZeroBased n) where- type Repr (ZeroBased n) = ZeroBased (MultiValue.Repr n)- cons (ZeroBased n) = zeroBased (MultiValue.cons n)- undef = zeroBased MultiValue.undef- zero = zeroBased MultiValue.zero- phi bb = Monad.lift zeroBased . MultiValue.phi bb . zeroBasedSize- addPhi bb a b = MultiValue.addPhi bb (zeroBasedSize a) (zeroBasedSize b)+instance (NiceValue.C n) => NiceValue.C (ZeroBased n) where+ type Repr (ZeroBased n) = ZeroBased (NiceValue.Repr n)+ cons (ZeroBased n) = zeroBased (NiceValue.cons n)+ undef = zeroBased NiceValue.undef+ zero = zeroBased NiceValue.zero+ phi bb = Monad.lift zeroBased . NiceValue.phi bb . zeroBasedSize+ addPhi bb a b = NiceValue.addPhi bb (zeroBasedSize a) (zeroBasedSize b) type instance- MultiValue.Decomposed f (ZeroBased pn) =- ZeroBased (MultiValue.Decomposed f pn)+ NiceValue.Decomposed f (ZeroBased pn) =+ ZeroBased (NiceValue.Decomposed f pn) type instance- MultiValue.PatternTuple (ZeroBased pn) =- ZeroBased (MultiValue.PatternTuple pn)+ NiceValue.PatternTuple (ZeroBased pn) =+ ZeroBased (NiceValue.PatternTuple pn) -instance (MultiValue.Compose n) => MultiValue.Compose (ZeroBased n) where- type Composed (ZeroBased n) = ZeroBased (MultiValue.Composed n)- compose (ZeroBased n) = zeroBased (MultiValue.compose n)+instance (NiceValue.Compose n) => NiceValue.Compose (ZeroBased n) where+ type Composed (ZeroBased n) = ZeroBased (NiceValue.Composed n)+ compose (ZeroBased n) = zeroBased (NiceValue.compose n) -instance (MultiValue.Decompose pn) => MultiValue.Decompose (ZeroBased pn) where+instance (NiceValue.Decompose pn) => NiceValue.Decompose (ZeroBased pn) where decompose (ZeroBased p) sh =- MultiValue.decompose p <$> unzipZeroBased sh+ NiceValue.decompose p <$> unzipZeroBased sh instance (Expr.Compose n) => Expr.Compose (ZeroBased n) where type Composed (ZeroBased n) = ZeroBased (Expr.Composed n)@@ -87,13 +87,13 @@ singletonRange :: n -> Range n singletonRange n = Range n n -unzipRange :: MultiValue.T (Range n) -> Range (MultiValue.T n)-unzipRange (MultiValue.Cons (Range from to)) =- Range (MultiValue.Cons from) (MultiValue.Cons to)+unzipRange :: NiceValue.T (Range n) -> Range (NiceValue.T n)+unzipRange (NiceValue.Cons (Range from to)) =+ Range (NiceValue.Cons from) (NiceValue.Cons to) -zipRange :: MultiValue.T n -> MultiValue.T n -> MultiValue.T (Range n)-zipRange (MultiValue.Cons from) (MultiValue.Cons to) =- MultiValue.Cons (Range from to)+zipRange :: NiceValue.T n -> NiceValue.T n -> NiceValue.T (Range n)+zipRange (NiceValue.Cons from) (NiceValue.Cons to) =+ NiceValue.Cons (Range from to) instance (Tuple.Undefined n) => Tuple.Undefined (Range n) where undef = Range Tuple.undef Tuple.undef@@ -102,51 +102,51 @@ type ValueOf (Range n) = Range (Tuple.ValueOf n) valueOf (Range from to) = Range (Tuple.valueOf from) (Tuple.valueOf to) -instance (MultiValue.C n) => MultiValue.C (Range n) where- type Repr (Range n) = Range (MultiValue.Repr n)- cons (Range from to) = zipRange (MultiValue.cons from) (MultiValue.cons to)- undef = MultiValue.compose $ singletonRange MultiValue.undef- zero = MultiValue.compose $ singletonRange MultiValue.zero+instance (NiceValue.C n) => NiceValue.C (Range n) where+ type Repr (Range n) = Range (NiceValue.Repr n)+ cons (Range from to) = zipRange (NiceValue.cons from) (NiceValue.cons to)+ undef = NiceValue.compose $ singletonRange NiceValue.undef+ zero = NiceValue.compose $ singletonRange NiceValue.zero phi bb a = case unzipRange a of Range a0 a1 ->- Monad.lift2 zipRange (MultiValue.phi bb a0) (MultiValue.phi bb a1)+ Monad.lift2 zipRange (NiceValue.phi bb a0) (NiceValue.phi bb a1) addPhi bb a b = case (unzipRange a, unzipRange b) of (Range a0 a1, Range b0 b1) ->- MultiValue.addPhi bb a0 b0 >>- MultiValue.addPhi bb a1 b1+ NiceValue.addPhi bb a0 b0 >>+ NiceValue.addPhi bb a1 b1 type instance- MultiValue.Decomposed f (Range pn) = Range (MultiValue.Decomposed f pn)+ NiceValue.Decomposed f (Range pn) = Range (NiceValue.Decomposed f pn) type instance- MultiValue.PatternTuple (Range pn) = Range (MultiValue.PatternTuple pn)+ NiceValue.PatternTuple (Range pn) = Range (NiceValue.PatternTuple pn) -instance (MultiValue.Compose n) => MultiValue.Compose (Range n) where- type Composed (Range n) = Range (MultiValue.Composed n)+instance (NiceValue.Compose n) => NiceValue.Compose (Range n) where+ type Composed (Range n) = Range (NiceValue.Composed n) compose (Range from to) =- zipRange (MultiValue.compose from) (MultiValue.compose to)+ zipRange (NiceValue.compose from) (NiceValue.compose to) -instance (MultiValue.Decompose pn) => MultiValue.Decompose (Range pn) where+instance (NiceValue.Decompose pn) => NiceValue.Decompose (Range pn) where decompose (Range pfrom pto) rng = case unzipRange rng of Range from to -> Range- (MultiValue.decompose pfrom from)- (MultiValue.decompose pto to)+ (NiceValue.decompose pfrom from)+ (NiceValue.decompose pto to) singletonShifted :: n -> Shifted n singletonShifted n = Shifted n n -unzipShifted :: MultiValue.T (Shifted n) -> Shifted (MultiValue.T n)-unzipShifted (MultiValue.Cons (Shifted from to)) =- Shifted (MultiValue.Cons from) (MultiValue.Cons to)+unzipShifted :: NiceValue.T (Shifted n) -> Shifted (NiceValue.T n)+unzipShifted (NiceValue.Cons (Shifted from to)) =+ Shifted (NiceValue.Cons from) (NiceValue.Cons to) -zipShifted :: MultiValue.T n -> MultiValue.T n -> MultiValue.T (Shifted n)-zipShifted (MultiValue.Cons from) (MultiValue.Cons to) =- MultiValue.Cons (Shifted from to)+zipShifted :: NiceValue.T n -> NiceValue.T n -> NiceValue.T (Shifted n)+zipShifted (NiceValue.Cons from) (NiceValue.Cons to) =+ NiceValue.Cons (Shifted from to) instance (Tuple.Undefined n) => Tuple.Undefined (Shifted n) where undef = Shifted Tuple.undef Tuple.undef@@ -156,53 +156,53 @@ valueOf (Shifted start len) = Shifted (Tuple.valueOf start) (Tuple.valueOf len) -instance (MultiValue.C n) => MultiValue.C (Shifted n) where- type Repr (Shifted n) = Shifted (MultiValue.Repr n)+instance (NiceValue.C n) => NiceValue.C (Shifted n) where+ type Repr (Shifted n) = Shifted (NiceValue.Repr n) cons (Shifted start len) =- zipShifted (MultiValue.cons start) (MultiValue.cons len)- undef = MultiValue.compose $ singletonShifted MultiValue.undef- zero = MultiValue.compose $ singletonShifted MultiValue.zero+ zipShifted (NiceValue.cons start) (NiceValue.cons len)+ undef = NiceValue.compose $ singletonShifted NiceValue.undef+ zero = NiceValue.compose $ singletonShifted NiceValue.zero phi bb a = case unzipShifted a of Shifted a0 a1 -> Monad.lift2 zipShifted- (MultiValue.phi bb a0) (MultiValue.phi bb a1)+ (NiceValue.phi bb a0) (NiceValue.phi bb a1) addPhi bb a b = case (unzipShifted a, unzipShifted b) of (Shifted a0 a1, Shifted b0 b1) ->- MultiValue.addPhi bb a0 b0 >>- MultiValue.addPhi bb a1 b1+ NiceValue.addPhi bb a0 b0 >>+ NiceValue.addPhi bb a1 b1 type instance- MultiValue.Decomposed f (Shifted pn) =- Shifted (MultiValue.Decomposed f pn)+ NiceValue.Decomposed f (Shifted pn) =+ Shifted (NiceValue.Decomposed f pn) type instance- MultiValue.PatternTuple (Shifted pn) =- Shifted (MultiValue.PatternTuple pn)+ NiceValue.PatternTuple (Shifted pn) =+ Shifted (NiceValue.PatternTuple pn) -instance (MultiValue.Compose n) => MultiValue.Compose (Shifted n) where- type Composed (Shifted n) = Shifted (MultiValue.Composed n)+instance (NiceValue.Compose n) => NiceValue.Compose (Shifted n) where+ type Composed (Shifted n) = Shifted (NiceValue.Composed n) compose (Shifted start len) =- zipShifted (MultiValue.compose start) (MultiValue.compose len)+ zipShifted (NiceValue.compose start) (NiceValue.compose len) -instance (MultiValue.Decompose pn) => MultiValue.Decompose (Shifted pn) where+instance (NiceValue.Decompose pn) => NiceValue.Decompose (Shifted pn) where decompose (Shifted pstart plen) rng = case unzipShifted rng of Shifted start len -> Shifted- (MultiValue.decompose pstart start)- (MultiValue.decompose plen len)+ (NiceValue.decompose pstart start)+ (NiceValue.decompose plen len) -unzipCyclic :: MultiValue.T (Cyclic n) -> Cyclic (MultiValue.T n)-unzipCyclic (MultiValue.Cons (Cyclic n)) = Cyclic (MultiValue.Cons n)+unzipCyclic :: NiceValue.T (Cyclic n) -> Cyclic (NiceValue.T n)+unzipCyclic (NiceValue.Cons (Cyclic n)) = Cyclic (NiceValue.Cons n) cyclicSize :: (Expr.Value val) => val (Cyclic n) -> val n cyclicSize = Expr.lift1 $ Shape.cyclicSize . unzipCyclic cyclic :: (Expr.Value val) => val n -> val (Cyclic n)-cyclic = Expr.lift1 $ \(MultiValue.Cons n) -> MultiValue.Cons (Cyclic n)+cyclic = Expr.lift1 $ \(NiceValue.Cons n) -> NiceValue.Cons (Cyclic n) instance (Tuple.Undefined n) => Tuple.Undefined (Cyclic n) where undef = Cyclic Tuple.undef@@ -215,25 +215,25 @@ type ValueOf (Cyclic n) = Cyclic (Tuple.ValueOf n) valueOf (Cyclic n) = Cyclic $ Tuple.valueOf n -instance (MultiValue.C n) => MultiValue.C (Cyclic n) where- type Repr (Cyclic n) = Cyclic (MultiValue.Repr n)- cons (Cyclic n) = cyclic (MultiValue.cons n)- undef = cyclic MultiValue.undef- zero = cyclic MultiValue.zero- phi bb = Monad.lift cyclic . MultiValue.phi bb . cyclicSize- addPhi bb a b = MultiValue.addPhi bb (cyclicSize a) (cyclicSize b)+instance (NiceValue.C n) => NiceValue.C (Cyclic n) where+ type Repr (Cyclic n) = Cyclic (NiceValue.Repr n)+ cons (Cyclic n) = cyclic (NiceValue.cons n)+ undef = cyclic NiceValue.undef+ zero = cyclic NiceValue.zero+ phi bb = Monad.lift cyclic . NiceValue.phi bb . cyclicSize+ addPhi bb a b = NiceValue.addPhi bb (cyclicSize a) (cyclicSize b) type instance- MultiValue.Decomposed f (Cyclic pn) = Cyclic (MultiValue.Decomposed f pn)+ NiceValue.Decomposed f (Cyclic pn) = Cyclic (NiceValue.Decomposed f pn) type instance- MultiValue.PatternTuple (Cyclic pn) = Cyclic (MultiValue.PatternTuple pn)+ NiceValue.PatternTuple (Cyclic pn) = Cyclic (NiceValue.PatternTuple pn) -instance (MultiValue.Compose n) => MultiValue.Compose (Cyclic n) where- type Composed (Cyclic n) = Cyclic (MultiValue.Composed n)- compose (Cyclic n) = cyclic (MultiValue.compose n)+instance (NiceValue.Compose n) => NiceValue.Compose (Cyclic n) where+ type Composed (Cyclic n) = Cyclic (NiceValue.Composed n)+ compose (Cyclic n) = cyclic (NiceValue.compose n) -instance (MultiValue.Decompose pn) => MultiValue.Decompose (Cyclic pn) where- decompose (Cyclic p) sh = MultiValue.decompose p <$> unzipCyclic sh+instance (NiceValue.Decompose pn) => NiceValue.Decompose (Cyclic pn) where+ decompose (Cyclic p) sh = NiceValue.decompose p <$> unzipCyclic sh instance (Expr.Compose n) => Expr.Compose (Cyclic n) where type Composed (Cyclic n) = Cyclic (Expr.Composed n)@@ -253,23 +253,23 @@ -instance (Enum enum, Bounded enum) => MultiValue.C (Enumeration enum) where+instance (Enum enum, Bounded enum) => NiceValue.C (Enumeration enum) where type Repr (Enumeration enum) = ()- cons = MultiValue.consUnit- undef = MultiValue.undefUnit- zero = MultiValue.zeroUnit- phi = MultiValue.phiUnit- addPhi = MultiValue.addPhiUnit+ cons = NiceValue.consUnit+ undef = NiceValue.undefUnit+ zero = NiceValue.zeroUnit+ phi = NiceValue.phiUnit+ addPhi = NiceValue.addPhiUnit -type instance MultiValue.Decomposed f (Enumeration enum) = Enumeration enum-type instance MultiValue.PatternTuple (Enumeration enum) = Enumeration enum+type instance NiceValue.Decomposed f (Enumeration enum) = Enumeration enum+type instance NiceValue.PatternTuple (Enumeration enum) = Enumeration enum instance- (Enum enum, Bounded enum) => MultiValue.Compose (Enumeration enum) where+ (Enum enum, Bounded enum) => NiceValue.Compose (Enumeration enum) where type Composed (Enumeration enum) = Enumeration enum- compose = MultiValue.cons+ compose = NiceValue.cons -instance MultiValue.Decompose (Enumeration enum) where+instance NiceValue.Decompose (Enumeration enum) where decompose Enumeration _ = Enumeration
src/Data/Array/Knead/Symbolic.hs view
@@ -36,7 +36,7 @@ import qualified Data.Array.Knead.Expression as Expr import Data.Array.Knead.Expression (Exp, ) -import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value as NiceValue import Data.Function.HT (Id) @@ -49,7 +49,7 @@ backpermute :: (Shape.C sh0, Shape.Index sh0 ~ ix0, Shape.C sh1, Shape.Index sh1 ~ ix1,- MultiValue.C a) =>+ NiceValue.C a) => Exp sh1 -> (Exp ix1 -> Exp ix0) -> Array sh0 a ->@@ -80,15 +80,15 @@ zip :: (Core.C array, Shape.C sh) => array sh a -> array sh b -> array sh (a,b)-zip = zipWith (Expr.lift2 MultiValue.zip)+zip = zipWith (Expr.lift2 NiceValue.zip) zip3 :: (Core.C array, Shape.C sh) => array sh a -> array sh b -> array sh c -> array sh (a,b,c)-zip3 = zipWith3 (Expr.lift3 MultiValue.zip3)+zip3 = zipWith3 (Expr.lift3 NiceValue.zip3) zip4 :: (Core.C array, Shape.C sh) => array sh a -> array sh b -> array sh c -> array sh d -> array sh (a,b,c,d)-zip4 = zipWith4 (Expr.lift4 MultiValue.zip4)+zip4 = zipWith4 (Expr.lift4 NiceValue.zip4)
src/Data/Array/Knead/Symbolic/Fold.hs view
@@ -28,8 +28,8 @@ import LLVM.DSL.Expression (Exp, unExp) -import qualified LLVM.Extra.Multi.Value as MultiValue-import LLVM.Extra.Multi.Value (atom, )+import qualified LLVM.Extra.Nice.Value as NiceValue+import LLVM.Extra.Nice.Value (atom, ) import qualified Type.Data.Num.Unary as Unary @@ -45,7 +45,7 @@ apply ::- (Core.C array, Shape.C sh0, Shape.C sh1, MultiValue.C a) =>+ (Core.C array, Shape.C sh0, Shape.C sh1, NiceValue.C a) => T sh0 sh1 a -> array sh0 a -> array sh1 a@@ -60,7 +60,7 @@ passAny = Cons id (const id) pass ::- (Unary.Natural rank0, Unary.Natural rank1, MultiValue.C a) =>+ (Unary.Natural rank0, Unary.Natural rank1, NiceValue.C a) => Cubic rank0 rank1 a -> Cubic (Unary.Succ rank0) (Unary.Succ rank1) a pass (Cons fsh reduce) =@@ -72,18 +72,18 @@ fold1CodeLinear ::- (Unary.Natural rank, MultiValue.C a) =>+ (Unary.Natural rank, NiceValue.C a) => (Exp a -> Exp a -> Exp a) -> Exp Index.Int -> (Val (Cubic.Index (Unary.Succ rank)) -> Code r a) -> (Val (Cubic.Index rank) -> Code r a) fold1CodeLinear f nc code ix = Core.fold1Code f- (Expr.lift1 (MultiValue.compose . Shape.ZeroBased) $ Index.decons nc)+ (Expr.lift1 (NiceValue.compose . Shape.ZeroBased) $ Index.decons nc) (\j -> code (ix #:. Index.cons j)) fold ::- (Unary.Natural rank0, Unary.Natural rank1, MultiValue.C a) =>+ (Unary.Natural rank0, Unary.Natural rank1, NiceValue.C a) => (Exp a -> Exp a -> Exp a) -> Cubic rank0 rank1 a -> Cubic (Unary.Succ rank0) rank1 a
src/Data/Array/Knead/Symbolic/Physical.hs view
@@ -32,9 +32,9 @@ import qualified Data.Array.Comfort.Shape as ComfortShape import Data.Array.Comfort.Storable.Unchecked (Array(Array)) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Extra.Memory as Memory import qualified LLVM.Extra.Maybe as Maybe @@ -133,17 +133,17 @@ scanl1 :: (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- Storable.C a, MultiValue.C a) =>+ Storable.C a, NiceValue.C a) => (Exp a -> Exp a -> Exp a) -> Sym.Array (sh, n) a -> IO (Array (sh, n) a) scanl1 f (Sym.Array esh code) = materialize "scanl1" esh $ \sptr ptr -> do- (sh, n) <- MultiValue.unzip <$> Shape.load esh sptr+ (sh, n) <- NiceValue.unzip <$> Shape.load esh sptr let step ix ptrStart = fmap fst $ (\body -> Shape.loop body n (ptrStart, Maybe.nothing)) $ \k0 (ptr0, macc0) -> do- a <- code $ MultiValue.zip ix k0+ a <- code $ NiceValue.zip ix k0 acc1 <- Maybe.run macc0 (return a) (flip (Expr.unliftM2 f) a) ptr1 <- Storable.storeNext acc1 ptr0 return (ptr1, Maybe.just acc1)@@ -152,7 +152,7 @@ mapAccumLSimple :: (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc, Storable.C x, Storable.C y) =>+ NiceValue.C acc, Storable.C x, Storable.C y) => (Exp acc -> Exp x -> Exp (acc,y)) -> Sym.Array sh acc -> Sym.Array (sh, n) x -> IO (Array (sh, n) y) mapAccumLSimple f arrInit arrData =@@ -192,4 +192,4 @@ IO (Array sh1 a) permute accum deflt ixmap input = scatter accum deflt- (Sym.mapWithIndex (Expr.lift2 MultiValue.zip . ixmap) input)+ (Sym.mapWithIndex (Expr.lift2 NiceValue.zip . ixmap) input)
src/Data/Array/Knead/Symbolic/PhysicalParametric.hs view
@@ -39,9 +39,9 @@ import qualified LLVM.DSL.Execution as Code import LLVM.DSL.Expression (Exp(Exp), unExp) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Extra.Memory as Memory import qualified LLVM.Extra.Arithmetic as A @@ -232,7 +232,7 @@ (Code.createFunction callShaper2 "shape" $ \paramPtr shapeAPtr shapeBPtr sizesPtr -> do (sha,shb) <-- fmap MultiValue.unzip $ unExp $+ fmap NiceValue.unzip $ unExp $ shape $ core $ Exp (Memory.load paramPtr) Memory.store sha shapeAPtr Memory.store shb shapeBPtr@@ -323,7 +323,7 @@ mapAccumLSimple :: (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc, Marshal.C p, Storable.C a, Storable.C b) =>+ NiceValue.C acc, Marshal.C p, Storable.C a, Storable.C b) => Parametric p (MapAccumLSimple sh n acc a b) -> IO (Rendered p (Array (sh,n) b)) mapAccumLSimple =@@ -343,7 +343,7 @@ -- FIXME: check correct size of array of initial values mapAccumLSequence ::- (Shape.C n, Marshal.C n, MultiValue.C acc, Storable.C final,+ (Shape.C n, Marshal.C n, NiceValue.C acc, Storable.C final, Marshal.C p, Storable.C a, Storable.C b) => Parametric p (MapAccumLSequence n acc final a b) -> IO (Rendered p (final, Array n b))@@ -366,7 +366,7 @@ mapAccumL :: (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc, Storable.C final,+ NiceValue.C acc, Storable.C final, Marshal.C p, Storable.C a, Storable.C b) => Parametric p (MapAccumL sh n acc final a b) -> IO (Rendered p (Array sh final, Array (sh,n) b))
src/Data/Array/Knead/Symbolic/PhysicalPrivate.hs view
@@ -9,9 +9,9 @@ import LLVM.DSL.Expression (Exp, unExp) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Extra.Control as C import qualified LLVM.Core as LLVM@@ -33,8 +33,8 @@ writeArray :: (Shape.C sh, Shape.Index sh ~ ix, Storable.C a) =>- MultiValue.T sh ->- (MultiValue.T ix -> LLVM.CodeGenFunction r (MultiValue.T a)) ->+ NiceValue.T sh ->+ (NiceValue.T ix -> LLVM.CodeGenFunction r (NiceValue.T a)) -> LLVM.Value (Ptr a) -> LLVM.CodeGenFunction r (LLVM.Value (Ptr a)) writeArray sh code ptr = do@@ -43,17 +43,17 @@ mapAccumLLoop ::- (MultiValue.C acc, Storable.C b,+ (NiceValue.C acc, Storable.C b, Shape.C sh, Shape.Index sh ~ ix) =>- (MultiValue.T ix -> LLVM.CodeGenFunction r (MultiValue.T a)) ->+ (NiceValue.T ix -> LLVM.CodeGenFunction r (NiceValue.T a)) -> (Exp acc -> Exp a -> Exp (acc, b)) ->- MultiValue.T sh ->- LLVM.Value (Ptr b) -> MultiValue.T acc ->- LLVM.CodeGenFunction r (LLVM.Value (Ptr b), MultiValue.T acc)+ NiceValue.T sh ->+ LLVM.Value (Ptr b) -> NiceValue.T acc ->+ LLVM.CodeGenFunction r (LLVM.Value (Ptr b), NiceValue.T acc) mapAccumLLoop code f n yPtr accInit = do let step k0 (ptr0, acc0) = do x <- code k0- (acc1,y) <- MultiValue.unzip <$> Expr.unliftM2 f acc0 x+ (acc1,y) <- NiceValue.unzip <$> Expr.unliftM2 f acc0 x ptr1 <- Storable.storeNext y ptr0 return (ptr1, acc1) Shape.loop step n (yPtr, accInit)@@ -61,7 +61,7 @@ mapAccumLSimple :: (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc,+ NiceValue.C acc, Storable.C x, Storable.C y) => (Exp acc -> Exp x -> Exp (acc,y)) ->@@ -70,15 +70,15 @@ LLVM.Value (Ptr y) -> LLVM.CodeGenFunction r () mapAccumLSimple f (Sym.Array _ initCode) (Sym.Array esh code) sptr ptr = do- (sh, n) <- MultiValue.unzip <$> Shape.load esh sptr+ (sh, n) <- NiceValue.unzip <$> Shape.load esh sptr let step ix ptrStart = do accInit <- initCode ix- fst <$> mapAccumLLoop (code . MultiValue.zip ix) f n ptrStart accInit+ fst <$> mapAccumLLoop (code . NiceValue.zip ix) f n ptrStart accInit void $ Shape.loop step sh ptr mapAccumLSequence :: (Shape.C n, Marshal.C n,- MultiValue.C acc, Storable.C final,+ NiceValue.C acc, Storable.C final, Storable.C x, Storable.C y) => (Exp acc -> Exp x -> Exp (acc,y)) ->@@ -97,7 +97,7 @@ mapAccumL :: (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc, Storable.C final,+ NiceValue.C acc, Storable.C final, Storable.C x, Storable.C y) => (Exp acc -> Exp x -> Exp (acc,y)) ->@@ -108,11 +108,11 @@ LLVM.CodeGenFunction r () mapAccumL f final (Sym.Array _ initCode) (Sym.Array esh code) (_, accPtr) (sptr, yPtr) = do- (sh, n) <- MultiValue.unzip <$> Shape.load esh sptr+ (sh, n) <- NiceValue.unzip <$> Shape.load esh sptr let step ix (accPtr0, yPtrStart) = do accInit <- initCode ix (ptrStop, accExit) <-- mapAccumLLoop (code . MultiValue.zip ix) f n yPtrStart accInit+ mapAccumLLoop (code . NiceValue.zip ix) f n yPtrStart accInit accPtr1 <- flip Storable.storeNext accPtr0 =<< Expr.unliftM1 final accExit@@ -130,11 +130,11 @@ LLVM.CodeGenFunction r () foldOuterL f (Sym.Array _ initCode) (Sym.Array esh code) sptr ptr = do sh <- Shape.load (Expr.snd esh) sptr- n <- MultiValue.fst <$> unExp esh+ n <- NiceValue.fst <$> unExp esh void $ writeArray sh initCode ptr let step k ix ptr0 = do- b <- code $ MultiValue.zip k ix+ b <- code $ NiceValue.zip k ix a0 <- Storable.load ptr0 a1 <- Expr.unliftM2 f a0 b Storable.storeNext a1 ptr0@@ -153,18 +153,18 @@ Sym.Array n a -> LLVM.Value (MarshalPtr n) -> LLVM.Value (Ptr b) ->- LLVM.CodeGenFunction r (MultiValue.T n)+ LLVM.CodeGenFunction r (NiceValue.T n) mapFilter f p (Sym.Array esh code) sptr ptr = do n <- Shape.load esh sptr let step ix (dstPtr,dstIx) = do a <- code ix- MultiValue.Cons c <- Expr.unliftM1 p a+ NiceValue.Cons c <- Expr.unliftM1 p a C.ifThen c (dstPtr,dstIx) (App.lift2 (,) (flip Storable.storeNext dstPtr =<< Expr.unliftM1 f a)- (MultiValue.inc dstIx))+ (NiceValue.inc dstIx)) Shape.sequenceShapeFromIndex . snd- =<< Shape.loop step n (ptr, MultiValue.zero)+ =<< Shape.loop step n (ptr, NiceValue.zero) filterOuter :: (Shape.Sequence n, Marshal.C n,@@ -174,19 +174,19 @@ Sym.Array (n,sh) a -> LLVM.Value (MarshalPtr (n,sh)) -> LLVM.Value (Ptr a) ->- LLVM.CodeGenFunction r (MultiValue.T (n,sh))+ LLVM.CodeGenFunction r (NiceValue.T (n,sh)) filterOuter (Sym.Array _eish selectCode) (Sym.Array esh code) sptr ptr = do- (n,sh) <- MultiValue.unzip <$> Shape.load esh sptr+ (n,sh) <- NiceValue.unzip <$> Shape.load esh sptr let step k (dstPtr0,dstK) = do- MultiValue.Cons c <- selectCode k+ NiceValue.Cons c <- selectCode k C.ifThen c (dstPtr0,dstK) (do- dstPtr1 <- writeArray sh (code . MultiValue.zip k) dstPtr0- (,) dstPtr1 <$> MultiValue.inc dstK)+ dstPtr1 <- writeArray sh (code . NiceValue.zip k) dstPtr0+ (,) dstPtr1 <$> NiceValue.inc dstK) finalN <- Shape.sequenceShapeFromIndex . snd- =<< Shape.loop step n (ptr, MultiValue.zero)- return $ MultiValue.zip finalN sh+ =<< Shape.loop step n (ptr, NiceValue.zero)+ return $ NiceValue.zip finalN sh scatterMaybe ::@@ -207,8 +207,8 @@ ish <- unExp eish let fill ix () = do- (MultiValue.Cons c, (jx, a)) <-- mapSnd MultiValue.unzip . MultiValue.splitMaybe <$> codeMap ix+ (NiceValue.Cons c, (jx, a)) <-+ mapSnd NiceValue.unzip . NiceValue.splitMaybe <$> codeMap ix C.ifThen c () $ do p <- getElementPtr sh ptr jx flip Storable.store p@@ -233,7 +233,7 @@ ish <- unExp eish let fill ix () = do- (jx, a) <- MultiValue.unzip <$> codeMap ix+ (jx, a) <- NiceValue.unzip <$> codeMap ix p <- getElementPtr sh ptr jx flip Storable.store p =<< Expr.unliftM2 (flip accum) a@@ -251,7 +251,7 @@ LLVM.Value (Ptr b) -> LLVM.CodeGenFunction r () addDimension en select (Sym.Array esh code) sptr ptr = do- (sh,n) <- MultiValue.unzip <$> Shape.load (Expr.zip esh en) sptr+ (sh,n) <- NiceValue.unzip <$> Shape.load (Expr.zip esh en) sptr let fill ix ptr0 = do a <- code ix
src/Data/Array/Knead/Symbolic/Private.hs view
@@ -8,7 +8,7 @@ import LLVM.DSL.Expression (Exp(Exp)) -import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Extra.Iterator as Iter import qualified LLVM.Extra.Maybe as Maybe import qualified LLVM.Core as LLVM@@ -20,7 +20,7 @@ import Prelude hiding (id, map, zipWith, replicate, ) -type Val = MultiValue.T+type Val = NiceValue.T type Code r a = LLVM.CodeGenFunction r (Val a) data Array sh a =@@ -66,7 +66,7 @@ (C array, Shape.C sh0, Shape.Index sh0 ~ ix0, Shape.C sh1, Shape.Index sh1 ~ ix1,- MultiValue.C a) =>+ NiceValue.C a) => array sh1 ix0 -> array sh0 a -> array sh1 a@@ -116,7 +116,7 @@ fold1Code ::- (Shape.C sh, Shape.Index sh ~ ix, MultiValue.C a) =>+ (Shape.C sh, Shape.Index sh ~ ix, NiceValue.C a) => (Exp a -> Exp a -> Exp a) -> Exp sh -> (Val ix -> Code r a) ->@@ -132,24 +132,24 @@ n Maybe.nothing fold1 ::- (C array, Shape.C sh0, Shape.C sh1, MultiValue.C a) =>+ (C array, Shape.C sh0, Shape.C sh1, NiceValue.C a) => (Exp a -> Exp a -> Exp a) -> array (sh0, sh1) a -> array sh0 a fold1 f = lift1 $ \(Array shs code) -> case Expr.unzip shs of- (sh, s) -> Array sh $ fold1Code f s . MultiValue.curry code+ (sh, s) -> Array sh $ fold1Code f s . NiceValue.curry code fold1All ::- (Shape.C sh, MultiValue.C a) =>+ (Shape.C sh, NiceValue.C a) => (Exp a -> Exp a -> Exp a) -> Array sh a -> Exp a fold1All f (Array sh code) = Exp (fold1Code f sh code) findAllCode ::- (Shape.C sh, Shape.Index sh ~ ix, MultiValue.C a) =>+ (Shape.C sh, Shape.Index sh ~ ix, NiceValue.C a) => (Exp a -> Exp Bool) -> Exp sh -> (Val ix -> Code r a) ->@@ -159,14 +159,14 @@ finalFound <- Iter.mapWhileState_ (\a _found -> do- MultiValue.Cons b <- Expr.unliftM1 p a+ NiceValue.Cons b <- Expr.unliftM1 p a notb <- LLVM.inv b return (notb, Maybe.fromBool b a)) (Iter.mapM code $ Shape.iterator n) Maybe.nothing Maybe.run finalFound- (return MultiValue.nothing)- (return . MultiValue.just)+ (return NiceValue.nothing)+ (return . NiceValue.just) {- | In principle this can be implemented using fold1All@@ -177,7 +177,7 @@ please decorate the array elements with their indices before calling 'findAll'. -} findAll ::- (Shape.C sh, MultiValue.C a) =>+ (Shape.C sh, NiceValue.C a) => (Exp a -> Exp Bool) -> Array sh a -> Exp (Maybe a) findAll p (Array sh code) = Exp (findAllCode p sh code)
src/Data/Array/Knead/Symbolic/Render.hs view
@@ -30,9 +30,9 @@ import qualified LLVM.DSL.Render.Run as Run import LLVM.DSL.Expression (Exp) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import Prelude2010 import Prelude ()@@ -51,7 +51,7 @@ instance (Shape.Sequence n, Marshal.C n,- Storable.C b, MultiValue.C b) =>+ Storable.C b, NiceValue.C b) => C (MapFilter n a b) where type Plain (MapFilter n a b) = IO (Phys.Array n b) function = Run.Cons PhysP.mapFilter@@ -59,7 +59,7 @@ instance (Shape.Sequence n, Marshal.C n, Shape.C sh, Marshal.C sh,- Storable.C a, MultiValue.C a) =>+ Storable.C a, NiceValue.C a) => C (FilterOuter n sh a) where type Plain (FilterOuter n sh a) = IO (Phys.Array (n,sh) a) function = Run.Cons PhysP.filterOuter@@ -67,7 +67,7 @@ instance (Shape.C sh0, Marshal.C sh0, Shape.C sh1, Marshal.C sh1,- Storable.C a, MultiValue.C a) =>+ Storable.C a, NiceValue.C a) => C (Scatter sh0 sh1 a) where type Plain (Scatter sh0 sh1 a) = IO (Phys.Array sh1 a) function = Run.Cons PhysP.scatter@@ -75,7 +75,7 @@ instance (Shape.C sh0, Marshal.C sh0, Shape.C sh1, Marshal.C sh1,- Storable.C a, MultiValue.C a) =>+ Storable.C a, NiceValue.C a) => C (ScatterMaybe sh0 sh1 a) where type Plain (ScatterMaybe sh0 sh1 a) = IO (Phys.Array sh1 a) function = Run.Cons PhysP.scatterMaybe@@ -83,19 +83,19 @@ instance (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc,- Storable.C a, MultiValue.C a,- Storable.C b, MultiValue.C b) =>+ NiceValue.C acc,+ Storable.C a, NiceValue.C a,+ Storable.C b, NiceValue.C b) => C (MapAccumLSimple sh n acc a b) where type Plain (MapAccumLSimple sh n acc a b) = IO (Phys.Array (sh,n) b) function = Run.Cons PhysP.mapAccumLSimple instance (Shape.C n, Marshal.C n,- MultiValue.C acc,- Storable.C final, MultiValue.C final,- Storable.C a, MultiValue.C a,- Storable.C b, MultiValue.C b) =>+ NiceValue.C acc,+ Storable.C final, NiceValue.C final,+ Storable.C a, NiceValue.C a,+ Storable.C b, NiceValue.C b) => C (MapAccumLSequence n acc final a b) where type Plain (MapAccumLSequence n acc final a b) = IO (final, Phys.Array n b) function = Run.Cons PhysP.mapAccumLSequence@@ -103,10 +103,10 @@ instance (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- MultiValue.C acc,- Storable.C final, MultiValue.C final,- Storable.C a, MultiValue.C a,- Storable.C b, MultiValue.C b) =>+ NiceValue.C acc,+ Storable.C final, NiceValue.C final,+ Storable.C a, NiceValue.C a,+ Storable.C b, NiceValue.C b) => C (MapAccumL sh n acc final a b) where type Plain (MapAccumL sh n acc final a b) = IO (Phys.Array sh final, Phys.Array (sh,n) b)@@ -115,8 +115,8 @@ instance (Shape.C n, Marshal.C n, Shape.C sh, Marshal.C sh,- Storable.C a, MultiValue.C a,- Storable.C b, MultiValue.C b) =>+ Storable.C a, NiceValue.C a,+ Storable.C b, NiceValue.C b) => C (FoldOuterL n sh a b) where type Plain (FoldOuterL n sh a b) = IO (Phys.Array sh a) function = Run.Cons PhysP.foldOuterL@@ -124,13 +124,13 @@ instance (Shape.C sh, Marshal.C sh, Shape.C n, Marshal.C n,- Storable.C b, MultiValue.C b) =>+ Storable.C b, NiceValue.C b) => C (AddDimension sh n a b) where type Plain (AddDimension sh n a b) = IO (Phys.Array (sh,n) b) function = Run.Cons PhysP.addDimension -instance (Storable.C a, MultiValue.C a) => C (Exp a) where+instance (Storable.C a, NiceValue.C a) => C (Exp a) where type Plain (Exp a) = IO a function = Render.storable
src/Data/Array/Knead/Symbolic/Render/Argument.hs view
@@ -20,9 +20,9 @@ import qualified LLVM.DSL.Render.Argument as Arg import LLVM.DSL.Expression (unExp) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import Foreign.ForeignPtr (withForeignPtr, touchForeignPtr) @@ -40,7 +40,7 @@ Core.Array esh (\ix -> do sh <- unExp esh- MultiValue.Cons ptr <- unExp eptr+ NiceValue.Cons ptr <- unExp eptr Storable.load =<< getElementPtr sh ptr ix)) (\(Array.Array sh fptr) -> withForeignPtr fptr $ \ptr ->
src/Data/Array/Knead/Symbolic/Render/Basic.hs view
@@ -27,8 +27,8 @@ import LLVM.DSL.Render.Run (run, (*->)) import LLVM.DSL.Expression (Exp) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal import Prelude2010 import Prelude ()
src/Data/Array/Knead/Symbolic/RenderAlt.hs view
@@ -21,8 +21,8 @@ import qualified LLVM.DSL.Render.Run as Run import LLVM.DSL.Expression (Exp) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal import Data.Word (Word, Word32)
src/Data/Array/Knead/Symbolic/Slice.hs view
@@ -32,14 +32,14 @@ > Shape (Z:.Int:.Int) The first one seems to save us many duplicate instances of- Storable, MultiValue etc.+ Storable, NiceValue etc. and it allows us easily to reuse the (:.) for all kinds of patterns. However, we need a way to restrict the element type of the (:.)-list elements. We can define that using variable ConstraintKinds, but e.g. we are not able to add a Storable superclass constraint to the instance Storable (Wrap constr). That is, we are left with the second option- and had to define a lot of similar Storable, MultiValue instances.+ and had to define a lot of similar Storable, NiceValue instances. -} {-# LANGUAGE GADTs #-} {-# LANGUAGE ExistentialQuantification #-}@@ -76,8 +76,8 @@ import Data.Array.Knead.Shape.Cubic ((#:.), (:.)((:.)), ) import Data.Array.Knead.Expression (Exp, ) -import qualified LLVM.Extra.Multi.Value as MultiValue-import LLVM.Extra.Multi.Value (atom, )+import qualified LLVM.Extra.Nice.Value as NiceValue+import LLVM.Extra.Nice.Value (atom, ) import qualified Type.Data.Num.Unary as Unary @@ -102,7 +102,7 @@ This is essentially a 'ShapeDep.backpermute'. -} apply ::- (Core.C array, Shape.C sh0, Shape.C sh1, MultiValue.C a) =>+ (Core.C array, Shape.C sh0, Shape.C sh1, NiceValue.C a) => T sh0 sh1 -> array sh0 a -> array sh1 a
test/Test/Array.hs view
@@ -9,9 +9,9 @@ import qualified Data.Array.Comfort.Shape as ComfortShape import Data.Array.Comfort.Storable (Array) -import qualified LLVM.Extra.Multi.Value.Storable as Storable-import qualified LLVM.Extra.Multi.Value.Marshal as Marshal-import qualified LLVM.Extra.Multi.Value as MultiValue+import qualified LLVM.Extra.Nice.Value.Storable as Storable+import qualified LLVM.Extra.Nice.Value.Marshal as Marshal+import qualified LLVM.Extra.Nice.Value as NiceValue import qualified LLVM.Core as LLVM @@ -40,12 +40,12 @@ rowSumSymb ::- (Shape.C sh0, Shape.C sh1, MultiValue.Additive a) =>+ (Shape.C sh0, Shape.C sh1, NiceValue.Additive a) => Symb.Array (sh0,sh1) a -> Symb.Array sh0 a rowSumSymb = Symb.fold1 Expr.add columnSumSymb ::- (Shape.C sh0, Shape.C sh1, MultiValue.Additive a) =>+ (Shape.C sh0, Shape.C sh1, NiceValue.Additive a) => Symb.Array (sh0,sh1) a -> Symb.Array sh1 a columnSumSymb = Symb.fold1 Expr.add . Slice.apply Slice.transpose