Skip to content

Experimenting with simd/archsimd#692

Draft
saswatamcode wants to merge 1 commit intothanos-io:mainfrom
saswatamcode:simdexp
Draft

Experimenting with simd/archsimd#692
saswatamcode wants to merge 1 commit intothanos-io:mainfrom
saswatamcode:simdexp

Conversation

@saswatamcode
Copy link
Member

@saswatamcode saswatamcode commented Mar 5, 2026

Experimenting with the experimental native SIMD package in Go 1.26. Won't build without GOEXPERIMENT=simd

Not entirely sure if I'm doing something unintended tho, need to read up more.

$ GOEXPERIMENT=simd GOOS=darwin GOARCH=amd64 go test -timeout 5m -run ^TestNewMaxAcc$ github.com/thanos-io/promql-engine/compute -race -v

=== RUN   TestNewMaxAcc
=== RUN   TestNewMaxAcc/empty_accumulator_has_NoValue
=== RUN   TestNewMaxAcc/single_Add_sets_max
=== RUN   TestNewMaxAcc/multiple_Add_keeps_max
=== RUN   TestNewMaxAcc/AddVector_takes_max_of_slice
=== RUN   TestNewMaxAcc/Add_and_AddVector_combined
=== RUN   TestNewMaxAcc/AddVectorSIMD_takes_max_of_slice
=== RUN   TestNewMaxAcc/Add_and_AddVectorSIMD_combined
=== RUN   TestNewMaxAcc/NaN_is_replaced_by_real_number
=== RUN   TestNewMaxAcc/Reset_clears_state
--- PASS: TestNewMaxAcc (0.01s)
    --- PASS: TestNewMaxAcc/empty_accumulator_has_NoValue (0.00s)
    --- PASS: TestNewMaxAcc/single_Add_sets_max (0.00s)
    --- PASS: TestNewMaxAcc/multiple_Add_keeps_max (0.00s)
    --- PASS: TestNewMaxAcc/AddVector_takes_max_of_slice (0.00s)
    --- PASS: TestNewMaxAcc/Add_and_AddVector_combined (0.00s)
    --- PASS: TestNewMaxAcc/AddVectorSIMD_takes_max_of_slice (0.00s)
    --- PASS: TestNewMaxAcc/Add_and_AddVectorSIMD_combined (0.00s)
    --- PASS: TestNewMaxAcc/NaN_is_replaced_by_real_number (0.00s)
    --- PASS: TestNewMaxAcc/Reset_clears_state (0.00s)
PASS
ok      github.com/thanos-io/promql-engine/compute      1.896s
$ GOEXPERIMENT=simd GOOS=darwin GOARCH=amd64 go test -bench=MaxAcc -benchmem ./compute/ -count 5

goos: darwin
goarch: amd64
pkg: github.com/thanos-io/promql-engine/compute
cpu: VirtualApple @ 2.50GHz
BenchmarkMaxAcc_AddVector-10             9008782               132.5 ns/op             0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVector-10             9018422               133.0 ns/op             0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVector-10             9008895               137.4 ns/op             0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVector-10             8980705               132.7 ns/op             0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVector-10             9029263               132.8 ns/op             0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVectorSIMD-10        18712428                63.67 ns/op            0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVectorSIMD-10        18807782                64.24 ns/op            0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVectorSIMD-10        18797163                63.55 ns/op            0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVectorSIMD-10        18721698                64.46 ns/op            0 B/op          0 allocs/op
BenchmarkMaxAcc_AddVectorSIMD-10        18688288                64.26 ns/op            0 B/op          0 allocs/op
PASS
ok      github.com/thanos-io/promql-engine/compute      13.550s

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
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