Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ generated output directories. The first figure (1,500) was a guess before
the baker existed. The cap exists to prevent unbounded growth, not to freeze
a constant: raise the declared number in `config.ron` (and the mutation
fixture that names it) when a real kernel needs room. Exceeding the current
declared cap without that bump is a FAIL.
declared cap without that bump is a FAIL. `cargo xtask generate` writes the
checked-in baker generated module declared by `baker.generated`; the
`generated source` check re-renders it in memory and compares through
`text::read_text`.

`cargo xtask ci --profile release --nightly nightly-YYYY-MM-DD` is the
release-evidence mode: every check must run, a would-be `SKIP` is recorded as
Expand Down Expand Up @@ -215,6 +218,7 @@ bounded hosted subset is not the complete release evidence.
| Version or crate `publish` setting | Release process (`RELEASING.md`): root `Cargo.lock`, changelog heading date, `package.version` and `package.manifest.publish` in `xtask/config.ron`, and GitHub `Lifecycle`. README and crate-doc status already describe published `0.1.0` Active; do not revert them to incubating. Pin unpackaged guide URLs (README, `crates/surfaces/src/lib.rs`, `crates/surfaces/examples/*.rs`) from `main` to the release tag. |
| New packaged file | `include` in `crates/surfaces/Cargo.toml`, and crate-relative `package.files` in `xtask/config.ron` |
| New baker packaged file | `include` in `crates/surfaces-bake/Cargo.toml`, and crate-relative `baker.files` in `xtask/config.ron` |
| Baker generated artifact | path in `baker.generated` (`xtask/config.ron`); rewrite with `cargo xtask generate`. Not a runtime packaged file. |
| New guard in `xtask` | An `Action` variant and required-handler entry in `xtask/src/config.rs`, dispatch in `xtask/src/checks/mod.rs`, a row in `xtask/config.ron`, and a mutation case in `xtask/tests/mutation.rs` showing it fails |
| Storage or cost wording | `crates/surfaces/src/lib.rs` crate docs, `crates/surfaces/src/surface.rs` / `evaluate.rs` / `axis/` item docs, `README.md` "Resource accounting and cost" |
| New or changed axis strategy | `crates/surfaces/src/lib.rs` re-exports and § Contract, `README.md` "Per-axis lookup strategies" table, the sixteen-pairing consumer in `tools/consumer/src/lib.rs`, `docs/v0.1-traceability.md` |
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@

### Added

- Host-side baker Rust emission in `ph-surfaces-bake`: `--emit-rust` writes
deterministic static knot arrays, a row-major `values[y][x]` grid,
`PAYLOAD_BYTES` for the selected pairing, and `MAX_ERR_LSB` to stdout.
`--x-bucketed` / `--y-bucketed` reject a bucket count outside the runtime
`1..=65_536` bound so the emitter does not print uncompilable
`BucketedAxis` source; `emit_rust_with` returns the same closed
`BakeError::InvalidBucketCount`. Packaged baker tests do not
`include!` the unpackaged generated fixture.
`cargo xtask generate` writes the baker-owned checked-in fixture; the
`generated source` check re-renders it in memory and fails with
`run cargo xtask generate` when it drifts. The bound is an i32 value LSB
of sample deviation, not a device or accuracy claim. This is not a
runtime API change.
- Host-side baker quantization in `ph-surfaces-bake`: fill each declared
grid node from on-knot samples, apply the caller-stated scale with
round-to-nearest (exact half-way away from zero; values just below a
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ syn = { version = "3.0.3", features = ["full", "visit"] }
time = { version = "0.3.55", features = ["macros", "parsing"] }
toml = "1.1.4"
walkdir = "2.5.0"
# Host gate only. The runtime crate must not name this package.
ph-surfaces-bake = { path = "crates/surfaces-bake", version = "0.1.0" }
13 changes: 10 additions & 3 deletions crates/surfaces-bake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ The public host API is `BakeInput::quantize` → `QuantizedTable`, plus
ph-surfaces-bake --help
ph-surfaces-bake --samples points.txt --x-knots 0,10 --y-knots 0,5 --scale 1
ph-surfaces-bake --samples points.txt --x-uniform 0,10,3 --y-uniform 0,5,3 --scale 1
ph-surfaces-bake --emit-rust --samples points.txt --x-knots 0,10 --y-knots 0,5 --scale 1
```

Rust emission and goldens are later issues. The baker may take reviewed host
crates for exact residual arithmetic. A declared implementation-line budget
keeps it from growing without bound.
`--emit-rust` writes Rust source on stdout. The baker does not own the
destination path; `cargo xtask generate` places the checked-in copy. The
emitted `MAX_ERR_LSB` is an i32 value LSB: deviation between the supplied
samples and the table built from them. It is not a device, accuracy, timing,
or flash claim. `--emit-golden` is not implemented yet.

The baker may take reviewed host crates for exact residual arithmetic. A
declared implementation-line budget keeps it from growing without bound. The
generated fixture under `generated/` is not part of the packaged crate.

## License

Expand Down
22 changes: 22 additions & 0 deletions crates/surfaces-bake/generated/rounding.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @generated by `cargo xtask generate`; do not edit by hand.

use ph_surfaces::BilinearSurface;

static X: [u16; 2] = [0, 2];
static Y: [u16; 2] = [0, 2];
#[rustfmt::skip]
static VALUES: [[i32; 2]; 2] = [
[0, 1],
[1, 2],
];

/// Pairing: BinaryAxis × BinaryAxis.
/// Referenced element payload, not total RAM, flash, binary, or linker cost.
pub const PAYLOAD_BYTES: usize = 24;

pub static SURFACE: BilinearSurface<2, 2> =
BilinearSurface::new(&X, &Y, &VALUES);

// MAX_ERR_LSB is an i32 value LSB: deviation from supplied samples, not
// device, accuracy, timing, or flash.
pub const MAX_ERR_LSB: i32 = 1;
Loading