-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NDTensors] Avoid more scalar indexing operations in block sparse GPU…
… code
- Loading branch information
Showing
10 changed files
with
60 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This circumvents an issues that `MtlArray` can't call `resize!`. | ||
# TODO: Raise an issue with Metal.jl. | ||
function NDTensors.append!!(::Type{<:MtlArray}, collection, collections...) | ||
return vcat(collection, collections...) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This was calling generic matrix multiplication. | ||
# TODO: Raise an issue with `Metal.jl`. | ||
function NDTensors.mul!!( | ||
::Type{<:MtlArray}, | ||
CM::Transpose, | ||
::Type{<:MtlArray}, | ||
AM::AbstractMatrix, | ||
::Type{<:MtlArray}, | ||
BM::AbstractMatrix, | ||
α, | ||
β, | ||
) | ||
mul!(transpose(CM), transpose(BM), transpose(AM), α, β) | ||
return CM | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# NDTensors.append! | ||
# Used to circumvent issues with some GPU backends like Metal | ||
# not supporting `resize!`. | ||
function append!!(collection, collections...) | ||
return append!!(leaf_parenttype(collection), collection, collections...) | ||
end | ||
|
||
function append!!(::Type, collection, collections...) | ||
return append!(collection, collections...) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters