Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dev/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[deps]
cupynumeric_jll = "2862d674-414d-5b0b-a494-b21f8deca547"
CUDA_SDK_jll = "6cbf2f2e-7e60-5632-ac76-dca2274e0be0"

[compat]
cupynumeric_jll = "25.10"
CUDA_SDK_jll = "13"
2 changes: 1 addition & 1 deletion ext/CUDAExt/cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ end

function nda_to_logical_array(arr::NDArray{T,N}) where {T,N}
st_handle = cuNumeric.get_store(arr)
return Legate.LogicalArray{T,N}(st_handle[], size(arr))
return Legate.LogicalArray{T,N}(st_handle, size(arr))
end

function Launch(kernel::cuNumeric.CUDATask, inputs::Tuple{Vararg{NDArray}},
Expand Down
5 changes: 1 addition & 4 deletions lib/cunumeric_jl_wrapper/src/wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ struct WrapCppOptional {
}
};

legate::LogicalArray* get_store(CN_NDArray* arr) {
auto res = arr->obj.get_store();
return new legate::LogicalArray(std::move(res));
}
legate::LogicalArray get_store(CN_NDArray* arr) { return arr->obj.get_store(); }

legate::Library get_lib() {
auto runtime = cupynumeric::CuPyNumericRuntime::get_runtime();
Expand Down
13 changes: 6 additions & 7 deletions src/ndarray/detail/ndarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ mutable struct NDArray{T,N,PADDED,P} <: AbstractNDArray{T,N}
return handle
end
end
# this here is to avoid if else patterns
# this here is to avoid if else patterns
@inline _NDArray(ptr, T, v, ::Nothing) = NDArray(ptr, T, v)
@inline _NDArray(ptr, T, v, parent) = NDArray(ptr, T, v, parent)

Expand Down Expand Up @@ -219,7 +219,9 @@ function nda_unary_reduction(out::NDArray, op_code::UnaryRedCode, input::NDArray
return out
end

function nda_unary_reduction_axes(op_code::UnaryRedCode, input::NDArray{T,N}, axes::Vector{Int32}, keepdims::Bool) where {T,N}
function nda_unary_reduction_axes(
op_code::UnaryRedCode, input::NDArray{T,N}, axes::Vector{Int32}, keepdims::Bool
) where {T,N}
axes_c = collect(Int32, axes)
ptr = ccall((:nda_unary_reduction_axes, libnda),
NDArray_t, (UnaryRedCode, NDArray_t, Ptr{Int32}, Int32, Cint),
Expand Down Expand Up @@ -336,11 +338,8 @@ function get_store(arr::NDArray)
end

function get_ptr(arr::NDArray{T,N}) where {T,N}
# Get the raw Legate array impl
st_handle = get_store(arr) # CxxPtr{LogicalArrayImpl}
# Wrap it in the high-level LogicalArray struct expected by Legate.get_ptr
# st_handle[] dereferences the CxxPtr to get the LogicalArrayImpl object
la = Legate.LogicalArray{T,N}(st_handle[], size(arr))
st_handle = get_store(arr) # LogicalArrayImplAllocated (returned by value)
la = Legate.LogicalArray{T,N}(st_handle, size(arr))
return Legate.get_ptr(la)
end

Expand Down
Loading