[go: nahoru, domu]

Skip to content
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

[XLA:GPU] Do not fuse custom fusions in horizontal_input_fusion. #76571

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ std::vector<HloInstruction*> FindAndSortFusionCandidates(
// Find out the input fusion instructions whose only consumer is `consumer`.
// This guarantees that fusing these candidates will never create cycles, as
// there is no back edge.
if (IsInputFusibleReduction(*predecessor) &&
if (!predecessor->IsCustomFusion() &&
IsInputFusibleReduction(*predecessor) &&
IsConsumerTheOnlyNonRootUser(*predecessor, *consumer)) {
if (fusion_instr_set.insert(predecessor).second) {
fusion_instrs.push_back(predecessor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,38 @@ TEST_F(HorizontalInputFusionTest, NonfusionInstrs) {
GmockMatch(m::Tuple(m::Reduce(), m::Reduce())));
}

TEST_F(HorizontalInputFusionTest, DoesNotFuseCustomFusions) {
auto module = ParseAndReturnVerifiedModule(R"(
max {
p0 = f16[] parameter(0)
p1 = f16[] parameter(1)
ROOT max = f16[] maximum(p0, p1)
}

triton_a {
p = f16[128,256] parameter(0)
c = f16[] constant(0)
ROOT n = f16[128] reduce(p, c), dimensions={1}, to_apply=max
}

triton_b {
p = f16[128,256] parameter(0)
c = f16[] constant(0)
ROOT n = f16[128] reduce(p, c), dimensions={1}, to_apply=max
}

ENTRY entry_computation {
p = f16[128,256] parameter(0)
fa = f16[128] fusion(p), kind=kCustom, calls=triton_a
fb = f16[128] fusion(p), kind=kCustom, calls=triton_b
ROOT tuple = (f16[128], f16[128]) tuple(fa, fb)
}
)")
.value();

EXPECT_FALSE(horizontal_input_fusion_.Run(module.get()).value());
}

} // namespace
} // namespace gpu
} // namespace xla