AccelerateHS / AccelerateHS/accelerate-llvm
[BUG] Atrace prints message before evaluating argument
- 主要语言
- Haskell
- 星标
- 171
- 派生
- 65
- PR 合并指标
- 30 天内没有已合并 PR
描述
**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.
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。