Release v0.24.0#80
Merged
Merged
Conversation
Signed-off-by: Sébastien Taylor <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Release v0.24.0 updates workspace/package versions and delivers two C API improvements: a new tensor quantization setter and more informative errno mapping for decoder failures.
Changes:
- Add
hal_tensor_set_quantization()to attach per-tensor affine quantization metadata to integer tensors via the C API. - Rewrite
hal_decoder_decode{,_proto,_tracked}error handling to mapDecoderErrorvariants toEINVALvsEIO(caller preconditions vs internal faults). - Bump versions to 0.24.0 across Cargo workspace, Python
pyproject.toml,Cargo.lock,NOTICE, and add the 0.24.0 changelog entry.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_tensor.py | Ruff-driven formatting adjustment for an existing skip marker. |
| NOTICE | Regenerated/updated attribution versions to 0.24.0. |
| crates/python/pyproject.toml | Bump Python package version to 0.24.0. |
| crates/capi/src/tensor.rs | Add hal_tensor_set_quantization() C entry point and Rust-side docs. |
| crates/capi/src/decoder.rs | Add errno_for_decoder_error() and apply it to decoder C entry points; update docs. |
| crates/capi/include/edgefirst/hal.h | Expose hal_tensor_set_quantization() and update decoder errno documentation in the public header. |
| CHANGELOG.md | Add 0.24.0 release notes describing the new C API symbol and errno behavior change. |
| Cargo.toml | Bump workspace/package version and internal crate versions to 0.24.0. |
| Cargo.lock | Update locked workspace crate versions to 0.24.0. |
|
Signed-off-by: Sébastien Taylor <[email protected]>
Comment on lines
+757
to
+777
| /// The C boundary actively validates inputs (the Rust constructor | ||
| /// `Quantization::per_tensor` and `TensorDyn::set_quantization` do not): | ||
| /// | ||
| /// - `scale` must be finite and strictly positive. NaN, ±∞, zero, and | ||
| /// negative values are rejected with `EINVAL`. (Some training tooling | ||
| /// permits negative scales as a mathematical equivalence, but real | ||
| /// runtime kernels in this codebase assume `scale > 0`.) | ||
| /// - `zero_point` must fit the tensor's integer dtype range | ||
| /// (`u8: 0..=255`, `i8: -128..=127`, `u16: 0..=65535`, `i16: | ||
| /// -32768..=32767`, `u32/u64: >= 0`, `i32/i64`: any `int`). Out-of-range | ||
| /// values are rejected with `EINVAL`. | ||
| /// - Float tensors reject quantization with `EINVAL`. This mirrors the | ||
| /// Rust `TensorDyn::set_quantization` contract. | ||
| /// | ||
| /// @param tensor Tensor handle (must be an integer dtype) | ||
| /// @param scale Quantization scale (must be finite and > 0) | ||
| /// @param zero_point Quantization zero-point (must fit the tensor dtype) | ||
| /// @return 0 on success, -1 on error | ||
| /// @par Errors (errno): | ||
| /// - EINVAL: NULL tensor, float dtype, non-finite/non-positive scale, | ||
| /// or zero_point out of range for the tensor's integer dtype |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Release v0.24.0 bundles two C API improvements alongside the version bump:
hal_tensor_set_quantization(tensor, scale, zero_point)— new C symbol mirroring the RustTensorDyn::set_quantizationcontract. Required when wrapping framework buffers (e.g. NNStreamerGstMemoryoutputs) that carry no quant of their own before feeding them to a schema-drivenhal_decoder_decode_proto()call. Float tensors reject withEINVAL.Decoder errno mapping rewritten.
hal_decoder_decode{,_proto,_tracked}previously collapsed everyDecoderErrorvariant toEIO, masking caller-side preconditions as "internal" faults. A newerrno_for_decoder_error()mapper splits them:EINVAL(caller input is malformed/incomplete):InvalidShape,InvalidConfig,NoConfig,DtypeMismatch,QuantMissing,Yaml,Json,NotSupported,NDArrayShape.EIO(internal/library fault the caller cannot fix):Internal,KernelDispatchUnreachable,ForcedKernelUnavailable.Notably, missing per-tensor quantization on integer decoder inputs now surfaces as
EINVALinstead ofEIO— operators triaging GStreamer / NNStreamer pipelines can read the upstream wiring bug directly rather than as a hardware/library failure.See
CHANGELOG.md[0.24.0]section for the full entry.Pre-flight checks
Run locally on this branch (
make verify-version sbom format lint):verify-version✓ — workspace 0.24.0 matchescrates/python/pyproject.tomlandCHANGELOG.mdformat✓ — rustfmt clean; one ruff line-length reformat intests/test_tensor.py(pre-existing drift, included)lint✓ — clippy strict-mode + ruff both cleansbom✓ — 262 components, license policy compliant,NOTICEregeneratedTest plan
release/0.24.0hal_tensor_set_quantizationsymbol exported and consumable from a downstream C harness-1witherrno == EINVAL(wasEIOon 0.23.2)mainv0.24.0frommainwith-s