Skip to content

add wasm-simd support for suggestVectorSizeForCpu #14992

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

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

kounoike
Copy link
Contributor

std.simd.suggestVectorSizeForCpu didn't support Wasm SIMD
This PR adds Wasm SIMD support.

$ zig version
0.11.0-dev.1987+a2c6ecd6d
$ cat wasm-simd.zig 
const std = @import("std");

pub fn main() !void {
    const wasm_simd_model = std.Target.wasm.cpu.bleeding_edge;
    const wasm_simd_cpu = comptime std.Target.Cpu.Model.toCpu(&wasm_simd_model, std.Target.Cpu.Arch.wasm32);

    std.debug.print("vector size for u8(wasm) {?}\n", .{std.simd.suggestVectorSizeForCpu(u8, wasm_simd_cpu)});
}
$ zig run wasm-simd.zig 
vector size for u8(wasm) null
$ zig run --zig-lib-dir ~/ghq/github.com/ziglang/zig/lib wasm-simd.zig 
vector size for u8(wasm) 16

@kounoike kounoike force-pushed the wasm-simd-vector-size branch from 25660be to ecbdc5e Compare March 17, 2023 23:58
@jedisct1 jedisct1 merged commit 5df31f3 into ziglang:master Mar 20, 2023
truemedian pushed a commit to truemedian/zig that referenced this pull request Mar 30, 2023
@kounoike kounoike deleted the wasm-simd-vector-size branch May 7, 2023 19:02
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.

2 participants