I've been toying with SIMD and my very first example crashed when the vector had around 100k elements. It works when NUM_POINTS is decreased to 10k.
Given:
const std = @import("std");
const NUM_POINTS: usize = 100_000;
pub fn main() void {
var prng = std.rand.DefaultPrng.init(0);
const random = prng.random();
var points: [NUM_POINTS]i16 = undefined;
for (&points) |*pos| {
pos.* = random.intRangeAtMost(i16, 0, 1000);
}
const result = isGreaterThan(&points, 3);
std.debug.print("{any}\n", .{result});
}
pub fn isGreaterThan(points: []i16, gte: i16) @Vector(NUM_POINTS, bool) {
const vgte: @Vector(NUM_POINTS, i16) = @splat(gte);
const vpoints: @Vector(NUM_POINTS, i16) = points[0..NUM_POINTS].*;
return vpoints > vgte;
}
Results in:
LLVM Emit Object... LLVM ERROR: SmallVector unable to grow. Requested capacity (18446744073709486080) is larger than maximum value for size type (4294967295)
Is this a compiler bug or am I missing something?