Support different ops at same call site with compile=True#6378
Support different ops at same call site with compile=True#6378rostan-t wants to merge 2 commits into
Conversation
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
|
| Filename | Overview |
|---|---|
| dali/python/nvidia/dali/experimental/dynamic/_compile.py | Core fix: _CallTrie nodes dict keyed by op type; op_class threaded through find/lookup/insert and get_compiled_result; device added to record match check; walrus replaced with explicit is-not-None guard. Logic is correct. |
| dali/test/python/experimental_mode/test_compile.py | New test correctly covers the multi-op same-call-site scenario with reference comparison against dynamic results over 3 compiled epochs; zip(strict=True) applied throughout. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[op call enters _compile_intercept] --> B{compile_ctx present?}
B -- No --> C[Dynamic fn_call]
B -- Yes --> D{State?}
D -- COMPILED --> E[get_compiled_result\nframe, op_class, inputs, kwargs]
E --> F{_call_trie.lookup\nframe, op_class}
F -- None --> G[Dynamic fn_call fallback]
F -- node found --> H{inputs/kwargs/device match?}
H -- No --> G
H -- Yes --> I[Return _pipeline_results node]
D -- TRACING --> J[fn_call dynamic]
J --> K[classify call site]
K --> L[record\ncall_chain, op_class, backend, inputs, kwargs]
L --> M{_call_trie.find\ncall_chain, op_class}
M -- None --> N[Create new CompileNode\ninsert into trie + nodes list]
M -- existing found --> O{inputs == existing.inputs\nAND kwargs match\nAND device match?}
O -- Yes --> P[Return existing node]
O -- No --> Q[Return None\nno CompiledBatch]
N --> R[Wrap result in CompiledBatch]
P --> R
Reviews (2): Last reviewed commit: "Use strict=True in zip for test result c..." | Re-trigger Greptile
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Category:
Bug fix (non-breaking change which fixes an issue)
Description:
Currently, with transparent pipelining, the following patterns is silently incorrect:
When a call site is reached multiple times during capture, we check if the arguments differ. If they don't, we return the already registered nodes. This fails because the operator itself isn't check.
This PR allows the call trie to track multiple operators on the same call site.
Additional information:
Affected modules and functionalities:
Transparent pipelining
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A