FP16 Hardware Feature Detection
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- wasm
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
Start with the linked Lowering.md and compare the three host-detection options and open questions in this issue. The issue does not identify proposal files, tests, or a settled design; first determine the intended interface and how it fits WebAssembly semantics. Done means an agreed, specified way to report FP16 support tiers, including forward compatibility and the stated stability and privacy constraints.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Motivation
Host CPUs fall into three tiers of FP16 hardware support (see Lowering.md):
| Tier | Hardware support | Examples |
|---|---|---|
| 0 | None. All FP16 ops are emulated in software | x86 without F16C (e.g. Jasper Lake), RISC-V without Zfhmin/Zvfhmin, interpreters |
| 1 | f16 <-> f32 conversions only. Other f16x8 ops lower via wider floats or software |
Client x86-64 with F16C (AMD Zen 1–5, Intel Core through Arrow/Lunar Lake), AArch64 (ARMv8.0-A), RISC-V Zfhmin+Zvfhmin |
| 2 | Native f16x8 SIMD |
ARMv8.2+ FEAT_FP16, server x86 AVX512-FP16+VL / AVX10, RISC-V Zvfh |
"Conversions" means f32.load_f16, f32.store_f16, f32x4.promote_low_f16x8, f16x8.demote_f32x4_zero, and f16x8.{splat,extract_lane,replace_lane} (which convert lanes to/from f32).
Every engine supporting FP16 validates all instructions on all three tiers, so a single .wasm binary runs everywhere and can bundle both f16x8 and f32x4 code paths. Because everything validates, WebAssembly.validate only reports engine support, not whether the host CPU accelerates FP16.
Libraries such as XNNPACK need the hardware tier to pick the right kernel:
- Tier 2: compute directly in
f16x8. - Tier 1: store weights in
f16(halving memory bandwidth), promote on load, and compute inf32x4. Running a puref16x8kernel on tier 1 (nearly all consumer x86-64 CPUs) is slower thanf32x4because each arithmetic op unpacks to wider floats, computes, and repacks (f16x8.madd/nmaddcannot even usef32FMA without double rounding). - Tier 0: compute in
f32x4(unpacking anyf16weights once up front rather than in inner loops).
Without feature detection, the only way to choose at runtime is a microbenchmark at startup, which is slow, noisy, and adds to startup time.
Requirements
All options below share these properties:
- Hint only: the result does not affect validation or instruction semantics. Engines may conservatively return
0(e.g. in anti-fingerprinting/jitless modes or the deterministic profile). - Stable: the value is constant for at least a compiled module or instance lifetime.
- Low fingerprinting surface: at most a couple of coarse bits, which are already observable via timing.
Options
Option 1: Dedicated instruction (f16.feat)
f16.feat : [] -> [i32] returns the tier from the table above.
- Pros: Self-contained and works in any embedding (Web, WASI) without glue code. Engines can constant-fold it at compile time and eliminate dead inline branches. JS loaders (e.g.
wasm-feature-detect) can still probe it before fetching large bundles via a tiny module. - Cons: Adds a host-dependent instruction to the core spec (though
relaxed-simdsets precedent for embedder-chosen hardware behavior). Specific to FP16, so other proposals would need their own.
Option 2: Opcode-parameterized query (instr.support <opcode>)
instr.support <opcode> : [] -> [i32] returns 1 if the given opcode is natively accelerated on the host, 0 otherwise.
- Pros: General. Also covers relaxed SIMD (e.g. FMA, dot product) and future proposals without new opcodes. Can be constant-folded like Option 1.
- Cons: "Accelerated" is ill-defined per opcode. For example,
f16x8.abs/negare a single bitwise op (sign-bit mask) on any SIMD hardware, yet say nothing about whetherf16x8.addis fast. Larger fingerprinting surface. Broadens the scope of the FP16 proposal. Encoding an opcode as an immediate will be awkward.
Option 3: JS API (WebAssembly.getHardwareSupport(name))
const tier = WebAssembly.getHardwareSupport("fp16"); // 0, 1, 2, or undefined if unsupported
- Pros: Keeps host introspection out of the core spec. Extensible to other features via new names.
- Cons: Web-only unless mirrored in WASI/C APIs. Pure-Wasm libraries can't self-detect, so the embedder must plumb the result in. Constant folding requires pairing with a compile-time import (e.g. via Wasm 3.0
builtins).
Open questions
- Single bit vs. 3 tiers? A single bit ("is native
f16x8available?") merges tiers 0 and 1, even though tier 0 still occurs on recent low-power x86 (e.g. Jasper Lake Chromebooks), non-ZfhminRISC-V, VMs, interpreters, and privacy modes. Without distinguishing them, libraries can't choose between the tier 1 promote-on-load path and the tier 0 unpack-up-front path above. - Ordered tier (
0, 1, 2) vs. bitmask? An ordered tier requires callers to checktier >= 2to stay forward-compatible, whereas a bitmask (1 << 0= conversions,1 << 1=f16x8SIMD, upper bits0) also handles non-linear extensions (e.g. follow-on widening FP16->FP32 FMA such as ARMFEAT_FHM).
- Ngôn ngữ chính
- WebAssembly
- Star
- 14
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 WebAssembly/fp16
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
WebAssembly/fp16#10 · 6 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
WebAssembly/fp16#8 · 1 bình luận ·
-
Hardware supportĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
WebAssembly/fp16#7 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
WebAssembly/fp16#6 · 1 bình luận · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
WebAssembly/fp16#4 · 22 bình luận ·
Tất cả issue của WebAssembly/fp16
Issue tương tự
-
flaky(kvm): mounted_static_x86_poll_stdio_matches_native native Linux oracle inherits open fd 42Đang mởflaky
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
carrick-sh/carrick#2550 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature wsl2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
microsoft/WSL#42306 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
srid/nixos-unified#164 ·
-
arch-based hyprland
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
noctalia-dev/noctalia#5423 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:WSL bug code-review linux networking pri:low sev:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày