Repository navigation
Conversation
FuseOps treats TupleGetItem as injective, so two chained TupleGetItem bindings, e.g. `a = outer[0]; b = a[0]`, form a group with two nodes. Only single-node groups were left unfused, so a Primitive function was created for this group. FunctionCreator then moves the first TupleGetItem to the caller to pass the used tuple field directly, which leaves a function with no call_tir and the default name "fused". FuseTIR names the fused PrimFunc after the PrimFuncs it calls, and rejects such a function with `Check failed: (func_info_.global_name != "fused")`. A group without any call has nothing to fuse, so keep its bindings as they are, the same way as a single-node group. Groups created by FuseOpsByPattern carry attributes and are not affected. Fixes apache#20194 Generated-by: Claude Code (Claude Opus 5.5)
Author
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #20194.
FuseOps treats
TupleGetItemas injective, so two chainedTupleGetItembindings form a group with two nodes, asaandbdo here:Only single-node groups were left unfused, so FuseOps created a
Primitivefunction for this group.FunctionCreatorthen moves the firstTupleGetItemto the caller to pass the used tuple field directly, which leaves a function with nocall_tirand the default namefused. FuseTIR names the fused PrimFunc after the PrimFuncs it calls, so it rejects that function withCheck failed: (func_info_.global_name != "fused"). The nested tuple case in the issue hits this with the LLVM default pipeline.This PR keeps the bindings of a group without any call as they are, the same way as a single-node group, since there is nothing to fuse. Groups created by
FuseOpsByPatterncarry attributes and are not affected.Testing: added
test_tuple_get_item_chain_without_calltotests/python/relax/test_transform_fuse_ops.py. It fails on main, where FuseOps creates thefusedfunction, and passes with this change.test_transform_fuse_ops.py(33 tests),test_transform_fuse_tir.py(35) andtest_transform_fuse_ops_by_pattern.py(29) pass, and the reproducer from the issue now builds and runs with the LLVM default pipeline for both tuple depths.Generated-by: Claude Code (Claude Opus 5.5)