AccelerateHS / AccelerateHS/accelerate

Passing arguments to kernels as values

Open
#283 1 comment 0 reactions 0 assignees View on GitHub
new feature
Dominant language
Haskell
Stars
1k
Forks
135
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.