AccelerateHS / AccelerateHS/accelerate-llvm

[BUG] Atrace prints message before evaluating argument

Đang mở
#100 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Haskell
Star
171
Fork
65
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.