bug: f16 writes always fail in the compiled writer on engines without DataView.setFloat16 (React Native / Hermes)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Bắt đầu trong compiledIO.ts, nơi các lệnh ghi f16 gọi DataView.setFloat16, và đọc numeric.ts để xem phép chuyển đổi toHalfBits hiện có. Kiểm tra đầu ra byte của writer đã biên dịch so với writer dự phòng và setFloat16 gốc khi có sẵn. Hoàn thành khi các lần ghi thành công mà không cần setFloat16, tạo ra các byte khớp nhau và tránh cảnh báo dự phòng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.4k
- Fork
- 151
- Merge trung bình
- 3 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 55
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của software-mansion/TypeGPU
-
fix(unplugin-typegpu): `getLang()` misidentifies file extensions when a query contains a dotCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
software-mansion/TypeGPU#3433 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(unplugin-typegpu): Return `undefined` from TypeGPU’s Bun `onLoad` when no transform is neededĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
software-mansion/TypeGPU#3429 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore(unplugin-typegpu): Inconsistent warning prefixes across entry pointsCó thể đã có người làm @dchaudhari7177 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
software-mansion/TypeGPU#3418 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: Remove popups from examplesCó thể đã có người làm @aleksanderkatan đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
software-mansion/TypeGPU#3327 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: Mnist on small phonesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
software-mansion/TypeGPU#3320 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của software-mansion/TypeGPU
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ehmpathy/rhachet-roles-bhrain#878 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Chat UI: Message actions dropdown is cut off beneath composer when message is near bottom of chatCó thể đã có người làm @koeria đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
milind-soni/OpenMausBot#8023 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows microphone listing treats words in a device name as DirectShow labelsCó thể đã có người làm @Sujal-chaudhary đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
clipy-recorder/clipy#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement from-app needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
nightly-labs/openbot#19162 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triage:in-progress
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Cotal-AI/Cotal#11229 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày