Skip to content
Open
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
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ Republic = "27243419-9dde-4721-b67c-fd63626fea7f"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[weakdeps]
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
cuTile = "0dea8319-8c4a-4662-a73d-20234d115b9a"

[extensions]
cuDNNExt = "cuDNN"
cuTileExt = "cuTile"

[compat]
Expand Down
16 changes: 16 additions & 0 deletions ext/cuDNNExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module cuDNNExt

import BitPacking
import cuDNN

function cuDNN.checked_array_pointer(t::cuDNN.Tensor, a::BitPacking.NarrowArray)
parent(a) isa cuDNN.DenseCuArray || throw(ArgumentError(
"binding for $(t.name) needs GPU-backed storage, got $(typeof(parent(a)))"))
cuDNN.graph_dtype(eltype(a)) == t.dtype || throw(ArgumentError(
"binding for $(t.name) has eltype $(eltype(a)), expected $(t.dtype)"))
length(a) == prod(t.dims) || throw(DimensionMismatch(
"binding for $(t.name) has $(length(a)) elements, expected $(prod(t.dims))"))
return pointer(parent(a))
end

end