aes: SIMD-acceleration for WASM
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- rust, wasm
- Ambito
- cryptography, performance
Direzione di ricerca
Inizia esaminando il commit di implementazione collegato e il percorso WASM AES fixslice64 esistente, quindi riproduci le misurazioni riportate con wasm-harness. Il lavoro è completato quando è disponibile un’implementazione SIMD adatta al merge upstream con copertura dei benchmark e una decisione documentata riguardo all’abilitazione di SIMD per impostazione predefinita o dietro un flag, inclusa la regressione di decrittografia di Wasmtime.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
WASM targets currently use the software fixslice implementation which processes up to 4 blocks at a time (fixslice64). WebAssembly has had the simd128 proposal stabilized in the spec for a while now, and the corresponding intrinsics ([core::arch::wasm32::*]) have been stable in Rust since 1.33. Every major WebAssembly runtime ships simd128 support today.
We use AES extensively in our projects which target running in browsers, the throughput of AES in WASM is a major performance lever for us. Translating the existing fixslice64 implementation (AI assisted, not sure what your policy is on that) to use 128 bit lanes yields the expected >2x throughput increase in V8 (chromium), and >3x in SpiderMonkey (firefox).
(AMD Ryzen 7 5800X)
| Unit: MB/s | wasmtime soft | wasmtime simd128 | wasmtime relative | v8 soft | v8 simd128 | v8 relative | sm soft | sm simd128 | sm relative |
|---|---|---|---|---|---|---|---|---|---|
| AES-128 enc | 186 | 184 | 0.99× | 258 | 604 | 2.34× | 213 | 657 | 3.08× |
| AES-128 dec | 185 | 122 | 0.66× | 235 | 508 | 2.16× | 182 | 598 | 3.29× |
| AES-192 enc | 159 | 150 | 0.94× | 224 | 522 | 2.33× | 185 | 588 | 3.18× |
| AES-192 dec | 159 | 100 | 0.63× | 202 | 486 | 2.41× | 153 | 577 | 3.77× |
| AES-256 enc | 138 | 140 | 1.01× | 192 | 455 | 2.37× | 159 | 491 | 3.09× |
| AES-256 dec | 135 | 89 | 0.66× | 171 | 424 | 2.48× | 134 | 453 | 3.38× |
As you can see, this causes a regression in Wasmtime decrypt performance due to bad JIT by Cranelift. I haven't been able to mitigate that without incurring significant throughput loss in the browser runtimes. I'm not sure whether the right approach is to eat the regression by default, or to put the SIMD behind a flag.
Can reproduce the benchmarks using wasm-harness
Would love to upstream this if possible. If so, I will open a PR.
- Lingua principale
- Rust
- Stelle
- 784
- Fork
- 157
- Merge medio
- 1g 1h
- PR unite (30g)
- 5
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 RustCrypto/block-ciphers
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
RustCrypto/block-ciphers#589 · 3 commenti ·
-
aes
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
RustCrypto/block-ciphers#548 · 1 commento ·
-
SVE AES on aarch64Apertaaes
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
RustCrypto/block-ciphers#485 · 7 commenti ·
-
Add const time column to the algorithms table and mention const time properties in each crate READMEAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
RustCrypto/block-ciphers#480 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
RustCrypto/block-ciphers#459 · 7 commenti ·
Tutte le issue di RustCrypto/block-ciphers
Issue simili
-
`sysknife history --help` says --since takes ISO-8601, and the parser refuses offsets and bare datesApertabug easy good first issue help wanted
Difficoltà 1/5 1-3 ore Idoneità per principianti 94/100
lacs-project/sysknife#519 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
-
area:breg bug criticality:p3 triage:needs-implementation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
registrystack/registry-stack#1699 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 1/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
lbjlaq/Antigravity-Manager#3539 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno