-
Notifications
You must be signed in to change notification settings - Fork 83
Fix MatchResult.fail() call signature in redundant_scatter_nd.py #2431
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
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Just create the MatchResult object in check() and call result.fail() inside the method. Remove the fail() function. |
…methods Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Done! I've removed the |
❌ 7 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
@copilot please run |
Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
The
fail
helper function inonnxscript/rewriter/redundant_scatter_nd.py
was incorrectly passing multiple arguments toMatchResult.fail()
, causing a TypeError when pattern matching failed.Problem
The error occurred when the rewriter tried to report match failures with multiple failure sources:
This resulted in:
The issue was that
MatchResult.fail()
only accepts 2 parameters afterself
:reason: str
- the failure reasonfailure_source: Union[ir.Node, ir.Value, list[...]] | None
- a single item or list of failure sourcesBut the helper function was passing all arguments directly:
MatchResult().fail(*args)
.Solution
Modified the
fail
helper function to properly handle multiple failure sources by collecting them into a list when callingMatchResult.fail()
:This change:
matmul_add_to_gemm.py
Testing
Verified that all existing call patterns in the file work correctly:
fail("message")
- reason onlyfail("message", node)
- reason + single sourcefail("message", node1, node2)
- reason + multiple sourcesFixes #2430.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.