vyre-libs 0.7.2

vyre Category A library ecosystem - pure-IR compositions over foundation IR and primitive-owned kernels
Documentation
# vyre-libs

Category A composition ecosystem over vyre's hardware-intrinsic
primitives. Every function here returns a `vyre::Program` (or a
list of `vyre::ir::Node` a consumer can embed in a larger Program)
built entirely from existing vyre-ops primitives. No shader source,
no new `inventory::submit!`, no backend-specific code.

## Modules

- `vyre_libs::math`: linear algebra, scans, broadcasts
- `vyre_libs::nn`: neural-net primitives (linear, ReLU, softmax,
  layer_norm, attention)
- `vyre_libs::matching`: string scanning (substring, DFA, multi-string): one building block inside arbitrary programs
- `vyre_libs::crypto`: hashing (FNV-1a, BLAKE3, SHA-256, CRC32)

## Design

Every public function wraps its IR body in a `Node::Region` with a
stable generator name. The optimizer treats Regions as opaque by
default (preserves source-mapping + debuggability); explicit inline
passes can unroll. This is LLVM's function-vs-always-inline split at
IR level.

One crate with four public modules today; each module promotes to
its own crates.io identity (`vyre-nn`, `vyre-math`,
`vyre-crypto`) when its consumer base justifies the fragmentation.

## Usage

```rust
use vyre_libs::math::dot;

let program = dot("x", "y", "result");
```

Production callers place library programs in a validated `ProgramGraph` and
execute them through the compiler artifact lifecycle.

## Bounded regex replay

Open-ended regexes need a finite accelerator work bound. Set that bound when
you compile the pipeline:

```rust
use vyre_libs::matching::{
    build_regex_dfa_pipeline_with_policy, RegexReplayPolicy,
};

let pipeline = build_regex_dfa_pipeline_with_policy(
    &[r"token=[0-9a-f]+"],
    4096,
    16_384,
    RegexReplayPolicy {
        open_ended_limit_bytes: 16 * 1024,
    },
)?;
```

The limit applies to each candidate origin. Bounded patterns use their exact
maximum. Open-ended patterns expose `max_bytes = None` and the selected finite
limit through `CompiledRegexSet::pattern_extents`. The whole-buffer program
derives each match start from its replay origin, so variable-length matches do
not subtract a guessed maximum from the end. Region evidence returns one
longest match for each pattern and origin.

## Multi-device paged scans

Use `scan_sharded_fused_weighted_timed` when one corpus spans several
physical adapters. Pass one backend and one measured throughput weight per
adapter. The result is identical to the single-device paged scan.
`ShardedScanTiming` reports each adapter's windows, own bytes, wall time, and
device time. You can use those values to rebalance the next batch and to
separate kernel work from staging and host aggregation.

## Feature flags

```toml
[dependencies]
vyre-libs = { version = "0.1", default-features = false, features = ["nn"] }
```

- `math` (default): linear algebra
- `nn` (default, implies `math`): neural-net primitives
- `matching` (default): string scanning primitives
- `crypto` (default): hashing

## License

MIT OR Apache-2.0

<!-- BEGIN GENERATED CRATE CONTRACT -->
## Crate contract

This section is generated by `python3 scripts/crate_readmes.py --write` from
the crate manifest, release train, ownership registry, and crate-guide metadata.

### Purpose

Own product-facing Tier 3 program compositions built from neutral primitives and contracts.

### Boundaries

The `product-libraries` owner maintains this `libraries` crate at `vyre-libs`.
Its allowed internal production dependencies are: `vyre-foundation`, `vyre-primitives`, `vyre-spec`.
Any other normal or build dependency requires an ownership-registry change.

### Minimal real example

Run the checked-in behavior from `vyre-libs/examples/check_select1.rs`:

```console
CARGO_BUILD_JOBS=1 ./cargo_full run -p vyre-libs --example check_select1
```

### Features

- Manifest features: `bench`, `c-parser`, `cpu-parity`, `crypto`, `crypto-blake3`, `crypto-fnv`, `decode`, `default`, `full`, `go-parser`, `hash`, `intern`, `logical`, `matching`, `matching-dfa`, `matching-nfa`, `matching-regex`, `matching-substring`, `math`, `math-algebra`, `math-broadcast`, `math-linalg`, `math-scan`, `math-succinct`, `nn`, `nn-activation`, `nn-attention`, `nn-inference`, `nn-linear`, `nn-linear-4bit`, `nn-moe`, `nn-norm`, `parsing`, `python-parser`, `rule`, `security`, `test-fixtures`, `text`, `visual`
- Default feature members: `math-linalg`, `math-scan`, `math-broadcast`, `nn-activation`, `nn-linear`, `nn-norm`, `matching-substring`, `matching-dfa`, `hash`, `decode`

### Errors and unsupported behavior

Invalid shapes, unsupported compositions, arithmetic overflow, and malformed evidence are rejected by the builder or validator before dispatch.

### Testing

Use [`docs/testing/vyre-libs.md`](../docs/testing/vyre-libs.md) for exact commands, Cargo targets, hardware
requirements, evidence outputs, expected skips, and failure semantics.

### Release status

`vyre-libs@0.7.2` is a publishable crate on the current Vyre release train. Publication still requires the release evidence and user-approval gates.

### Ownership

`docs/CRATE_OWNERSHIP.toml` is authoritative for this crate's responsibility
and allowed internal edges. Regenerate `docs/CRATE_GRAPH.md` and
`docs/OWNERSHIP.md` after changing that registry.

### License

Licensed under either of

- Apache License, Version 2.0, or
- MIT license

at your option. See the workspace `LICENSE-APACHE` and `LICENSE-MIT` files.

<!-- END GENERATED CRATE CONTRACT -->