-
Notifications
You must be signed in to change notification settings - Fork 52
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
transpose scheduler fix: reduction IterDomain on input tensors #1661
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
23d80d0
quick fix
jjsjann123 f0d32e6
I don't know how to code
jjsjann123 afb65c7
test added
jjsjann123 c9843f7
fixing accessing moved unique_ptr
jjsjann123 2189929
typo
jjsjann123 bfcaa97
Merge remote-tracking branch 'origin/main' into HEAD
jjsjann123 ac7b06f
adding a failing test with wrong result
jjsjann123 b6c4ba7
Revert "adding a failing test with wrong result"
jjsjann123 fca6028
review comment
jjsjann123 ba2ae61
Merge remote-tracking branch 'origin/main' into HEAD
jjsjann123 a6aa596
review comments
jjsjann123 d8927d4
review comments
jjsjann123 03f7d5c
Merge branch 'main' into issue_1659
jjsjann123 847c68d
Merge branch 'main' into issue_1659
jjsjann123 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1335,4 +1335,56 @@ TEST_F(TransposeTest, TransposeSplitAggregatedVectorizationWidth) { | |
NVF_CHECK(ref.equal(cg_outputs.at(0))); | ||
} | ||
|
||
// Testing transpose scheduler to handle trivial reduction IterDomain produced | ||
// by segmented fusion, see issue 1659 for details | ||
TEST_F(TransposeTest, TrivialReductionIterDomainOnInputsIssueRepro1659) { | ||
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. Please also change the comment here to avoid the term "trivial reduction" |
||
auto fusion = std::make_unique<Fusion>(); | ||
auto fusion_ptr = fusion.get(); | ||
FusionGuard fg(fusion_ptr); | ||
|
||
auto tv0 = TensorViewBuilder() | ||
.ndims(3) | ||
.contiguity({true, true, std::nullopt}) | ||
.shape({-1, -1, 1}) | ||
.dtype(DataType::Float) | ||
.build(); | ||
fusion->addInput(tv0); | ||
auto tv1 = TensorViewBuilder() | ||
.ndims(3) | ||
.contiguity({true, std::nullopt, true}) | ||
.shape({-1, 1, -1}) | ||
.dtype(DataType::Float) | ||
.build(); | ||
fusion->addInput(tv1); | ||
auto tv2 = sum(tv0, {1}); | ||
auto tv3 = squeeze(tv1, std::vector<int64_t>{1}); | ||
auto tv4 = add(tv2, tv3); | ||
fusion->addOutput(tv4); | ||
|
||
auto options = at::TensorOptions().dtype(at::kFloat).device(at::kCUDA, 0); | ||
|
||
auto t0 = at::randn({1024, 512, 1}, options); | ||
auto t1 = at::randn({1024, 1, 512}, options); | ||
std::vector<c10::IValue> aten_inputs({t0, t1}); | ||
|
||
FusionExecutorCache executor_cache(std::move(fusion)); | ||
auto cg_outputs = executor_cache.runFusionWithInputs(aten_inputs); | ||
|
||
auto runtime = executor_cache.getMostRecentKernelRuntime(); | ||
NVF_CHECK(runtime->isSegmented(), "Segmentation expected"); | ||
auto heuristic0 = | ||
runtime->schedulerHeuristics()->heuristicsList().at(0).get()->heuristic(); | ||
NVF_CHECK( | ||
heuristic0 == ScheduleHeuristic::Reduction, | ||
"Unexpected heuristic: ", | ||
heuristic0); | ||
auto heuristic1 = | ||
runtime->schedulerHeuristics()->heuristicsList().at(1).get()->heuristic(); | ||
NVF_CHECK( | ||
heuristic1 == ScheduleHeuristic::Transpose, | ||
"Unexpected heuristic: ", | ||
heuristic1); | ||
testValidate(fusion_ptr, cg_outputs, {t0, t1}, __LINE__, __FILE__); | ||
} | ||
|
||
} // namespace nvfuser |
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.
As Xiang also commented, trivial reduction could be confusing as it would imply squeeze. Can you please rephrase the comment?