AccelerateHS / AccelerateHS/accelerate-llvm
[BUG] Atrace prints message before evaluating argument
- Lenguaje dominante
- Haskell
- Estrellas
- 171
- Forks
- 65
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
**Description**
The implementation of `Atrace` prints the message before the argument (that is passed on) is evaluated:
https://github.com/AccelerateHS/accelerate-llvm/blob/2b5d69448557e89002c0179ea1aaf59bb757a6e3/accelerate-llvm/src/Data/Array/Accelerate/LLVM/Execute.hs#L286-L287
This is just like Debug.Trace works in Haskell, but Haskell's behaviour is because of laziness, whereas Accelerate is strict and hence this behaviour is neither helpful nor terribly intuitive.
**Steps to reproduce**
```haskell
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.Debug.Trace as A
import qualified Data.Array.Accelerate.LLVM.Native as CPU
prog :: A.Acc (A.Vector Int) -> A.Acc (A.Vector Int)
prog a = A.atrace "second" (A.map (+1) (A.atrace "first" a))
main :: IO ()
main = print $ CPU.runN prog (A.fromList (A.Z A.:. 10) [1..10])
```
This prints:
```
second
first
Vector (Z :. 10) [2,3,4,5,6,7,8,9,10,11]
```
**Expected behaviour**
Get first, _then_ second.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.