Skip to content

Packaging Improvements - #343

Merged
ashvardanian merged 6 commits into
mainfrom
main-dev
Oct 2, 2026
Merged

ashvardanian merged 6 commits into
mainfrom
main-dev

Conversation

@ashvardanian

Copy link
Copy Markdown
Owner

No description provided.

ashvardanian and others added 6 commits August 31, 2026 23:06
`sz_cap_rvvcrypto_k` was defined and probed as `Zvkned` plus `Zvknhb`, but the
GCM helpers in `cipher/rvvcrypto.h` reached past that pair for the `vghsh.vv`
and `vgmul.vv` of `Zvkg` whenever the baseline `-march` happened to name it.
Nothing certified that third extension, so a build configured
`-march=rv64gcv_zvkned_zvknhb_zvkg` emitted seven Galois-hash instructions
behind a capability that never asked whether the core had them.

The path was also dead everywhere it was safe. `__riscv_zvkg`, the macro the
helpers tested, comes from the command line and never from a target pragma,
while CMake and `build.rs` carry the extensions in the pragmas and stop the
baseline at `rv64gcv`. So every configuration either took the serial reduction
or was out of spec, and the vectorized one shipped to nobody.

Three resolutions were on the table: delete the vector path, give `Zvkg` its own
capability bit the way `neonaes` and `neonsha` split over NEON, or fold it into
the existing one. RVA23 settles it - the profile sells the NIST algorithms only
as `Zvkng`, which bundles GHASH with the AES and SHA-2 suites, and offers no
`Zvkn` or `Zvknc` option at all. A conformant part carrying the two extensions
this tier already required carries the third. Folding costs one bit test where a
separate capability would have cost a probe, an enum bit, dispatch plumbing, and
a second variant of every GCM entry point.

So the capability now covers all three, and the helpers call the intrinsics
unconditionally - no compile-time switch inside a kernel a runtime check has
already chosen. The reduction they used to fall back to stays commented beside
the vector form, for the part that ships `Zvkn` without the Galois hash and
would want its own capability. The compile probe exercises `vghsh` too, so a
toolchain that cannot emit it disables the tier at configure time, and
`build.rs` learns the same extension.

Built from the bare `rv64gcv` baseline both build systems produce,
`sz_aes256_gcm_encrypt_rvvcrypto` now emits 7 `vghsh`/`vgmul` beside its 42
`vaes*`, where it previously emitted none. Header-only builds naming all three
extensions produce identical counts, so the two paths no longer diverge.

Nothing in CI executes any of this yet; validating the tags against the serial
oracle needs a `qemu-riscv64 -cpu rv64,zvkned=true,zvknhb=true,zvkg=true` job.

Co-Authored-By: Matteo Forzan <[email protected]>
Wheels build with cibuildwheel 4.2 instead of 3.4.1, on macOS 26 and
Windows 2025 runners. Version 4 replaces the whole `environment` option
when `CIBW_ENVIRONMENT_LINUX` is set, so the job variables now reach
the containers through `environment-pass`, keeping the per-architecture
overrides intact. Windows keeps `repair-wheel-command` empty, since the
new `delvewheel` default would vendor `cudart64_12.dll` into the CUDA
wheel, and the CUDA Linux repair moves its libraries next to the
extension. The release step pins TinySemVer to v3 and pushes with the
repository token, so the version bump clears the `main*` ruleset.
A new release job builds CPython 3.13 and 3.14 wheels for Pyodide and
refuses any not tagged `pyemscripten_*_wasm32`, which PyPI would reject
file by file mid-upload. Under Emscripten the test runner calls pytest
in-process, since there is no `fork`, and the file-mapping test skips
where the platform maps no files. The Pyodide override zeroes the x86
and Arm tiers that `setup.py` would otherwise infer from the host.

