-
Notifications
You must be signed in to change notification settings - Fork 33
CUDA kernels take 3 #427
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
CUDA kernels take 3 #427
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d530bf9
CUDA take 3
wsmoses 3b54150
conditional run cuda
wsmoses 5cdf38c
Update test/integration/cuda.jl
wsmoses 57a87da
bump enzymexla
wsmoses 4298112
fix
wsmoses 5d22903
fix gpu reg
wsmoses 8365568
Update BUILD
wsmoses 90a85b0
Update BUILD
wsmoses df6717f
Update Project.toml
wsmoses b682b5e
Update ReactantCUDAExt.jl
wsmoses fa13d83
Apply suggestions from code review
wsmoses 80b4d49
fix reactant method blocker
wsmoses e129edb
Update ReactantCUDAExt.jl
wsmoses 37bb247
only do compile
wsmoses bb47389
use names in cache
wsmoses 87d12d2
Apply suggestions from code review
wsmoses 40bc031
cleanup further gc issues
wsmoses 5708ff9
Apply suggestions from code review
wsmoses e9d4443
fix
wsmoses 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
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
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 was deleted.
Oops, something went wrong.
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,29 @@ | ||
| using Reactant | ||
| using Test | ||
| using CUDA | ||
|
|
||
| function square_kernel!(x, y) | ||
| i = threadIdx().x | ||
| x[i] *= y[i] | ||
| sync_threads() | ||
| return nothing | ||
| end | ||
|
|
||
| # basic squaring on GPU | ||
| function square!(x, y) | ||
| @cuda blocks = 1 threads = length(x) square_kernel!(x, y) | ||
| return nothing | ||
| end | ||
|
|
||
| @testset "Square Kernel" begin | ||
| oA = collect(1:1:64) | ||
| A = Reactant.to_rarray(oA) | ||
| B = Reactant.to_rarray(100 .* oA) | ||
| if CUDA.functional() | ||
| @jit square!(A, B) | ||
| @test all(Array(A) .≈ (oA .* oA .* 100)) | ||
| @test all(Array(B) .≈ (oA .* 100)) | ||
| else | ||
| @code_hlo optimize = :before_kernel square!(A, B) | ||
| 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
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.
@jumerckx as a note. Something that I missed earlier, we previously had a catch all like this that we'll only do rewrite insts if the top level function is not a reactant method, but I think this was accidentally removed by your earlier PR. In any case restored here (and once CUDA lands will actually be tested it is done)