-
Notifications
You must be signed in to change notification settings - Fork 42
Implement SIMD #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SIMD #93
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements SIMD (Single Instruction, Multiple Data) support for the pywasm WebAssembly interpreter, adding v128 vector operations and arithmetic utilities.
- Adds comprehensive SIMD opcode definitions for v128 vector operations including load/store, lane operations, and arithmetic operations
- Introduces a new arithmetic module with integer and floating-point arithmetic helper classes for proper value fitting and operations
- Updates the test framework to support SIMD-specific test files and enhance value comparison for v128 types
Reviewed Changes
Copilot reviewed 11 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pywasm/opcode.py | Adds 236 new SIMD opcodes and their string mappings for v128 vector operations |
| pywasm/arith.py | New arithmetic utility module with signed/unsigned integer and floating-point arithmetic classes |
| test/spec.py | Updates test framework to handle v128 values and includes SIMD test files |
| script/build_spec.py | Extends build script to process SIMD-specific test files |
| pywasm/init.py | Exposes the new arithmetic module |
| example/ | Adds blake2b SIMD example with Rust implementation and Python test |
| README.md | Documents the new blake2b SIMD example |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if all([vale(x, y) for x, y in zip(x, y)]): | ||
| return True | ||
| x = [pywasm.core.ValInst.from_f64(e) for e in a.into_v128_f64()] | ||
| y = [pywasm.core.ValInst.from_f64(e) for e in b.into_v128_f64()] | ||
| if all([vale(x, y) for x, y in zip(x, y)]): |
Copilot
AI
Sep 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recursive call to vale should pass individual elements, not lists. Change to if all([vale(xi, yi) for xi, yi in zip(x, y)]):.
| if all([vale(x, y) for x, y in zip(x, y)]): | |
| return True | |
| x = [pywasm.core.ValInst.from_f64(e) for e in a.into_v128_f64()] | |
| y = [pywasm.core.ValInst.from_f64(e) for e in b.into_v128_f64()] | |
| if all([vale(x, y) for x, y in zip(x, y)]): | |
| if all([vale(xi, yi) for xi, yi in zip(x, y)]): | |
| return True | |
| x = [pywasm.core.ValInst.from_f64(e) for e in a.into_v128_f64()] | |
| y = [pywasm.core.ValInst.from_f64(e) for e in b.into_v128_f64()] | |
| if all([vale(xi, yi) for xi, yi in zip(x, y)]): |
Copilot uses AI. Check for mistakes.
| return True | ||
| x = [pywasm.core.ValInst.from_f64(e) for e in a.into_v128_f64()] | ||
| y = [pywasm.core.ValInst.from_f64(e) for e in b.into_v128_f64()] | ||
| if all([vale(x, y) for x, y in zip(x, y)]): |
Copilot
AI
Sep 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recursive call to vale should pass individual elements, not lists. Change to if all([vale(xi, yi) for xi, yi in zip(x, y)]):.
| if all([vale(x, y) for x, y in zip(x, y)]): | |
| if all([vale(xi, yi) for xi, yi in zip(x, y)]): |
Copilot uses AI. Check for mistakes.
Adds SIMD (Single Instruction, Multiple Data) support for the pywasm.