-
Notifications
You must be signed in to change notification settings - Fork 70
Clip slice range expressions #460
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
Conversation
|
!build |
This currently fails at lowering due to infinite recursion in nvfuser::prove::lessEqual when trying to simplify index expressions for index hoisting.
|
Closing in favor of #511. |
|
|
||
| const int64_t slice_offset = 4; | ||
| const std::vector<int64_t> shape({1024 * 1024}); | ||
| const std::vector<int64_t> shape({1024L * 1024L}); |
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.
Silencing clang-tidy
| std::cout << "Fusion IR after pre-segmenter optimization passes:" | ||
| << std::endl; | ||
| debug() << "Fusion IR after pre-segmenter optimization passes:" | ||
| << std::endl; |
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.
Unrelated to this PR. Just found wrong ostream in this debug dump.
|
!build |
|
!build |
test/test_resize.cpp
Outdated
|
|
||
| // Test slice with a variety of constant ranges | ||
| TEST_F(NVFuserTest, FusionResizeSliceConstantShmoo_CUDA) { | ||
| for (auto [start, stop] : std::vector<std::pair<int64_t, int64_t>>( |
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.
Should we use the same set of slices as FusionResizeSliceInputShmoo_CUDA?
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.
Yes that's good now. The reason I didn't originally is just that it slows down the test a lot since we need to recompile for each slice.
test/test_resize.cpp
Outdated
| fe.compileFusion(&fusion); | ||
|
|
||
| auto t0 = at::randn(shape, options); | ||
| for (auto [start, stop] : std::vector<std::pair<int64_t, int64_t>>( |
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.
Should we pull this set of slices out of the test and reuse it for all the three tests?
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.
Done
naoyam
left a comment
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.
LGTM
This PR normalizes the inputs to
slicein order to mimic the semantics of numpy/PyTorch slicing. For an axis with extentext, if we receive a slice of(start, stop, step)we normalize it to(norm_start, norm_stop, step)whereSpecific changes in this PR:
sliceop.The simple Fusion in the input range test prints like this:
resulting in the following CUDA kernel:
This PR does NOT simplify these expressions for non-constant inputs. This can be done at concretization, which will be left for a follow-up PR.
Stacked on #892 and #895.
Fixes #439. Fixes #52.