[spectec] wasm-2.0: $vextunop__/$vextbinop__ are defined only for Inn, so I8/I16-lane extadd_pairwise, extmul, and dot have no result
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- wasm
- Domain
- compilers
Research direction
Read the $vextunop__ and $vextbinop__ clauses in specification/wasm-2.0/3-numerics.spectec, then compare the corresponding clauses in 3.2-numerics.vector.spectec from wasm-3.0 and check $vunop_ in the wasm-2.0 file. Update the operand shapes to cover the Jnn cases described in the issue, then run the five named SIMD test files through the Spec2Maude validation workflow; done means all five pass.
Written by the indexing model from the issue text.
Description
In specification/wasm-2.0/3-numerics.spectec (checked on main, e7a9df7c), the clauses of $vextunop__ and $vextbinop__ (lines 588, 595, 600) match only Inn shapes:
def $vextunop__(Inn_1 X M_1, Inn_2 X M_2, EXTADD_PAIRWISE sx, c_1) = c
def $vextbinop__(Inn_1 X M_1, Inn_2 X M_2, EXTMUL half sx, c_1, c_2) = c
def $vextbinop__(Inn_1 X M_1, Inn_2 X M_2, DOT S, c_1, c_2) = c
Inn is I32 | I64 (1-syntax.spectec:141), but the syntax admits Jnn shapes (syntax vextunop_(Jnn X M), 1-syntax.spectec:376-381), and the binary format produces them, e.g. (A-binary.spectec:623):
| 0xFD 124:Bu32 => VEXTUNOP (I16 X 8) (I8 X 16) (EXTADD_PAIRWISE S)
So no clause applies to i16x8.extadd_pairwise_i8x16_s/u, i32x4.extadd_pairwise_i16x8_s/u, i16x8.extmul_*_i8x16_*, i32x4.extmul_*_i16x8_*, and i32x4.dot_i16x8_s. The premise of Step_pure/vextunop / Step_pure/vextbinop has no solution, and execution gets stuck. Only i64x2.extmul_*_i32x4_* is covered. Example (test/core/simd/simd_i16x8_extadd_pairwise_i8x16.wast:13 in wg-2.0):
(assert_return (invoke "i16x8.extadd_pairwise_i8x16_s" (v128.const i8x16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1))
(v128.const i16x8 2 2 2 2 2 2 2 2))
We found this with Spec2Maude, a tool that translates the SpecTec IL of the Wasm spec into Maude, a rewriting-logic framework, so that the spec semantics can be formally analyzed (e.g., model checking of Wasm programs). To validate the translation, we run the official test suite of each Wasm version (here, the wg-2.0 tag) on the translated semantics. Five files fail on the wasm-2.0 spec as is: simd_i16x8_extadd_pairwise_i8x16, simd_i32x4_extadd_pairwise_i16x8, simd_i16x8_extmul_i8x16, simd_i32x4_extmul_i16x8, and simd_i32x4_dot_i16x8.
Possible fix: use Jnn in these clauses, as wasm-3.0 does (3.2-numerics.vector.spectec:316-325) and as $vunop_ already does in the same wasm-2.0 file:
def $vextunop__(Jnn_1 X M_1, Jnn_2 X M_2, EXTADD_PAIRWISE sx, c_1) = c
def $vextbinop__(Jnn_1 X M_1, Jnn_2 X M_2, EXTMUL half sx, c_1, c_2) = c
def $vextbinop__(Jnn_1 X M_1, Jnn_2 X M_2, DOT S, c_1, c_2) = c
(with Inn_1/Inn_2 replaced by Jnn_1/Jnn_2 in the premises as well). With this change, all five files pass with the Maude translation.
- Dominant language
- WebAssembly
- Stars
- 3.5k
- Forks
- 545
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WebAssembly/spec
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/spec#2333 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/spec#2330 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
WebAssembly/spec#2302 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 53/100
WebAssembly/spec#2301 · 9 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
WebAssembly/spec#2279 · 6 comments ·
Maintainers usually reply within 1 day
All issues in WebAssembly/spec
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
DAE2 crashes on call.without.effects with a non ref.func expressionPossibly taken @stevenfontanella claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
WebAssembly/binaryen#9404 ·
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:med platform:windows type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:Analysis enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 69/100
facebookresearch/atlas-lean#5118 ·
Maintainers usually reply within 1 day
-
C-bugfix
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Quantinuum/hugr#3354 ·
Maintainers usually reply within 1 day