RISC-V wheels so far shipped scalar code, because the RVV tier waited
on a vector baseline the `rv64gc` images never set. `setup.py` now
enables it on riscv64, and the manylinux leg builds with Clang, which
honours each kernel's `target("arch=+v")` while GCC ignores it; the
musl leg stays scalar. Both riscv64 images move to dated tags carrying
`patchelf` 0.19, as 0.17 corrupts RPATHs and the import dies with
SIGILL.
StringZilla ships only extension modules, so `find_packages()` could
only ever pick up folders that are not part of the library, `test/`
today. An explicit empty list keeps any future folder with an
`__init__.py` out of the wheels without an exclusion list to maintain,
and stops setuptools from falling back to its own discovery.

Co-authored-by: Junhyung Lee <[email protected]>
Co-authored-by: Ash Vardanian <[email protected]>
Reverse search sent every needle from 2 to 256 bytes through Horspool,
leaving the TODO slots for short needles empty. `sz_rfind_serial` now
dispatches 2, 3 and 4 byte needles to SWAR kernels that mirror the
forward ones, scanning 8 candidate offsets per word from the end and
taking the highest matching lane with `clz` instead of `ctz`. On a 1 MiB
haystack without a match, 2-byte needles go from 0.14 to 2.54 GB/s,
3-byte from 0.28 to 1.02 GB/s and 4-byte from 0.43 to 1.24 GB/s.

Closes #70

Co-Authored-By: Vladimir Babin <[email protected]>
The pre-release wheel jobs still installed 3.4.1 and set
`CIBW_ENVIRONMENT_LINUX`, which replaces the whole `environment` option,
so the riscv64 overrides never applied: GCC built the RVV kernels it
cannot target and the job failed. Both jobs now match the release
workflow, passing their variables through `environment-pass`, and a
pre-release Pyodide job builds the wheels the release would publish.
TinySemVer follows `@v3` in both workflows, and the PEP 783 tag check
matches the wheel name with a glob rather than parsing `ls`.
@ashvardanian
ashvardanian merged commit 82e1526 into main Oct 2, 2026
62 checks passed
sub4biz pushed a commit to sub4biz/StringZilla that referenced this pull request Nov 14, 2026
The 5.x line released v5.2.0 through v5.3.2 after 6.0 branched at
v5.1.2, and its public main ends at d0c8dea. Its fixes now hold on
6.0's code:

- Reverse searches with large limits no longer overflow (1b9b0a5, ashvardanian#347)
- Empty needles match in default string views (faf71d7, ashvardanian#346)
- `rpartition` puts the text last when the separator is missing
  (b128ed3, ashvardanian#356)
- `translate` writes into a reusable `out` buffer (e1d7b8c, ashvardanian#353)
- Byte argsort walks windows on a heap stack instead of recursing, so
  long shared prefixes no longer exhaust the call stack, and Haswell and
  NEON accept empty inputs (7deae1e, ashvardanian#344; 12d5f81)
- 2-4 byte needles search backward with SWAR (e94052b, ashvardanian#342)
- RISC-V GCM kernels dispatch only where Zvkg is present (2f78f25)
- Pyodide wheels and RISC-V wheel images (96c88fd, ashvardanian#343), and Python
  CI runs under the debug allocator (339f47a)

Already on 6.0's code: forward searches past the end (31e7c8c, ashvardanian#348)
and big-endian VSX byte sets (fcf768b, ashvardanian#360), both via 8f298ac, and
the test package's exclusion from wheels (fa427ac, ashvardanian#338). The CUDA
wheel, StringZillas scratch and tape-length fixes target code 6.0
replaced.

Unknown keyword arguments now raise `TypeError` in `split`, `splitlines`,
the strips, `decode`, the `String` constructor, `shuffled` and `sample`,
where `else if (PyErr_Format(...))` never returned and surfaced as
`SystemError`; porting `translate(out=)` exposed it.

Also folded: dead includes dropped from four tests.

Co-Authored-By: Guillaume de Rouville <[email protected]>
Co-Authored-By: Shai <[email protected]>
Co-Authored-By: Vladimir Iglovikov <[email protected]>
Co-Authored-By: Vladimir Babin <[email protected]>
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.

3 participants