bug: f16 writes always fail in the compiled writer on engines without DataView.setFloat16 (React Native / Hermes)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- backend, performance
Línea de trabajo
Empieza en compiledIO.ts, donde las escrituras de f16 llaman a DataView.setFloat16, y lee numeric.ts para ver la conversión existente toHalfBits. Comprueba que la salida de bytes del escritor compilado coincide con la del escritor de reserva y con setFloat16 nativo cuando esté disponible. Se considera terminado cuando las escrituras se realizan correctamente sin setFloat16, producen los mismos bytes y evitan la advertencia del escritor de reserva.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
On engines without DataView.prototype.setFloat16 (Hermes in React Native; also Node 22 and older browsers), every write of data that contains f16 throws inside the compiled writer. TypeGPU then falls back to the slow writer and logs a "this is likely a bug" warning on every call.
Repro
Node 24, with setFloat16 removed to mimic Hermes:
import { d } from 'typegpu';
import { writeToArrayBuffer } from './src/data/dataIO.ts';
delete (DataView.prototype as any).setFloat16;
const schema = d.arrayOf(d.f16, 100_000);
const data = Array.from({ length: 100_000 }, (_, i) => i * 0.001);
writeToArrayBuffer(new ArrayBuffer(d.sizeOf(schema)), schema, data);
Output, repeated on every write:
⚠️ [fallback] Error when using compiled writer for data type 'array' (unnamed) - this is likely a bug, please submit an issue at https://github.com/software-mansion/TypeGPU/issues
Using fallback writer instead. TypeError: output.setFloat16 is not a function
Impact
- Node 24,
arrayOf(f16, 100k): ~0.12 ms with nativesetFloat16vs ~1.75 ms without it, plus one warning per write. - iPhone (react-native-webgpu 0.22, Hermes),
mnist-inferenceexample: uploading the weights takes 320 ms; with the fix below it takes 155 ms. - #3383 adds
mat*hschemas that go through the samesetFloat16path, so they would be affected too.
Cause
compiledIO.ts maps f16 to setFloat16 without checking that the method exists. The writer is built fine and throws only at write time, so the failure repeats on every call.
Possible fix
Feature-detect once. When setFloat16 is missing, emit:
output.setUint16(offset, toHalfBits(v), littleEndian);
toHalfBits already exists in numeric.ts. Optionally, add a one-loop fast path for arrayOf(f16).
I have a local version with tests (bytes match both the fallback writer and native setFloat16) if that helps.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.4k
- Forks
- 151
- Merge medio
- 3 d 8 h
- PR fusionados (30 d)
- 55
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de software-mansion/TypeGPU
-
fix(unplugin-typegpu): `getLang()` misidentifies file extensions when a query contains a dotQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
software-mansion/TypeGPU#3433 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
fix(unplugin-typegpu): Return `undefined` from TypeGPU’s Bun `onLoad` when no transform is neededAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
software-mansion/TypeGPU#3429 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
chore(unplugin-typegpu): Inconsistent warning prefixes across entry pointsPosiblemente ocupada @dchaudhari7177 la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
software-mansion/TypeGPU#3418 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
docs: Remove popups from examplesPosiblemente ocupada @aleksanderkatan la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
software-mansion/TypeGPU#3327 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
docs: Mnist on small phonesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
software-mansion/TypeGPU#3320 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de software-mansion/TypeGPU
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ehmpathy/rhachet-roles-bhrain#878 ·
Los mantenedores suelen responder en 1 día
-
Chat UI: Message actions dropdown is cut off beneath composer when message is near bottom of chatPosiblemente ocupada @koeria la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
milind-soni/OpenMausBot#8023 ·
Los mantenedores suelen responder en 1 día
-
Windows microphone listing treats words in a device name as DirectShow labelsPosiblemente ocupada @Sujal-chaudhary la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
clipy-recorder/clipy#447 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
enhancement from-app needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
nightly-labs/openbot#19162 ·
Los mantenedores suelen responder en 1 día
-
triage:in-progress
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Cotal-AI/Cotal#11229 · 1 comentario ·
Los mantenedores suelen responder en 1 día