Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

GC and on-stack equivalents of f32.load_f16 and f32.store_f16

Aperta
#10 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
wasm
Ambito
compilers

Direzione di ricerca

Iniziare con le operazioni on-stack proposte e il tipo di storage f16 alternativo descritti nell’issue; confrontarne le implicazioni per WasmGC, la memoria lineare e le istruzioni struct/array esistenti. Il lavoro è completo quando la proposta ha un design definito per le istruzioni o il tipo di storage richiesti e il comportamento corrispondente è specificato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Outside of the SIMD operations, the proposal includes two opcodes to read and write f32s to the linear memory as f16s. Languages that compile to WasmGC typically don't even allocate a memory at all. It would be quite inconvenient to allocate a 2-byte memory and read-write through it in order to manipulate f16 bits.

I propose to add at least an on-stack equivalent to these instructions, which is similar to the pairs f32.reinterpret_i32 f64.promote_f32 and f32.demote_f64 i32.reinterpret_f32:

  • f32.promote_f16_reinterpret_i32: [i32] -> [f32]
    extracts the 16 low-order bits of the input, reinterpret them as an f16, and promote that f16 value an f32.

  • i32.reinterpret_f16_demote_f32: [f32] -> [i32]
    demotes the input f32 into an f16, reinterpret it as an i16, and zero-extend it to an i32

One could argue that the above are the fundamental operations, and that the memory operations could be expressed in terms of them + i16 memory operations.

If not, then I propose we also bring WasmGC on par with the linear memory with appropriate struct. and array. operations:

  • struct.get_promote x y: [(ref null x)] -> [f32]: loads an i16 field, reinterpret as f16 and promote to f32
  • struct.set_demote x y: [(ref null x) f32] -> []: demotes to an f16, reinterpret as i16 and stores
  • Similarly for array.get_promote and array.set_demote.

Edit: alternative for WasmGC: just introduce f16 as a storagetype, but not as a full valtype (like i16). Then we can use the existing struct.get, struct.set, etc. instructions. This is probably a lot simpler.

Lingua principale
WebAssembly
Stelle
14
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WebAssembly/half-precision

Tutte le issue di WebAssembly/half-precision

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.