Commit 32fc887
authored
Emit override-redirected functions in deterministic order (#137)
## Problem
`Redirector::into_module` topologically sorts functions so dependents
are emitted before their callers, but it drives the emission order by
iterating a `HashMap`. That order is valid but arbitrary and reseeds
every process, so a module that uses a function `override` (the
redirector only runs when an override is present) composes to
**byte-different output on every run**. This breaks gpu-driver shader
caching.
## Fix
Use an `IndexMap` so the `retain()` loop visits functions in the
deterministic source-arena order; same-level functions then emit in a
stable order. Behaviour is otherwise unchanged, this path is only
reachable when a function override exists, and `indexmap` is already a
dependency.1 parent 5119786 commit 32fc887
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
186 | | - | |
187 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| |||
0 commit comments