modus
Menu
On this page

Vector forms: SSE2

This document says which procedures of the system compute with vectors, in which form, what stays scalar, and how to measure each one. The terms are in Glossary (scalar form, vector form) and Glossary (usable instruction set, extended state).

The idea in plain words. A processor has registers that hold several numbers side by side, and instructions that compute on all of them at once. A procedure that works on many pixels or many words can use them: it does the work of four values with one instruction. That is its vector form. The same procedure written with one value for each instruction is its scalar form. In this system a procedure that has a vector form also keeps its scalar form, and the two must give the same bytes for every input: the vector form is only faster, never different. Host tests compare the two, so a fault of the vector form shows as a wrong byte, not as a wrong picture.

What has a vector form today. Eight procedures, all with 128-bit registers (SSE2 on x86-64):

ProcedureScalar formVector formValues for each step
The blend of a glyphblend_coverage_row_in_order (src/library/modus/graphics/blend.odin)blend_coverage_row_sse2 (src/library/modus/graphics/blend_vectors_amd64.odin)4 pixels
The blend of colors with straight alpha: the colors of the draw records and the pictures with alphablend_straight_alpha_row_scalar (src/library/modus/graphics/blend.odin)blend_straight_alpha_row_sse2 (src/library/modus/graphics/blend_vectors_amd64.odin)4 pixels
The blend of a picture with premultiplied alphablend_premultiplied_alpha_row_scalar (src/library/modus/graphics/blend.odin)blend_premultiplied_alpha_row_sse2 (src/library/modus/graphics/blend_vectors_amd64.odin)4 pixels
The BLAKE3 hash of a subtree of four chunkschunk_value, four times (src/library/modus/contract/blake3/blake3.odin)four_chunk_values_side_by_side (src/library/modus/contract/blake3/chunks_side_by_side_amd64.odin)4 chunks
The check of a text: UTF-8 with no control charactertext_valid_byte_by_byte (src/library/modus/contract/text_encoding/text_encoding.odin)text_valid_sixteen_bytes_at_a_time (src/library/modus/contract/text_encoding/text_valid_sixteen_bytes_at_a_time.odin)16 bytes
The 16-tag group match of a Swiss tablegroup_match_tag_scalar, group_match_empty_scalar, group_match_free_scalar (src/library/modus/hash_table/group_match.odin)group_match_tag_sse2, group_match_empty_sse2, group_match_free_sse2 (src/library/modus/hash_table/group_match_amd64.odin)16 control bytes
The fuzzy match of a query against a namefuzzy_match_scalar (src/library/modus/line_editor/fuzzy_match.odin)fuzzy_match_vectors (src/library/modus/line_editor/fuzzy_match_vectors.odin)16 bytes
The triangles of the processor back end of the WebGPU subsetrasterize_triangle_scalar (src/library/modus/contract/webgpu_subset/software_3d.odin)rasterize_triangle_simd (same file)4 pixels

What this document is not. It is not the rule on the vector registers of the kernel. The kernel has no vector instruction at all, and it saves the registers of each thread: Architecture: The extended state of the processor. It is not the design of the blend in linear light either: The text of the system: a vector font with subpixel bands: The blend in linear light.

For whom. A reader who writes or changes a vector form, and a reader who measures one.

The map of this document. Section 1: the rule of the same bytes. Section 2: why one form, SSE2. Sections 3 to 6: the blend of a glyph, the compositor, BLAKE3, the check of a text. Section 7: how to measure on the machine. Section 8: limits. Section 9: the 16-tag group match. Section 10: the fuzzy match. Section 11: the triangles of the WebGPU subset.

1. The rule of the same bytes

The rule: a vector form gives the same bytes as its scalar form, for every input. Two facts of the system need it. The screenshots of the system are compared byte for byte. One source gives one module, and the hash of a module is its identity: a hash that depends on the form is not a hash of the content.

How a vector form keeps the rule:

  • Integers only. A vector form does the arithmetic of the scalar form in lanes (a lane is the part of a register that holds one value), with the same widths of the intermediate values. It rounds nowhere where the scalar form does not.
  • The scalar form stays beside each vector form. It has three uses: it is the reference of the host tests, it is the code of a target that is not amd64, and it is the code of the last values of a row that do not fill a group of the vector form.
  • No load and no store outside the slice of the caller. A vector form loads and stores a group of values only when the whole group is inside the slice. The columns after the last whole group go through the scalar form. It allocates nothing.
  • One public procedure. The caller does not choose a form. The public procedure chooses at compile time, by the target:
blend_premultiplied_alpha_row :: #force_inline proc "contextless" (to: [^]Color, from: [^]u32, count: int) {
	when ODIN_ARCH == .amd64 {
		blend_premultiplied_alpha_row_sse2(to, from, count)
	} else {
		blend_premultiplied_alpha_row_scalar(to, from, count)
	}
}

The host tests compare each vector form with its scalar form on inputs from a generator with a fixed seed, so each host gets the same inputs:

  • every length from 0 to 67;
  • every place of the input against a boundary of 16 bytes (a pixel is 4 bytes, so 4 places for a row of pixels; 16 places for the bytes of a hash);
  • the edge values often: 0, 1, 254 and 255 in each byte, whole words of 0, of all ones and of full coverage;
  • guard words before and after each row: a form that writes outside its columns changes them.

When a test fails, it gives the first wrong pixel, the value of each form, and the count of pixels changed outside the drawn columns. The tests of the blends are in src/library/modus/graphics/blend_vectors_test_amd64.odin (coverage_forms_give_the_bytes_of_the_scalar_form, coverage_forms_meet_each_channel_value, premultiplied_forms_give_the_bytes_of_the_scalar_form, premultiplied_forms_meet_each_channel_value, straight_alpha_forms_give_the_bytes_of_the_scalar_form, straight_alpha_forms_meet_each_channel_value, coverage_forms_with_alpha_give_the_bytes_of_the_scalar_form). The tests of the hash are in src/library/modus/contract/blake3/chunks_side_by_side_test_amd64.odin (sse2_form_gives_the_hash_of_the_scalar_form, subtrees_side_by_side_at_each_counter). The tests of the check of a text are in src/library/modus/contract/text_encoding/text_valid_sixteen_bytes_at_a_time_test.odin (section 6). The test of the 16-tag group match is in src/library/modus/hash_table/hash_table_test.odin (group_forms_give_the_mask_of_the_scalar_form). The tests of the fuzzy match are in src/library/modus/line_editor/fuzzy_match_vectors_test.odin (vector_form_at_the_edges, vector_form_gives_the_result_of_the_scalar_form). modustool check runs them.

2. One form: SSE2

The vector forms use the 128-bit registers of SSE2. Two facts make this form free of conditions:

So a vector form needs no test of the processor and no choice at the start of a process: on amd64 the public procedure runs the SSE2 form, and on another target the scalar form.

How a module is compiled. A module is compiled for the plain x86-64 processor, with SSE2: for a module, llc gets no -mattr and no -mcpu (build_module in tools/modustool/build/modules.odin). The kernel is the one exception, in the other direction: it is compiled with every vector feature off (KERNEL_TARGET_FEATURES), and the build refuses a kernel that has a vector instruction outside the save and the restore of the extended state (tools/modustool/build/vector_check.odin). No vector form runs in the kernel.

