Jimmy Miller
Projects

My projects are mostly experiments. I am more interested in exploring the ideas behind things to learn than I am in writing production-ready software. Some eventually graduate to be tools I use every day. But even those are mostly things I find useful, not for others.

simd-lang

A language that makes it easy to write succinct SIMD code.

Vectorized iteration with cross-iteration state. The stream, over, and carry keywords make SIMD code read like a normal loop. Hits ~73% of simdjson stage-1 throughput on M1 (~3.5 GB/s) and ~76% for full DOM parse (~1.15 GB/s).

simdexamples/json_stage1.simd
1fn json_stage1(input: ptr[u8], positions: ptr[i32]) -> i32[1] {
2 stream chunk: u8[64] over input carry (prev_in_string: u64[1] = 0,
3 pos: i32[1] = 0) {
4 quote_vec = chunk == '"'
5 bs_vec = chunk == '\\'
6 real_quote_vec = quote_vec & ~lane_shr(bs_vec, 1)
7
8 structural_vec = (chunk == '{') | (chunk == '}') | (chunk == '[')
9 | (chunk == ']') | (chunk == ':') | (chunk == ',')
10
11 quote_bits = to_bitmask(real_quote_vec)
12 in_string_raw = clmul(quote_bits, ~0)
13 in_string_with_carry = in_string_raw ^ prev_in_string
14
15 real_structural_bits = to_bitmask(structural_vec) & ~in_string_with_carry
16 real_structural_vec = from_bitmask(real_structural_bits, 64)
17
18 indices = iota(64) + chunk_offset
19 compressstore(positions, pos, indices, real_structural_vec)
20
21 carry prev_in_string = in_string_with_carry >> 63 * ~0
22 carry pos = pos + popcount(real_structural_vec)
23 }
24 return pos
25}