Commit 4c52213
fix: use topological ordering in FX graph cleanup to fix erase_node crash (Granite4 GPTQ) (#2426)
## SUMMARY:
Fix the FX tracing crash reported as the second error in #2338. The BFS
cleanup of concrete args did not maintain topological ordering — if a
node was visited multiple times, its position in the deletion dict was
not updated, causing dependents to be deleted before their dependencies
(`RuntimeError: Tried to erase Node getitem_169`).
The fix uses `move_to_end` in the BFS traversal so that revisited nodes
are moved to the end of the deletion dict, ensuring topological order.
Companion to #2425 (shape fix) and compressed-tensors #609 (3D
pack/unpack). Together they resolve #2338.
## TEST PLAN:
Tested on Granite 4.0-h-small with a single layer, using all three fixes
(#2425, #2426, compressed-tensors #609).
Script based on `test_gptq_no_exclusion.py` from #2338 with
`model.model.layers = model.model.layers[:1]` added after model loading.
Command: `python test_gptq_no_exclusion.py --model-name
ibm-granite/granite-4.0-h-small --output /workspace/test-output
--calibration-samples 16`
Results:
- FX tracing completed — no `erase_node` crash
- 3D→2D conversion OK
- Cache preparation OK (16/16 samples)
- Calibration started but hit OOM on the Mamba layer (unrelated to the
fix — naive Mamba path without `causal_conv1d` on a 31GB GPU)
Signed-off-by: gillesturpin <turpingilles@orange.fr>
Co-authored-by: HDCharles <39544797+HDCharles@users.noreply.github.com>1 parent 7461d02 commit 4c52213
File tree
1 file changed
+2
-0
lines changed- src/llmcompressor/pipelines/sequential
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
| 1481 | + | |
| 1482 | + | |
1481 | 1483 | | |
1482 | 1484 | | |
1483 | 1485 | | |
| |||
0 commit comments