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

sortperm! fails when output is UInt vector #2046

Closed
chrstphrbrns opened this issue Aug 19, 2023 · 2 comments · Fixed by #2051
Closed

sortperm! fails when output is UInt vector #2046

chrstphrbrns opened this issue Aug 19, 2023 · 2 comments · Fixed by #2051
Labels
bug Something isn't working

Comments

@chrstphrbrns
Copy link
Contributor

julia> CUDA.versioninfo()
CUDA runtime 12.2, artifact installation
CUDA driver 12.0
NVIDIA driver 525.125.6

CUDA libraries: 
- CUBLAS: 12.2.4
- CURAND: 10.3.3
- CUFFT: 11.0.8
- CUSOLVER: 11.5.1
- CUSPARSE: 12.1.2
- CUPTI: 20.0.0
- NVML: 12.0.0+525.125.6

Julia packages: 
- CUDA: 4.4.0
- CUDA_Driver_jll: 0.6.0+2
- CUDA_Runtime_jll: 0.8.0+0

Toolchain:
- Julia: 1.11.0-DEV.304
- LLVM: 15.0.7
- 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_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.013 GiB / 11.000 GiB available)
  1: NVIDIA GeForce RTX 2080 Ti (sm_75, 10.745 GiB / 11.000 GiB available)

julia> c=cu(collect(1:1000000));

julia> out=CuVector{UInt}(undef,length(c));

julia> sortperm!(out,c);
# ERROR: InvalidIRError: compiling MethodInstance for (::GPUArrays.var"#broadcast_kernel#26")(::CUDA.CuKernelContext, ::CuDeviceVector{UInt64, 1}, ::Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{…}, Tuple{…}, typeof(identity), Tuple{…}}, ::Int64) resulted in invalid LLVM IR
# Reason: unsupported call to an unknown function (call to jl_f_tuple)
# ...

julia> out=CuVector{Int}(undef,length(c));

julia> sortperm!(out,c);
# no error

julia> out=CuVector{UInt32}(undef,length(c));

julia> sortperm!(out,c);
# no error
@chrstphrbrns chrstphrbrns added the bug Something isn't working label Aug 19, 2023
@chrstphrbrns chrstphrbrns changed the title sortperm! fails when output is UInt8 vector sortperm! fails when output is UInt vector Aug 19, 2023
@maleadt
Copy link
Member

maleadt commented Aug 21, 2023

The problem is that you're swapping out and c; the indices has to be the first argument.
It shouldn't error like that though, so let me push a fix.

@chrstphrbrns
Copy link
Contributor Author

out is just an uninitialized output vector. c is the data I'm sorting (pointlessly, in this MWE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants