docs: `libm::expf` on device is libdevice, not the host libm — say so where bit-comparability matters
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 82/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- documentation
Direzione di ricerca
Trova l'esempio libm_math e il punto in cui è già spiegato che le chiamate a libm::{expf, sinf, ...} vengono intercettate e abbassate a intrinsic di libdevice, oltre al capitolo di matematica del libro che ripete lo stesso materiale. Leggi prima la formulazione esistente, poi aggiungi l'avvertenza richiesta: libm::* lato device è libdevice, non la libm dell'host, e corrisponde entro ulps anziché in modo bit-exact, quindi un'implementazione correttamente arrotondata non sostituisce l'algoritmo dell'host. Fatto significa che la frase compare in entrambi i punti e che i docs/il libro continuano a compilare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The libm_math example states (correctly) that device libm::{expf, sinf, ...} calls are intercepted and lowered to the matching
libdevice intrinsic (__nv_expf, ...). What is not stated anywhere is that this makes them a different function from the
host's expf, which matters to anyone whose output has to be bit-identical to the host's.
Measured (downstream, not upstream)
In Craton, comparing a device-computed scale 2 / (1 + exp(-z)) against the host's expf (glibc 2.44) on 320 arguments that
occur in a real model:
| device form | bit-identical to the host |
|---|---|
f32 exp |
243 / 320 (max 2 ulp) |
f64 intermediate, one rounding |
226 / 320 (max 2 ulp) |
A more accurate computation matched libm worse, because glibc's expf is not correctly rounded either. Matching it required
transcribing sysdeps/ieee754/flt-32/e_expf.c (32-entry table + a cubic evaluated in f64), which then matched 320 / 320.
Ask
One sentence in the libm_math example (and in the book's math material): libm::* on the device is libdevice, not the host's
libm; do not use it where bit-for-bit agreement with the host is required — and note that a correctly rounded implementation is not
a substitute for matching the host's algorithm.
Environment
348895e4, CUDA toolkit 13.4 (V13.4.92), driver 615.78.08, NVIDIA RTX PRO 4500 Blackwell (compute capability 12.0, sm_120),
host x86_64 Linux with glibc 2.44.
- Lingua principale
- Rust
- Stelle
- 4.1k
- Fork
- 377
- Merge medio
- 3g 2h
- PR unite (30g)
- 103
Preparare l'ambiente
- 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 NVIDIA/cuda-rust
-
cuTile: Tile::shape() fails during compilation to Tile IRForse già presa @dzheltkov l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 2 giorni
-
paper: launch_overhead_rust pins tokio 1.53.0 and patches crates to a local pathForse già presa @elibol l’ha presa 7 giorni fa. Apertacutile-rs supply-chain
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
NVIDIA/cuda-rust#1622 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
already-fixed bug cutile-rs
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
NVIDIA/cuda-rust#1568 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
[BUG]: The doc of trait `LoadTileLike` is incorrectForse già presa @mangeshraut712 l’ha presa 25 giorni fa. Apertabug cutile-rs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
NVIDIA/cuda-rust#1523 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di NVIDIA/cuda-rust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
swc-project/swc-next-issues#533 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
nautechsystems/nautilus_trader#5718 ·
I maintainer di solito rispondono entro 1 giorno
-
`luvus --remote` cannot start on a host whose login shell is NushellForse già presa @schlich l’ha presa oggi. Apertastatus: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
NomicFoundation/slang#2391 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 5 giorni