Repository navigation
fix: Map each parameter of a block default expression to the argument at its position - #163
Open
georgeguimaraes wants to merge 1 commit into
Open
georgeguimaraes wants to merge 1 commit into
georgeguimaraes wants to merge 1 commit into
Conversation
… at its position expand_block_via_default/4 zipped the parameters that the default expression reaches with all block arguments. When the default function ignores an argument, every parameter after it read the argument before its own. Each parameter now reads the argument at its position. The option lists after the tensor arguments are not arguments of the program.
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.
expand_block_via_default/4zipped the parameters that the default expression reaches with all block arguments. When the default function ignores an argument, the expression does not reach its parameter. So every later parameter read the argument before its own. For example, withfn _struct, _a, b -> Nx.multiply(b, 2) end, the compiled block multipliedain place ofb.Each parameter now reads the argument at its own position, which is the first argument of the parameter node. The option lists after the tensor arguments are not arguments of the program, so the map leaves them out.
The new test uses a block that no lowering recognizes, so it lowers through its default function. It fails without the fix.