futhask 1.1.1 → 1.2.0
raw patch · 3 files changed
+9/−7 lines, 3 filesdep ~futhark-manifest
Dependency ranges changed: futhark-manifest
Files
- ChangeLog.md +2/−0
- futhask.cabal +2/−2
- src/CodeGen.hs +5/−5
ChangeLog.md view
@@ -3,3 +3,5 @@ fix bugs in sum type handling ## 1.1.1 fix num_groups context option+## 1.2.0+change from `unique` to `consumed` and `fresh` to describe aliasing
futhask.cabal view
@@ -1,7 +1,7 @@ cabal-version: 1.12 name: futhask-version: 1.1.1+version: 1.2.0 synopsis: Generate Haskell wrappers for Futhark libraries description: Please see the README on GitLab at <https://gitlab.com/Gusten_Isfeldt/futhask#futhask> category: FFI Tools@@ -36,7 +36,7 @@ , directory >=1.3.3 && <1.4 , raw-strings-qq >=1.1 && <1.2 , split >=0.2.3 && <0.3- , futhark-manifest ==1.9.0.0 + , futhark-manifest ==1.11.0.0 , text >=2.0.1 && < 3 , bytestring >=0.10 && <1 , containers >=0.6 && <1
src/CodeGen.hs view
@@ -465,7 +465,7 @@ subargs t = zipWith (\i _ -> "t" <> T.pack (show i)) [0..] (subtypes t) name' = decapitalize name futtype = name - <~> T.unwords (map (\i -> "(" <> inputName i <> " : " <> (if inputUnique i then "*" else "") <> inputType i <> ")") inputs) + <~> T.unwords (map (\i -> "(" <> inputName i <> " : " <> (if inputConsumed i then "*" else "") <> inputType i <> ")") inputs) <> " : " <> outputType output tuningDec = let ps = entryPointTuningParams entry in if length ps == 0 then ""@@ -473,7 +473,7 @@ attributeDec = let as = entryPointAttrs entry in if length as == 0 then "" else comment $ "attributes:\n" <> mconcat (map (\t -> " - " <> t <> "\n") as)- typeDec = name' <> " :: " <> (if any inputUnique inputs then "MonadIO" else "Monad") <> " m\n => " + typeDec = name' <> " :: " <> (if any inputConsumed inputs then "MonadIO" else "Monad") <> " m\n => " <> mconcat (map (\i -> typeDec' (inputType i) <> " -- ^" <> inputName i <> "\n -> " ) inputs) <> "M.FutT c m " <> (let ot = outputType output in if isTuple ot @@ -490,8 +490,8 @@ <> processOutput <> cleanup <> "C.sync ctx >> pure res)" - <> if any inputUnique inputs - then " >>= \\res\n -> " <> freeuniqueinputs <> "pure res\n"+ <> if any inputConsumed inputs + then " >>= \\res\n -> " <> freeConsumedinputs <> "pure res\n" else "\n" args = zipWith (\i _ -> "arg" <> T.pack (show i)) [0..] inputs prepareInput i a = let t = inputType i in if isPrimitive t @@ -513,7 +513,7 @@ outputInContext f args = "F.alloca (\\ptr -> " <> inContext f ("ptr":args) <> " >> F.peek ptr)" cleanup = mconcat (zipWith (\i a -> if isTuple (inputType i) then inContext ("Raw.free_" <> reformatTypeName (inputType i)) [a] <> "\n >> " else "") inputs args)- freeuniqueinputs = mconcat (zipWith (\i a -> if inputUnique i + freeConsumedinputs = mconcat (zipWith (\i a -> if inputConsumed i then finalizeValue a (inputType i) else "" ) inputs args) finalizeValue n t = if isPrimitive t