How to portably use this proposal?
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- wasm
- 领域
- compilers
调研方向
从提案当前的设计以及此 issue 中描述的可移植性问题入手,包括 f16x8 和 f32x4 示例,以及引擎在不同 CPU 能力下的行为。没有指定文件、测试或入口点。要视为完成,就需要为用户和实现者记录一项已达成共识的生态系统和引擎可移植性方向。
由索引模型根据 Issue 内容生成。
描述
Hello! I had some comments during the CG meeting today but I wanted to elaborate on them in an issue here. My concern stems from not knowing how consumers will end up using this proposal in a bit more of an abstract sense beyond "well you just use it". My understanding is that "if you know what you're doing" you would first have a target platform in mind (e.g. arm64 or some specific machine), you'd then ensure that there's an engine to use there (e.g. all your own users use one browser or something like that), and then you'd get the instructions into a wasm binary and measure to make sure everything works. What I'm curious about is what to do if you don't fall into the bucket of "if you know what you're doing".
Put more concretely the current trajectory of this proposal looks like it's going to have two key properties that users would need to consider:
- A wide performance gap on machines that natively support this proposal and machines that require emulation for the proposal.
- Depending on the final level of complexity for engines it may also not be reasonable to expect to be able to run this proposal on older cpus which don't have even enough support for "ok we can at least mostly emulate things". (for example only sse2 on x64 or pre-8.2 on arm64 -- I'm not certain the complexity here on either s390x or riscv64)
The rest of my comments here are under the assumption that (1) and (2) are true. Ideally I think that those would both be fixed, but given the nature of this proposal I don't think it's easy to do that. Personally I like the idea of exposing hardware capabilities in wasm, but my thinking here is exploring the consequences of (1) and (2) and adoption in ecosystem libraries.
Personally I don't have any experience with 16-bit floats or the applications that use them. One hypothetical use case, which may not be reasonable, would be something along the lines of: a library has the ability to use f16x8 but also has the ability to use f32x4. On supporting hardware f16x8 is the fastest but f32x4 is faster on hardware that doesn't support f16x8 natively (or via emulation of f16x8). In this situation a library has no means of internally selecting which algorithm to use. This means that the implementation detail of float width would need to be bubbled up to users of the library, and that can increase complexity in the sense that every library with this decision would have to bubble up knobs of which to use at runtime.
Another possible concern for a library like this is whether or not to even include f16x8 instructions. For example let's assume that this proposal is phase 4, implemented in all engines, and has been stable for a year or so. Even in this situation should this hypothetical library use f16x8 by default? Or should it provide a compile time flag to disable support? This is relevent, for example, if users want to use the library in engines on platforms where the engine does not have support for this proposal (e.g. the fallback to old hardware is too complex).
Overall an answer to all of this could be: "it's expected all users of this proposal know what they're doing" or something like that. My concerns go away in this situation because library authors would "know what they're doing", applications using these libraries would "know what they're doing", and engines would be communicating with these "in-the-know" users for what platforms need to support things. For example if it turns out no one has a use case for supporting this proposal with sse2-only cpus then that would just never happen and no one would ever see the error of "your cpu is too old to run this module". This in my opinion of course touches on the concerns of wasm being "universally portable" though to a degree, but not if the users of this proposal are expected to be only a few critical ones and not necessarily see widespread adoption.
Personally though my naive way to answer these concerns of mine would be to (a) add the ability to detect whether these instructions are "fast" and (b) allow engines to implement these instructions with a trap. That would provide libraries the ability to internally detect which algorithm to use and everything could always be turned on by default. Engines that don't want to implement the proposal could only do the validation parts and then trap at runtime (and the detection instruction would say "no"). I realize though that this touches on other concerns about the determinism of wasm but I at least personally feel like that ship has sailed with the relaxed-simd proposal and would prefer to lean in to exposing the intrinsic nature of how hardware is different and modules get run on different hardware.
Apologies for the long issue, happy to discuss here more too! Also I realize I'm not a key stakeholder in this proposal nor in simd-related things. I've done various bits and pieces of wasm simd in Rust and Wasmtime for various architectures but I don't use simd day-in-and-day-out nor am I aware of users of Wasmtime, for example, that are cpu-bound and heavily reliant on simd things.
- 主要语言
- WebAssembly
- 星标
- 14
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
WebAssembly/fp16 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
WebAssembly/fp16#11 · 1 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 38/100
WebAssembly/fp16#10 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
WebAssembly/fp16#8 · 1 条评论 ·
-
Hardware support未关闭
难度 5/5 一周以上 新手友好度 25/100
WebAssembly/fp16#7 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
WebAssembly/fp16#6 · 1 条评论 · 1 个 reaction ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
DAE2 crashes on call.without.effects with a non ref.func expression可能已有人在做 @stevenfontanella 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
WebAssembly/binaryen#9404 ·
维护者通常 1 天内回复
-
area:compiler effort:S impact:med platform:windows type:bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
area:Analysis enhancement
难度 1/5 1-3 小时 新手友好度 69/100
facebookresearch/atlas-lean#5118 ·
维护者通常 1 天内回复
-
C-bugfix
难度 2/5 1-3 小时 新手友好度 82/100
Quantinuum/hugr#3354 ·
维护者通常 1 天内回复