How a vector form is written. The arithmetic is written with base:intrinsics on #simd[N]T types: simd_shuffle, simd_select, simd_lanes_eq, simd_shr, simd_shl, simd_bit_and, simd_bit_or, simd_bit_xor, simd_reduce_or, simd_reduce_and, simd_extract, unaligned_load, unaligned_store, the operators + - *, and cast between element widths. The compiler lowers them to SSE2 instructions. No form names an instruction of the processor, and no form is written in assembler.

What SSE2 is not here. It is not the only instruction set that a process can use. A process can read its usable instruction sets with src/library/modus/instruction_sets (usable_instruction_sets) and run AVX2 code where the processor has it and the kernel saves its registers. No vector form of the system does that today: the measures below say why.

What was measured about AVX2

An AVX2 form of each procedure, behind one choice at the start of a process (CPUID and XGETBV as instruction templates), was measured by the host tests on a host with AVX2. The host load was 10, above the limit of 8, so these times rank the forms and are not valid measures of speed:

Measure (host, -o:speed)ScalarSSE2AVX2
One glyph from the glyph cache301 ns193 ns244 ns
BLAKE3 of 390 624 bytes835 us200 us383 us

The build with no optimisation (the build of the host tests of modustool check) gave the same order: one glyph 1382 / 813 / 4716 ns in a first run, BLAKE3 5920 / 1904 / 2002 us.

AVX2 lost to SSE2 in both places, and its form of the blend of a glyph gave wrong bytes in the build with no optimisation. So the system has the scalar form and the SSE2 form only: no AVX2 form, and no vector form that chooses at the start of a process.

What an AVX2 form needs

  1. 1. The registers saved, and a way to know it. This part exists. The kernel saves the extended state of a thread at each switch of threads: with xsaveopt when the processor has it, with the ymm registers of AVX and the registers of AVX-512 when the processor has them; with fxsave else (src/modulus/extended_state.odin; Architecture: The extended state of the processor). A process reads whether AVX2 is usable with src/library/modus/instruction_sets, once at its start: CPUID is slow in a virtual machine.
  2. 2. A form that wins by measure on the machine, with optimisation, on a host with a load under 8. The blend of a glyph reads a table at an index for each channel. The AVX2 gather (vpgatherdd) is not faster than single loads on every processor, and on processors from Skylake to Ice Lake and Tiger Lake the correction against Gather Data Sampling (2023) makes it several times slower. A form to measure first: the arithmetic in ymm registers with the reads of one byte of the SSE2 form, and no gather.
  3. 3. The cause of the wrong bytes understood. The facts:
    • In the build with no optimisation, the AVX2 form gave the byte 03 in some channels. 03 is entry 0 of the table of square roots, so the gather read index 0 in those lanes: the vector of indices that the gather received had zeros where the indices were not 0. The build with optimisation gave the right bytes.
    • One cause is known: an AVX2 procedure that passes vectors of 256 bits by value to procedures without the target feature (section "A lesson"). With the indices passed to the gather procedure through a pointer, the fault stayed.
    • The probable cause: the same kind of fault at another place, where a vector of more than 128 bits passes between two procedures in a build that puts nothing inline. Candidates: the call of the binding x86._mm256_i32gather_epi32 (a procedure of the C convention that takes and gives a vector of 256 bits), or the vector of 512 bits that the shared arithmetic returned. A fault of the compiler in that build is also possible.
    • The way to know: read the LLVM IR of the test build for the gather procedure and its callers, and compare the vector of indices that is stored with the one that the gather instruction receives.

A lesson for later: vectors of more than 128 bits across procedures

A procedure with the target feature avx2 and a procedure without it pass a vector of more than 128 bits in different places: one ymm register, against two xmm registers or memory. A call by value between the two gives the callee other bytes. A build with no optimisation puts no procedure inline, so each such call is real.

The rule for a later AVX2 form:

  • Such a vector crosses between the two kinds of procedure only through a pointer.
  • A host test of the AVX2 form runs in the build with no optimisation and in the build with optimisation.

A vector of 128 bits or less is passed in one xmm register by both kinds. That is why the SSE2 forms have no such fault.

SSSE3, SSE4.1 and AVX-512

No form uses SSSE3 or SSE4.1. pshufb (SSSE3) does a rotation of 8 bits in one instruction in place of three in BLAKE3; pmulld and pblendvb (SSE4.1) have SSE2 forms of one to three instructions that the compiler writes. The gain is a few instructions in loops whose cost is elsewhere (the reads of the table, the 7 rounds). Such a form needs a test of the processor at the start of a process (src/library/modus/instruction_sets).

AVX-512 gives 512-bit registers (16 pixels, 16 chunks of BLAKE3 side by side), mask registers (the last pixels of a row with no scalar tail), and a gather of 16 lanes. The kernel already saves its three state components on a processor that has them: the extended state area of each thread has 2688 bytes for that (EXTENDED_STATE_CAPACITY). A form still needs the same test of the processor as AVX2, and a measure first: on some processors a 512-bit instruction lowers the clock of the core for a while.

3. The blend of a glyph (src/library/modus/graphics)

What it is. A glyph of the vector font is a rectangle of coverage words from the private glyph cache: for each pixel, how much of each color stripe of the screen the shape covers. The blend mixes the text color over the pixels of the canvas with that coverage, in linear light (The text of the system: a vector font with subpixel bands: Subpixel bands; The text of the system: a vector font with subpixel bands: The blend in linear light). It is the cost of every text of the system.

The hot loop is blend_coverage_row_in_order (src/library/modus/graphics/blend.odin): for each pixel with partial coverage, three channels, each square_root[(d * d * (255 - a) + c * c * a) >> 12], with d the pixel, c the color and a the coverage. The text of the system: a vector font with subpixel bands: The glyph cache, gives its cost: a glyph from the glyph cache costs about 9 times a glyph of Spleen.

The SSE2 form is blend_coverage_row_sse2 in src/library/modus/graphics/blend_vectors_amd64.odin, 4 pixels at a time. Each byte of the four pixels gets one lane of 16 bits (16 lanes, which the compiler splits in two registers), because the product of two bytes fits in 16 bits.

PartForm
The split of 4 pixels and 4 coverage words into 16 lanes of 16 bits (one lane for each byte)vector: a widening conversion
The order of the stripes (red-green-blue, blue-green-red, none)vector: one shuffle of lanes, chosen at compile time
d * d, 255 - a, the two products, the sum, >> 12vector: 16-bit squares, 32-bit products and sum
The read of square_root12 reads of one byte for 4 pixels: SSE2 has no gather
The choice of each channel (coverage 0: the pixel; 255: the color; else the table) and of each pixel (a word of 0: the pixel whole; a word that covers the three stripes: the color whole)vector: comparisons and selects, no branch
A group of 4 words of 0, or of full coverageone test for the group, before the arithmetic
The last 0 to 3 columns of a rowthe scalar form

