AccelerateHS / AccelerateHS/accelerate

Passing arguments to kernels as values

未关闭
#283 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
new feature
主要语言
Haskell
星标
1k
派生
135
PR 合并指标
30 天内没有已合并 PR

描述

I see that if I have a function:

```
f :: Acc (Scalar (Float, Float, Float, Float)) -> Acc (Array sh Float) -> Acc (Array sh Float)
```

The generated kernel signature will look like:

```
__global__ void fun(float* arg1, float* arg2, float* arg3, float* arg4, float* arg5, float* arr1, float* out)
```

All of the scalar arguments are passed as pointers to the device allocated memory. This has a couple of consequences at runtime: each of these arguments needs to be allocated, memcpy'd, put into memory table/nursery, and then evicted from the memory. Furthermore, because of chunked allocations, even if we are marshalling a 4 byte Float, 4kB are allocated. I think that it is non-optimal, because of all the allocations and copying.

Would it be possible to implement passing small arguments as values so that we can avoid the overhead? If you could give a couple of pointers, I'd take a look at this.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。