JIT: Interprocedural analysis for out parameters
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 12/100
Direzione di ricerca
This is open-ended JIT design work: the body asks whether to compile specialized versions of methods with out parameters or to strengthen the inliner, and names no file. Start by reading the linked PR 138016 to see the local-variable rewrite it used, and the JIT inliner sources under src/coreclr/jit. Done means a design agreed with the JIT maintainers (@jkotas, @dotnet/jit-contrib), not a patch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
It seems that in the vast majority of calls with out parameters, callers declare the corresponding arguments inline:
void Foo(..., out int written)
{
...
written++;
...
written++;
}
// typical usage
Foo(..., out int written);
Knowing that an out argument is on the stack and is not aliased can help the JIT generate better code. For example, https://github.com/dotnet/runtime/pull/138016 made one benchmark nearly 2.5x faster by updating a local variable instead of modifying the out argument directly.
Suggestion
Could we compile two versions of each method with out parameters: a default version and a specialized version that uses this hint? The JIT could then choose the appropriate version at each call site. The ReJIT concern still applies, but is there anything else I'm missing?
Alternatively, we can boost the inliner additionally.
cc @jkotas @dotnet/jit-contrib
Data
Roslyn syntax scan over the product code in src/libraries and src/coreclr/System.Private.CoreLib, excluding tests and ref folders (12,463 files, 15,780 out arguments at call sites):
out argument kind |
Share |
|---|---|
inline decl (out var x / out T x) |
37.4% |
| pre-declared local | 26.6% |
forwarded out param (TryX -> TryXCore) |
23.4% |
discard (out _ / out var _) |
7.2% |
field / this.x / arr[i] / *p / ref param / other |
5.4% |
Inline declarations are about 37%. All non-aliased stack locals (inline + pre-declared + discard) add up to about 71%.
- Lingua principale
- C#
- Stelle
- 18.5k
- Fork
- 5.8k
- Merge medio
- 2g 18h
- PR unite (30g)
- 588
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 dotnet/runtime
-
area-CodeGen-coreclr untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dotnet/runtime#138181 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-System.Collections untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
dotnet/runtime#138090 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-System.Text.Json untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dotnet/runtime#138089 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-Setup untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
dotnet/runtime#137376 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area-System.Memory untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
dotnet/runtime#137334 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di dotnet/runtime
Issue simili
-
Add `net10.0`Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
dotnet-outdated/dotnet-outdated#871 ·
I maintainer di solito rispondono entro 1 giorno
-
triage/untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
unoplatform/uno#26676 ·
I maintainer di solito rispondono entro 1 giorno
-
.NET bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
[问题] 导出文件时,提示后面还有1243390911步Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
jhaizhou-ops/S2Arm#2177 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno