-
Notifications
You must be signed in to change notification settings - Fork 130
[NDTensorsMetalExt] Fix more scalar indexing issues on Metal #1264
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
Merged
Merged
Changes from 73 commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
ab39bed
Same issue on Metal and CUDA
kmp5VT 5b63ddd
Replace _gemm! with mul!!
kmp5VT 478131f
Add comment
kmp5VT 1324868
Fix some issues with permutedims in Metal
kmp5VT 526bf4a
Change the default_eltype of NDTensors to Float32 if using Mtl
kmp5VT 4b9be1d
Blocksparse shouldn't use default of Float64. Use NDTensors.default_e…
kmp5VT 5e34f9d
Make sure to revert to original Float64
kmp5VT 3e93f9b
If in Float32 need to adjust atol. Also turn off and on Float32 appro…
kmp5VT 8f9f46c
There is no check when multiplying numbers this might lead to an issu…
kmp5VT 911542d
Format
kmp5VT fdbdef6
Merge branch 'main' into kmp5/debug/scalar_metal
kmp5VT cb08934
Merge branch 'main' into kmp5/debug/scalar_metal
kmp5VT 0a2f1ca
Merge branch 'main' into kmp5/debug/scalar_metal
kmp5VT 6780956
Create NDTensorsTestUtils
kmp5VT 1ab3418
Move functions to NDTensorsTestUtils
kmp5VT 2ff61ff
Use NDTensorsTestUtils
kmp5VT 09e95cf
Remove global modification of default_eltype
kmp5VT cb2bd51
format
kmp5VT ed10f71
Rename test files test_FILENAME.jl
kmp5VT c61bc5b
Fix spelling mistake
kmp5VT 6530969
Update test files to create random modules and run in the modules. Al…
kmp5VT a792341
format
kmp5VT bb424d7
Create a couple necessary BlockSparseTensor constructors
kmp5VT b393700
fix dmrg tests
kmp5VT 49b0f7b
Fix metal tests
kmp5VT c50f431
format
kmp5VT 06a9e47
This is fixed in this pr
kmp5VT d39f765
fix elt issue in combiner
kmp5VT cb652b7
format
kmp5VT c4e7332
use tuple when different types
kmp5VT dc8b13e
Fix typo
kmp5VT ef3b4d5
Alphabetize and consistently use LinearAlgebra.
kmp5VT b22c430
Remove commented code
kmp5VT e6baedc
Remove comment
kmp5VT 1473da7
remove comma
kmp5VT 40be5aa
Split into two lines
kmp5VT fc7561f
Need to have module `NDTensors` in path
kmp5VT 25f6d04
Reorder for documentation
kmp5VT 0fbe7b8
Update dense test code
kmp5VT 488aefd
Add better comment
kmp5VT e7ed450
Fix remaining issues
kmp5VT 87c50e3
format
kmp5VT 4880655
Metal testing now fully functional remove it from extra
kmp5VT 87eca37
Merge remote-tracking branch 'origin/main' into kmp5/debug/scalar_metal
kmp5VT 16b9c74
Move metal back to extras because it cannot be installed properly for…
kmp5VT 7e4839a
use is_supported_eltype function
kmp5VT 2ef4f16
Update NDTensorsCUDAExt example
kmp5VT e1748be
Remove LinearAlgebra.
kmp5VT 37c0ced
Changes to NDTensorsCUDA example
kmp5VT 663b56e
Remove NDTensors.
kmp5VT 8de246b
Update NDTensors/test/runtests.jl [no-ci]
kmp5VT e6a68e5
Just bring name into namespace
kmp5VT edcb6c8
Just use reshape
kmp5VT 246ecd4
Updates to NDTensorsMetal example
kmp5VT ab237aa
Remove unwrap_type
kmp5VT 0abeb5a
format
kmp5VT 4700b39
calling permutedims(expose(A) ...) can cause a stack overflow.
kmp5VT ac4f9c1
format
kmp5VT 771403b
Update mul.jl [no-ci]
kmp5VT c2b39a1
Update mul.jl [no-ci]
kmp5VT 919b041
Update documentation
kmp5VT d4621f5
Add permutedims for CuArray failing
kmp5VT 98719ed
Merge branch 'kmp5/debug/scalar_metal' of github.com:kmp5VT/ITensors.…
kmp5VT da62a14
format
kmp5VT c03accd
Merge branch 'main' into kmp5/debug/scalar_metal
kmp5VT cda274f
simplifications to NDTensorsCUDA example
kmp5VT 5f29bf4
Allowscalar shouldn't be necessary
kmp5VT 7ce440b
Simplifications to NDTensorsMetal tests
kmp5VT 6dd95d4
spelling
kmp5VT 2498930
formatting
kmp5VT 61562ef
Merge branch 'main' into kmp5/debug/scalar_metal
kmp5VT 8a5a3d7
format
kmp5VT b56f8a4
grab NDTensors.cpu
kmp5VT 66045ae
Simplify code
kmp5VT a2d569d
add random module to files its missing
kmp5VT d85ac43
Move readwrite to `NDTensors/tes/broken`
kmp5VT ce0caba
Remove @eval module...
kmp5VT ffbb01c
remove extra end
kmp5VT bc7c400
Use TupleTools.sort
kmp5VT 3eadb7b
use `TupleTools.sort`
kmp5VT 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 |
|---|---|---|
| @@ -1,7 +1,37 @@ | ||
| ## Theres an issue in metal that `ReshapedArray' wrapped arrays cannot be permuted using | ||
| ## permutedims (failing in that Metal uses scalar indexing) | ||
| ## These functions are to address the problem in different instances of permutedims | ||
| function Base.permutedims(E::Exposed{<:MtlArray,<:Base.ReshapedArray}, perm) | ||
| A = copy(E) | ||
| return permutedims(A, perm) | ||
| end | ||
|
|
||
| function Base.permutedims!( | ||
| Edest::Exposed{<:MtlArray,<:Base.ReshapedArray}, Esrc::Exposed{<:MtlArray}, perm | ||
| ) | ||
| Aperm = permutedims(Esrc, perm) | ||
| copyto!(expose(parent(Edest)), expose(Aperm)) | ||
| return unexpose(Edest) | ||
| end | ||
|
|
||
| function Base.permutedims!( | ||
| Edest::Exposed{<:MtlArray}, Esrc::Exposed{<:MtlArray,<:Base.ReshapedArray}, perm | ||
| ) | ||
| Aperm = permutedims(Esrc, perm) | ||
| copyto!(Edest, expose(Aperm)) | ||
| return unexpose(Edest) | ||
| end | ||
|
|
||
| ## To get around the Metal issue here we copy and permute Esrc, | ||
| ## then we reshape Esrc to the size of Edest's parent | ||
| ## and broadcast into the parent. | ||
| function Base.permutedims!( | ||
| Edest::Exposed{<:MtlArray,<:Base.ReshapedArray}, | ||
| Esrc::Exposed{<:MtlArray,<:Base.ReshapedArray}, | ||
| perm, | ||
| f, | ||
| ) | ||
| Aperm = reshape(permutedims(Esrc, perm), size(parent(Edest))) | ||
| parent(Edest) .= f.(parent(Edest), Aperm) | ||
| return unexpose(Edest) | ||
| 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
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.
Uh oh!
There was an error while loading. Please reload this page.