JuliaGPU / JuliaGPU/AMDGPU.jl

`sort!(x, dims=2)` doesn't work

Open
#1,030 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Julia
Stars
344
Forks
79
Avg merge
2d 23h
Merged PRs (30d)
27

Description

MWE:

julia> x = AMDGPU.rand(100, 100);

julia> sort!(x, dims=2)
ERROR: MethodError: no method matching _sort_impl!(::ROCArray{Float32, 2, AMDGPU.Runtime.Mem.HIPBuffer}, ::ROCBackend; dims::Int64)
This method does not support all of the given keyword arguments (and may not support any).

Closest candidates are:
  _sort_impl!(::AbstractArray, ::KernelAbstractions.Backend; lt, by, rev, order, max_tasks, min_elems, prefer_threads, block_size, temp) got unsupported keyword argument "dims"
   @ AcceleratedKernels ~/.julia/packages/AcceleratedKernels/AdYRJ/src/sort/sort.jl:81

Stacktrace:
 [1] kwerr(::@NamedTuple{dims::Int64}, ::Function, ::ROCArray{Float32, 2, AMDGPU.Runtime.Mem.HIPBuffer}, ::ROCBackend)
   @ Base ./error.jl:175
 [2] sort!(v::ROCArray{Float32, 2, AMDGPU.Runtime.Mem.HIPBuffer}, backend::ROCBackend; kwargs::@Kwargs{dims::Int64})
   @ AcceleratedKernels ~/.julia/packages/AcceleratedKernels/AdYRJ/src/sort/sort.jl:74
 [3] sort!(x::ROCArray{Float32, 2, AMDGPU.Runtime.Mem.HIPBuffer}; kwargs::@Kwargs{dims::Int64})
   @ AMDGPU ~/.julia/packages/AMDGPU/1CdUx/src/kernels/sorting.jl:1
 [4] top-level scope
   @ REPL[7]:1
julia> versioninfo()
Julia Version 1.12.5
Commit 5fe89b8ddc1 (2026-02-09 16:05 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 128 × AMD EPYC 7713 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 128 virtual cores)

julia> AMDGPU.versioninfo()
AMDGPU versioninfo
┌───────────┬──────────────────┬───────────┬─────────────────────────────────────────────────────────────────────────────────────────┐
│ Available │ Name             │ Version   │ Path                                                                                    │
├───────────┼──────────────────┼───────────┼─────────────────────────────────────────────────────────────────────────────────────────┤
│     +     │ LLD              │ -         │ /opt/rocm-6.4.4/lib/llvm/bin/ld.lld                                                     │
│     +     │ Device Libraries │ -         │ /home/efaulha2/.julia/artifacts/0a0cad46b7dacc66387ed19e8c0f45b097f46691/amdgcn/bitcode │
│     +     │ HIP              │ 6.4.43484 │ /opt/rocm-6.4.4/lib/libamdhip64.so                                                      │
│     +     │ rocBLAS          │ 4.4.1     │ /opt/rocm-6.4.4/lib/librocblas.so                                                       │
│     +     │ rocSOLVER        │ 3.28.2    │ /opt/rocm-6.4.4/lib/librocsolver.so                                                     │
│     +     │ rocSPARSE        │ 3.4.0     │ /opt/rocm-6.4.4/lib/librocsparse.so                                                     │
│     +     │ rocRAND          │ 3.3.0     │ /opt/rocm-6.4.4/lib/librocrand.so                                                       │
│     +     │ rocFFT           │ 1.0.32    │ /opt/rocm-6.4.4/lib/librocfft.so                                                        │
│     -     │ MIOpen           │ -         │ -                                                                                       │
└───────────┴──────────────────┴───────────┴─────────────────────────────────────────────────────────────────────────────────────────┘

AMDGPU devices
┌────┬────────────────────┬────────────────────────┬───────────┬────────────┬───────────────┐
│ Id │               Name │               GCN arch │ Wavefront │     Memory │ Shared Memory │
├────┼────────────────────┼────────────────────────┼───────────┼────────────┼───────────────┤
│  1 │ AMD Instinct MI210 │ gfx90a:sramecc+:xnack- │        64 │ 63.984 GiB │    64.000 KiB │
└────┴────────────────────┴────────────────────────┴───────────┴────────────┴───────────────┘

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the MWE in AMDGPU's sort! entry point at src/kernels/sorting.jl, then inspect the AcceleratedKernels call at sort.jl:81 and how it handles keyword arguments. Confirm the change by rerunning sort!(x, dims=2) on the shown ROCArray without the MethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.