Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when broadcasting composed functions #1550

Closed
chrstphrbrns opened this issue Jun 26, 2022 · 3 comments
Closed

Error when broadcasting composed functions #1550

chrstphrbrns opened this issue Jun 26, 2022 · 3 comments
Labels
bug Something isn't working upstream Somebody else's problem.

Comments

@chrstphrbrns
Copy link
Contributor

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.0-DEV.848 (2022-06-24)
 _/ |\__'_|_|_|\__'_|  |  Commit 51c88129e2 (1 day old master)
|__/                   |

julia> using CUDA

julia> a = CUDA.randn(100_000);

julia> @time sum((sin∘cos∘sin∘cos∘sin∘cos∘sin∘cos).(a))
ERROR: GPU broadcast resulted in non-concrete element type Any.
This probably means that the function you are broadcasting contains an error or type instability.
...

julia> @time sum((sin∘cos∘sin).(a))
ERROR: GPU broadcast resulted in non-concrete element type Any.
This probably means that the function you are broadcasting contains an error or type instability.
...
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.0-DEV.848 (2022-06-24)
 _/ |\__'_|_|_|\__'_|  |  Commit 51c88129e2 (1 day old master)
|__/                   |

julia> using CUDA

julia> a = CUDA.randn(100_000);

julia> @time sum((sin∘cos).(a))
  4.605380 seconds (11.41 M allocations: 775.927 MiB, 6.96% gc time, 60.82% compilation time)
53347.61f0

julia> @time sum((sin∘cos∘sin).(a))
  0.868966 seconds (2.06 M allocations: 139.620 MiB, 5.15% gc time, 79.97% compilation time)
70603.82f0

The final sin∘cos∘sin command fails in the first example and succeeds in the second

CUDA toolkit 11.7, artifact installation
NVIDIA driver 510.73.5, for CUDA 11.6
CUDA driver 11.6

Libraries: 
- CUBLAS: 11.10.1
- CURAND: 10.2.10
- CUFFT: 10.7.2
- CUSOLVER: 11.3.5
- CUSPARSE: 11.7.3
- CUPTI: 17.0.0
- NVML: 11.0.0+510.73.5
- CUDNN: 8.30.2 (for CUDA 11.5.0)
- CUTENSOR: 1.4.0 (for CUDA 11.5.0)

Toolchain:
- Julia: 1.9.0-DEV.848
- LLVM: 14.0.5
- PTX ISA support: 3.2, 4.0, 4.1, 4.2, 4.3, 5.0, 6.0, 6.1, 6.3, 6.4, 6.5, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5
- Device capability support: sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80, sm_86

2 devices:
  0: NVIDIA GeForce RTX 2080 Ti (sm_75, 10.098 GiB / 11.000 GiB available)
  1: NVIDIA GeForce RTX 2080 Ti (sm_75, 10.753 GiB / 11.000 GiB available)
@chrstphrbrns chrstphrbrns added the bug Something isn't working label Jun 26, 2022
@maleadt
Copy link
Member

maleadt commented Jun 27, 2022

This is due to the Julia compiler:

julia> Base._return_type(sin∘cos∘sin∘cos∘sin, Tuple{Float64})
Any

julia> Base._return_type(sin∘cos∘sin∘cos, Tuple{Float64})
Float64

It's possible we could extend the limit by using specific abstract interpreter parameters, but then somebody first would need to figure out which limit/heuristic this is triggering, as well as fix #1253 before this would affect broadcast.

@maleadt maleadt added the upstream Somebody else's problem. label Jun 27, 2022
@ToucheSir
Copy link
Contributor

This was just fixed today (Base issue), so if it gets backported then perhaps nothing needs to be done?

@maleadt
Copy link
Member

maleadt commented Jun 29, 2022

Ah yes, good catch, looks like we can close this then.

@maleadt maleadt closed this as completed Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Somebody else's problem.
Projects
None yet
Development

No branches or pull requests

3 participants