The table is kept: 12 reads of one byte cost less than a square root computed in lanes (a search of 8 steps for each channel).

The blend of colors with straight alpha is the same arithmetic, with the alpha of each color as the coverage of its three channels and the channels of each color in place of one color: blend_straight_alpha_row_sse2, 4 pixels at a time. A group of four colors with alpha 0 is not read; a group of four opaque colors is written whole, with the high byte 0. A draw record of one color with alpha (graphics.blend_fill) blends a row of that color, 64 pixels at a time; an opaque record is a fill and takes no blend. The host test straight_alpha_forms_meet_each_channel_value also checks that the scalar form gives the bytes of the blend of a glyph whose word covers the three channels with the alpha: one rule for both.

The blend of a glyph with alpha, for a text whose color has an alpha below 255: each coverage is first scaled, round(coverage * alpha / 255) (coverage_with_alpha, t = c * a + 128, then (t + t >> 8) >> 8, exact for each product of two bytes, in lanes of 16 bits in the SSE2 form). No scaled coverage reaches 255, so the SSE2 form drops the test of a group covered whole, and keeps the test of a group of four words of 0. The blend tables give the result of each coverage, so the scaled coverage reads the table of the opaque color of the same channels. The host test coverage_forms_with_alpha_give_the_bytes_of_the_scalar_form compares the two forms for six alphas, and fast_blend_with_alpha_is_the_reference (text_test.odin) compares the blend tables with the reference.

The flag of the scalar form. The scalar form keeps the channels of the previous pixel, with a flag for "no previous pixel" (previous_known). The value 0xFFFFFFFF cannot mean "no previous pixel": a first pixel 0xFFFFFFFF is then blended as black. A canvas of the system holds 0x00RRGGBB only, but the blend must be right for every word. The host test coverage_scalar_form_reads_a_pixel_of_all_ones keeps the flag.

The blend table is a third path, not a vector form. For a text over one flat color, graphics.blend_glyph_rows reads the result of each channel from a blend table: three loads and a store for a pixel, with no arithmetic (The text of the system: a vector font with subpixel bands: Where the time goes, and the fast blend). The two paths meet in this way:

  • A row of a glyph whose two end pixels have one color takes the blend table of that color.
  • A row whose two ends differ (a gradient across, a picture) takes the form of the target: the SSE2 form on amd64.
  • A lone pixel of another color inside a row of the table takes the scalar form: the SSE2 form gives a lone pixel to the scalar form anyway.

The three give the same bytes: the host test three_blends_give_the_same_bytes_for_each_cache compares the blend table, the SSE2 form alone and the scalar form alone.

Fill and copy

They have no vector form of their own:

  • graphics.copy calls intrinsics.mem_copy_non_overlapping, which is copy_bytes_without_overlap of src/runtime/memory.asm. That procedure already moves 16 bytes at a time in xmm registers: two or four moves that overlap for 16 to 64 bytes, a loop of 64 bytes above, and rep movsb from 2048 bytes to 1 MiB. It uses no AVX: the same file runs in the boot program and on a processor where AVX is not usable.
  • graphics.fill is a loop of 32-bit stores, and the compiler makes it a vector loop: the code of the compositor has pshufd $0x0 (the color in the four lanes) and stores of 16 bytes in interface::execute_in_rectangle (objdump -d build/modules/compositor/linked.elf). A fill of 32-bit pixels is not a fill of bytes: fill_bytes_with_value does not apply.

The kernel links another form of src/runtime/memory.asm (WITHOUT_VECTOR_REGISTERS): general registers, rep movsb and rep stosb only.

4. The compositor

The compositor draws each frame of the screen. This table says, for each kind of work of a frame, which form does it:

Work of a frameForm
The copy of the background and of a surface into the frame, and of the frame into the screencopy_bytes_without_overlap of src/runtime/memory.asm: already vector moves
The swap of red and blue when the screen is blue-green-redthe compiler makes it a vector loop (psrld $0x10, pand, por on 16 bytes, in entry of the compositor)
The blend of the pointer picture (blend_premultiplied_alpha)SSE2 form, blend_premultiplied_alpha_row_sse2
Opaque rectangles on whole pixels (Rectangle records), opaque gradients down (a fill for each line)graphics.fill: a vector loop of the compiler
Rectangles inside the pixels: at most nine parts, each of one covered alphaSSE2 form, blend_straight_alpha_row_sse2, one blend_fill for each part: no coverage is computed for each pixel
Gradients across (one row of colors for each span of rows) and at an angle (one row for each line)the row of colors is scalar: the level of each pixel, one division, and its mix; an opaque gradient across covered whole copies its row into each line (copy_bytes_without_overlap), else the SSE2 form blends the row, and a group of four opaque colors is a store
Rectangles, gradients and pictures with alpha (graphics.blend_fill, graphics.blend_copy)SSE2 form, blend_straight_alpha_row_sse2
A text with alphathe blend of a glyph with each coverage times the alpha: SSE2 form blend_coverage_row_sse2, and the blend tables, which the scaled coverage reads; Spleen and the replacement box blend each pixel of ink with blend_fill

The blend of the pointer picture. A pointer picture has one alpha for each pixel, premultiplied (Pointer pictures: The format of the system: one pointer theme file). For each channel, with d the pixel and a the alpha of the source:

  • t = d * (255 - a) + 128, then (t + t >> 8) >> 8: a division by 255 that is exact for each 16-bit product.
  • The SSE2 form computes each channel in its own lane of 16 bits. The scalar form computes red and blue in two lanes of 16 bits of one word, and green alone: the lanes have the same values.
  • The source is then added as words of 32 bits, as in the scalar form: a source that is not premultiplied carries from one channel into the next in both forms. The validation of a pointer theme file refuses such a pixel, so the compositor never draws one.
  • A group of four transparent pixels is not read. A source with alpha 255 needs no case of its own in the SSE2 form: 255 - a is 0, and the result is the source without its alpha.

5. BLAKE3 (src/library/modus/contract/blake3)

Where the hash runs. The root service checks the hash of each resource before it gives it to a process, and the loader checks the hash of each module that it loads. The hash of a module is its identity, so every start of a process pays this cost.

How BLAKE3 cuts its input. The input is cut in chunks of 1024 bytes. Each chunk gives a chaining value of 8 words, and the chaining values are joined two by two in a tree, up to the root. The chunks do not depend on each other: several can be compressed at the same time.

The form is the one of the reference implementation of BLAKE3 for many chunks: the chunks of a subtree side by side, one chunk in each lane. The other candidate, the compression of one block of one chunk with the 16 words in 4 vectors (one row in each), gives less: the message words must be moved between lanes at each round.

  • src/library/modus/contract/blake3/chunks_side_by_side_amd64.odin (four_chunk_values_side_by_side): the 16 words of the state of 4 chunks in 16 vectors of 4 words. A round is the 8 mixes of the scalar form, each on whole vectors (mix_lanes). The words of a block of the 4 chunks are turned with a transpose of 4 x 4 words (shuffles). The counter of each chunk is computed for each lane in 64 bits, so a low word that passes 2^32 between two lanes is right.
  • subtree_value takes this path for a subtree of exactly 4 chunks. The left part of a tree is always a power of two of whole chunks, so every input of more than 4096 bytes has such subtrees. The parents of the chunk values are the scalar form.
  • Scalar: an input of 4096 bytes or less, the last part of a tree that is not a power of two of chunks, the parents, the root.

blake3.hash and blake3.subtree_chaining_value take the SSE2 form on amd64 with no parameter of the caller. The host tests reach both forms through hash_in_form, which is private to the package.

The rotations by 16, 12, 8 and 7 bits are written as two shifts and an or (rotate_lanes_right); the compiler can write the rotation by 16 as shuffles of 16-bit lanes. The object code is not read yet.

6. The check of a text (src/library/modus/contract/text_encoding)

Where the check runs. Each border that takes a text from another party calls text_valid: the palette table, a store name, a history file, a paste, a display text. The rule is UTF-8 with no control character (Text encoding: UTF-8 in every contract in the repository).

The form is the algorithm of John Keiser and Daniel Lemire, "Validating UTF-8 In Less Than One Instruction Per Byte" (2021), with comparisons in place of its three lookups in tables of 16 bytes: SSE2 has no such lookup. The design and the measure that chose it: The check of a text, sixteen bytes at a time in the repository.

  • text_valid_sixteen_bytes_at_a_time: a group of 16 bytes and the group before it. A group of ASCII checks only its controls. Another group checks the count of continuations after each lead, the leads that start nothing, the bounds of the second byte after E0, ED, F0 and F4, and the controls.
  • The last bytes, fewer than 16, are copied into a group of spaces and checked as a group: no load reads past the slice.
  • The form stops at the first group with an error.

Three differences from the other vector forms.

  • The source has no _amd64 suffix and text_valid calls it on each target: each of its operations (compares, saturating subtraction, shuffles by constant places, the mask of bit 7) compiles for each vector unit. Some take more than one instruction: SSE2 has no unsigned compare of bytes, and NEON has no mask of bit 7.
  • The last bytes go through the vector form, in a group of spaces, not through the scalar form.
  • The kernel compiles the package in and calls none of it: it replaces invalid sequences with invalid_sequences_replace, which is scalar. The build refuses a vector instruction in the kernel.

The host tests (text_valid_sixteen_bytes_at_a_time_test.odin): each length around a group (0, 1, 15, 16, 17, 31, 32, 33, 47, 48, 49, 63, 64) with a control at the end; each valid and refused sequence at each place of texts of each length up to 50, so each sequence crosses each boundary of a group at each of its bytes; a sequence cut by the end of the slice; slices that start at each place 1 to 15 of a larger buffer; each window of three bytes at the places 13, 14 and 15 of a text of 32 bytes, one window in 251 in each run and all 2^24 with -define:EXHAUSTIVE=true (8 s with no optimisation); each lead F0 to F4 at the places 12 to 15 with each second byte and the edge classes of the third and fourth bytes; a lead cut at the end of a group that is not ASCII, before groups of ASCII and with no last bytes; and 400 000 random texts of 0 to 300 bytes (random bytes, edge bytes, valid texts, valid texts with one, two or three bytes changed, inserted or removed) against the scalar form, with a fixed seed that the failure prints. The fuzz target text_encoding compares the two forms too.

The measure on the host, with the target of a module. The test is opt-in: it runs only with -define:MEASURE=true. It prints the time of each form, and fails only when the forms give different answers:

nix develop -c odin test src/library/modus/contract/text_encoding -o:speed -microarch:x86-64 -vet -collection:modus=src/library/modus -define:MEASURE=true -define:ODIN_TEST_NAMES=text_encoding.text_valid_speed_of_each_form

The numbers of the last measure, with a load of 1.7, the least of 5 runs:

TextScalar formVector form
ASCII, 64 bytes482 MiB/s11 505 MiB/s
ASCII, 4 KiB482 MiB/s17 316 MiB/s
ASCII, 1 MiB480 MiB/s17 742 MiB/s
French and CJK, 63 bytes591 MiB/s3 243 MiB/s
French and CJK, 4 KiB609 MiB/s5 891 MiB/s
French and CJK, 1 MiB341 MiB/s5 949 MiB/s
Random bytes, 64 bytes, refused4.6 ns4.0 ns

7. How to measure on the machine

A measure is a line that a process of the system writes on the log. Each command runs the main machine test; each line is in build/test_output.txt. A measure is valid when uptime shows a load under 8. No test fails on a time: a measure is printed, never asserted (Developer tools: The bounds of the tests).

flock -o <the lock of the worktree> nix develop -c modustool test main
grep "vector_glyphs: one glyph" build/test_output.txt
grep "compositor: the blend of the arrow" build/test_output.txt
grep "root: the resource font_outlines" build/test_output.txt
LineThe numberThe scalar form
vector_glyphs: one glyph ...after "from the private glyph cache:": one glyph in ns, the least of 50 batches; after "Spleen 8x16:": one glyph of Spleen309 ns from the glyph cache of the boot image before it left, Spleen 35 ns (The text of the system: a vector font with subpixel bands: The glyph cache)
compositor: the blend of the arrow of 32x32 ...the blend of the arrow in ns, and a copy of the same size824 to 1008 ns, a copy 151 to 153 ns

On the host, with the optimisation of a module. Each test prints the time of each form, and fails only when the forms give different bytes:

nix develop -c odin test src/library/modus/graphics -o:speed -vet -collection:modus=src/library/modus -define:ODIN_TEST_NAMES=graphics.glyph_draw_cost_of_each_form
nix develop -c odin test src/library/modus/contract/blake3 -o:speed -vet -collection:modus=src/library/modus -define:ODIN_TEST_NAMES=blake3.hash_cost_of_each_form
nix develop -c odin test src/library/modus/line_editor -o:speed -microarch:x86-64 -vet -collection:modus=src/library/modus -define:MEASURE=true -define:ODIN_TEST_NAMES=line_editor.fuzzy_match_speed_of_each_form

graphics.text_speed_of_each_blend gives the time of one glyph with the blend table, with the SSE2 form alone and with the scalar form alone, in the same way.

8. Limits

9. The 16-tag group match

What it is. A Swiss table (src/library/modus/hash_table; intent in Swiss tables and the fast hash in the repository) groups 16 slots together with 16 consecutive 1-byte control tags (Empty = 0x00, Deleted = 0x01, or full 0x80 | (hash & 0x7F)). Each probe step tests all 16 control bytes of a group at once and returns a 16-bit mask where bit i marks lane i.

The SSE2 form (src/library/modus/hash_table/group_match_amd64.odin) loads 16 control bytes as #simd[16]u8 and uses base:intrinsics only:

OperationIntrinsicsLowered SSE2 instructions
group_match_tag_sse2(controls, tag)unaligned_load, simd_lanes_eq, simd_extract_msbsmovdqu, pcmpeqb, pmovmskb
group_match_empty_sse2(controls)unaligned_load, simd_lanes_eq against 0x00, simd_extract_msbsmovdqu, pxor, pcmpeqb, pmovmskb
group_match_free_sse2(controls)unaligned_load, ~simd_extract_msbs (bit 7 clear)movdqu, pmovmskb, not

The public procedures (group_match_tag, group_match_empty, group_match_free in group_match.odin) pick the SSE2 form on amd64 and the scalar loops on other targets. The host test group_forms_give_the_mask_of_the_scalar_form compares all three SSE2 procedures against their scalar forms for every byte value 0..255 in each of the 16 lanes and for uniform edge groups (0x00, 0x01, 0x7F, 0x80, 0xFF).

How to measure on the host. Both timing tests are opt-in (-define:MEASURE=true) and require -o:speed -microarch:x86-64:

nix develop -c odin test src/library/modus/hash_table -o:speed -microarch:x86-64 -vet -collection:modus=src/library/modus -define:MEASURE=true -define:ODIN_TEST_NAMES=hash_table.lookup_cost_against_the_chained_table
nix develop -c odin test src/library/modus/fast_hash -o:speed -microarch:x86-64 -vet -collection:modus=src/library/modus -define:MEASURE=true -define:ODIN_TEST_NAMES=fast_hash.hash_cost_of_short_keys

Measured on the host (-o:speed -microarch:x86-64, host load 3.71, least of 15 rounds for hash_table, least of 20 batches of 100 000 for fast_hash):

Table size (entries)Random hitRandom missGlyph hitGlyph miss
161.46 ns (687 million/s)1.29 ns (776 million/s)1.36 ns (736 million/s)1.17 ns (855 million/s)
1 0002.21 ns (452 million/s)1.82 ns (549 million/s)1.91 ns (524 million/s)2.10 ns (476 million/s)
4 0962.06 ns (485 million/s)1.70 ns (589 million/s)2.07 ns (482 million/s)1.28 ns (780 million/s)
100 0004.11 ns (243 million/s)5.88 ns (170 million/s)3.43 ns (292 million/s)1.89 ns (530 million/s)
Key length (fast_hash, rapidhash V3)Time for one hashRate
8 bytes2.68 ns373 million/s
16 bytes2.68 ns373 million/s
32 bytes3.71 ns270 million/s
64 bytes6.19 ns162 million/s

10. The fuzzy match

Where it runs. The console completion and the ranking thread of the palette match each candidate name against the typed query (fuzzy_match, rank_candidates). The scoring rule is in The line of the console: The fuzzy match, and the design is in The fuzzy match and the frecency in the repository.

The portable vector form is fuzzy_match_vectors in src/library/modus/line_editor/fuzzy_match_vectors.odin. It uses #simd[16]u8 vectors and base:intrinsics only, so it compiles on every architecture without a target guard: SSE2 on x86-64, NEON on ARM64.

  • Blocks of 16 bytes. The name is read in at most 8 blocks (NAME_SCAN_LIMIT = 128). A partial last block is copied into zeros so no load reads past the slice of the caller.
  • ASCII check. All blocks are OR-ed and simd_extract_msbs checks bit 7. Any name or query with a byte past ASCII falls back to fuzzy_match_scalar.
  • Lowering in lanes. A to Z become a to z, and control bytes (< 0x20 or 0x7F) become 0x80 (CONTROL_MARK), matching how the scalar form decodes them as the replacement character.
  • Bitmask prefilter and two passes. For each query character, comparing against each lowered block and extracting MSBs yields one u128 mask (clipped to the length of the name). A zero mask above the previous position stops the match at once. The forward pass takes count_trailing_zeros to find the earliest end; the backward pass takes count_leading_zeros to find the latest start of the shortest window.

Verification. vector_form_at_the_edges tests empty inputs, block borders (15, 16, 17, 31, 32, 33 bytes), scan and query bounds (64/65 and 127/128/129 bytes), zero bytes against padding, control bytes, and non-ASCII UTF-8. vector_form_gives_the_result_of_the_scalar_form compares fuzzy_match_vectors against fuzzy_match_scalar on 200 000 deterministic cases (seed 0x9E3779B97F4A7C15), checking exact equality of matched, score, and places.

Host measure (-o:speed -microarch:x86-64 -define:MEASURE=true, host load 6.90, four queries over realistic exports, module names, and file paths):

CandidatesQuery (matches)Scalar (M names/s)Vector (M names/s)Speedup
100mcnt (5)8.460.67.2x
100stwr (9)8.751.96.0x
100srclinedit (0)7.652.16.8x
100zqj (0)8.053.06.7x
10 000mcnt (1130)7.435.74.8x
10 000stwr (472)7.036.55.2x
10 000srclinedit (59)5.832.45.6x
10 000zqj (0)8.166.28.2x
100 000mcnt (11 419)8.037.74.7x
100 000stwr (4894)7.435.74.9x
100 000srclinedit (606)6.834.35.1x
100 000zqj (0)8.764.97.5x

11. The triangles of the WebGPU subset

Where it runs. software_3d_execute draws the triangles of a command stream of the WebGPU subset on the processor, in 2D (Solid_Color_2D) and in 3D (Vertex_Color_3D) (The access to a GPU for acceleration: The WebGPU of the system in the repository). The design of the step is in From the desktop of today to a light web browser: SIMD on the hot paths in the repository.

The first form of floats. Each other vector form computes with integers. The rasterizer computes with f32, and it keeps the rule of the same bytes in this way:

  • Each lane does the operations of the scalar form, in the same order: the edge functions, the barycentric weights, the depth, 1 / w and the four channels corrected for perspective. An addition and a multiplication of IEEE 754 give the same bits in a lane as in a scalar register. The compiler fuses no multiplication and addition without a flag that allows it, and the build gives none: the host tests pass in a build for a processor with FMA (-microarch:native).
  • The product of an edge function that depends on the row only is computed once for each row, as a scalar. This product is the same value that the scalar form computes at each pixel.
  • The test of the top-left rule is written as the refusal of the scalar form (w < 0, or w == 0 on an edge that is not top or left), not as its negation. A NaN fails both comparisons, so both forms keep such a pixel.
  • A lane that is refused divides 1 by 1, so no lane divides by zero. The form never reads the value of a refused lane.
PartForm
The setup of a triangle: the order of the vertices, the area, the box clipped to the scissor rectangle, the top-left edgesscalar, once for each triangle, shared by the two forms (triangle_setup)
The three edge values of 4 adjacent pixelsvector, #simd[4]f32
The coverage test with the top-left rulevector: comparisons and masks, no branch
A group of 4 pixels outside the triangleone test (simd_reduce_and), before the interpolation
The barycentric weights, the depth, 1 / w and the color and alpha corrected for perspectivevector
The depth test, the 24-bit depth and the blend in linear lightscalar, write_fragment_pixel, one pixel at a time in lane order
The last 0 to 3 columns of a rowthe scalar form, shade_triangle_pixel

The vector form writes each pixel through write_fragment_pixel, as the scalar form does. So no load and no store passes the slice of the caller, and the blend of a pixel reads the result of the pixel before it, in the same order as the scalar form.

