-
Notifications
You must be signed in to change notification settings - Fork 480
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
Introduce CUDA OpenXLA fallback. #7318
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
091fb6b
Initial implementation.
ysiraichi 1c8b479
Replace usage of `xla_cpu_fallback`.
ysiraichi a908ed4
Remove 'fallback' suffix.
ysiraichi 2d4bb59
Scratch
ysiraichi aae7197
Deal with undefined tensors + bring back step 3.
ysiraichi bbb86a8
Refactor test.
ysiraichi 540275a
Refactor fallback.
ysiraichi 868333a
Refactor tests.
ysiraichi e9fb89d
Fix lint issues.
ysiraichi e1e1da1
Forward declare CUDA functions.
ysiraichi 5413a74
Lazy initialize CUDA.
ysiraichi 1304dc7
Fix lint.
ysiraichi e4642f9
Fix compilation.
ysiraichi 2f32ba8
Address reviews.
ysiraichi 8c0dddd
Create fallback implementation for tests.
ysiraichi 9c2e28b
Fix lint issue.
ysiraichi ea33a74
Fix test builds and add `libc10_cuda.so` dependency.
ysiraichi 0ef4e1b
Fix C++ test dependencies.
ysiraichi d035935
Build a second library for conditionally loading CUDA functions.
ysiraichi 4129e86
Add Python module initialization.
ysiraichi 9a22be7
Fix lib and `dlopen` options.
ysiraichi 7d5063a
Fix lint issues.
ysiraichi 75ffb01
Skip CUDA fallback tests on CPU envs.
ysiraichi 0dd29da
Fix lint issues.
ysiraichi 2c2b165
Clean up.
ysiraichi 4686238
Make sure only one XLA device is used.
ysiraichi 8d5fe8f
Fix compilation issues.
ysiraichi 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ ptxla_cc_test( | |
":cpp_test_util", | ||
":torch_xla_test", | ||
"//torch_xla/csrc:tensor", | ||
"//torch_xla/csrc:aten_cuda_functions", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) | ||
|
@@ -63,6 +64,7 @@ ptxla_cc_test( | |
deps = [ | ||
":torch_xla_test", | ||
"//torch_xla/csrc:tensor", | ||
"//torch_xla/csrc:aten_cuda_functions", | ||
"@com_google_googletest//:gtest_main", | ||
"@xla//xla:shape_util", | ||
], | ||
|
@@ -77,6 +79,7 @@ ptxla_cc_test( | |
"//torch_xla/csrc/runtime:runtime", | ||
"//torch_xla/csrc/runtime:debug_macros", | ||
"//torch_xla/csrc:tensor", | ||
"//torch_xla/csrc:aten_cuda_functions", | ||
"//torch_xla/csrc:thread_pool", | ||
"@com_google_absl//absl/synchronization", | ||
"@com_google_googletest//:gtest_main", | ||
|
@@ -95,6 +98,7 @@ ptxla_cc_test( | |
":cpp_test_util", | ||
":torch_xla_test", | ||
"//torch_xla/csrc:tensor", | ||
"//torch_xla/csrc:aten_cuda_functions", | ||
"@com_google_googletest//:gtest_main", | ||
], | ||
) | ||
|
@@ -119,6 +123,7 @@ ptxla_cc_test( | |
"//torch_xla/csrc/runtime:env_vars", | ||
"//torch_xla/csrc/runtime:sys_util", | ||
"//torch_xla/csrc:tensor", | ||
"//torch_xla/csrc:aten_cuda_functions", | ||
"@com_google_googletest//:gtest_main", | ||
"@xla//xla:xla_data_proto_cc", | ||
"@tsl//tsl/profiler/utils:session_manager", | ||
|
@@ -137,6 +142,7 @@ ptxla_cc_test( | |
":torch_xla_test", | ||
"//torch_xla/csrc/runtime:metrics", | ||
"//torch_xla/csrc:tensor", | ||
"//torch_xla/csrc:aten_cuda_functions", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm using the fallback implementation for solving the undefined references in C++ tests. I think this should be reasonable, since we don't test fallback on C++ tests. |
||
"@com_google_googletest//:gtest_main", | ||
"@xla//xla:permutation_util", | ||
], | ||
|
Oops, something went wrong.
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.
I wonder how the copts and linkopts are determined
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.
To be honest, I just copied them from
_XLAC
. I guess I could get rid of them, though. What do you think?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.
Well, if it works now, feel free to keep it :p