AccelerateHS / AccelerateHS/accelerate

Passing arguments to kernels as values

Aperta
#283 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
new feature
Lingua principale
Haskell
Stelle
1k
Fork
135
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.