The host tests (src/library/modus/contract/webgpu_subset/rasterizer_forms_test.odin) run each stream in each form through software_3d_execute_in_form, which is private to the package. They compare each color byte, each depth value and the summary (pixels_shaded, triangles_rasterized). The textures start with the same random content, so a pass with Load_Op.Load blends and tests depth over it. Each test runs the widths 1, 3, 5, 17, 63, 64 and 65 and the formats RGBA8_Unorm, BGRA8_Unorm and R8_Unorm:

  • cube_forms_give_the_same_bytes: a cube of 12 triangles, turned and seen in perspective, with its 24-bit depth buffer, at 8 angles, at heights of 1 and 37, with Clear and Load.
  • blended_triangle_forms_give_the_same_bytes: 6 translucent 3D triangles that overlap, Src_Alpha and One_Minus_Src_Alpha, with alphas from below 0 to above 1, vertices behind the eye, with and without a depth buffer.
  • shared_edge_forms_shade_each_pixel_once: a fan whose edges pass through pixel centers, a square cut on its diagonal, and a grid of moved points that covers the whole picture. The test checks that the count of shaded pixels equals the count of pixels and that no pixel keeps the clear color: no crack and no pixel shaded twice.
  • edge_case_forms_give_the_same_bytes: random triangles from far off the screen, scissor rectangles, a repeated vertex, three points on a line, an area at the bound of a degenerate triangle, tiny triangles, places of 10^7 pixels, vertices on pixel centers and corners, and triangle strips.

A test that fails gives the first wrong byte or depth value and the value of each form. A change of the order of one sum of the vector form, or a top-left rule that is not applied, makes these tests fail.

The measure on the host. The test is opt-in: it runs only with -define:MEASURE=true. It prints the time of a frame of a cube that fills most of a picture of 640 x 480 in each form, and fails only when the forms shade a different count of pixels:

nix develop -c odin test src/library/modus/contract/webgpu_subset -o:speed -microarch:x86-64 -vet -collection:modus=src/library/modus -define:MEASURE=true -define:ODIN_TEST_NAMES=webgpu_subset.cube_speed_of_each_form

The last run had a host load of 13, above the limit of 8. So these times rank the forms and are not valid measures of speed. One frame of 197 328 pixels, the least of 5 runs of 60 frames:

FormatScalar formVector form
RGBA8_Unorm17.9 ms16.8 ms
BGRA8_Unorm22.7 ms14.2 ms
R8_Unorm16.4 ms12.7 ms

Most of the time of a pixel is in write_fragment_pixel: the square root of the encoding of each channel takes four divisions. That part is still scalar.

blend_coverage_row_in_order procedure of the package graphics

blend_coverage_row_in_order :: #force_inline proc "contextless" (line: [^]Color, words: [^]u32, first, last: int, color: Color, $ORDER: Subpixel_Order, square_root: ^[4096]u8, alpha: u32 = OPAQUE) #no_bounds_check

blend_coverage_row_in_order is the scalar form, for one order of the.

src/library/modus/graphics/blend.odin:155

blend_coverage_row_sse2 procedure of the package graphics

blend_coverage_row_sse2 :: proc "contextless" (line: [^]Color, words: [^]u32, first, last: int, color: Color, $ORDER: Subpixel_Order, square_root: ^[4096]u8, alpha: u32 = OPAQUE) #no_bounds_check

blend_coverage_row_sse2 is the SSE2 form of blend_coverage_row_in_order:.

src/library/modus/graphics/blend_vectors_amd64.odin:201

blend_straight_alpha_row_scalar procedure of the package graphics

blend_straight_alpha_row_scalar :: proc "contextless" (to: [^]Color, from: [^]u32, count: int, square_root: ^[4096]u8) #no_bounds_check

blend_straight_alpha_row_scalar is the scalar form: count colors of from,.

src/library/modus/graphics/blend.odin:274

blend_straight_alpha_row_sse2 procedure of the package graphics

blend_straight_alpha_row_sse2 :: proc "contextless" (to: [^]Color, from: [^]u32, count: int, square_root: ^[4096]u8) #no_bounds_check

blend_straight_alpha_row_sse2 is the SSE2 form of.

src/library/modus/graphics/blend_vectors_amd64.odin:263

blend_premultiplied_alpha_row_scalar procedure of the package graphics

blend_premultiplied_alpha_row_scalar :: proc "contextless" (to: [^]Color, from: [^]u32, count: int)

blend_premultiplied_alpha_row_scalar is the scalar form of one row: count.

src/library/modus/graphics/blend.odin:64

blend_premultiplied_alpha_row_sse2 procedure of the package graphics

blend_premultiplied_alpha_row_sse2 :: proc "contextless" (to: [^]Color, from: [^]u32, count: int) #no_bounds_check

blend_premultiplied_alpha_row_sse2 is the SSE2 form of.

src/library/modus/graphics/blend_vectors_amd64.odin:316

chunk_value procedure of the package blake3

chunk_value :: proc "contextless" (chunk: []u8, chunk_counter: u64, last_flags: Flags) -> [8]u32

chunk_value gives the chaining value of one chunk of at most CHUNK_SIZE bytes.

src/library/modus/contract/blake3/blake3.odin:272

four_chunk_values_side_by_side procedure of the package blake3

four_chunk_values_side_by_side :: proc "contextless" (input: []u8, chunk_counter: u64) -> (values: [4][8]u32) #no_bounds_check

four_chunk_values_side_by_side gives the chaining values of the four whole.

src/library/modus/contract/blake3/chunks_side_by_side_amd64.odin:33

text_valid_byte_by_byte procedure of the package text_encoding

text_valid_byte_by_byte :: proc "contextless" (bytes: []u8) -> bool

text_valid_byte_by_byte is the scalar form of text_valid: it reads one.

src/library/modus/contract/text_encoding/text_encoding.odin:143

text_valid_sixteen_bytes_at_a_time procedure of the package text_encoding

text_valid_sixteen_bytes_at_a_time :: proc "contextless" (bytes: []u8) -> bool

text_valid_sixteen_bytes_at_a_time gives the answer of.

src/library/modus/contract/text_encoding/text_valid_sixteen_bytes_at_a_time.odin:39

group_match_tag_scalar procedure of the package hash_table

group_match_tag_scalar :: proc "contextless" (controls: ^[GROUP_WIDTH]u8, tag: u8) -> (mask: u16)

A procedure with no comment in its source.

src/library/modus/hash_table/group_match.odin:39

group_match_empty_scalar procedure of the package hash_table

group_match_empty_scalar :: proc "contextless" (controls: ^[GROUP_WIDTH]u8) -> (mask: u16)

A procedure with no comment in its source.

src/library/modus/hash_table/group_match.odin:48

group_match_free_scalar procedure of the package hash_table

group_match_free_scalar :: proc "contextless" (controls: ^[GROUP_WIDTH]u8) -> (mask: u16)

A procedure with no comment in its source.

src/library/modus/hash_table/group_match.odin:57

group_match_tag_sse2 procedure of the package hash_table

group_match_tag_sse2 :: #force_inline proc "contextless" (controls: ^[GROUP_WIDTH]u8, tag: u8) -> u16

