Skip to content

Commit 968f294

Browse files
committed
Consistency
1 parent bb33fa5 commit 968f294

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ Base.unsafe_convert(::Type{MTL.MTLBuffer}, A::PermutedDimsArray) =
479479
## unsafe_wrap
480480

481481
function Base.unsafe_wrap(::Type{<:Array}, arr::MtlArray{T,N}, dims=size(arr); own=false) where {T,N}
482-
return unsafe_wrap(Array{T,N}, arr.data[], dims; own=own)
482+
return unsafe_wrap(Array{T,N}, arr.data[], dims; own)
483483
end
484484

485485
function Base.unsafe_wrap(t::Type{<:Array{T}}, buf::MTLBuffer, dims; own=false) where T

src/compiler/execution.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ end
253253
end
254254

255255
# pass by reference, in an argument buffer
256-
argument_buffer = alloc(kernel.pipeline.device, sizeof(argtyp), storage=Shared)
256+
argument_buffer = alloc(kernel.pipeline.device, sizeof(argtyp); storage=Shared)
257257
argument_buffer.label = "MTLBuffer for kernel argument"
258258
unsafe_store!(convert(Ptr{argtyp}, argument_buffer), arg)
259259
return argument_buffer

src/memory.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function Base.unsafe_copyto!(dev::MTLDevice, dst::MtlPointer{T}, src::Ptr{T}, N:
3535
storage_type = dst.buffer.storageMode
3636
if storage_type == MTL.MTLStorageModePrivate
3737
# stage through a shared buffer
38-
# shared = alloc(dev, N*sizeof(T), src, storage=Shared)
38+
# shared = alloc(dev, N*sizeof(T), src; storage=Shared)
3939
# unsafe_copyto!(dev, dst, pointer(shared), N; queue, async=false)
4040
# free(shared)
41-
tmp_buf = alloc(dev, N*sizeof(T), src, storage=Shared) #CPU -> GPU (Shared)
41+
tmp_buf = alloc(dev, N*sizeof(T), src; storage=Shared) #CPU -> GPU (Shared)
4242
unsafe_copyto!(dev, MtlPointer{T}(dst.buffer, dst.offset), MtlPointer{T}(tmp_buf, 0), N; queue, async=false) # GPU (Shared) -> GPU (Private)
4343
free(tmp_buf)
4444
elseif storage_type == MTL.MTLStorageModeShared
@@ -56,7 +56,7 @@ function Base.unsafe_copyto!(dev::MTLDevice, dst::Ptr{T}, src::MtlPointer{T}, N:
5656
storage_type = src.buffer.storageMode
5757
if storage_type == MTL.MTLStorageModePrivate
5858
# stage through a shared buffer
59-
shared = alloc(dev, N*sizeof(T), storage=Shared)
59+
shared = alloc(dev, N*sizeof(T); storage=Shared)
6060
unsafe_copyto!(dev, MtlPointer{T}(shared, 0), MtlPointer{T}(src.buffer, src.offset), N; queue, async=false)
6161
unsafe_copyto!(dst, convert(Ptr{T}, shared), N)
6262
free(shared)

test/array.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ check_storagemode(arr, smode) = Metal.storagemode(arr) == smode
7272
N = length(dim)
7373

7474
# mtl
75-
let arr = mtl(rand(2,2), storage= SM)
75+
let arr = mtl(rand(2,2); storage= SM)
7676
@test check_storagemode(arr, SM)
7777
end
7878

@@ -134,7 +134,7 @@ check_storagemode(arr, smode) = Metal.storagemode(arr) == smode
134134
end
135135

136136
let b = rand(Float32, 10)
137-
arr_mtl = mtl(b, storage=Private)
137+
arr_mtl = mtl(b; storage=Private)
138138
@test_throws ErrorException arr_mtl[1]
139139
@test Metal.@allowscalar arr_mtl[1] == b[1]
140140
end
@@ -145,7 +145,7 @@ check_storagemode(arr, smode) = Metal.storagemode(arr) == smode
145145
end
146146

147147
let b = rand(Float32, 10)
148-
arr_mtl = mtl(b, storage=Shared)
148+
arr_mtl = mtl(b; storage=Shared)
149149
@test arr_mtl[1] == b[1]
150150
end
151151
elseif SM == Metal.Managed
@@ -155,7 +155,7 @@ check_storagemode(arr, smode) = Metal.storagemode(arr) == smode
155155
end
156156

157157
let b = rand(Float32, 10)
158-
arr_mtl = mtl(b, storage=Managed)
158+
arr_mtl = mtl(b; storage=Managed)
159159
@test arr_mtl[1] == b[1]
160160
end
161161
end

0 commit comments

Comments
 (0)