Repository navigation
Commit ca541f7
authored
[transform_ext] Avoid stale op handles in prepare_subgraphs (#323)
`_prepare` iterates over a snapshot of `block.operations`, but
`_fold_gemm_cast_reshape` erases some of those ops (the
`tensor.expand_shape` and the cast), so the loop then reads erased ops
through stale Python handles. On macOS this segfaults
`test/transform/test_subgraph_tiling.py` and five
`examples/xegpu/llama-bench_1B_*` tests. On Linux it happens to work
because the freed memory still holds the old ops. To reproduce it on
Linux, make glibc overwrite freed memory.
```
GLIBC_TUNABLES=glibc.malloc.perturb=11:glibc.malloc.tcache_count=0 python test/transform/test_subgraph_tiling.py
```
Collect the matmuls before folding instead.
Part of #269.1 parent 6164aaf commit ca541f7
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
0 commit comments