A procedure with no comment in its source.

src/library/modus/hash_table/group_match_amd64.odin:15

group_match_empty_sse2 procedure of the package hash_table

group_match_empty_sse2 :: #force_inline proc "contextless" (controls: ^[GROUP_WIDTH]u8) -> u16

A procedure with no comment in its source.

src/library/modus/hash_table/group_match_amd64.odin:21

group_match_free_sse2 procedure of the package hash_table

group_match_free_sse2 :: #force_inline proc "contextless" (controls: ^[GROUP_WIDTH]u8) -> u16

A procedure with no comment in its source.

src/library/modus/hash_table/group_match_amd64.odin:27

fuzzy_match_scalar procedure of the package line_editor

fuzzy_match_scalar :: proc "contextless" (query: string, name: string) -> (score: int, places: Match_Places, matched: bool)

fuzzy_match_scalar is the reference form of fuzzy_match: it decodes the.

src/library/modus/line_editor/fuzzy_match.odin:104

fuzzy_match_vectors procedure of the package line_editor

fuzzy_match_vectors :: proc "contextless" (query: string, name: string) -> (score: int, places: Match_Places, matched: bool)

A procedure with no comment in its source.

src/library/modus/line_editor/fuzzy_match_vectors.odin:41

rasterize_triangle_scalar procedure of the package webgpu_subset

rasterize_triangle_scalar :: proc "contextless" (setup: ^Triangle_Setup, target: ^Fragment_Target) -> (pixels_shaded: u64)

rasterize_triangle_scalar is the reference form: one pixel at a time.

src/library/modus/contract/webgpu_subset/software_3d.odin:648

rasterize_triangle_simd procedure of the package webgpu_subset

rasterize_triangle_simd :: proc "contextless" (setup: ^Triangle_Setup, target: ^Fragment_Target) -> (pixels_shaded: u64)

rasterize_triangle_simd is the vector form: the edge values, the coverage.

src/library/modus/contract/webgpu_subset/software_3d.odin:696

coverage_forms_give_the_bytes_of_the_scalar_form procedure of the package graphics

coverage_forms_give_the_bytes_of_the_scalar_form :: proc(t: ^testing.T)

Every length from 0 to 67, every place of the words and of the pixels.

src/library/modus/graphics/blend_vectors_test_amd64.odin:231

coverage_forms_meet_each_channel_value procedure of the package graphics

coverage_forms_meet_each_channel_value :: proc(t: ^testing.T)

Each pixel value d and each coverage a of a channel, under colors with.

src/library/modus/graphics/blend_vectors_test_amd64.odin:286

premultiplied_forms_give_the_bytes_of_the_scalar_form procedure of the package graphics

premultiplied_forms_give_the_bytes_of_the_scalar_form :: proc(t: ^testing.T)

A procedure with no comment in its source.

src/library/modus/graphics/blend_vectors_test_amd64.odin:340

premultiplied_forms_meet_each_channel_value procedure of the package graphics

premultiplied_forms_meet_each_channel_value :: proc(t: ^testing.T)

Each alpha, each destination value, and source values with the edge.

src/library/modus/graphics/blend_vectors_test_amd64.odin:394

straight_alpha_forms_give_the_bytes_of_the_scalar_form procedure of the package graphics

straight_alpha_forms_give_the_bytes_of_the_scalar_form :: proc(t: ^testing.T)

The colors with straight alpha of the draw records: every length from 0.

src/library/modus/graphics/blend_vectors_test_amd64.odin:437

straight_alpha_forms_meet_each_channel_value procedure of the package graphics

straight_alpha_forms_meet_each_channel_value :: proc(t: ^testing.T)

Each alpha over each value of a pixel, with the edge values of a color:.

src/library/modus/graphics/blend_vectors_test_amd64.odin:502

coverage_forms_with_alpha_give_the_bytes_of_the_scalar_form procedure of the package graphics

coverage_forms_with_alpha_give_the_bytes_of_the_scalar_form :: proc(t: ^testing.T)

The coverage of a text with alpha: the SSE2 form gives the bytes of the.

src/library/modus/graphics/blend_vectors_test_amd64.odin:100

sse2_form_gives_the_hash_of_the_scalar_form procedure of the package blake3

sse2_form_gives_the_hash_of_the_scalar_form :: proc(t: ^testing.T)

Every length from 0 to 67, the lengths at the edges of a chunk and of a.

src/library/modus/contract/blake3/chunks_side_by_side_test_amd64.odin:31

subtrees_side_by_side_at_each_counter procedure of the package blake3

subtrees_side_by_side_at_each_counter :: proc(t: ^testing.T)

The subtrees of four chunks at chunk counters where the low word of the.

src/library/modus/contract/blake3/chunks_side_by_side_test_amd64.odin:71

usable_instruction_sets procedure of the package instruction_sets

usable_instruction_sets :: proc "contextless" () -> Instruction_Sets

usable_instruction_sets reads the facts of the processor that runs it and.

src/library/modus/instruction_sets/instruction_sets.odin:220

EXTENDED_STATE_CAPACITY constant of the package kernel

EXTENDED_STATE_CAPACITY :: 2688

The area of one thread: the standard form of xsave, with x87, SSE, AVX.

src/modulus/extended_state.odin:24

blend_fill procedure of the package graphics

blend_fill :: proc "contextless" (canvas: Canvas, x, y, width, height: int, color: u32, square_root: ^[4096]u8)

blend_fill paints a rectangle in a color with straight alpha, 0xAARRGGBB,.

src/library/modus/graphics/blend.odin:217

coverage_with_alpha procedure of the package graphics

coverage_with_alpha :: #force_inline proc "contextless" (coverage, alpha: u32) -> u32

coverage_with_alpha gives round(coverage * alpha / 255) for a coverage and.

src/library/modus/graphics/blend.odin:128

coverage_scalar_form_reads_a_pixel_of_all_ones procedure of the package graphics

coverage_scalar_form_reads_a_pixel_of_all_ones :: proc(t: ^testing.T)

The scalar form once read the channels of a pixel 0xFFFFFFFF as 0: it took.

src/library/modus/graphics/blend_vectors_test_amd64.odin:329

blend_glyph_rows procedure of the package graphics

blend_glyph_rows :: proc "contextless" (canvas_row: [^]Color, stride: int, words: [^]u32, width, first_row, last_row, first, last: int, color: Color, order: Subpixel_Order, square_root: ^[4096]u8, tables: ^Blend_Tables, alpha: u32 = OPAQUE)

blend_glyph_rows draws the rows of a glyph with the fast blend: the same.

src/library/modus/graphics/blend.odin:370

copy procedure of the package graphics

copy :: proc "contextless" (canvas: Canvas, x, y: int, source: Canvas)

copy draws all of source at (x, y) of canvas.

src/library/modus/graphics/graphics.odin:126

copy_bytes_without_overlap procedure of the package lz4

copy_bytes_without_overlap :: #force_inline proc "contextless" (destination: [^]u8, source: [^]u8, count: int)

copy_bytes_without_overlap copies count bytes from source to destination.

