futhark 0.25.25 → 0.25.26
raw patch · 14 files changed
+107/−16 lines, 14 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +17/−0
- docs/installation.rst +32/−0
- docs/man/futhark-fmt.rst +5/−1
- futhark.cabal +1/−1
- rts/c/timing.h +4/−0
- src/Futhark/CLI/Fmt.hs +28/−5
- src/Futhark/CodeGen/Backends/MulticoreC.hs +1/−1
- src/Futhark/CodeGen/Backends/MulticoreISPC.hs +1/−1
- src/Futhark/CodeGen/ImpGen/GPU.hs +1/−2
- src/Futhark/CodeGen/ImpGen/GPU/Base.hs +3/−0
- src/Futhark/CodeGen/ImpGen/GPU/Block.hs +2/−0
- src/Futhark/Fmt/Printer.hs +4/−3
- src/Futhark/Pkg/Info.hs +6/−1
- src/Language/Futhark/Parser/Monad.hs +2/−1
CHANGELOG.md view
@@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.25.26]++### Fixed++* Some Windows compatibility quirks (#2200, #2201).++* `futhark pkg`: fixed parsing of Git timestamps in Z time zone.++* GPU backends did not handle array constants correctly in some cases.++* `futhark fmt`: do not throw away doc comments for `local`+ definitions.++* `futhark fmt`: improve formatting of value specs.++* `futhark fmt`: add `--check` option.+ ## [0.25.25] ### Added
docs/installation.rst view
@@ -191,6 +191,38 @@ the Linux instructions above. The C code generated by the Futhark compiler should work on Windows, except for the ``multicore`` backend. +Alternatively, you can use the C compiler that is installed with+`w64devkit`_++Using HIP+~~~~~~~~~~~~~~~~~~~~++*Note*: dependencies can sometimes move faster than this documentation.+This Windows/HIP HowTo was written in Jan 2025 on a setup without WSL,+using PowerShell, and after the installation of `w64devkit`_ via `scoop`_.++If you wish to use ``futhark hip`` on windows, you must have the+`ROCm/HIP SDK`_ installed on your system.+The SDK installation will create a ``HIP_PATH`` environment variable on+your system pointing to the installed SDK. It is advised to check that+this variable has indeed been created.++In order for ```futhark hip``` to work you need to setup 3 environment+variables in your PowerShell::++ # CPATH creation so that the compiler can find the HIP headers+ $env:CPATH = $env:HIP_PATH + "include"+ # LIBRARY_PATH creation so that the linker can find the HIP libraries+ $env:LIBRARY_PATH = $env:HIP_PATH + "lib"+ # PATH modification so that the compiled app can find the HIP DLLs at runtime+ $env:PATH = $env:PATH + ";" + $env:HIP_PATH + "bin"+++.. _`ROCm/HIP SDK`: https://www.amd.com/fr/developer/resources/rocm-hub/hip-sdk.html+.. _`w64devkit`: https://github.com/skeeto/w64devkit+.. _`scoop` : https://scoop.sh/++ Futhark with Nix ----------------
docs/man/futhark-fmt.rst view
@@ -9,7 +9,7 @@ SYNOPSIS ======== -futhark fmt [FILES]+futhark fmt [options...] [FILES] DESCRIPTION ===========@@ -26,6 +26,10 @@ OPTIONS =======++--check+ Check if the given files are correctly formatted, and if not,+ terminate with an error message and a nonzero exit code. -h Print help text to standard output and exit.
futhark.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: futhark-version: 0.25.25+version: 0.25.26 synopsis: An optimising compiler for a functional, array-oriented language. description: Futhark is a small programming language designed to be compiled to
rts/c/timing.h view
@@ -14,6 +14,10 @@ return ((double)time.QuadPart / freq.QuadPart) * 1000000; } +static int64_t get_wall_time_ns(void) {+ return get_wall_time() * 1000;+}+ #else // Assuming POSIX
src/Futhark/CLI/Fmt.hs view
@@ -1,25 +1,48 @@ -- | @futhark fmt@ module Futhark.CLI.Fmt (main) where -import Control.Monad (forM_)+import Control.Monad (forM_, unless)+import Data.Text qualified as T import Data.Text.IO qualified as T import Futhark.Fmt.Printer import Futhark.Util.Options-import Futhark.Util.Pretty (hPutDoc, putDoc)+import Futhark.Util.Pretty (docText, hPutDoc, putDoc) import Language.Futhark import Language.Futhark.Parser (SyntaxError (..)) import System.Exit import System.IO +newtype FmtCfg = FmtCfg+ { cfgCheck :: Bool+ }++initialFmtCfg :: FmtCfg+initialFmtCfg = FmtCfg {cfgCheck = False}++fmtOptions :: [FunOptDescr FmtCfg]+fmtOptions =+ [ Option+ ""+ ["check"]+ (NoArg $ Right $ \cfg -> cfg {cfgCheck = True})+ "Check whether file is correctly formatted."+ ]+ -- | Run @futhark fmt@. main :: String -> [String] -> IO ()-main = mainWithOptions () [] "[FILES" $ \args () ->+main = mainWithOptions initialFmtCfg fmtOptions "[FILES]" $ \args cfg -> case args of [] -> Just $ putDoc =<< onInput =<< T.getContents files -> Just $ forM_ files $ \file -> do- doc <- onInput =<< T.readFile file- withFile file WriteMode $ \h -> hPutDoc h doc+ file_s <- T.readFile file+ doc <- onInput file_s+ if cfgCheck cfg+ then unless (docText doc == file_s) $ do+ T.hPutStrLn stderr $ T.pack file <> ": not formatted correctly."+ T.hPutStr stderr $ docText doc+ exitFailure+ else withFile file WriteMode $ \h -> hPutDoc h doc where onInput s = do case fmtToDoc "<stdin>" s of
src/Futhark/CodeGen/Backends/MulticoreC.hs view
@@ -53,7 +53,7 @@ mempty operations generateBoilerplate- ""+ "#include <pthread.h>\n" (DefaultSpace, [DefaultSpace]) cliOptions )
src/Futhark/CodeGen/Backends/MulticoreISPC.hs view
@@ -78,7 +78,7 @@ generateBoilerplate mapM_ compileBuiltinFun funs )- mempty+ "#include <pthread.h>\n" (DefaultSpace, [DefaultSpace]) MC.cliOptions )
src/Futhark/CodeGen/ImpGen/GPU.hs view
@@ -223,11 +223,10 @@ locksForInputs atomics inputs' expCompiler :: ExpCompiler GPUMem HostEnv Imp.HostOp--- We generate a simple kernel for itoa and replicate.+-- We generate a simple kernel for iota and replicate. expCompiler (Pat [pe]) (BasicOp (Iota n x s et)) = do x' <- toExp x s' <- toExp s- sIota (patElemName pe) (pe64 n) x' s' et expCompiler (Pat [pe]) (BasicOp (Replicate shape se)) | Acc {} <- patElemType pe = pure ()
src/Futhark/CodeGen/ImpGen/GPU/Base.hs view
@@ -184,6 +184,9 @@ compileThreadExp (Pat [pe]) (BasicOp (Opaque _ se)) = -- Cannot print in GPU code. copyDWIM (patElemName pe) [] se []+-- The static arrays stuff does not work inside kernels.+compileThreadExp (Pat [dest]) (BasicOp (ArrayVal vs t)) =+ compileThreadExp (Pat [dest]) (BasicOp (ArrayLit (map Constant vs) (Prim t))) compileThreadExp (Pat [dest]) (BasicOp (ArrayLit es _)) = forM_ (zip [0 ..] es) $ \(i, e) -> copyDWIMFix (patElemName dest) [fromIntegral (i :: Int64)] e []
src/Futhark/CodeGen/ImpGen/GPU/Block.hs view
@@ -278,6 +278,8 @@ -- Cannot print in GPU code. copyDWIM (patElemName pe) [] se [] -- The static arrays stuff does not work inside kernels.+compileBlockExp (Pat [dest]) (BasicOp (ArrayVal vs t)) =+ compileBlockExp (Pat [dest]) (BasicOp (ArrayLit (map Constant vs) (Prim t))) compileBlockExp (Pat [dest]) (BasicOp (ArrayLit es _)) = forM_ (zip [0 ..] es) $ \(i, e) -> copyDWIMFix (patElemName dest) [fromIntegral (i :: Int64)] e []
src/Futhark/Fmt/Printer.hs view
@@ -511,7 +511,7 @@ where sub | null ps = fmtName bindingStyle name- | otherwise = fmtName bindingStyle name <+> align (sep line $ map fmt ps)+ | otherwise = fmtName bindingStyle name <+> align (sep space $ map fmt ps) fmt (ModSpec name mte doc loc) = addComments loc $ fmt doc <> "module" <+> fmtName bindingStyle name <> ":" <+> fmt mte fmt (IncludeSpec mte loc) = addComments loc $ "include" <+> fmt mte@@ -533,7 +533,7 @@ let (root, withs) = typeWiths mte in addComments loc . localLayout loc $ fmt root- </> sep line (map fmtWith (withs ++ [tr]))+ </> sep line (map fmtWith (reverse $ tr : withs)) where fmtWith (TypeRef v ps td _) = "with"@@ -614,11 +614,12 @@ fmt (ModTypeDec tb) = fmt tb fmt (ModDec tb) = fmt tb fmt (OpenDec tb loc) = addComments loc $ "open" <+> fmt tb- fmt (LocalDec tb loc) = addComments loc $ "local" <+> fmt tb+ fmt (LocalDec tb loc) = addComments loc $ "local" </> fmt tb fmt (ImportDec path _tb loc) = addComments loc $ "import" <+> "\"" <> fmtPretty path <> "\"" instance Format UncheckedProg where+ fmt (Prog Nothing []) = popComments fmt (Prog Nothing decs) = sepDecs fmt decs </> popComments fmt (Prog (Just dc) decs) = fmt dc </> sepDecs fmt decs </> popComments
src/Futhark/Pkg/Info.hs view
@@ -167,7 +167,12 @@ gitCmd_ ["-C", gitdir, "rev-parse", ref, "--"] [sha] <- gitCmdLines ["-C", gitdir, "rev-list", "-n1", ref] [time] <- gitCmdLines ["-C", gitdir, "show", "-s", "--format=%cI", ref]- utc <- zonedTimeToUTC <$> iso8601ParseM (T.unpack time)+ utc <-+ -- Git sometimes produces timestamps with Z time zone, which are+ -- not valid ZonedTimes.+ if 'Z' `T.elem` time+ then iso8601ParseM (T.unpack time)+ else zonedTimeToUTC <$> iso8601ParseM (T.unpack time) gm <- memoiseGetManifest getManifest' pure $ PkgRevInfo
src/Language/Futhark/Parser/Monad.hs view
@@ -59,6 +59,7 @@ addDoc doc (TypeDec tp) = TypeDec (tp {typeDoc = Just doc}) addDoc doc (ModTypeDec sig) = ModTypeDec (sig {modTypeDoc = Just doc}) addDoc doc (ModDec mod) = ModDec (mod {modDoc = Just doc})+addDoc doc (LocalDec dec loc) = LocalDec (addDoc doc dec) loc addDoc _ dec = dec addDocSpec :: DocComment -> SpecBase NoInfo Name -> SpecBase NoInfo Name@@ -66,7 +67,7 @@ addDocSpec doc (ValSpec name ps t NoInfo _ loc) = ValSpec name ps t NoInfo (Just doc) loc addDocSpec doc (TypeSpec l name ps _ loc) = TypeSpec l name ps (Just doc) loc addDocSpec doc (ModSpec name se _ loc) = ModSpec name se (Just doc) loc-addDocSpec _ spec = spec+addDocSpec _ spec@IncludeSpec {} = spec addAttr :: AttrInfo Name -> UncheckedDec -> UncheckedDec addAttr attr (ValDec val) =