Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Is support for 16bit Floating point planned/in scope?

Offen
#95 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Rust
Sterne
3.4k
Forks
126
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/1003
Old labels: t: enhancement
Originally creatd by duplexsystem on 2023-03-15T16:50:07Z 👍: 2


16bit Floating point support has been a feature of GPUs since Nvidia's Pascal, AMD's RDNA2, and Adreno GPUs starting at some point (couldn't find out when). Copied from this WebGPU suggestion (because it's a good summary) fp16 provide the following, quite large benefits over fp32:

  • It uses half the memory size (of course). This is particularly important on mobile devices where available memory is limited. Specifically, one of the most common / strongest request the Metal team gets from 3rd parties is for features which can help decrease their memory use.
  • Because it uses half the size, memory bandwidth is more effectively used.
  • Even without the bandwidth increase, devices often have increased ALU performance for half-precision operations.
  • Power consumption is decreased on some devices, leading to better battery life.

In addition fp16 support has been a, optional, core feature since Vulkan 1.2, see VK_KHR_shader_float16_int8.

Sadly rust currently does not have an fp16 type, however there are crates such as half which emulate fp16 and optionally compile down to native types/intrinsics when possible. However possibly other than directly writing inline SPIR-V, and even that may cause unintended side effects as to my knowledge rust-gpu was not written with fp16 support in mind, rust-gpu does not support fp16. Given glam also does not support fp16 ecosystem integration would not be trivial. However the performance gain and flexibility of allowing fp16 are quite large and fp16 would expand the amount of shaders that could be ported to rust in a performant way (see FSR 1.0, FSR 2.0, and NIS among others).

All that to preface: Is support for 16bit Floating point planned/in scope for rust-gpu, be that directly support or just exposing intrinsics and supporting 16bit storage?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Der Issue nennt keine Repository-Dateien, Tests oder Einstiegspunkte; beginne damit, die vorhandene Unterstützung für Typen und SPIR-V in rust-gpu zu lokalisieren und die verlinkte Vulkan-Erweiterung sowie half crate zu prüfen. Als erledigt würde eine von einem Maintainer genehmigte Abgrenzung für native fp16-Unterstützung, Intrinsics oder 16-Bit-Speicherung gelten, zusammen mit der entsprechenden Implementierungs- und Validierungsarbeit.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
compilers, computer-graphics
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.