src/library/modus/contract/lz4/lz4.odin:123

fill procedure of the package graphics

fill :: proc "contextless" (canvas: Canvas, x, y, width, height: int, color: Color)

fill paints a rectangle in one color, cut to the canvas.

src/library/modus/graphics/graphics.odin:58

blend_premultiplied_alpha procedure of the package graphics

blend_premultiplied_alpha :: proc "contextless" (canvas: Canvas, x, y: int, source: Canvas)

blend_premultiplied_alpha draws source over canvas at (x, y), cut to the.

src/library/modus/graphics/blend.odin:38

blend_copy procedure of the package graphics

blend_copy :: proc "contextless" (canvas: Canvas, x, y: int, source: Canvas, square_root: ^[4096]u8)

blend_copy draws all of source at (x, y) of canvas, cut to the canvas,.

src/library/modus/graphics/blend.odin:244

mix_lanes procedure of the package blake3

mix_lanes :: #force_inline proc "contextless" (state: ^[16]Four_Words, a, b, c, d: int, x, y: Four_Words)

mix_lanes is mix of the scalar form, in each lane.

src/library/modus/contract/blake3/chunks_side_by_side_amd64.odin:129

subtree_value procedure of the package blake3

subtree_value :: proc "contextless" (input: []u8, chunk_counter: u64, side_by_side: bool) -> [8]u32

subtree_value gives the chaining value of a subtree that is not the root.

src/library/modus/contract/blake3/blake3.odin:218

hash procedure of the package blake3

hash :: proc "contextless" (input: []u8) -> Hash

hash gives the BLAKE3 hash of input.

src/library/modus/contract/blake3/blake3.odin:58

subtree_chaining_value procedure of the package blake3

subtree_chaining_value :: proc "contextless" (input: []u8, chunk_counter: u64) -> Chaining_Value

subtree_chaining_value gives the chaining value of a part of an input that.

src/library/modus/contract/blake3/blake3.odin:178

hash_in_form procedure of the package blake3

hash_in_form :: proc "contextless" (input: []u8, side_by_side: bool) -> Hash

hash_in_form gives the hash with the chunks of each subtree of four chunks.

src/library/modus/contract/blake3/blake3.odin:102

rotate_lanes_right procedure of the package blake3

rotate_lanes_right :: #force_inline proc "contextless" (value: Four_Words, $COUNT: u32) -> Four_Words

A procedure with no comment in its source.

src/library/modus/contract/blake3/chunks_side_by_side_amd64.odin:141

text_valid procedure of the package text_encoding

text_valid :: proc "contextless" (bytes: []u8) -> bool

text_valid says if a text has no invalid sequence: the check of a text at a border.

src/library/modus/contract/text_encoding/text_encoding.odin:136

invalid_sequences_replace procedure of the package text_encoding

invalid_sequences_replace :: proc "contextless" (bytes: []u8)

invalid_sequences_replace writes "?" in place of each byte of each invalid sequence of a.

src/library/modus/contract/text_encoding/text_encoding.odin:202

text_speed_of_each_blend procedure of the package graphics

text_speed_of_each_blend :: proc(t: ^testing.T)

The time of one glyph at scale 1 of Paper Mono in each blend, over a.

src/library/modus/graphics/blend_vectors_test_amd64.odin:709

group_match_tag procedure of the package hash_table

group_match_tag :: #force_inline proc "contextless" (controls: ^[GROUP_WIDTH]u8, tag: u8) -> u16

group_match_tag gives the control bytes equal to a tag: the full slots.

src/library/modus/hash_table/group_match.odin:11

group_match_empty procedure of the package hash_table

group_match_empty :: #force_inline proc "contextless" (controls: ^[GROUP_WIDTH]u8) -> u16

group_match_empty gives the empty slots: a slot that no key took since.

src/library/modus/hash_table/group_match.odin:21

group_match_free procedure of the package hash_table

group_match_free :: #force_inline proc "contextless" (controls: ^[GROUP_WIDTH]u8) -> u16

group_match_free gives the slots that an insert can take: empty or.

src/library/modus/hash_table/group_match.odin:31

fuzzy_match procedure of the package line_editor

fuzzy_match :: #force_inline proc "contextless" (query: string, name: string) -> (score: int, places: Match_Places, matched: bool)

fuzzy_match matches a query against a name.

src/library/modus/line_editor/fuzzy_match.odin:97

rank_candidates procedure of the package line_editor

rank_candidates :: proc "contextless" (query: string, candidates: []Candidate, ranked: []Ranked, skip_equal_names := false) -> (kept: int, matched: int)

rank_candidates matches the query against each candidate (at most.

src/library/modus/line_editor/fuzzy_match.odin:244

CONTROL_MARK constant of the package line_editor

CONTROL_MARK :: 0x80

The scalar form decodes each control character as the replacement.

src/library/modus/line_editor/fuzzy_match_vectors.odin:29

count_leading_zeros procedure of the package virtual_interrupt_controller

count_leading_zeros :: #force_inline proc "contextless" (word: u64) -> u64

A procedure with no comment in its source.

src/modulus/virtual_interrupt_controller/virtual_interrupt_controller.odin:114

software_3d_execute procedure of the package webgpu_subset

software_3d_execute :: proc "contextless" (stream: Gpu_Command_Stream, device: Software_Device) -> (summary: Software_Execution_Summary, refusal: Gpu_Refusal)

software_3d_execute validates and executes a WebGPU subset command stream on.

src/library/modus/contract/webgpu_subset/software_3d.odin:1014

triangle_setup procedure of the package webgpu_subset

triangle_setup :: proc "contextless" (v0_in, v1_in, v2_in: Screen_Vertex, scissor_x0, scissor_y0, scissor_x1, scissor_y1: i32) -> (setup: Triangle_Setup, ok: bool)

triangle_setup orders the vertices for a positive area and clips the box of.

src/library/modus/contract/webgpu_subset/software_3d.odin:556

write_fragment_pixel procedure of the package webgpu_subset

write_fragment_pixel :: proc "contextless" (color_bytes: []u8, depth_values: []u32, has_depth: bool, format: Texture_Format, pipeline: Pipeline_Desc, pixel_index: int, z: f32, src_r, src_g, src_b, src_a: f32) -> bool

A procedure with no comment in its source.

src/library/modus/contract/webgpu_subset/software_3d.odin:380

shade_triangle_pixel procedure of the package webgpu_subset

shade_triangle_pixel :: proc "contextless" (setup: ^Triangle_Setup, target: ^Fragment_Target, px: i32, cy: f32, row_base: int) -> bool

shade_triangle_pixel is the scalar form for one pixel: the reference of the.

src/library/modus/contract/webgpu_subset/software_3d.odin:610

software_3d_execute_in_form procedure of the package webgpu_subset

software_3d_execute_in_form :: proc "contextless" (stream: Gpu_Command_Stream, device: Software_Device, form: Rasterizer_Form) -> (summary: Software_Execution_Summary, refusal: Gpu_Refusal)

software_3d_execute_in_form lets the host tests run one stream in each form.

src/library/modus/contract/webgpu_subset/software_3d.odin:1021