Skip to content

Add AVX-512 kernels (#850)#850

Open
terrelln wants to merge 9 commits into
facebook:devfrom
terrelln:export-D109893567
Open

Add AVX-512 kernels (#850)#850
terrelln wants to merge 9 commits into
facebook:devfrom
terrelln:export-D109893567

Conversation

@terrelln

@terrelln terrelln commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary:

Adds the AVX-512 implementations of the PivCo-Huffman encode and decode kernels and their generated lookup tables, and registers them with _select(), the header externs, and the kernel test suite.

Differential Revision: D109893567

@meta-codesync

meta-codesync Bot commented Jun 29, 2026

Copy link
Copy Markdown

@terrelln has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109893567.

terrelln added a commit to terrelln/openzl that referenced this pull request Jun 29, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the Huffman Pivoted encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from 59a4384 to 0380029 Compare June 29, 2026 18:32
@meta-codesync meta-codesync Bot changed the title Add AVX-512 kernels Add AVX-512 kernels (#850) Jun 29, 2026
terrelln added a commit to terrelln/openzl that referenced this pull request Jun 29, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the Huffman Pivoted encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from 0380029 to 499e104 Compare June 29, 2026 18:36
terrelln added a commit to terrelln/openzl that referenced this pull request Jun 29, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the Huffman Pivoted encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from 499e104 to 22bbdbb Compare June 29, 2026 18:43
terrelln added a commit to terrelln/openzl that referenced this pull request Jun 29, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the Huffman Pivoted encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from 22bbdbb to fcfe62d Compare June 29, 2026 19:01
terrelln added a commit to terrelln/openzl that referenced this pull request Jun 29, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the Huffman Pivoted encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from fcfe62d to abcf095 Compare June 29, 2026 19:51
terrelln added a commit to terrelln/openzl that referenced this pull request Jun 29, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the Huffman Pivoted encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from abcf095 to 675c258 Compare June 29, 2026 19:56
@terrelln terrelln closed this Jun 29, 2026
terrelln added 8 commits June 30, 2026 11:07
Differential Revision: D109877948
Differential Revision: D109877947
Summary:
Adds byte-aligned bit reservation and pop primitives to the FF bitstream, needed by the upcoming PivCo-Huffman kernels:

- `ZS_BitCStreamFF_reserveAlignedBits` / `ZS_BitCStreamFF_commitReservedBits` on the write side.
- `ZS_BitDStreamFF_popAlignedBits` on the read side, plus a `begin` cursor in `ZS_BitDStreamFF` so the reader can compute byte offsets.
- `ZS_BitDStreamFF_finish` now returns the number of bytes consumed.
- Hardens `ZS_BitCStreamFF_init`/`_finish`/`_flush` against small buffers by avoiding pointer arithmetic that could underflow.

Differential Revision: D109878843
Summary:
Introduces the architecture-specific kernel interface for the PivCo-Huffman codec along with a portable, correctness-oriented generic implementation and the kernel test suite.

- `arch/common_pivco_arch.h`: shared `ZL_PIVCO_HUFFMAN_SLOP` contract.
- `arch/{encode,decode}_pivco_arch.h`: the `ZL_PivCoHuffmanEncode` / `ZL_PivCoHuffmanDecode` function-pointer tables and the `_select()` dispatchers.
- `arch/{encode,decode}_pivco_arch.c`: the portable `_generic` implementation of every kernel (partition/pack on encode, merge/flat-depth on decode). `_select()` currently returns `_generic`; the SIMD kernels register themselves in later commits.
- `test_pivco_huffman.cpp`: the `PivCoHuffmanArchTest` suite that checks every supported kernel against an independent reference, parameterized over the registered architectures.

Differential Revision: D109878842
Summary: Adds `micro_pivco_huffman.cpp` and wires it into the micro benchmark harness (`micro_bench.{cpp,h}`) to measure the PivCo-Huffman encode/decode kernels.

Differential Revision: D110077474
Summary:
Implements the PivCo-Huffman kernel on top of the architecture kernel interface.

- `common_pivco_kernel.{h,c}`: the shared coding tree (`ZL_PivCoHuffmanTree`), `ZL_PivCoHuffman_computeTableLog`, rank/split helpers, and the block-size constants shared by both directions.
- `encode_pivco_kernel.{h,c}`: `ZL_PivCoHuffman_encode` plus its scratch/bound sizing.
- `decode_pivco_kernel.{h,c}`: `ZL_PivCoHuffman_decode` plus its scratch sizing.
- `test_pivco_huffman.cpp`: the `PivCoHuffmanKernelTest` cases exercising round-trips, multi-block and custom block sizes, tree construction, and corruption rejection through the kernel interface.

Differential Revision: D109882916
Summary:
Binds the PivCo-Huffman kernel into OpenZL as a real codec and registers it.

- `{encode,decode}_pivco_binding.{h,c}` and `graph_pivco_huffman.h`: the encoder/decoder transform bindings and the codec's graph definition.
- `zl_pivco_huffman.h` / `PivCoHuffman.hpp` / `Codecs.hpp`: the public C and C++ codec API.
- `zl_graphs.h`, `zl_public_nodes.h`, `private_nodes.h`, `wire_format.h`, `{encoder,decoder}_registry.c`, `graph_registry.c`: register the new node/graph and assign its wire-format id.
- `spec.md`: the on-wire format specification.
- `tests/registry/components/PivCoHuffman.cpp` and `OpenZLComponents.h`: integration coverage in the component registry.

Differential Revision: D109893484
Summary: Adds `scripts/gen_pivco_huffman_tables.py`, which renders the generated lookup-table headers consumed by the architecture-specific kernels (x86, neon, avx512). It is checked in ahead of the per-architecture kernels that include its output.

Differential Revision: D109893569
@terrelln terrelln reopened this Jun 30, 2026
Summary:
Pull Request resolved: facebook#850

Adds the AVX-512 implementations of the PivCo-Huffman encode and decode kernels and their `generated` lookup tables, and registers them with `_select()`, the header externs, and the kernel test suite.

Differential Revision: D109893567
@terrelln terrelln force-pushed the export-D109893567 branch from 675c258 to b078ca3 Compare June 30, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant