-
Notifications
You must be signed in to change notification settings - Fork 71
Add tests for AMDGPU #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kshyatt
wants to merge
7
commits into
master
Choose a base branch
from
ksh/amd
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+95
−7
Open
Add tests for AMDGPU #271
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8c8dc41
Add tests for AMDGPU
kshyatt 1364d01
Add AMDGPU allocator support
lkdvos 3b343ae
Get AMDGPU tensor ops working
2ee27e9
Update Project.toml
kshyatt 9e3569f
Update pipeline.yml
kshyatt c906f14
Merge branch 'master' into ksh/amd
kshyatt 5502697
Fix AMD on 1.10
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
| module TensorOperationsAMDGPUExt | ||
|
|
||
| using AMDGPU | ||
| using TensorOperations | ||
| using TensorOperations: TensorOperations as TO | ||
|
|
||
| #------------------------------------------------------------------------------------------- | ||
| # Allocator | ||
| #------------------------------------------------------------------------------------------- | ||
|
|
||
| TO.tensoradd_type(TC, A::AnyROCArray, pA::Index2Tuple, conjA::Bool) = | ||
| ROCArray{TC, TO.numind(pA)} | ||
|
|
||
| function TO.tensoralloc_add( | ||
| TC, A::AbstractArray, pA::Index2Tuple, conjA::Bool, | ||
| istemp::Val, allocator::TO.AMDAllocator | ||
| ) | ||
| ttype = ROCArray{TC, TO.numind(pA)} | ||
| structure = TO.tensoradd_structure(A, pA, conjA) | ||
| return TO.tensoralloc(ttype, structure, istemp, allocator)::ttype | ||
| end | ||
|
|
||
| function TO.tensoralloc_contract( | ||
| TC, | ||
| A::AbstractArray, pA::Index2Tuple, conjA::Bool, | ||
| B::AbstractArray, pB::Index2Tuple, conjB::Bool, | ||
| pAB::Index2Tuple, | ||
| istemp::Val, allocator::TO.AMDAllocator | ||
| ) | ||
| ttype = ROCArray{TC, TO.numind(pAB)} | ||
| structure = TO.tensorcontract_structure(A, pA, conjA, B, pB, conjB, pAB) | ||
| return TO.tensoralloc(ttype, structure, istemp, allocator)::ttype | ||
| end | ||
|
|
||
| # NOTE: the general implementation in the `DefaultAllocator` case works just fine, without | ||
| # selecting an explicit memory model | ||
| function TO.tensoralloc( | ||
| ::Type{<:ROCArray{T, N}}, structure, | ||
| ::Val{istemp}, allocator::TO.AMDAllocator | ||
| ) where {T, N, istemp} | ||
| return ROCArray{T, N}(undef, structure) | ||
| end | ||
|
|
||
| function TO.tensorfree!(C::ROCArray, ::TO.AMDAllocator) | ||
| AMDGPU.unsafe_free!(C) | ||
| return nothing | ||
| end | ||
|
|
||
| end |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this
conj!there? It looks a bit suspicious to me, since I'm not sure we are really allowed to modifyA, so we are really depending on the fact thatconj(SV(A))produces a view without modifyingA.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "resolved" the AMD tests but caused the CUDA ones to fail (I was testing on an AMD machine), I thought
conj!on aStridedViewwould also return simply a view but I guess not