feat: Implement issorted for AbstractGPUArray without scalar indexing.#678
feat: Implement issorted for AbstractGPUArray without scalar indexing.#678maleadt merged 2 commits intoJuliaGPU:masterfrom
Conversation
|
@kshyatt please review. |
|
Thanks for getting to this so quickly! I'm at a conference today so may not get to it immediately but perhaps @maleadt has spare time? If not I'll look on Monday. |
|
@maleadt I have removed the unnecessary I initially tried using Please let me know if I'm missing something. |
|
Seems to generate code fine? What issue exact were you running into? julia> code_llvm(Base.lt, Tuple{Base.Order.ForwardOrdering, Int, Int})
; Function Signature: lt(Base.Order.ForwardOrdering, Int64, Int64)
; @ ordering.jl:118 within `lt`
define i8 @julia_lt_3166(i64 signext %"a::Int64", i64 signext %"b::Int64") #0 {
top:
; ┌ @ operators.jl:431 within `isless`
; │┌ @ int.jl:83 within `<`
%0 = icmp slt i64 %"a::Int64", %"b::Int64"
%1 = zext i1 %0 to i8
ret i8 %1
; └└
}
julia> code_llvm(Base.lt, Tuple{Base.Order.ReverseOrdering{Base.Order.ForwardOrdering}, Int, Int})
; Function Signature: lt(Base.Order.ReverseOrdering{Base.Order.ForwardOrdering}, Int64, Int64)
; @ ordering.jl:119 within `lt`
define i8 @julia_lt_3169(i64 signext %"a::Int64", i64 signext %"b::Int64") #0 {
top:
; @ ordering.jl:119 within `lt` @ ordering.jl:118
; ┌ @ operators.jl:431 within `isless`
; │┌ @ int.jl:83 within `<`
%0 = icmp slt i64 %"b::Int64", %"a::Int64"
%1 = zext i1 %0 to i8
ret i8 %1
; └└
} |
|
Your PR no longer requires formatting changes. Thank you for your contribution! |
|
Hi @maleadt . I have made the changes that you've suggested. |
Fix for #635
Base.issortedon AbstractGPUArray currently falls back to scalar iteration, which triggers scalar indexing errors and prevents correct usage on GPU-backed arrays.This PR introduces a GPU-native implementation of
issortedusing a kernel-based approach, ensuring the operation executes entirely on the device.Tests
(GPUArrays with base as
test_args)(GPUArrays)
