My use cases evolve around sparse linear algebra. As always, there are big differences in performance between CPU and GPU (-like). As a naive solution, I used isgpu(backend) to choose a groupsize. However, isgpu is no longer around, and I have (once) observed the PoCL backend on the CPU to be fastest for a groupsize of 1, whereas the CPU performed better for ~4 and CUDABackend much better for 32 (or 64). I've used smth like this, which I specialized using package extensions:
clamp_groupsize(groupsize::Int, backend)::Int
Technically, one can probably only recommend prod(@groupsize) but not @groupsize directly. It would be nice if KA would provide an abstraction that, in the long term, could make use of CUDA's occupancy API. Therefore, I would recommend smth like
recommended_groupsize(backend, kernel)::Int
where the user then has to recover the actual groupsize for N > 1 dimensional kernels.
- If CUDA, use the occupancy API
- If old CPU backend, use number of cores
- If new PoCL CPU backend, use one (more research needed!)
I'm sometimes confused on whether I should focus on groupsize or the hardware's vector width. Please let me know what you think. 🙂
My use cases evolve around sparse linear algebra. As always, there are big differences in performance between CPU and GPU (-like). As a naive solution, I used
isgpu(backend)to choose agroupsize. However,isgpuis no longer around, and I have (once) observed the PoCL backend on the CPU to be fastest for a groupsize of 1, whereas theCPUperformed better for ~4 andCUDABackendmuch better for 32 (or 64). I've used smth like this, which I specialized using package extensions:Technically, one can probably only recommend
prod(@groupsize)but not@groupsizedirectly. It would be nice if KA would provide an abstraction that, in the long term, could make use of CUDA's occupancy API. Therefore, I would recommend smth likewhere the user then has to recover the actual groupsize for
N > 1dimensional kernels.I'm sometimes confused on whether I should focus on
groupsizeor the hardware's vector width. Please let me know what you think. 🙂