acompiled

The catalog contains seeded project examples. Your workspace stores your own projects and conversations.

tsvet/utf8-check

Public
Star9

UTF-8 validation in x86-64: a scalar reference and an AVX2 version that checks 32 bytes per step. Every build fuzzes one against the other.

Code
Blame·5 commits across 47 linesoldernewer
System V buildSep 30 1# Verified builds for utf8-check. Every commit assembles both validators for
2# both ABIs, checks them against table 3-7 and each other, then times them.
4[project]
5isa = "x86-64"
6assembler = "nasm"
System V buildSep 30 7target = "Windows x64 and System V objects, AVX2"
8
9[[step]]
10name = "assemble for System V"
11run = ["nasm", "-f", "elf64", "-o", "build/utf8_scalar.o", "src/utf8_scalar.asm"]
12
13[[step]]
14name = "assemble AVX2 for System V"
15run = ["nasm", "-f", "elf64", "-o", "build/utf8_avx2.o", "src/utf8_avx2.asm"]
17[[step]]
18name = "assemble the scalar reference"
19run = ["nasm", "-f", "win64", "-o", "build/utf8_scalar.obj", "src/utf8_scalar.asm"]
20
22name = "assemble AVX2"
23run = ["nasm", "-f", "win64", "-o", "build/utf8_avx2.obj", "src/utf8_avx2.asm"]
24
26name = "build the tests"
AVX2: three nibble tables and a saturating subtractAug 4 27run = ["gcc", "-O2", "-Wall", "-o", "build/test.exe", "test/test.c", "build/utf8_scalar.obj", "build/utf8_avx2.obj"]
29[[step]]
Fuzz the AVX2 version against the scalar oneAug 5 30name = "table 3-7, then 1,000,000 fuzzed inputs"
Fuzz the AVX2 version against the scalar oneAug 5 32run = ["./build/test.exe", "1000000"]
33expect = "0 mismatches"
36name = "build the benchmark"
AVX2: three nibble tables and a saturating subtractAug 4 37run = ["gcc", "-O2", "-Wall", "-o", "build/bench.exe", "bench/bench.c", "build/utf8_scalar.obj", "build/utf8_avx2.obj"]
39[[step]]
AVX2: three nibble tables and a saturating subtractAug 4 40name = "time both on 64 MiB"
42run = ["./build/bench.exe"]
43expect = "MiB of mixed text"
44
AVX2: three nibble tables and a saturating subtractAug 4 46path = "build/utf8_avx2.obj"
System V buildSep 30 47paths = ["build/utf8_scalar.obj", "build/utf8_avx2.o", "build/utf8_scalar.o"]