AccelerateHS / AccelerateHS/accelerate

[BUG] Imperfect dead code elimination

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

Mô tả

**Description**
For certain contrived inputs, fusion leaves unused program fragments in the output AST. It seems this can happen when a node was originally used, but due to expression simplification / fusion became unused.

**Steps to reproduce**
Print the following using `show` with `Data.Array.Accelerate` imported unqualified (and `Prelude` not imported)::
```haskell
let arr = use (fromList Z [1 :: Float])
in zipWith
(\x _ -> x)
(generate Z_ (\_ -> 1 :: Exp Float))
(zipWith (\x y -> T2 x y)
(map (\x -> x) arr)
(map (\x -> x) arr))
```
The result is:
```
let
a0 = use (Scalar Z [1.0])
a1 = map (\x0 -> x0) a0
a2 = map (\x0 -> x0) a0
in
generate () (\() -> 1.0)
```
Note that none of `a0`, `a1` and `a2` are actually used.

**Expected behaviour**
The output was expected to be `generate () (\() -> 1.0)`. :)

**Your environment**
- Accelerate: 1.3.0.0; also `203a9271`
- Accelerate backend(s): n/a
- GHC: 8.8.4
- OS: Arch Linux

**Additional context**
AD again delivers in producing obscure code :)

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.