Allocation results in unnecessary moves around destructive operations
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start with the three cases in the regalloc2-repro repository, then compare their output with the reported fib.asm and fib.vcode files from the linked botlish audit. Trace the allocation around the destructive operations and verify that the unnecessary moves into r13 are reduced without regressing the repro cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am implementing a Cranelift-based compiler stack for a new programming language where one design objective is efficient machine code. This is why early in development I am doing audits on the generated code to find out which inefficiencies are caused by the mid-end, which by the backend and which by missing language features.
In the asm dump of my fibonacci benchmark I saw this:
177: mov rsi,r13
17a: mov r14,rax
17d: sub rsi,0x2
181: mov r13,rsi
184: shl rsi,1
187: mov r13,rsi
18a: or rsi,0x1
18e: mov r13,rsi
191: mov QWORD PTR [rbx+0x8],rsi
rsi is moved repeatedly into r13 for no discernible reason, then the content of rsi is moved into memory. r13 is later overwritten. So r13 was completely useless here.
The entire ASM is available in https://github.com/mwagner-webdev/botlish/blob/9cb689a/audit/native-scalar-asm/bench/fib.asm
This code was generated via Cranelift from this CLIF: https://github.com/mwagner-webdev/botlish/blob/9cb689a/audit/native-scalar-asm/bench/fib.vcode
I have a minimal repro here with three cases that illustrate the issue: https://github.com/mwagner-webdev/regalloc2-repro
I have zero experience with the workings of register allocators and it's all pretty fascinating. Obviously perfect allocation is impossible, but this looks like a clear-cut pathological case for which some heuristic may be found.
- Lingua principale
- Rust
- Stelle
- 266
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bytecodealliance/regalloc2
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
bytecodealliance/regalloc2#247 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
bytecodealliance/regalloc2#222 · 4 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
bytecodealliance/regalloc2#206 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
bytecodealliance/regalloc2#194 · 7 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
bytecodealliance/regalloc2#191 · 3 commenti ·
Tutte le issue di bytecodealliance/regalloc2
Issue simili
-
Browser (wasm) relay client cannot connect to relays whose URL has a trailing-dot FQDN hostname Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
n0-computer/iroh#4550 ·
-
impl detach for native Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
paritytech/zombienet-sdk#591 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
farion1231/cc-switch#7638 · 1 commento ·
-
onnx-ir re-exports ModelProto and GraphProto but not NodeProto, AttributeProto and AttributeType Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100