bug: f16 writes always fail in the compiled writer on engines without DataView.setFloat16 (React Native / Hermes)
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- backend, performance
調査の方向性
f16の書き込みがDataView.setFloat16を呼び出すcompiledIO.tsから始め、既存のtoHalfBits変換についてnumeric.tsを確認してください。コンパイル済みwriterのバイト出力を、fallback writerおよび利用可能な場合はネイティブのsetFloat16と比較してください。setFloat16なしで書き込みが成功し、一致するバイトを生成し、fallbackの警告を回避できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 3.4k
- フォーク
- 151
- 平均マージ
- 3日 8時間
- マージ済み PR(30日)
- 55
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
software-mansion/TypeGPU のほかの issue
-
fix(unplugin-typegpu): `getLang()` misidentifies file extensions when a query contains a dot再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
software-mansion/TypeGPU#3433 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
fix(unplugin-typegpu): Return `undefined` from TypeGPU’s Bun `onLoad` when no transform is neededオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
software-mansion/TypeGPU#3429 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
chore(unplugin-typegpu): Inconsistent warning prefixes across entry points対応中かも @dchaudhari7177 が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
software-mansion/TypeGPU#3418 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
docs: Remove popups from examples対応中かも @aleksanderkatan が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
software-mansion/TypeGPU#3327 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
software-mansion/TypeGPU#3320 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
software-mansion/TypeGPU の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ehmpathy/rhachet-roles-bhrain#878 ·
メンテナーはふだん 1 日以内に返信
-
Chat UI: Message actions dropdown is cut off beneath composer when message is near bottom of chat対応中かも @koeria が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
milind-soni/OpenMausBot#8023 ·
メンテナーはふだん 1 日以内に返信
-
Windows microphone listing treats words in a device name as DirectShow labels対応中かも @Sujal-chaudhary が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
clipy-recorder/clipy#447 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement from-app needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
nightly-labs/openbot#19162 ·
メンテナーはふだん 1 日以内に返信
-
triage:in-progress
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Cotal-AI/Cotal#11229 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信