Broadcasting device-only functions: mismatch between contexts
- Dominant language
- Julia
- Stars
- 1.4k
- Forks
- 281
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 30
Description
We're now using some form of contextual dispatch to differentiate between host and device functions. However, in some cases the host looks up a function to, e.g., query inference and get the element type. These results are from the 'host context', which may not match what exists in the GPU context.
For example, broadcast looks up the element type of the operation to determine the output container, which now fails when using device-only functions (that infer to `Union{}` on the host):
```
julia> CUDA.rsqrt.(CUDA.ones(1))
ERROR: GPU broadcast resulted in non-concrete element type Union{}.
This probably means that the function you are broadcasting contains an error or type instability.
```
Maybe the CPU function generated for a device override should still infer the same, even though it would actually error?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.