Skip to content

Commit

Permalink
Merge branch 'master' into automap
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Jan 10, 2025
2 parents 4a369e2 + 69e3a42 commit 0595620
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

* 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.

## [0.25.25]

### Added
Expand Down
6 changes: 3 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
packages: futhark.cabal
index-state: 2024-11-04T14:44:59Z
index-state: 2025-01-10T04:07:23Z

package futhark
ghc-options: -j -fwrite-ide-info -hiedir=.hie

allow-newer: base, template-haskell

source-repository-package
type: git
location: https://github.com/jyp/glpk-hs.git
tag: 1f276aa19861203ea8367dc27a6ad4c8a31c9062

allow-newer: base, template-haskell, ghc-prim
32 changes: 32 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,38 @@ In most cases, it is better to install `WSL
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
----------------

Expand Down
3 changes: 1 addition & 2 deletions src/Futhark/CodeGen/ImpGen/GPU.hs
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,10 @@ withAcc pat inputs lam = do
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 ()
Expand Down
3 changes: 3 additions & 0 deletions src/Futhark/CodeGen/ImpGen/GPU/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ compileThreadExp :: ExpCompiler GPUMem KernelEnv Imp.KernelOp
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 []
Expand Down
2 changes: 2 additions & 0 deletions src/Futhark/CodeGen/ImpGen/GPU/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ compileBlockExp (Pat [pe]) (BasicOp (Opaque _ se)) =
-- 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 []
Expand Down
2 changes: 1 addition & 1 deletion src/Futhark/Fmt/Printer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ instance Format UncheckedDec where
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 <> "\""

Expand Down
7 changes: 6 additions & 1 deletion src/Futhark/Pkg/Info.hs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ revInfo gitdir path ref = do
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
Expand Down
3 changes: 2 additions & 1 deletion src/Language/Futhark/Parser/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ addDoc doc (ValDec val) = ValDec (val {valBindDoc = Just doc})
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
addDocSpec doc (TypeAbbrSpec tpsig) = TypeAbbrSpec (tpsig {typeDoc = Just doc})
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) =
Expand Down
7 changes: 7 additions & 0 deletions tests_fmt/expected/local.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- | top level.

local
-- | I am a doc comment.
module type mt = {

}
7 changes: 7 additions & 0 deletions tests_fmt/local.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- | top level.

local
-- | I am a doc comment.
module type mt = {

}

0 comments on commit 0595620

Please sign in to comment.