Repository navigation
[aot_compile] Say what the no-match report's advice rests on after a raise - #197050
bobrenjc93 wants to merge 32 commits into
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/197050
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 3b41756 with merge base 51d4378 ( 🟢 GREEN LIGHT - PR approved to be merged without human review:
reason: UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Claude finished @bobrenjc93's task in 8m 23s —— View job PR Review: #197050Two new conditional advice lines in the no-match report are logically correct as written, but one of them duplicates wording that already exists in Full reviewPR Review: #197050SummaryAdds an Code Quality
Testing
Performance
RecommendationNeeds Discussion Nothing here is incorrect: I traced every reachable combination of I was unable to run the test suite — |
[ghstack-poisoned]
|
Claude finished @bobrenjc93's task in 15m 19s —— View job PR Review: #197050The five findings from my earlier pass are addressed and I found no correctness bug in the new gates, but the Full reviewPR Review: #197050SummaryRecords Code Quality
Performance
RecommendationRequest Changes The docstring is the only blocking item and it is a one-paragraph edit: the class documents the report's contents as a contract, and after this PR that contract is false for the case the PR itself adds a test for. The unqualified post-throw entry line is a design question rather than a defect — the I could not run the Test Plan: |
[ghstack-poisoned]
…d the no-match report's call (#197220) **Problem.** When every checked guard tree raised, the no-match report still ended with `Add a ModelInput covering this call`, which contradicts its own `fix or drop that artifact` line: a new input would guard the same dict and raise the same way. **Fix.** Dispatch records which trees actually answered. The report advises a `ModelInput` only when some checked tree answered or the artifact holds no inputs, and otherwise says that every guard tree raised. **Summary.** The commit below tolerates a guard tree that raises during module dispatch and reports the raise as that entry's line, but leaves the report's closing advice as it was at the parent: `Add a ModelInput covering this call, or check whether guard_filter_fn kept a guard this call cannot satisfy` is appended to every report. When every tree whose guards were asked about raised, nothing rejected the call, and an input covering it would guard the same dict and raise the same way, so the report told the caller both to fix or drop the artifact and to add an input -- two instructions that contradict each other. Dispatch now records `answered`, the indices that reached an answer in either pass, written on a rejection only, and the report advises a `ModelInput` whenever some checked tree answered (`coverable`) or the artifact holds no input at all. When no checked tree ever answered and two or more trees raised, a footer saying every guard tree raised replaces the advice, unless an opted-out result's line has already said the raise withheld it; a single raiser's own `fix or drop that artifact` line already says as much. Nothing served or raised changes -- the same calls raise the same `RuntimeError` with the same `__cause__`, and the dispatch passes, the veto and the warning are untouched -- only the report's closing lines differ, and six of the eleven touched tests fail on the commit below's `aot_compile.py`. ## Where this sits in the stack Split from `[no-ci] [aot_compile] Say what the no-match report's advice rests on after a raise` (#197050, the commit above) for review budget: this commit decides WHETHER the report's closing advice applies, and the sibling qualifies it when every rejection it rests on followed a raise. ## The contradiction Measured on `DictBranchModule` with one input and a colliding key, the report at the commit below reads: ``` [0] <guard check raised ValueError: boom from __eq__ (through the guard tree's pybind boundary)> [0]'s guard check raised while checking this call; fix or drop that artifact. Add a ModelInput covering this call, or check whether guard_filter_fn kept a guard this call cannot satisfy -- ... ``` Nothing rejected the call, and an input covering it would guard the same dict and raise the same way. `test_no_match_message_drops_the_input_advice_when_the_one_tree_raised` pins that report now ending on the fix-or-drop line. ## Recording who answered ```python # AOTCompiledModel.__call__ raised: dict[int, Exception] = {} unanswered: set[int] = set() answered: set[int] = set() # new: indices that ever reached an answer try: answer = first._live_guard_manager().check(f_locals) except Exception as e: raised[0] = e; unanswered.add(0); answer = False else: answered.add(0) # new def accepts(i, result): try: answer = result._live_guard_manager().check(f_locals) except Exception as e: raised[i] = e; unanswered.add(i); return False if answer: return True # an accept serves and builds no report # Recorded on a rejection only. unanswered.discard(i) answered.add(i) # new return False ``` Dispatch now records which entries reached an answer, and records it where the order is known rather than reconstructing it afterwards. `answered` holds the indices that reached an answer in either dispatch pass, which is what the `ModelInput` advice reads: an entry that answered and then raised did reject this call, so an input covering the call is on the table even though its own report line is that later raise. Keying that advice on the last evaluation instead drops it for exactly those entries -- measured: `coverable` read off `answered - unanswered` fails `test_no_match_message_advises_an_input_after_an_answer_then_a_raise` with no `ModelInput` line at all. The write happens on a rejection only: an accept returns before it, since dispatch then serves and builds no report, so the result that accepts pays nothing for it. ## The two gated closing lines ```python # _no_match_report raiser = next((i for i in raised if enabled[i]), None) coverable = any(results[i]._guard_check_enabled for i in answered) # new withheld = not all(enabled) ... if raiser is not None: lines.append(f"[{raiser}]'s guard check raised while checking this call; fix or drop that artifact.") if coverable or not results: # parent: unconditional lines.append("Add a ModelInput covering this call, or check whether guard_filter_fn kept ...") if len(raised) > 1 and not withheld and not coverable: # new footer lines.append("Every guard tree raised while checking this call; the reasons above are those raises, not guards this call failed.") ``` **The `ModelInput` line.** The report advises a `ModelInput` whenever at least one checked tree reached an answer (`coverable`, `any(results[i]._guard_check_enabled for i in answered)`, the shape the last-resort veto already uses over `raised`). `deserialize` accepts an artifact holding no inputs at all, where `aot_compile_module` refuses one: with no entries there is no raise to describe and nothing that could have answered, so that report carries the `ModelInput` line alone -- adding an input is exactly its advice. Dropping `not results` from the `ModelInput` gate fails `test_no_match_report_claims_no_raise_for_an_artifact_with_no_inputs` on the line going missing. **The every-tree-raised footer.** When no checked tree ever answered, the entry lines above are all raises, and the one closing line a single raiser earns is the `fix or drop that artifact` line the commit below already emits for it: that raiser's entry line, that advice and a footer saying every tree raised would say `[0] raised` three times over, which is what the first version of this commit printed -- measured on `test_no_match_message_when_a_raise_did_not_cross_the_pybind_boundary`, whose four-line report closed with `[0]'s guard check raised while checking this call; fix or drop that artifact.` and then `Every guard tree raised while checking this call; ...`. So the footer that says the reasons above are the raises themselves, not guards this call failed, is added only once two or more trees raised and none answered: there the fix-or-drop line names one raiser of several, and without the footer nothing on the report says that no guard rejected the call. ``` # test_no_match_message_when_every_guard_tree_raised: two enabled trees, both raise, no opt-out No AOT compiled graph matched this call. Tried 2 compiled input(s): [0] <guard check raised RuntimeError: the first tree is unhappy> [1] <guard check raised RuntimeError: the second tree is unhappy> [0]'s guard check raised while checking this call; fix or drop that artifact. Every guard tree raised while checking this call; the reasons above are those raises, not guards this call failed. ``` Under that gate every entry raised -- each entry either raised or answered, and an opted-out entry reaches the report only because an enabled raise withheld it, which the `not withheld` term excludes -- so `len(raised) > 1` counts the raisers and the entries alike. The two gates are independent `if`s: they are already exclusive on `coverable`, and an `elif` would read as an ordering that does not exist. Each term of the footer's gate is pinned by a mutation: | mutation | fails | | --- | --- | | gate on `raised` instead of `len(raised) > 1` | `test_no_match_message_drops_the_input_advice_when_the_one_tree_raised`, `test_no_match_message_when_a_raise_did_not_cross_the_pybind_boundary`, `test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators` (footer under a single raiser's line) | | drop `not withheld` | `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning` (a fifth line under its withheld line, which has already said what the raise cost) | | drop `not coverable` | `test_no_match_message_advises_an_input_when_one_of_two_raisers_answered` (footer beside the `ModelInput` advice it contradicts) | ## What changes against the commit below Nothing served or raised changes: the same calls raise the same `RuntimeError` with the same `__cause__`, and the dispatch passes, the veto and the warning are untouched. Only the report's closing lines differ: the `ModelInput` line is omitted when no checked tree ever answered and the artifact has inputs, so a single raiser's report ends on its fix-or-drop line, and an every-tree-raised line replaces the advice when two or more trees raised, none answered and no opt-out was withheld. Making the `ModelInput` line unconditional again fails `test_no_match_message_when_every_guard_tree_raised`, `test_no_match_message_drops_the_input_advice_when_the_one_tree_raised`, `test_aot_compile_module_raising_tree_does_not_reach_an_opted_out_result`, `test_aot_compile_module_restores_torch_function_after_a_throw`, `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning` and `test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators` on the line appearing. The `AOTCompiledModel` docstring listed that advice as part of every report; it now says when the advice is present, what replaces it when no checked tree answered AND two or more trees raised -- the empty artifact has neither and gets the advice, not the replacement, which is what `test_no_match_report_claims_no_raise_for_an_artifact_with_no_inputs` pins -- that a single raiser's own line already says as much, and that the replacement too stays off a report whose withheld line has already said the raise withheld an opt-out. ## Tests Five tests are new and six of the commit below's tests gain or change an assertion about the closing lines this commit adds or removes for their case. Of those eleven, six fail on the commit below's `aot_compile.py`: - `test_no_match_message_when_every_guard_tree_raised`, `test_no_match_message_drops_the_input_advice_when_the_one_tree_raised`, `test_aot_compile_module_raising_tree_does_not_reach_an_opted_out_result`, `test_aot_compile_module_restores_torch_function_after_a_throw` and `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, on the `ModelInput` line appearing; - `test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators`, on the four lines it counted there -- header, entry, fix-or-drop advice, `ModelInput` advice -- against the three a single raiser's report has now. The five that pass there do so because the parent's `ModelInput` line is unconditional and it has no every-tree-raised line to find; each is a pin here by the mutation named above: - `test_no_match_report_claims_no_raise_for_an_artifact_with_no_inputs` (`not results`); - `test_no_match_message_advises_an_input_after_an_answer_then_a_raise` (`coverable` over `answered`, not over the last evaluation); - `test_no_match_message_advises_an_input_when_one_of_two_raisers_answered` (`not coverable` on the footer's gate); - `test_no_match_message_when_a_raise_did_not_cross_the_pybind_boundary` (`len(raised) > 1`); - `test_no_match_message_when_only_the_report_raises`, which gains only an assertion that the every-tree-raised line is absent from its report, whose one tree answered. ## Review order Review `answered` and its update in `accepts()`; the report's `coverable`; the two gated lines at the end of `_no_match_report`, the comment on the empty artifact and the comment on the footer's gate; the sentence of the `AOTCompiledModel` docstring that describes the report's closing lines; then, in the test file, `test_no_match_message_drops_the_input_advice_when_the_one_tree_raised`, `test_no_match_message_when_every_guard_tree_raised`, `test_no_match_message_advises_an_input_when_one_of_two_raisers_answered`, `test_no_match_report_claims_no_raise_for_an_artifact_with_no_inputs` and `test_no_match_message_advises_an_input_after_an_answer_then_a_raise`. Test Plan: ``` python test/dynamo/test_aot_compile.py -k test_no_match_message_when_every_guard_tree_raised python test/dynamo/test_aot_compile.py -k test_no_match_message_drops_the_input_advice_when_the_one_tree_raised python test/dynamo/test_aot_compile.py -k test_no_match_message_advises_an_input_when_one_of_two_raisers_answered python test/dynamo/test_aot_compile.py -k test_no_match_report_claims_no_raise_for_an_artifact_with_no_inputs python test/dynamo/test_aot_compile.py -k test_no_match_message_advises_an_input_after_an_answer_then_a_raise python test/dynamo/test_aot_compile.py -k test_no_match_message_when_only_the_report_raises python test/dynamo/test_aot_compile.py -k test_no_match_message_when_a_raise_did_not_cross_the_pybind_boundary python test/dynamo/test_aot_compile.py -k test_aot_compile_module_raising_tree_does_not_reach_an_opted_out_result python test/dynamo/test_aot_compile.py -k test_aot_compile_module_restores_torch_function_after_a_throw python test/dynamo/test_aot_compile.py -k test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning python test/dynamo/test_aot_compile.py -k test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators python test/dynamo/test_aot_compile.py lintrunner --take RUFF,PYFMT torch/_dynamo/aot_compile.py test/dynamo/test_aot_compile.py ``` The eleven were also run against the commit below's `torch/_dynamo/aot_compile.py` (six fail, the five named above pass), and each gate was then mutated on its own -- `coverable` keyed on the last evaluation, `not results` dropped, the `ModelInput` line made unconditional, the footer gated on `raised` instead of `len(raised) > 1`, its `not withheld` dropped, its `not coverable` dropped -- and the eleven rerun; only the tests named above failed under each. Authored with the assistance of Claude Code. > **FAQ: `raiser` and `coverable` walk all results to filter by membership in > a small set, where `any(results[i]._guard_check_enabled for i in > answered)` is the same predicate in the shape already used at the veto.** > > Taken for `coverable`, which is exactly that line. Not for `raiser`: it does > not walk all results. It is > `next((i for i in raised if results[i]._guard_check_enabled), None)` > -- already a walk of the small dict, and it needs the first such index in > recording order rather than a bool, so there is no `any(...)` shape to move it > to. > **FAQ: `answered` never holds an accept -- the accept returns before the > write -- so `rejected` would name what the set holds and make `coverable` a > restatement rather than a derivation.** > > Kept as `answered`. It is the report's counterpart to `unanswered`, the > commit below's name for the same property keyed on the LAST evaluation: `i > in unanswered` decides whether an entry's line is its raise or a quoted > guard, `i in answered` whether a `ModelInput` could cover it, and what both > key on is that `check()` returned rather than raised. That every recorded > answer was a rejection is what a report existing means, and it is written at > the write (`Recorded on a rejection only`) and at `coverable` (`answered in > either dispatch pass rejected this call`), the two places the set is read. > The commit above adds `trusted` as a third set over the same indices and > reads `answered - trusted`; renaming here would ripple through its four > `answered` hunks for a word those two comments already supply. Co-Authored-By: Claude Fable 5.1 <[email protected]> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: #197220 Approved by: https://github.com/pytorchgreenlight ghstack dependencies: #197049, #196823, #197149, #197048, #196825, #196897, #197218, #196909, #196826, #197390, #197391, #197188, #197179, #197195
Test-only, split for review budget from `[aot_compile] Tolerate a guard tree that raises during module dispatch` (#196826), four commits below, whose `torch/_dynamo/aot_compile.py` this commit does not touch. The three tests here were three of the twelve of `[aot_compile] Pin the raise-tolerant module dispatch's warning: its paths, text and dedup` (#197195), directly below; this commit adds them without touching the eight that stayed there, and folds a fourth's two assertions into the landed test whose setup it repeated. They pin the exits of `AOTCompiledModel.__call__` that record a raise nowhere -- a `KeyboardInterrupt` or `SystemExit` out of a later tree, a later result whose signature cannot take the call, a call the one signature cannot take -- and that a call binds once per result across both dispatch passes and the report. Where they sit. The two about binding join the landed `test_module_dispatch_*` tests on how a call binds, directly after `test_module_dispatch_binds_per_result_when_signatures_differ`, under that prefix, and, like that cluster, without `_hide_leaked_dynamo_globals`; `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates` stays among #197195's dedup tests, because its last call is a dedup pin, and calls it as they all do. Two module-level helpers beside `compile_mode_defaults` serve them: `compile_two_signatures`, the two-signature model that landed test and the cannot-bind test assemble, built from the same `aot_compile_forward` (its comment states when the two results bind alike -- iff `second_forward`'s parameters and closure cells match forward's, measured: a `(self, x)` second forward binds alike, one named `(self, y)` or given a default does not -- rather than promising they never do), and `AlwaysRaises(message)`, the stub guard manager whose every `check()` raises, subclassing `NeverReChecked` so a regression that re-checks it in a report fails on that class's message; the interrupt and cannot-bind tests use it where each had its own copy. The exits that record nothing. Every path in #196826 that RETURNS a graph with a raise on record logs one, every path that builds a report chains one, and a call that ends in neither leaves as the exception that ended it; its FAQ says why nothing is logged on the way out. `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates`: two results, [0]'s tree raising `RuntimeError` and [1]'s raising, on one call each, `KeyboardInterrupt` and then `SystemExit`; each leaves `__call__` as itself with nothing logged, and the next call, with [1]'s real tree back, serves [1] and logs `[0]'s guard check raised RuntimeError: zero is unhappy`. That last call pins WHERE the dedup is judged (FAQ below). `SystemExit` travels the same path as `KeyboardInterrupt` today -- one `except Exception` in `accepts()` is the only handler between the tree and the caller, and the comment says so -- and is there because the `AOTCompiledModel` docstring promises both propagate: without it an `except (Exception, SystemExit)` added later would pass every test in the file (measured below). The order of the two iterations is not load-bearing (FAQ below). `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`: two results that cannot share a binding, [0]'s tree raising and [1]'s signature needing an argument the call lacks; `TypeError: missing a required argument: 'z'` leaves `__call__` with nothing logged. It pins its premises before the call -- `_binds_alike` is False, so [1] binds inside its own `accepts()`, and [0]'s `guard_check` raises `RuntimeError: zero is unhappy` -- so a stub that stopped raising fails it with `RuntimeError not raised` (measured below) instead of leaving the case it names unexercised. Both keep `assertNoLogs` outermost (FAQ below). `test_module_dispatch_wrong_arity_raises_type_error` is the one-result form of the same exit, and the source before #196826 already had it right: a call the signature cannot bind is the `TypeError` a plain module call raises, with no report folded around it -- `prepare_f_locals` stays outside `accepts()`' `try`. The type is the whole pin: the report is raised as a `RuntimeError`, so `assertRaisesRegex(TypeError, ...)` excludes it and nothing else about the exception needs reading. One more thing the source before #196826 already did, kept, pinned in the landed `test_module_dispatch_binds_per_result_when_signatures_differ`, which already builds the two-signature model and shows each result binding on its own: a third call, `x.half()`, that no result matches ends in the no-match report (`assertRaisesRegex(RuntimeError, "No AOT compiled graph matched")`) having bound once per result -- in index order, the same objects, asserted per position so a wrong-order failure names the position -- while both passes checked each result (`check` wrapped and counted: two per result); that source's per-result list already satisfied it, and #196826's `bound` dict keeps it. The report's entry count is not asserted here: the report reads `bound[i]`, so it adds nothing to the bind count, and seven other tests count those lines. Test Plan: ``` python test/dynamo/test_aot_compile.py -k test_aot_compile_module_interrupt_out_of_a_later_tree_propagates python test/dynamo/test_aot_compile.py -k test_module_dispatch_later_result_that_cannot_bind_raises_type_error python test/dynamo/test_aot_compile.py -k test_module_dispatch_wrong_arity_raises_type_error python test/dynamo/test_aot_compile.py -k test_module_dispatch_binds_per_result_when_signatures_differ python test/dynamo/test_aot_compile.py ``` The whole file runs 283 tests, `OK (skipped=6)`, three more than #197195's file loads. `lintrunner --take RUFF,PYFMT test/dynamo/test_aot_compile.py` is clean. The four were also run against the `torch/_dynamo/aot_compile.py` of #196826's parent under this test file: the interrupt and cannot-bind tests both error on [0]'s `RuntimeError: zero is unhappy` escaping the call before the exit they pin is reached, and the two that pin what that source already did pass, as they should. Each of the two negative pins fails a mutant of its own, run against the whole 283-test file at this commit; the tests named are the only ones that failed. Moving the bind inside `accepts()`' `try` fails `test_module_dispatch_wrong_arity_raises_type_error` and `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`: the `TypeError` is read as a raise and each call ends in a no-match report (`No AOT compiled graph matched this call. Tried 1 compiled input(s)` and `Tried 2`) where the `TypeError` was expected. Rebinding on every pass (`f_locals = None` in place of `bound.get(i)`) fails `test_module_dispatch_binds_per_result_when_signatures_differ` with `Expected 2 but got 4` binds (and the landed `test_module_dispatch_decides_a_shared_binding_past_the_first_result`, on `_binds_alike` being called). Deleting the second pass fails it on its `check` counts, `Expected 2 but got 1` -- its bind count alone reads the same with one pass as with two -- along with 14 tests of the file that pin the re-check. Each fix in #196826 that the other two cover was then reverted on its own against the same file. Widening `accepts()`' handler to `BaseException` fails only `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates`, whose `KeyboardInterrupt` call gets a `RuntimeError: No AOT compiled graph matched this call. Tried 2 compiled input(s)` report where it asked for the interrupt; widening it to `(Exception, SystemExit)` fails only the same test, on its `SystemExit` call, the same way. Deciding the dedup's `(index, exception type)` pair in `accepts()`' handler, as the raise is recorded, rather than in `warn_swallowed` fails the same test on its last call's `assertLogs` (`no logs of level WARNING or higher triggered`), and one other test in the file, #196826's `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, the same way (FAQ below). Making the dispatch handler re-raise fails the interrupt and cannot-bind tests on [0]'s `RuntimeError` escaping, the two pins of the older behaviour passing. Reading the warning's raiser off the served index fails the interrupt test's last call, whose log then names `[1]`; that mutant is #197195's, whose message lists the four tests it fails there. Replacing [0]'s `AlwaysRaises` in `test_module_dispatch_later_result_that_cannot_bind_raises_type_error` with a stub that returns False fails it on its premise assertion, `RuntimeError not raised`. > **FAQ: `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates` > and `test_module_dispatch_later_result_that_cannot_bind_raises_type_error` > nest `assertNoLogs` outside `assertRaisesRegex`, so a spurious warning on a > call that also fails the raise assertion is reported as the raise failure. > Swap them so `assertRaisesRegex` is outermost?** > > Declined, because the swap makes the log pin vacuous, measured here. > `unittest`'s `_AssertLogsContext.__exit__` returns False without reading its > records whenever an exception is passing through it ("let unexpected > exceptions pass through"), and on these two tests' expected path the call > ALWAYS raises, so an `assertNoLogs` nested inside the raise assertion exits > by exception every time and checks nothing. With > `log.warning("spurious warning on record")` added to `accepts()`' handler: > as written, both tests fail with `AssertionError: Unexpected logs found: > ['WARNING:torch._dynamo.aot_compile:spurious warning on record']`; with > `assertRaisesRegex` outermost, the cannot-bind test passes and the > interrupt test fails only on its last call, on `len(logs.output)` reading > 2 where 1 is expected -- the swapped blocks let the warning through on all > three aborted calls. The masking the finding describes happens only on a > call that has already failed the raise assertion, where the test fails > either way. The order as written is the one on which the silence is > checked at all, and a one-line comment at each site says so; that line is > the one note about the test framework the two tests keep, because it is > what stops the swap. > **FAQ: the interrupt test's last call -- [1]'s real tree restored, the > next call serving [1] and warning about [0] -- asserts the two substrings > `test_aot_compile_module_warns_again_about_a_replaced_index` (#197195) > already asserts, and a regression that populated `_warned` while logging > already fails the aborted calls' `assertNoLogs`. Are the aborted calls not > the test?** > > The last call pins WHERE the dedup is judged. Measured by moving it: > deciding the `(index, exception type)` pair in `accepts()`' handler as the > raise is recorded, and leaving `warn_swallowed` to log the pairs so > collected, passes the aborted calls (nothing is logged; the interrupts > still escape), #197195's pop and every-input tests and #196826's > single-result and once-per-model tests alike, and fails exactly two of the > file's 283 tests: this last call, with `no logs of level WARNING or higher > triggered`, because the aborted calls had already consumed `(0, > "RuntimeError")`, and #196826's > `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, > whose first call ends in a no-match report rather than an interrupt and > whose second call is silent for the same reason. That is a restructuring a > later reader could plausibly make -- the handler is where the pair is first > known -- and it would make every aborted call a silent one for the raise on > its record. The test's comment names both tests the move fails. > **FAQ: `unittest`'s `testPartExecutor` re-raises `KeyboardInterrupt` but > catches `SystemExit`, so does the interrupt test's iteration order -- > `KeyboardInterrupt` first -- decide whether a regression aborts the whole > run or is reported as one failure?** > > No, measured. The only `KeyboardInterrupt` the test raises is the stub's, > inside `assertRaisesRegex(KeyboardInterrupt, ...)`, which catches it on the > expected path and turns a wrong message into an `AssertionError`; a > regression that swallows it hands the test the no-match report, a > `RuntimeError`, which `assertRaisesRegex` lets through as this test's > error. With `accepts()`' handler widened to `BaseException`, the whole > file ran to completion in either order: 283 tests, `FAILED (errors=1)`, > the one error this test's `KeyboardInterrupt` iteration getting > `RuntimeError: No AOT compiled graph matched this call. Tried 2 compiled > input(s)`, both as written and with the tuple reversed to `(SystemExit, > KeyboardInterrupt)`. No `KeyboardInterrupt` reaches `testPartExecutor` on > any path this test has, so the order says nothing and the comment claims > nothing about it. > **FAQ: `AlwaysRaises` replaces this commit's two inline `Raises` stubs; > the file's twelve other inline raisers (eight `Raises`, four > `RaisingGuardManager`, two of them already taking the message as a > constructor argument) are left in place. Why not convert them too?** > > `git blame` puts every one of them in a test of #196826, #197179, #197188 > or #197195 below, and this commit's one claim about #197195's eight tests > is that it does not touch them; converting their stubs here would put > edits to four other PRs' tests in a commit whose diff is otherwise three > tests and two helpers, and would shift the hunks #197220, #197050 and > #197257 apply above. `AlwaysRaises` is module level so those owners can > adopt it in one line each; the two message-taking copies are drop-ins for > it already. Authored with the assistance of Claude Code. Co-Authored-By: Claude Fable 5.1 <[email protected]> ghstack-source-id: 4b8ef1f Pull-Request: #197219
Test-only, split for review budget from `[aot_compile] Tolerate a guard tree that raises during module dispatch` (#196826), four commits below, whose `torch/_dynamo/aot_compile.py` this commit does not touch. The three tests here were three of the twelve of `[aot_compile] Pin the raise-tolerant module dispatch's warning: its paths, text and dedup` (#197195), directly below; this commit adds them without touching the eight that stayed there, and folds a fourth's two assertions into the landed test whose setup it repeated. They pin the exits of `AOTCompiledModel.__call__` that record a raise nowhere -- a `KeyboardInterrupt` or `SystemExit` out of a later tree, a later result whose signature cannot take the call, a call the one signature cannot take -- and that a call binds once per result across both dispatch passes and the report. Where they sit. The two about binding join the landed `test_module_dispatch_*` tests on how a call binds, directly after `test_module_dispatch_binds_per_result_when_signatures_differ`, under that prefix, and, like that cluster, without `_hide_leaked_dynamo_globals`; `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates` stays among #197195's dedup tests, because its last call is a dedup pin, and calls it as they all do. Two module-level helpers beside `compile_mode_defaults` serve them: `compile_two_signatures`, the two-signature model that landed test and the cannot-bind test assemble, built from the same `aot_compile_forward` (its comment states when the two results bind alike -- iff `second_forward`'s parameters and closure cells match forward's, measured: a `(self, x)` second forward binds alike, one named `(self, y)` or given a default does not -- rather than promising they never do), and `AlwaysRaises(message)`, the stub guard manager whose every `check()` raises, subclassing `NeverReChecked` so a regression that re-checks it in a report fails on that class's message; the interrupt and cannot-bind tests use it where each had its own copy. The exits that record nothing. Every path in #196826 that RETURNS a graph with a raise on record logs one, every path that builds a report chains one, and a call that ends in neither leaves as the exception that ended it; its FAQ says why nothing is logged on the way out. `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates`: two results, [0]'s tree raising `RuntimeError` and [1]'s raising, on one call each, `KeyboardInterrupt` and then `SystemExit`; each leaves `__call__` as itself with nothing logged, and the next call, with [1]'s real tree back, serves [1] and logs `[0]'s guard check raised RuntimeError: zero is unhappy`. That last call pins WHERE the dedup is judged (FAQ below). `SystemExit` travels the same path as `KeyboardInterrupt` today -- one `except Exception` in `accepts()` is the only handler between the tree and the caller, and the comment says so -- and is there because the `AOTCompiledModel` docstring promises both propagate: without it an `except (Exception, SystemExit)` added later would pass every test in the file (measured below). The order of the two iterations is not load-bearing (FAQ below). `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`: two results that cannot share a binding, [0]'s tree raising and [1]'s signature needing an argument the call lacks; `TypeError: missing a required argument: 'z'` leaves `__call__` with nothing logged. It pins its premises before the call -- `_binds_alike` is False, so [1] binds inside its own `accepts()`, and [0]'s `guard_check` raises `RuntimeError: zero is unhappy` -- so a stub that stopped raising fails it with `RuntimeError not raised` (measured below) instead of leaving the case it names unexercised. Both keep `assertNoLogs` outermost (FAQ below). `test_module_dispatch_wrong_arity_raises_type_error` is the one-result form of the same exit, and the source before #196826 already had it right: a call the signature cannot bind is the `TypeError` a plain module call raises, with no report folded around it -- `prepare_f_locals` stays outside `accepts()`' `try`. The type is the whole pin: the report is raised as a `RuntimeError`, so `assertRaisesRegex(TypeError, ...)` excludes it and nothing else about the exception needs reading. One more thing the source before #196826 already did, kept, pinned in the landed `test_module_dispatch_binds_per_result_when_signatures_differ`, which already builds the two-signature model and shows each result binding on its own: a third call, `x.half()`, that no result matches ends in the no-match report (`assertRaisesRegex(RuntimeError, "No AOT compiled graph matched")`) having bound once per result -- in index order, the same objects, asserted per position so a wrong-order failure names the position -- while both passes checked each result (`check` wrapped and counted: two per result); that source's per-result list already satisfied it, and #196826's `bound` dict keeps it. The report's entry count is not asserted here: the report reads `bound[i]`, so it adds nothing to the bind count, and seven other tests count those lines. Test Plan: ``` python test/dynamo/test_aot_compile.py -k test_aot_compile_module_interrupt_out_of_a_later_tree_propagates python test/dynamo/test_aot_compile.py -k test_module_dispatch_later_result_that_cannot_bind_raises_type_error python test/dynamo/test_aot_compile.py -k test_module_dispatch_wrong_arity_raises_type_error python test/dynamo/test_aot_compile.py -k test_module_dispatch_binds_per_result_when_signatures_differ python test/dynamo/test_aot_compile.py ``` The whole file runs 283 tests, `OK (skipped=6)`, three more than #197195's file loads. `lintrunner --take RUFF,PYFMT test/dynamo/test_aot_compile.py` is clean. The four were also run against the `torch/_dynamo/aot_compile.py` of #196826's parent under this test file: the interrupt and cannot-bind tests both error on [0]'s `RuntimeError: zero is unhappy` escaping the call before the exit they pin is reached, and the two that pin what that source already did pass, as they should. Each of the two negative pins fails a mutant of its own, run against the whole 283-test file at this commit; the tests named are the only ones that failed. Moving the bind inside `accepts()`' `try` fails `test_module_dispatch_wrong_arity_raises_type_error` and `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`: the `TypeError` is read as a raise and each call ends in a no-match report (`No AOT compiled graph matched this call. Tried 1 compiled input(s)` and `Tried 2`) where the `TypeError` was expected. Rebinding on every pass (`f_locals = None` in place of `bound.get(i)`) fails `test_module_dispatch_binds_per_result_when_signatures_differ` with `Expected 2 but got 4` binds (and the landed `test_module_dispatch_decides_a_shared_binding_past_the_first_result`, on `_binds_alike` being called). Deleting the second pass fails it on its `check` counts, `Expected 2 but got 1` -- its bind count alone reads the same with one pass as with two -- along with 14 tests of the file that pin the re-check. Each fix in #196826 that the other two cover was then reverted on its own against the same file. Widening `accepts()`' handler to `BaseException` fails only `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates`, whose `KeyboardInterrupt` call gets a `RuntimeError: No AOT compiled graph matched this call. Tried 2 compiled input(s)` report where it asked for the interrupt; widening it to `(Exception, SystemExit)` fails only the same test, on its `SystemExit` call, the same way. Deciding the dedup's `(index, exception type)` pair in `accepts()`' handler, as the raise is recorded, rather than in `warn_swallowed` fails the same test on its last call's `assertLogs` (`no logs of level WARNING or higher triggered`), and one other test in the file, #196826's `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, the same way (FAQ below). Making the dispatch handler re-raise fails the interrupt and cannot-bind tests on [0]'s `RuntimeError` escaping, the two pins of the older behaviour passing. Reading the warning's raiser off the served index fails the interrupt test's last call, whose log then names `[1]`; that mutant is #197195's, whose message lists the four tests it fails there. Replacing [0]'s `AlwaysRaises` in `test_module_dispatch_later_result_that_cannot_bind_raises_type_error` with a stub that returns False fails it on its premise assertion, `RuntimeError not raised`. > **FAQ: `test_aot_compile_module_interrupt_out_of_a_later_tree_propagates` > and `test_module_dispatch_later_result_that_cannot_bind_raises_type_error` > nest `assertNoLogs` outside `assertRaisesRegex`, so a spurious warning on a > call that also fails the raise assertion is reported as the raise failure. > Swap them so `assertRaisesRegex` is outermost?** > > Declined, because the swap makes the log pin vacuous, measured here. > `unittest`'s `_AssertLogsContext.__exit__` returns False without reading its > records whenever an exception is passing through it ("let unexpected > exceptions pass through"), and on these two tests' expected path the call > ALWAYS raises, so an `assertNoLogs` nested inside the raise assertion exits > by exception every time and checks nothing. With > `log.warning("spurious warning on record")` added to `accepts()`' handler: > as written, both tests fail with `AssertionError: Unexpected logs found: > ['WARNING:torch._dynamo.aot_compile:spurious warning on record']`; with > `assertRaisesRegex` outermost, the cannot-bind test passes and the > interrupt test fails only on its last call, on `len(logs.output)` reading > 2 where 1 is expected -- the swapped blocks let the warning through on all > three aborted calls. The masking the finding describes happens only on a > call that has already failed the raise assertion, where the test fails > either way. The order as written is the one on which the silence is > checked at all, and a one-line comment at each site says so; that line is > the one note about the test framework the two tests keep, because it is > what stops the swap. > **FAQ: the interrupt test's last call -- [1]'s real tree restored, the > next call serving [1] and warning about [0] -- asserts the two substrings > `test_aot_compile_module_warns_again_about_a_replaced_index` (#197195) > already asserts, and a regression that populated `_warned` while logging > already fails the aborted calls' `assertNoLogs`. Are the aborted calls not > the test?** > > The last call pins WHERE the dedup is judged. Measured by moving it: > deciding the `(index, exception type)` pair in `accepts()`' handler as the > raise is recorded, and leaving `warn_swallowed` to log the pairs so > collected, passes the aborted calls (nothing is logged; the interrupts > still escape), #197195's pop and every-input tests and #196826's > single-result and once-per-model tests alike, and fails exactly two of the > file's 283 tests: this last call, with `no logs of level WARNING or higher > triggered`, because the aborted calls had already consumed `(0, > "RuntimeError")`, and #196826's > `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, > whose first call ends in a no-match report rather than an interrupt and > whose second call is silent for the same reason. That is a restructuring a > later reader could plausibly make -- the handler is where the pair is first > known -- and it would make every aborted call a silent one for the raise on > its record. The test's comment names both tests the move fails. > **FAQ: `unittest`'s `testPartExecutor` re-raises `KeyboardInterrupt` but > catches `SystemExit`, so does the interrupt test's iteration order -- > `KeyboardInterrupt` first -- decide whether a regression aborts the whole > run or is reported as one failure?** > > No, measured. The only `KeyboardInterrupt` the test raises is the stub's, > inside `assertRaisesRegex(KeyboardInterrupt, ...)`, which catches it on the > expected path and turns a wrong message into an `AssertionError`; a > regression that swallows it hands the test the no-match report, a > `RuntimeError`, which `assertRaisesRegex` lets through as this test's > error. With `accepts()`' handler widened to `BaseException`, the whole > file ran to completion in either order: 283 tests, `FAILED (errors=1)`, > the one error this test's `KeyboardInterrupt` iteration getting > `RuntimeError: No AOT compiled graph matched this call. Tried 2 compiled > input(s)`, both as written and with the tuple reversed to `(SystemExit, > KeyboardInterrupt)`. No `KeyboardInterrupt` reaches `testPartExecutor` on > any path this test has, so the order says nothing and the comment claims > nothing about it. > **FAQ: `AlwaysRaises` replaces this commit's two inline `Raises` stubs; > the file's twelve other inline raisers (eight `Raises`, four > `RaisingGuardManager`, two of them already taking the message as a > constructor argument) are left in place. Why not convert them too?** > > `git blame` puts every one of them in a test of #196826, #197179, #197188 > or #197195 below, and this commit's one claim about #197195's eight tests > is that it does not touch them; converting their stubs here would put > edits to four other PRs' tests in a commit whose diff is otherwise three > tests and two helpers, and would shift the hunks #197220, #197050 and > #197257 apply above. `AlwaysRaises` is module level so those owners can > adopt it in one line each; the two message-taking copies are drop-ins for > it already. Authored with the assistance of Claude Code. Co-Authored-By: Claude Fable 5.1 <[email protected]> ghstack-source-id: 02f1b6b Pull-Request: #197219
[ghstack-poisoned]
|
Reopened: this PR was closed automatically by GitHub when #196826 landed, because that commit's message contained the phrase "is not the fix: #197050", which GitHub read as a closing keyword. None of this PR's code landed. The head is now rebased onto the landed base with the split stack below it; no change to this PR's own diff. |
|
Claude finished @bobrenjc93's task in 23m 6s —— View job PR Review: #197050Two comments already in the file promise that "the caveat a follow-up change appends to the advice names those trees and quotes their raises" — this PR is that change, and the caveat it ships names no index and quotes no raise, so both promises are now stale and the raise the caveat is about is still printed nowhere. Full reviewPR Review: #197050SummaryRecords a Code Quality
Testing
RecommendationRequest Changes The blocking item is self-contained and does not depend on which state of the branch you meant to land: two comments in the file say this change names the trees and quotes their raises, and the shipped caveat does neither, so the shape at I could not run the Test Plan: |
[ghstack-poisoned]
|
Re-reviewed against the current head 1.
Fixed in 2.
Declined here, owned by the commit above ( 3.
Fixed in 4.
Fixed in 5.
Fixed in 6.
Fixed in 7.
Fixed in |
|
Claude finished @bobrenjc93's task in 20m 27s —— View job PR Review: #197050All seven items from the last round check out at Full reviewPR Review: #197050SummaryRecords a Verification of the previous round, against
Performance
Code Quality
Testing
RecommendationApprove The report-side logic holds as written: I re-traced the reachable combinations of I could not run the Test Plan: |
|
@pytorchbot merge -i |
…ing (#197219) **Problem.** #196826 made `AOTCompiledModel` dispatch record a guard tree that raises and either serve over it (with a warning) or fold it into the no-match report, but three exits that leave `__call__` with a raise on record and nothing logged -- a bare `SystemExit` out of a later tree, a later result whose signature cannot take the call, a call the one signature cannot take -- were unpinned, as was the promise that a call binds once per result across both dispatch passes and the report. **Fix.** Three tests and one two-signature helper pin those exits, and two assertions are folded into the landed per-result binding test. No source change. **Summary.** Test-only, split for review budget from `[aot_compile] Tolerate a guard tree that raises during module dispatch` (#196826), four commits below, whose `torch/_dynamo/aot_compile.py` this commit does not touch. The three tests here were three of the twelve of `[aot_compile] Pin the raise-tolerant module dispatch's warning: its paths, text and dedup` (#197195), directly below; this commit adds them without touching the eight that stayed there, and folds a fourth's two assertions into the landed test whose setup it repeated. They pin the exits of `AOTCompiledModel.__call__` that record a raise nowhere -- a `SystemExit` out of a later tree, a later result whose signature cannot take the call, a call the one signature cannot take -- and that a call binds once per result across both dispatch passes and the report. One module-level helper, `compile_two_signatures`, builds the two-signature model the landed binding test and the cannot-bind test assemble, and the stub guard manager both raise tests need is the file's own module-level `RaisingTree(text)`, adopted at the two sites where each had an inline copy. The two negative pins each fail a mutant of their own and the two raise tests each error against #196826's parent, measured as the Test Plan records. ## Where they sit The two about binding join the landed `test_module_dispatch_*` tests on how a call binds, directly after `test_module_dispatch_binds_per_result_when_signatures_differ`, under that prefix, and, like that cluster, without `_hide_leaked_dynamo_globals`; `test_aot_compile_module_system_exit_out_of_a_later_tree_propagates` stays among #197195's dedup tests, because its last call is a dedup pin, and calls it as they all do. ## The helper and the stub ```python def compile_two_signatures(x, second_forward, *second_call): # One module, two results: [0] is ScaleModule's own forward compiled for `x`, # [1] is `second_forward` compiled for `second_call`. They bind alike iff # `second_forward`'s parameters (names, kinds, defaults) and closure cells # match forward's, so a caller wanting a non-shared binding varies one. mod = ScaleModule() doubled = aot_compile_forward(mod, ScaleModule.forward, x) second = aot_compile_forward(mod, second_forward, *second_call) return AOTCompiledModel(mod, [doubled, second]) ``` One module-level helper beside `compile_mode_defaults` serves them: `compile_two_signatures`, the two-signature model that landed test and the cannot-bind test assemble, built from the same `aot_compile_forward`. Its comment states when the two results bind alike -- iff `second_forward`'s parameters and closure cells match forward's, measured: a `(self, x)` second forward binds alike, one named `(self, y)` or given a default does not -- rather than promising they never do. The stub guard manager both tests need for the result whose tree raises is the file's own module-level `RaisingTree(text)`, adopted at the two sites where each had an inline copy; neither reads its `checks` counter, so this commit adds no second always-raising class beside it (FAQ below). ## The exits that record nothing Every path in #196826 that RETURNS a graph with a raise on record logs one, every path that builds a report chains one, and a call that ends in neither leaves as the exception that ended it; its FAQ says why nothing is logged on the way out. ### A bare `SystemExit` out of a later tree ```python class Exits: def check(self, f_locals): raise SystemExit("inside the tree") results[0]._artifacts.guard_manager = RaisingTree("zero is unhappy") results[1]._artifacts.guard_manager = Exits() with self.assertNoLogs(logger, level="WARNING"): with self.assertRaisesRegex(SystemExit, "inside the tree"): model(x) # leaves __call__ as the SystemExit, nothing logged results[1]._artifacts.guard_manager = real with self.assertLogs(logger, level="WARNING") as logs: self.assertEqual(model(x), x * 2) # serves [1] # exactly one line: "[0]'s guard check raised RuntimeError: zero is unhappy" ... "dispatch served [1]" ``` `test_aot_compile_module_system_exit_out_of_a_later_tree_propagates`: two results, [0]'s tree raising `RuntimeError` and [1]'s raising `SystemExit`; that call leaves `__call__` as the `SystemExit` with nothing logged, and the next call, with [1]'s real tree back, serves [1] and logs `[0]'s guard check raised RuntimeError: zero is unhappy`. That last call pins WHERE the dedup is judged (FAQ below). `SystemExit` and not `KeyboardInterrupt`, which the landed `test_aot_compile_module_interrupt_out_of_a_guard_tree_propagates` already drives out of this same handler behind a raiser: what no other test in the file has is a BARE `SystemExit`, where `accepts()`' `except Exception` decides on its own -- the `SystemExit` cases of the landed `test_aot_compile_module_wrapped_interrupt_out_of_a_guard_tree_propagates` arrive wrapped in the pybind boundary's `SystemError`, which the handler does catch and `_meant_an_exception` then re-raises -- and the `AOTCompiledModel` docstring promises both propagate. ### A later result that cannot bind ```python def needs_z(self, y, z): return y * z combined = compile_two_signatures(x, needs_z, x, x) results[0]._artifacts.guard_manager = RaisingTree("zero is unhappy") self.assertFalse(combined._binds_alike(tuple(results))) # premise: [1] binds inside its own accepts() with self.assertRaisesRegex(RuntimeError, "zero is unhappy"): results[0].guard_check(combined.model, x) # premise: [0] does raise with self.assertNoLogs("torch._dynamo.aot_compile", level="WARNING"): with self.assertRaisesRegex(TypeError, "missing a required argument: 'z'"): combined(x) ``` `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`: two results that cannot share a binding, [0]'s tree raising and [1]'s signature needing an argument the call lacks; `TypeError: missing a required argument: 'z'` leaves `__call__` with nothing logged. It pins its premises before the call -- `_binds_alike` is False, so [1] binds inside its own `accepts()`, and [0]'s `guard_check` raises `RuntimeError: zero is unhappy` -- so a stub that stopped raising fails it with `RuntimeError not raised` (measured below) instead of leaving the case it names unexercised. Both keep `assertNoLogs` outermost (FAQ below). ### A call the one signature cannot take ```python model = torch.compile(ScaleModule(), fullgraph=True, backend="eager") model._aot_compile([ModelInput(args=(torch.randn(3, 3),), kwargs={}, contexts=[])]) with self.assertRaisesRegex(TypeError, "too many positional arguments"): model(x, x) with self.assertRaisesRegex(TypeError, "missing a required argument: 'x'"): model() ``` `test_module_dispatch_wrong_arity_raises_type_error` is the one-result form of the same exit, and the source before #196826 already had it right: a call the signature cannot bind is the `TypeError` a plain module call raises, with no report folded around it -- `prepare_f_locals` stays outside `accepts()`' `try`. The type is the whole pin: the report is raised as a `RuntimeError`, so `assertRaisesRegex(TypeError, ...)` excludes it and nothing else about the exception needs reading. ## One bind per result, across both passes and the report ```python # folded into test_module_dispatch_binds_per_result_when_signatures_differ binds = [] def counted(result, *args, **kwargs): binds.append(result) return bind(result, *args, **kwargs) with patch.object(AOTCompiledFunction, "prepare_f_locals", counted): with checks[0] as check0, checks[1] as check1, no_match: combined(x.half()) # no result matches: the no-match report self.assertEqual((check0.call_count, check1.call_count), (2, 2)) # both passes checked both results self.assertEqual(len(binds), len(results)) # bound once per result for i, (bind_of, result) in enumerate(zip(binds, results)): self.assertIs(bind_of, result, f"bind {i} is not of result [{i}]") # in index order, the same objects ``` One more thing the source before #196826 already did, kept, pinned in the landed `test_module_dispatch_binds_per_result_when_signatures_differ`, which already builds the two-signature model and shows each result binding on its own: a third call, `x.half()`, that no result matches ends in the no-match report (`assertRaisesRegex(RuntimeError, "No AOT compiled graph matched")`) having bound once per result -- in index order, the same objects, asserted per position so a wrong-order failure names the position -- while both passes checked each result (`check` wrapped and counted: two per result); that source's per-result list already satisfied it, and #196826's `bound` dict keeps it. The report's entry count is not asserted here: the report reads `bound[i]`, so it adds nothing to the bind count, and seven other tests count those lines. ## What each test pins, by mutation | mutation of #196826's `aot_compile.py` | fails | | --- | --- | | bind moved inside `accepts()`' `try` | `test_module_dispatch_wrong_arity_raises_type_error`, `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`, nothing else: the `TypeError` is read as a raise and each call ends in a no-match report | | rebind on every pass (`f_locals = None` for `bound.get(i)`) | `test_module_dispatch_binds_per_result_when_signatures_differ` on `len(binds)`: `Expected 2 but got 4`, nothing else | | second pass deleted | the same test on its `check` counts, `(2, 2)` read as `(2, 1)`, plus 23 other re-check tests | | handler AND `_meant_an_exception` widened to admit `SystemExit` | `test_aot_compile_module_system_exit_out_of_a_later_tree_propagates` (a no-match report where the exit was asked for); widening the handler alone changes nothing | | dedup pair decided in `accepts()`' handler, not `warn_swallowed` | the same test on its last call's `assertLogs`, `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, and six others | | dispatch handlers re-raise | the system-exit and cannot-bind tests on [0]'s `RuntimeError` escaping | | warning's raiser read off the served index | the system-exit test's last call, whose log then names `[1]` (#197195's mutant) | | [0]'s `RaisingTree` replaced by a stub returning False | the cannot-bind test on its premise, `RuntimeError not raised` | The Test Plan gives each measurement in full, including the parent run: the system-exit and cannot-bind tests both error on [0]'s `RuntimeError: zero is unhappy` escaping the call before the exit they pin is reached, and the two that pin what that source already did pass, as they should. Test Plan: ``` python test/dynamo/test_aot_compile.py -k test_aot_compile_module_system_exit_out_of_a_later_tree_propagates python test/dynamo/test_aot_compile.py -k test_module_dispatch_later_result_that_cannot_bind_raises_type_error python test/dynamo/test_aot_compile.py -k test_module_dispatch_wrong_arity_raises_type_error python test/dynamo/test_aot_compile.py -k test_module_dispatch_binds_per_result_when_signatures_differ python test/dynamo/test_aot_compile.py ``` The whole file is green, `OK (skipped=6)`. `lintrunner --take RUFF,PYFMT test/dynamo/test_aot_compile.py` is clean. The four were also run against the `torch/_dynamo/aot_compile.py` of #196826's parent under this test file: the system-exit and cannot-bind tests both error on [0]'s `RuntimeError: zero is unhappy` escaping the call before the exit they pin is reached, and the two that pin what that source already did pass, as they should. Each of the two negative pins fails a mutant of its own, each run against the whole file at this commit. Moving the bind inside `accepts()`' `try` fails `test_module_dispatch_wrong_arity_raises_type_error` and `test_module_dispatch_later_result_that_cannot_bind_raises_type_error`, and nothing else: the `TypeError` is read as a raise and each call ends in a no-match report (`No AOT compiled graph matched this call. Tried 1 compiled input(s)` with `[0] <guard check raised TypeError: too many positional arguments>`, and `Tried 2`) where the `TypeError` was expected. Rebinding on every pass (`f_locals = None` in place of `bound.get(i)`) fails `test_module_dispatch_binds_per_result_when_signatures_differ`, and nothing else, on `len(binds)`: `Expected 2 but got 4`. Deleting the second pass fails it on its `check` counts, `(2, 2)` read as `(2, 1)` -- its bind count alone reads the same with one pass as with two -- along with 23 other tests of the file that pin the re-check. Each fix in #196826 that the other two cover was then reverted on its own against the same file. A bare `SystemExit` reaches the record only if BOTH `accepts()`' handler and `_meant_an_exception` are widened to admit it: widening the handler alone, to `BaseException` or to `(Exception, SystemExit)`, changes nothing, because the gate re-raises whatever a tree meant that is not an `Exception` (measured: this test and the file's five other interrupt tests stay green). Widened in both places, `test_aot_compile_module_system_exit_out_of_a_later_tree_propagates` gets `RuntimeError: No AOT compiled graph matched this call. Tried 2 compiled input(s)` where it asked for the exit, with only the three `SystemExit` cases of the wrapped-interrupt test above failing beside it. Deciding the dedup's `(index, exception type)` pair in `accepts()`' handler, as the raise is recorded, rather than in `warn_swallowed` fails the same test on its last call's `assertLogs` (`no logs of level WARNING or higher triggered`), #196826's `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning` the same way, and six others that read the record or the one-shot (FAQ below). Making the dispatch handlers re-raise fails the system-exit and cannot-bind tests on [0]'s `RuntimeError` escaping, the two pins of the older behaviour passing. Reading the warning's raiser off the served index fails the system-exit test's last call, whose log then names `[1]`; that mutant is #197195's, whose message lists the tests it fails there. Replacing [0]'s `RaisingTree` in `test_module_dispatch_later_result_that_cannot_bind_raises_type_error` with a stub that returns False fails it on its premise assertion, `RuntimeError not raised`. > **FAQ: > `test_aot_compile_module_system_exit_out_of_a_later_tree_propagates` > and `test_module_dispatch_later_result_that_cannot_bind_raises_type_error` > nest `assertNoLogs` outside `assertRaisesRegex`, so a spurious warning on a > call that also fails the raise assertion is reported as the raise failure. > Swap them so `assertRaisesRegex` is outermost?** > > Declined, because the swap makes the log pin vacuous, measured here. > `unittest`'s `_AssertLogsContext.__exit__` returns False without reading its > records whenever an exception is passing through it ("let unexpected > exceptions pass through"), and on these two tests' expected path the call > ALWAYS raises, so an `assertNoLogs` nested inside the raise assertion exits > by exception every time and checks nothing. With `log.warning("spurious > warning on record")` added where both tests' aborted call records [0]'s > raise -- the inline handler, not `accepts()`, which neither aborted call > reaches: as written, both tests fail with `AssertionError: Unexpected logs > found: ['WARNING:torch._dynamo.aot_compile:spurious warning on record']`; > with `assertRaisesRegex` outermost, the cannot-bind test PASSES and the > system-exit test fails only on its last call, on `len(logs.output)` reading > 2 where 1 is expected -- the swapped blocks let the warning through on the > aborted call. The masking the finding describes happens only on a call that > has already failed the raise assertion, where the test fails either way. > The order as written is the one on which the silence is checked at all, and > a one-line comment at each site says so; that line is the one note about > the test framework the two tests keep, because it is what stops the swap. > **FAQ: the system-exit test's last call -- [1]'s real tree restored, the > next call serving [1] and warning about [0] -- asserts the two substrings > `test_aot_compile_module_warns_again_about_a_replaced_index` (#197195) > already asserts, and a regression that populated `_warned` while logging > already fails the aborted call's `assertNoLogs`. Is the exit the test is > named for not the test?** > > The exit is, and the last call pins WHERE the dedup is judged, which the > aborted call cannot. Measured by moving it: deciding the `(index, exception > type)` pair in `accepts()`' handler as the raise is recorded, and leaving > `warn_swallowed` to log the pairs so collected, passes the aborted call > (nothing is logged; the exit still escapes), #197195's pop and every-input > tests and #196826's single-result and once-per-model tests alike, and fails > this last call, with `no logs of level WARNING or higher triggered`, because > the aborted call had already consumed `(0, "RuntimeError")`; #196826's > `test_aot_compile_module_two_raisers_in_the_report_and_then_the_warning`, > whose first call ends in a no-match report rather than an exit and whose > second call is silent for the same reason; and six more that read the > record the mutant drops or the one-shot it spends. That is a restructuring > a later reader could plausibly make -- the handler is where the pair is > first known -- and it would make every aborted call a silent one for the > raise on its record. The test's comment names both tests the move fails. > **FAQ: the file's inline raiser stubs -- four `class Raises`, two > `class RaisingGuardManager`, and the `Interrupts` of > `test_aot_compile_module_interrupt_out_of_a_guard_tree_propagates` -- all > duplicate the module-level `RaisingTree` these two tests adopt. Why not > convert them too?** > > `git blame` puts every one of them in a test of #197188, #197220, #197390 > or #197391 below, and #197188, #197220 and #197390 are already approved, > so the conversion cannot be folded into the commits that own the stubs > either; doing it here would put edits to four other PRs' tests in a commit > whose diff is otherwise three tests and one helper, and would shift the > hunks #197050 and #197257 apply above. `RaisingTree` is module level and > already adopted at 21 sites, so those owners can adopt it in one line each. Authored with the assistance of Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Pull Request resolved: #197219 Approved by: https://github.com/pytorchgreenlight ghstack dependencies: #197049, #196823, #197149, #197048, #196825, #196897, #197218, #196909, #196826, #197390, #197391, #197188, #197179, #197195, #197220, #197001, #197569, #197301, #196908, #197319
…means (#197257) Split from `[aot_compile] Say what the no-match report's advice rests on after a raise` (#197050, the commit below) for review budget: that commit appends a caveat to the report's `ModelInput` advice when every rejection the advice rests on followed a raise from its own tree, and this one makes the caveat name the trees it means and quote their raises. At the commit below the caveat reads `Fix the raise first: every rejection this advice rests on followed a raise from its own tree, and ...`, and the only raise the report names above it is the raiser line's: `[i]'s guard check raised while checking this call`, where `i` is the FIRST enabled index in `raised`, and the chain carries the first raise recorded of all. The tree the caveat means is an entry in `answered` but not in `trusted`, whose own entry line quotes its rejection, not its raise. Those coincide on a one-input report and diverge as soon as another enabled tree raised before it, so there `the raise` points at the wrong tree and the raise the caveat means is printed nowhere -- measured on `ScaleModule` with two inputs, a tree that raises on every pass at [0] and `RaisesOnceThenRejects("the scan is unhappy")` at [1]: the report at the commit below carries `[0] <guard check raised RuntimeError: every pass is unhappy>`, `[1] stub guard rejected`, `[0]'s guard check raised while checking this call`, and the advice ending in `Fix the raise first: ...`, with `the scan is unhappy` nowhere on it. Order to review: `_raise_text`, split out of `_raised_line`, and the caveat's caller added to the reachability comment on `_quoted`; the caveat's `untrusted` list, its `plural` and its join at the end of `_no_match_report`, the `coverable` and `trusted_rejection` gates it hangs off, and the comment on the list; the sentence added to the comment on `_STALE_AFTER_THROW`; the `AOTCompiledModel` docstring's clause about the report's closing lines; then, in the test file, the two placeholders added to `CAVEAT_AFTER_A_RAISE`, `test_no_match_message_names_the_tree_whose_raise_qualifies_the_advice`, `test_no_match_message_names_every_tree_whose_raise_qualifies_the_advice`, `test_no_match_message_caveat_quotes_a_raise_through_the_pybind_boundary`, `test_no_match_message_caveat_skips_an_opted_out_raise_then_rejection`, `test_no_match_message_caveat_reads_the_opt_out_snapshot`, and the quoting assertions added to `test_no_match_message_qualifies_a_rejection_that_followed_a_raise`, `test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw`, `test_no_match_report_reads_the_dispatch_record_after_a_raise` and `test_no_match_message_qualifies_the_advice_when_the_re_check_raises`, and the trailing separator and the odd exception kind added to `test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators`. The caveat now names those trees by index and quotes each one's raise -- `Fix the raise out of [1] <RuntimeError: the scan is unhappy> first` -- because nothing else on the report carries such a raise. `test_no_match_message_names_the_tree_whose_raise_qualifies_the_advice` is the shape above, and pins that [0]'s line, the raiser line and the `__cause__` are all [0]'s while the caveat names [1] and quotes its raise, the one place on the report that text appears. Building the caveat over `[raiser]` instead of the enabled entries of `answered` fails that test and `test_no_match_message_names_every_tree_whose_raise_qualifies_the_advice`, whose [1] the raiser line never names. The entries are the ENABLED ones: an opted-out tree that raised and then rejected is in `answered` too, since recording never reads the flag, but nobody asked about its guards, its own line is the withheld one blaming the raiser, and quoting its raise here would contradict that line and the withheld advice, which both say the raiser's raise is what withheld it. `test_no_match_message_caveat_skips_an_opted_out_raise_then_rejection` puts `RaisesOnceThenRejects` on an enabled [0] and on an opted-out [1], where [0] being an enabled raiser is what keeps the last resort from serving [1], and pins that the caveat names and quotes only [0], singular, with [1]'s message nowhere on the report; dropping the `enabled[i]` filter fails that test, on `Fix the raises out of [0] <RuntimeError: the checked scan is unhappy>; [1] <RuntimeError: the opted-out scan is unhappy> first`. Enabled means the `enabled` snapshot the entry lines read, not a fresh read of the flag: the report runs user code between the veto's read and this list -- an entry's `check_verbose`, or a `disable_guard_check()` from another thread, which is a plain store -- so a fresh read can drop an entry this same report printed as a rejection, and where it was the only one the sentence loses its subject, nothing left between `Fix the raise out of` and `first` and a doubled space where the tree should be. `test_no_match_message_caveat_reads_the_opt_out_snapshot` is that shape, the two-input report above with [1]'s `check_verbose` opting [1] out before it returns the rejection the advice rests on: the snapshot leaves `Fix the raise out of [1] <RuntimeError: the scan is unhappy> first`, and this filter made a fresh read leaves exactly the subjectless sentence and fails that test, the only test in the file it fails. The `coverable` and `trusted_rejection` gates that decide whether the caveat fires read that same snapshot, so what they found and what the list keeps cannot disagree: a `coverable and not trusted_rejection` report has an answered entry enabled in the snapshot and outside `trusted`, which is an entry `accepts()` recorded a raise for, so the list is never empty and `trusted` need not be subtracted. Off the flag the gates were two reads of it, and a store landing between them on the only answered entry left `coverable` true, `trusted_rejection` false and the subjectless sentence above over an empty list. Dropping the `enabled[i]` filter errors `test_no_match_message_quotes_a_tree_that_raised_then_answered` with `KeyError: 1` as well, its opted-out [1] having rejected with no raise on record. The quoted text comes from `_raise_text`, the part of `_raised_line` that turns a recorded raise into `Kind: reason`, with the same pybind-boundary clause and the same newline collapse, so an entry line and the caveat cannot describe one raise differently. The collapse covers the kind as well as the reason, which is why it wraps `Kind: reason` rather than the reason alone: `kind` is `type(reason).__name__`, and a class built with `type()` may hold a separator in its name, so interpolating it raw splits an entry line and the caveat over lines -- the failure the collapse exists to prevent, and one the caveat can multiply, a report carrying a kind per tree it names. An entry line that quotes a raise reads as before unless that text ends in a separator `splitlines()` breaks on: `_raised_line` collapsed the whole line after appending the bracket, so `...abc\n>` came out `...abc >`, while `_raise_text` collapses before the boundary clause and the bracket are appended and emits `...abc>`, which is also what keeps the C++-throw golden below clean. `test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators`, from a commit below, now ends its message in a fifth separator and raises a class named `Odd\nKind`, and pins the whole line, ` [0] <guard check raised Odd Kind: page break rec sep line (through the guard tree's pybind boundary)>`: on the commit below it fails on `sep line (through`, and with `kind` interpolated raw it fails on a report of four lines where it reads three, the entry split after `Odd`. The caveat is one sentence whichever number of trees it names. Each entry is bracketed as on the entry line, `[i] <Kind: reason>`, and the entries are joined with `; `: the quoted text is arbitrary user text that may hold commas, and `_raise_text`'s pybind-boundary clause is a parenthetical of its own, so parentheses around an entry nest it (`[0] (ValueError: boom on compare 1 (through the guard tree's pybind boundary))`) and a comma join puts a user comma where a boundary between entries reads. With two such trees it reads `Fix the raises out of [0] <RuntimeError: a>; [1] <RuntimeError: b> first`, and `_STALE_AFTER_THROW`, unchanged here, is already phrased for one tree or several -- `a C++ throw out of a tree can leave that tree's relational guard state stale, so its next check ...` -- so the clause has an antecedent however many trees precede it; its comment now says that is one reason for the phrasing. `test_no_match_message_names_every_tree_whose_raise_qualifies_the_advice` installs `RaisesOnceThenRejects` on both enabled results with different messages, one holding a comma, and pins the plural, both bracketed entries, and that each message appears exactly once on the report (the raiser line and the chain carry only [0]'s, the first recorded). The order the entries come in is incidental rather than pinned: `answered` holds small ints, whose set iteration is value-ordered at these table sizes, so dropping the `sorted` leaves the whole file green (`Ran 337 tests ... OK (skipped=6)`). Mutating `plural` to `""`, the join to `untrusted[0]` or the joiner to `, ` fails that test; parentheses around the entry fail it, the seven other tests that pin a whole caveat, and `test_no_match_report_reads_the_dispatch_record_after_a_raise`, which pins its one bracketed entry. `test_no_match_message_caveat_quotes_a_raise_through_the_pybind_boundary` renders the caveat for the other flavour of raise: a `RaisesThenHits(raises=1)` key on `DictBranchModule` raises through pybind on the scan and answers after it (`RaisesOnCompare` raises on every compare, so a tree keyed on it never gives the rejection the caveat rests on), and the test pins `[0] <ValueError: boom on compare 1 (through the guard tree's pybind boundary)>` inside the caveat, quoted exactly once on the report. A commit below's `test_no_match_message_quotes_a_tree_that_raised_then_answered` has that shape too and said no line of the report quotes its raise; the caveat now does, and its comment says so. `test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw`, from the commit below, drives the caveat with a real `TORCH_CHECK` throw out of `TENSOR_MATCH` (`NestedTensorImpl doesn't support strides`), and now pins the caveat quoting it as `[0] <RuntimeError: ...>` with no boundary clause, since pybind translated a throw with nothing chained. The golden collapses `str(cause)` as `_raise_text` collapses the reason, `" ".join(str(cause).splitlines())`: under `TORCH_SHOW_CPP_STACKTRACES=1`, which `test/run_test.py` sets when it retries a failed test, pybind takes `e.what()` over `e.what_without_backtrace()` and the message carries the C++ backtrace, one frame per line and each line newline-terminated, while the report is one line per paragraph, so an uncollapsed golden can never be the advice's suffix and the test would be red on exactly a retry: measured red with the variable set and the collapse removed from `_raise_text`, green with it, and green either way with the variable unset. The collapse is of `str(cause)` alone, not of the whole `[0] <RuntimeError: ...>` entry, because the last frame's newline sits right before the closing bracket and collapsing the whole entry leaves `... >` where `_raise_text`, which collapses the reason before the bracket is appended, emits `...>`. Against the commit below, nothing served or raised changes: the same calls raise the same `RuntimeError` with the same `__cause__`, and the dispatch passes, the veto, the warning and `trusted` are untouched, and the gates on the report's closing lines, the caveat's included, now read the `enabled` snapshot rather than the flag: nothing between the veto's read and them runs user code, so no call of its own accord tells the two apart, and the whole file is green under either read. Two texts differ: the caveat's, where `Fix the raise first` becomes `Fix the raise(s) out of [i] <Kind: reason>; ... first`, naming and quoting every enabled tree whose rejection the advice rests on, and a raise entry line whose reason ends in a separator, which loses the stray space before its closing bracket. The `AOTCompiledModel` docstring said the advice says to fix the raise first; it now says the advice names and quotes those raises, and the two comments that called the caveat a follow-up change -- that docstring's closing sentences and the one on the report's raise entry line, both accurate at the commit below -- say what it does today. The sentence that followed it -- reading a dispatch-recorded raise's entry line and `__cause__` onto the caveat -- is deleted rather than qualified again: the entry-line shapes, the caveat's gate and the `__cause__` rule are each stated once earlier in the same docstring, and the sentence only restated them. Both texts state that gate as `trusted` keys it, per tree rather than over every raise on the report -- a tree that rejected and THEN raised is trusted, and its own line quotes that raise -- and the entry-line comment keeps the commit below's reading for the shape the gate leaves out, an enabled tree that rejected before any raise from its own tree switching the caveat off, and then no line of that report carries the raise. One tree can put two raises on the report, in two bracketed forms: `test_no_match_message_qualifies_the_advice_when_the_re_check_raises`, from the commit below, has dispatch record `the first pass is unhappy` and then a rejection at [0], and the report's `check_verbose` raise `the re-check is unhappy`, so [0]'s entry line is `<guard check raised RuntimeError: the re-check is unhappy>` and the caveat quotes `[0] <RuntimeError: the first pass is unhappy>`. That is the intended reading, not a side effect: the caveat quotes the raise the rejection the advice rests on followed, which is dispatch's, and the re-check's raise is the report's own, already on the entry line. The test pins the whole caveat and that dispatch's message appears exactly once on the report, where it asserted only that the caveat was present. Five tests are new; five of the commits below's gain an assertion: three the assertion that the caveat quotes the raise for their case (`test_no_match_message_qualifies_a_rejection_that_followed_a_raise` and `test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw` pin the named entry through `CAVEAT_AFTER_A_RAISE`'s placeholders, and `test_no_match_report_reads_the_dispatch_record_after_a_raise`, whose [0] raised on the scan, rejected on the second pass and accepted on the re-check, pins the caveat's `Fix the raise out of [0] <RuntimeError: the first pass is unhappy> first`, and that it appears exactly once on the report, where it asserted that text absent), `test_no_match_message_qualifies_the_advice_when_the_re_check_raises` the whole caveat, and `test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators` the trailing separator and the odd kind; and a commit below's `test_no_match_message_quotes_a_tree_that_raised_then_answered` changes only its comment. Of those eleven, ten fail on the commit below's `aot_compile.py`, all but the comment-only one. The caveat's text stays one golden, `CAVEAT_AFTER_A_RAISE`, now with two placeholders, the plural of `raise` and the bracketed entries it names, that the eight tests pinning the whole paragraph share. Test Plan: ``` python test/dynamo/test_aot_compile.py -k test_no_match_message_names_the_tree_whose_raise_qualifies_the_advice python test/dynamo/test_aot_compile.py -k test_no_match_message_names_every_tree_whose_raise_qualifies_the_advice python test/dynamo/test_aot_compile.py -k test_no_match_message_caveat_quotes_a_raise_through_the_pybind_boundary python test/dynamo/test_aot_compile.py -k test_no_match_message_caveat_skips_an_opted_out_raise_then_rejection python test/dynamo/test_aot_compile.py -k test_no_match_message_caveat_reads_the_opt_out_snapshot python test/dynamo/test_aot_compile.py -k test_no_match_message_qualifies_a_rejection_that_followed_a_raise python test/dynamo/test_aot_compile.py -k test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw TORCH_SHOW_CPP_STACKTRACES=1 python test/dynamo/test_aot_compile.py -k test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw python test/dynamo/test_aot_compile.py -k test_no_match_report_reads_the_dispatch_record_after_a_raise python test/dynamo/test_aot_compile.py -k test_no_match_message_quotes_a_tree_that_raised_then_answered python test/dynamo/test_aot_compile.py -k test_no_match_message_qualifies_the_advice_when_the_re_check_raises python test/dynamo/test_aot_compile.py -k test_no_match_report_keeps_a_raise_on_one_line_past_odd_separators python test/dynamo/test_aot_compile.py lintrunner --take RUFF,PYFMT torch/_dynamo/aot_compile.py test/dynamo/test_aot_compile.py ``` The eleven were also run against the commit below's `torch/_dynamo/aot_compile.py` (ten fail, the comment-only one passes), and the caveat's construction was then mutated one term at a time -- built over `[raiser]` instead of the enabled entries of `answered`, the `enabled[i]` filter dropped, that filter made a fresh `results[i]._guard_check_enabled` read, both gates made fresh reads of the flag, `plural` made `""`, the join made `untrusted[0]`, the joiner made `, `, the entries parenthesized, and `kind` interpolated raw in `_raise_text` -- and the tests that name the caveat rerun; only the tests named above failed under each, the gates' fresh reads leaving the whole file green and the filter's fresh read failing `test_no_match_message_caveat_reads_the_opt_out_snapshot` alone. Authored with the assistance of Claude Code. > **FAQ: The trailing-separator improvement is exact only for one trailing > separator: two leave `...abc >` still, since collapsing a text that ends in > two of them yields a trailing space of its own.** > > True, and left as is: the collapse puts a space between the pieces > `splitlines()` returns, so a text ending in N separators keeps N-1 spaces > before the bracket. What the format rests on is the entry staying on one > line, which holds for any N, and no golden reads the residue; stripping it > would be a rule the report applies to no other quoted text. Co-Authored-By: Claude Fable 5.1 <[email protected]> Pull Request resolved: #197257 Approved by: https://github.com/pytorchgreenlight ghstack dependencies: #197049, #196823, #197149, #197048, #196825, #196897, #197218, #196909, #196826, #197390, #197391, #197188, #197179, #197195, #197220, #197001, #197569, #197301, #196908, #197319, #197219, #197580, #197050
…as (#197745) **Problem.** `IMPORT_NAME` checked that `__import__`'s result was a module only after `import_source` had already bound the result into the traced globals and a process-wide cache, so a non-module `sys.modules` entry was left behind in both, and a later trace with a real module in the entry crashed with an `InternalTorchDynamoError` instead of compiling. **Fix.** Move the module-type check ahead of the `import_source` call, so a non-module never reaches the traced globals or the cache and the graph break happens first; the replay arm needs no check and pushes as-is. **Summary.** `IMPORT_NAME` tested `__import__`'s result with `isinstance(value, (types.ModuleType, DummyModule))` at push time, after `import_source` had already minted `__import_<mangled>` for the name and written that result into `self.output.global_scope` -- the root frame's real globals, a live module `__dict__` that nothing unwinds -- and into `_import_module`'s process-wide cache. `sys.modules` accepts any object and `__import__` hands it back verbatim, so a non-module entry was bound under the alias and only then graph-broken on (`Bad import result`), and a later trace, after a real module had replaced the entry, passed the push-time check on the module `__import__` returned while `import_source` served the cached non-module: the alias kept the non-module, the pushed variable held the module, and the guards built on the alias read `VALUE` off an `object()`, an `InternalTorchDynamoError` on a trace that should have compiled. Hoisting the check ahead of the `import_source` call keeps the non-module out of the traced globals and out of the cache, since the call that filled it no longer runs, so a later trace with a real module in the entry binds the alias to that module and compiles. The hoisted test is `isinstance(value, types.ModuleType)` alone and sits on the import arm only, because a replayed value is a `DummyModule`, a plain dataclass that is not a `ModuleType`, which `add_local_mod` already rejected non-modules for when the record was written, so the replay arm pushes with no type test and the `DummyModule` import goes away. Two behaviours change against the parent, both pinned or explained below: `IMPORT_NAME` of a non-module entry no longer writes the alias before breaking, and with `replay_record_enabled` on such an entry reaches the graph break instead of `add_local_mod`'s `AssertionError`. ## The bug: bind first, check second ```python # parent, IMPORT_NAME value = __import__(module_name, ...) # sys.modules[name] handed back verbatim source = self.import_source(module_name) # mints __import_<mangled>, writes value into # self.output.global_scope AND _import_module's cache if isinstance(value, (types.ModuleType, DummyModule)): # checked only now self.push(PythonModuleVariable(value, source=source)) else: unimplemented(gb_type="Bad import result", ...) # too late: the alias is already bound ``` `self.output.global_scope` is the root frame's real globals, a live module `__dict__` that nothing unwinds, so the non-module stayed bound under the alias for good. The second failure follows from the cache: ```python sys.modules[name] = object() torch.compile(fn)(x) # parent: Unsupported: Bad import result -- but fn.__globals__["__import_..."] is the object() torch._dynamo.reset() sys.modules[name] = module # a real module now torch.compile(fn)(x) # parent: InternalTorchDynamoError -- the guards read VALUE off the cached object() # now: compiles, agrees with eager, alias bound to `module` ``` On the parent's second trace, `__import__` returned the module, so the push-time check passed, but `import_source` served the cached non-module: the alias kept the non-module, the pushed variable held the module, and the guards built on the alias read `VALUE` off an `object()`. ## The fix: check before `import_source` ```python # now, IMPORT_NAME, import arm value = __import__(module_name, ...) if not isinstance(value, types.ModuleType): unimplemented(gb_type="Bad import result", context=typestr(value), explanation="Import result is not a Python module.", hints=[]) ... source = self.import_source(module_name) # never reached with a non-module ... self.push(PythonModuleVariable(value, source=source)) # no type test on either arm ``` Hoisting the check ahead of the `import_source` call keeps the non-module out of the traced globals and out of the cache, since the call that filled it no longer runs: a later trace with a real module in the entry binds the alias to that module and compiles. **Why `ModuleType` alone, on the import arm only.** A replayed value is a `DummyModule`, a plain dataclass that is not a `ModuleType`, so a check on that arm would refuse every replay -- and needs none, `add_local_mod` having rejected non-modules when the record was written. That is why the replay arm now pushes with no type test at all, and why the `DummyModule` half of the old condition, which existed only for it, goes away with the import from `replay_record`. ## The other nine `import_source` callers The check guards this one call site. The other nine `import_source` callers reach it with no module-type test, and a non-module entry under one of their names is still bound verbatim there, unchanged here -- though `get_globals_source_and_value` already brings its own test, since `_registered_module_for_globals` returns a name only for a `types.ModuleType` whose `__dict__` is the frame's globals. Those names are torch's own and stdlib ones, or a class's `__module__`; a non-module under one of them is a broken process, not a trace to save. `IMPORT_NAME` is the one caller resolving a name the traced bytecode chose, which is what makes its result worth checking. ## Behaviour changes against the parent - **`IMPORT_NAME` of a non-module `sys.modules` entry no longer writes the alias before breaking.** `test_import_alias_is_not_bound_to_a_non_module_import` pins it by planting a non-module, requiring the `Bad import result` graph break and an unbound alias, and then, with a real module in the entry, a compile that agrees with eager and an alias bound to that module. - **With `replay_record_enabled` on (off by default), such an entry now reaches that graph break** instead of the `AssertionError` `add_local_mod` raised first when it ran ahead of the check. That one is untested, since the path is the parent's `add_local_mod` and the config is off by default. ## The test ```python name = "torch_test_package_import_alias_non_module" alias = f"__import_{name}" def fn(x): import torch_test_package_import_alias_non_module as taken return x + taken.VALUE sys.modules[name] = object() with self.assertRaisesRegex(Unsupported, "Bad import result"): torch.compile(fn, backend="eager", fullgraph=True)(*args) self.assertNotIn(alias, fn.__globals__) # parent: the alias is bound to the object() torch._dynamo.reset() sys.modules[name] = module # types.ModuleType(name) with VALUE = 1 compiled = torch.compile(fn, backend="eager", fullgraph=True) self.assertEqual(fn(*args), compiled(*args)) # parent: InternalTorchDynamoError from the guard build self.assertIs(fn.__globals__[alias], module) ``` The cleanup clears `_import_module`'s cache as well as `sys.modules` and the alias, since the memo outlives the `sys.modules` entry and a same-process rerun would otherwise resolve this run's module from it. The test lives in `test_package.py` rather than `test_misc.py` because the alias binding this is about is the one `CompilePackage` records and `install()` rebinds, and that file already owns the rest of the `import_sources` coverage. Test Plan: ``` python test/dynamo/test_package.py -k test_import_alias_is_not_bound_to_a_non_module_import python test/dynamo/test_package.py ``` The new test is red on the parent's `torch/_dynamo/symbolic_convert.py`, on the alias the parent wrote before breaking, and its second half fails there too, with the guard-build `AttributeError` on the cached `object()`; restoring the push-time `isinstance` in place of the hoisted one reproduces the first failure. The whole file is green at this commit. ``` lintrunner --take RUFF,PYFMT,CODESPELL,GB_REGISTRY torch/_dynamo/symbolic_convert.py torch/_dynamo/graph_break_registry.json test/dynamo/test_package.py ``` The `Bad import result` registry entry is unchanged: the call moves, its strings do not. Authored with the assistance of Claude Code. Co-Authored-By: Claude Fable 5.1 <[email protected]> Pull Request resolved: #197745 Approved by: https://github.com/pytorchgreenlight ghstack dependencies: #197049, #196823, #197149, #197048, #196825, #196897, #197218, #196909, #196826, #197390, #197391, #197188, #197179, #197195, #197220, #197001, #197569, #197301, #196908, #197319, #197219, #197580, #197050, #197257
…197746) A refactor with no behaviour change, to make room for the commit directly above, which gives `import_source` a second argument: `graph_break_ok`, the flag that decides whether an alias slot already holding something else is a graph break or a hard error. `cache_method` keys on the whole argument tuple, so that flag would silently become part of the key, and a module name that two callers on one translator both resolve would run the body once per distinct flag value instead of once. Nothing about the second run would be wrong -- `f_globals[alias] is value` holds by then, so the check is skipped, and the package record and `update_co_names` are idempotent -- but the memo exists to make resolution happen once, and the flag cannot change the answer a memo hit returns: it is read only when the slot is taken, which a hit rules out, because the memo is written only past that check. First-caller-wins is therefore the same source any caller would have got. Keying on `module_name` alone also lets the new argument be passed by keyword at the call sites, which the decorator forbade. So the decorator gives way to an explicit `_import_source_memo` dict declared in `InstructionTranslatorBase.__init__`, read at the top of the method and written just before the return. Its lifetime is the decorator's: it lives on the translator and dies with it, which is what made the cache safe in the first place -- the alias it hands back names a global in the globals of the compile that minted it. The comment above the method now says why the key is one argument rather than the signature. Test Plan: ``` python test/dynamo/test_package.py -k import_alias python test/dynamo/test_package.py ``` Behaviour-neutrality was also measured directly on this tree, on a frame doing `from torch.autograd.profiler import profile` with `config.record_runtime_overhead` on, so that `IMPORT_NAME` and codegen's pregraph marker both resolve `torch.autograd.profiler`: the sequence of aliases `import_source` resolves across the compile is identical before and after this commit. ``` lintrunner --take RUFF,PYFMT,CODESPELL,GB_REGISTRY torch/_dynamo/symbolic_convert.py torch/_dynamo/graph_break_registry.json test/dynamo/test_package.py ``` Authored with the assistance of Claude Code. Co-Authored-By: Claude Fable 5.1 <[email protected]> Pull Request resolved: #197746 Approved by: https://github.com/pytorchgreenlight ghstack dependencies: #197049, #196823, #197149, #197048, #196825, #196897, #197218, #196909, #196826, #197390, #197391, #197188, #197179, #197195, #197220, #197001, #197569, #197301, #196908, #197319, #197219, #197580, #197050, #197257, #197745
Stack from ghstack (oldest at bottom):
Problem. After #197220, the no-match report advises "Add a ModelInput covering this call" whenever some guard tree rejected the call, without saying how that rejection came about. When the only rejection came from a tree that had raised on the pass before, the rejection may be about the stale relational state a C++ throw left behind rather than about this call, and the report said nothing about it.
Fix. Dispatch records
trusted, the indices that rejected with no raise of their own on record at that moment. When every rejection the advice rests on followed a raise from its own tree, the advice paragraph gains one more sentence: fix the raise first, since a C++ throw can leave that tree's relational guard state stale.Summary. The commit below, #197220, advises a
ModelInputwhenever some checked tree rejected the call and says nothing about how that rejection came about, so when the only rejection dispatch got out of a tree FOLLOWED a raise from the same tree, the advice stands on the answer the last-resort veto below refuses to act on: a C++ throw skips_reset_relational_guard_state(), so that rejection can be about the stale relational state rather than about this call. Dispatch now records one more set,trusted, the indices that answered with no raise of their own on record at that moment (if i not in raised), written on the rejection-only path ofaccepts()so an accept pays nothing for it, and the report computestrusted_rejectionover the enabled ones the way it already computescoverableoveranswered. Whencoverable and not trusted_rejection, theModelInputparagraph goes on to say so -- fix the raise first, since every rejection this advice rests on followed a raise from its own tree, and a C++ throw can leave that tree's relational guard state stale -- with the stale-state clause hedged (can leave) and held in a constant,_STALE_AFTER_THROW, because it is emitted for both flavours of raise and is a fact about only the throw that unwinds past the reset. The caveat keys on what dispatch recorded rather than on the lines the report printed, does not yet say WHICH tree's raise it means (#197257, the commit above, makes it name and quote them), and one trusted rejection is enough to leave the advice unqualified. Against the commit below nothing served or raised changes -- sameRuntimeError, same__cause__, same entry lines, same gates -- only theModelInputparagraph differs, and the four new tests plus the existing ones that now assert the caveat fail on the commit below'saot_compile.py.Where this sits in the stack
Split from
[no-ci] [aot_compile] Advise a ModelInput only when some checked tree answered the no-match report's call(#197220, the commit below) for review budget: that commit decides whether the report's closing advice applies at all, and this one says what the advice rests on when it does. Split again, for the same budget, from[aot_compile] Name and quote the raises the no-match report's caveat means(#197257, the commit above): this commit adds the caveat and the bookkeeping it keys on, and that one makes the caveat name the trees it means and quote their raises.The report the commit below prints
Measured on
ScaleModulewith one input and a stub tree that raises on the scan and rejects on the second pass, the report at the commit below reads:The
ModelInputadvice stands on a rejection that followed the same tree's raise, which the last-resort veto below refuses to act on, and nothing on the report says so.Recording
trustedDispatch now records one more thing about a rejection, and records it where the order is known rather than reconstructing it afterwards.
trustedholds the indices that answered with no raise of their own on record at that moment (if i not in raised), so it does not depend on dispatch running exactly two passes: under a third pass an answer-raise-answer tree would still be in it and a raise-answer-raise tree still out of it, where a predicate overanswered,raisedandunansweredcan only tell those two apart by counting passes. Recordingtrustedwithout theraisedcheck -- every answer trusted -- failstest_no_match_message_qualifies_a_rejection_that_followed_a_raise,test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw,test_no_match_message_qualifies_the_advice_when_the_re_check_raises,test_no_match_message_quotes_a_tree_that_raised_then_answeredandtest_no_match_message_advises_an_input_when_one_of_two_raisers_answered, all on the caveat going missing.The two lines that record it sit on the rejection-only path the commit below made of the answer exit of
accepts(): an accept returns before them, since dispatch then serves and builds no report, so the result that accepts pays nothing for them, and a rejection pays the four set operations now on that path --unanswered.discard(i),answered.add(i),i not in raised,trusted.add(i):check()of a one-inputScaleModuletree throughGuardManagerWrapper, the call dispatch makesThe comment at that block gives the same two numbers.
The caveat
The report says what it knows rather than choosing. The commit below advises a
ModelInputwhenever at least one checked tree reached an answer (coverable); when none of those answers came before its own tree raised (not trusted_rejection) the same paragraph now goes on to say so: fix the raise first, since every rejection the advice rests on followed a raise from its own tree, and a C++ throw out of a tree can leave that tree's relational guard state stale.The caveat does not say WHICH tree's raise it means: on the one-input reports here the raiser line above it names that tree, and the commit above makes the caveat name and quote the raises itself, since the two diverge as soon as another enabled tree raised first -- measured on the report of
test_no_match_message_advises_an_input_when_one_of_two_raisers_answered, from a commit below, where [0] raises on both passes and [1] raises on the scan and rejects after: the raiser line and the__cause__are [0]'s, the advice rests on [1]'s rejection alone, and [1]'s raise appears nowhere on the report (its entry line is itscheck_verboserejection). That test now also pins that the caveat is emitted there, on a clause the commit above keeps. The two texts that promised a caveat naming those trees -- the last sentence of theAOTCompiledModeldocstring and the comment on the report'sunansweredbranch -- now say what this caveat does say and leave the naming to that commit.Why the stale-state clause is hedged
The clause is hedged (
can leave, notleaves) because it is emitted for both flavours of raise and is a fact about only one of them:_reset_relational_guard_state()runs on every return path ofRootGuardManager::check_nopybind_templateandcheck_verbose_nopybind(torch/csrc/dynamo/guards.cpp), so only a throw that unwinds past them skips it, and a tree that returns to pybind with an error merely set -- theSystemErrorwhose chained cause_unwrapped_raisequotes, which is howDICT_CONTAINSraises, itsresult == -1branch being dead -- ran the reset on its way out.TORCH_CHECK) unwinding past the root's exitsRuntimeError, no__cause__SystemErrorat the pybind boundary, cause quoted by_unwrapped_raise;(through the guard tree's pybind boundary)on the entry lineThe caveat is still emitted after the second flavour, and the veto below still withholds on it, because dispatch does not tell the two apart (
test_no_match_message_quotes_a_tree_that_raised_then_answered, from a commit below, says so in as many words), and a report that called clean a rejection dispatch refused to act on would contradict the veto it explains; so the clause states what a raise can have cost, and the entry line's(through the guard tree's pybind boundary)is where a reader tells which flavour this one was.The clause is a constant,
_STALE_AFTER_THROW, so that it sits beside the comment explaining that hedge rather than inside the f-string that appends it, and so that the commit above can rewrite the caveat around it without touching it. Nothing else shares it: the class docstring states the same fact of an actual throw, unhedged, in its own prose, and the warning_warn_swallowedlogs states the defect in its own words and is untouched here -- a caller on the report path never sees that warning anyway, since it runs only when dispatch served something and a report is built only when nothing was, so the report is the only place such a caller learns this. The constant is phraseda C++ throw out of a tree can leave that tree'srather than the docstring'sout of it leaves its relational guard state stalebecause the caveat's own sentence names no tree, soitwould have no antecedent in it.What the caveat keys on
The caveat keys on what dispatch recorded, not on the lines the report printed: the re-check is a third evaluation, and where it raises instead of rejecting --
test_no_match_message_qualifies_the_advice_when_the_re_check_raises-- or accepts -- the shape of #196826'stest_no_match_report_reads_the_dispatch_record_after_a_raise-- the report quotes no rejection, but theModelInputline still stands on the one dispatch got, so the caveat is emitted whatever the entry line reads.It is emitted with an opted-out entry on the report too, and after the error-set flavour of raise:
test_no_match_message_quotes_a_tree_that_raised_then_answeredputsRaisesThenHits(raises=1)on a checked [0] beside an opted-out [1], and its withheld line says only why the opt-out was withheld.One trusted rejection is enough to leave the advice unqualified, even beside a rejection that followed a raise:
trusted_rejectionis anany, pinned bytest_no_match_message_trusts_one_rejection_taken_before_a_raise, where [0] rejected then raised and [1] raised then rejected:Requiring every enabled entry in
answeredto be intrustedinstead fails only that test. Droppingtrusted_rejectionfrom the caveat gate fails it,test_no_match_message_survives_a_raising_guardandtest_no_match_message_advises_an_input_after_an_answer_then_a_raiseon the caveat appearing. The gate's other term iscoverable, which is what keeps the caveat off a report about an artifact with no inputs at all, where the advice is printed by thenot resultsdisjunct beside it and no rejection exists to have followed anything:test_no_match_report_claims_no_raise_for_an_artifact_with_no_inputsnow also asserts the caveat's absence, and droppingcoverablefrom the inner gate fails that test alone.trustedrecorded without theraisedchecktrusted_rejectionmade anallover the enabled entries ofansweredtest_no_match_message_trusts_one_rejection_taken_before_a_raiseonlytrusted_rejectiondropped from the caveat gate..._trusts_one_rejection_taken_before_a_raise,test_no_match_message_survives_a_raising_guard,test_no_match_message_advises_an_input_after_an_answer_then_a_raise, on the caveat appearingcoverabledropped from the inner gatetest_no_match_report_claims_no_raise_for_an_artifact_with_no_inputsonlyThe one real throw:
test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throwThe one flavour the clause is a fact about has a test on a real tree.
PairModule(forward(self, x, y), so Dynamo installsNO_TENSOR_ALIASINGover both) is compiled on two dense tensors and called with a strided nested tensor asy.TENSOR_MATCHon it fires aTORCH_CHECK(NestedTensorImpl doesn't support strides), pybind translates the throw into a plainRuntimeErrorwith no__cause__, and the throw skips the reset, so the scan leavesxrecorded in the aliasing guard; the second pass visits x's manager first, finds the duplicate and rejects there, before reaching the leaf that threw; that clean return resets the state; and the report's re-check quotes y's dispatch-key mismatch rather than a raise. Measured on that tree directly, which the test also pins:check()throws, and thecheck_verbose()right after it answersDuplicate tensor found where not expected!. The report carries one entry line namingL['y']and no raise line, the raiser line, and theModelInputadvice ending in the caveat; the__cause__is the strides error with nothing chained behind it.The two probes of the tree run AFTER the dispatch under test, so that dispatch ran on a tree the test had not touched; the residue they pin is the same on the tree dispatch and the report have been through, since a
check()after a throw still fails on x as a duplicate. The test's comment names the two orderings the shape rests on besides the skipped reset: root accessors stay inGuard.sort_keyorder,L['x']beforeL['y'], because the throw leavescheck_accessors_nopybindbefore its fail-count bump and sort; andTensorCheck::check_verbosecompares dispatch key sets before it reads strides, which is why the re-check namesL['y']instead of throwing a second time. Every other test that asserts the caveat drives it with a stub whosecheck()raises from Python and touches no relational state, and the only other real throw in the suite (test_aot_compile_module_restores_torch_function_after_a_throw, one tensor) raises on every pass, reaches no answer, and so gets noModelInputadvice to qualify.What does not change
Against the commit below, nothing served or raised changes: the same calls raise the same
RuntimeErrorwith the same__cause__, and the dispatch passes, the veto, the warning_warn_swallowedlogs, every entry line and the gates on the report's closing lines are untouched. Only theModelInputparagraph differs: it carries the caveat sentence when every rejection it stands on came after a raise from its own tree.Stubs and the golden
The stubs that drive the caveat are two module-scope classes next to
NeverReChecked, each taking its raise message:RaisesOnceThenRejects(raises on the firstcheck(), rejects after, quotes a rejection incheck_verbose) andRejectsOnceThenRaises(the mirror, onNeverReCheckedsince its last evaluation raised). Each replaces a local copy from the commits below --RaisesThenRejectsintest_no_match_message_advises_an_input_when_one_of_two_raisers_answered, whose entry line now reads the shared stub'sstub guard rejected, andRejectsThenRaisesintest_no_match_message_advises_an_input_after_an_answer_then_a_raise-- and the one local stub of the first shape,RaisesThenRejectsThenRaisesin the new re-check test, subclassesRaisesOnceThenRejectsand overrides onlycheck_verbose, which is the one thing that differs. The one same-named local stub left, intest_no_match_report_reads_the_dispatch_record_after_a_raise, is not collapsible: itscheck_verboseaccepts, and theRaisesTwicebeside it inherits that. Everycheckscount the tests assert is unchanged. The caveat's text is one golden,CAVEAT_AFTER_A_RAISE, which starts in the advice's own last clause and runs through the caveat, so the two tests that assert it withendswithpin the junction of the two rather than the caveat alone.Tests
Four tests are new, and tests of the commits below gain an assertion about the caveat for their case. The ones that assert the caveat is present fail on the commit below's
aot_compile.py:test_no_match_message_qualifies_the_advice_when_the_re_check_raisestest_no_match_message_qualifies_a_rejection_that_followed_a_raisetest_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throwtest_no_match_message_quotes_a_tree_that_raised_then_answeredtest_no_match_message_advises_an_input_when_one_of_two_raisers_answeredThe rest pass there because the parent's
ModelInputline has no caveat to find; each is a pin here by a mutation named above.Order to review
_STALE_AFTER_THROWand the comment on why it is hedged;trustedand its update inaccepts(); the report'strusted_rejection; the caveat appended to theModelInputadvice at the end of_no_match_report; the sentence of theAOTCompiledModeldocstring that describes the report's closing lines, and the two texts -- its last sentence and the comment on the report'sunansweredbranch -- that said what this caveat would carry; then, in the test file, the two stubs next toNeverReCheckedand the one that subclasses one of them,PairModule,CAVEAT_AFTER_A_RAISE,test_no_match_message_qualifies_a_rejection_that_followed_a_raise,test_no_match_message_qualifies_a_rejection_that_followed_a_cpp_throw,test_no_match_message_trusts_one_rejection_taken_before_a_raiseandtest_no_match_message_qualifies_the_advice_when_the_re_check_raises.Test Plan:
The caveat tests were also run against the commit below's
torch/_dynamo/aot_compile.py, and each gate was then mutated on its own --trusted_rejectiondropped from the caveat gate,coverabledropped fromit,
trusted_rejectionmade anallover the enabled entries ofanswered,trusted_rejectionmade a literalallovertrusted,trustedrecordedwithout the
raisedcheck -- and those tests rerun; only the tests namedabove failed under each.
Authored with the assistance of Claude Code.
FAQ
Co-Authored-By: Claude Fable 5.1 [email protected]
🤖 Generated with Claude Code
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98