AccelerateHS / AccelerateHS/accelerate

Passing arguments to kernels as values

Aberta
#283 1 comentário 0 reações 0 responsáveis Ver no GitHub
new feature
Linguagem predominante
Haskell
Estrelas
1k
Forks
135
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.