Skip to content

Conversation

@mohanson
Copy link
Collaborator

Adds SIMD (Single Instruction, Multiple Data) support for the pywasm.

@mohanson mohanson requested a review from Copilot September 16, 2025 06:35
Copy link

Copilot AI left a 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.

Comment on lines +88 to +92
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)]):
Copy link

Copilot AI Sep 16, 2025

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)]):.

Suggested change
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)]):
Copy link

Copilot AI Sep 16, 2025

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)]):.

Suggested change
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.

@mohanson mohanson merged commit 10f9a3f into master Sep 16, 2025
6 checks passed
@mohanson mohanson deleted the simd branch September 16, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant