feat(network): 802.1Qbv GCL synthesis baseline (REQ-TSN-SYNTH-QBV-BASE-001)#290
Merged
Conversation
…E-001) Synthesize a TAS gate-control list for one egress port — the inverse of the existing TAS checker (REQ-TSN-002). Each class gets one contiguous open window (mask=1<<cos) sized by a monotone binary search so its tas_residual_service curve meets its per-hop deadline under the EXACT network-calculus delay_bound; leftover cycle time becomes a closed guard window (mask=0). The search predicate and a final pass both run the real checker (tas_residual_service + delay_bound) on the synthesizer's own output, and synthesize_gcl re-parses its emitted GCL blob before returning — self-certifying, so a future change that breaks soundness fails construction, not just the test. Adds ClassDemand, GclSynthError (NoDemands / CycleNotWholeNanos / DuplicateClass / ClassInfeasible / Oversubscribed / SelfCheck), and GateSchedule::to_gcl_blob. Window durations are nanosecond-quantized to match GateSchedule::parse (which consumes ns). Scope: this is the BANDWIDTH baseline. With one window per class the worst-case gate latency is cycle − duration, independent of window placement — window order is a provable no-op on the bounds. Closing the residual gap needs window SPLITTING, which is the re-scoped REQ-TSN-SYNTH-QBV-001 (moved to v0.21.0, arXiv:2407.00987's actual contribution). Mirrors the REQ-NC-PLP-CONVERGE-001 → REQ-NC-PLP-003 precursor split. Oracle TEST-TSN-SYNTH-QBV-BASE: round-trip + per-class deadline, monotone window widening, guard window, infeasibility/oversubscription, input validation (6 tests). No new dependency. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Rivet verification gate✅ 20/20 passed
Filter: Failed artifacts(none) Updated automatically by |
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.
What
First cut of 802.1Qbv Gate Control List (GCL) synthesis — the inverse of the existing TAS checker (
tas_residual_service). Given a per-egress-port set of class demands (arrival curve + NC deadline),synthesize_gclproduces aGateSchedulewhose windows tile[0, cycle_ps)such that every class's residual-service curve meets its deadline.This implements REQ-TSN-SYNTH-QBV-BASE-001 (the bandwidth baseline), a deliberate precursor split from REQ-TSN-SYNTH-QBV-001 — mirroring the REQ-NC-PLP-CONVERGE-001 → REQ-NC-PLP-003 precedent.
The synthesis model (baseline)
Each class K gets one contiguous open window (
mask = 1<<cos) of durationd_K; the leftover becomes a single closed guard window (mask = 0). With one window per class:T_K(worst-case latency)= cycle − d_KR_K(open-fraction rate)= link · d_K / cycleBoth are independent of window placement, so
delay(d_K) = (cycle − d_K) + σ_K/R_Kis strictly decreasing ind_K. That gives a unique minimal feasibled_Kvia binary search; the only inter-class coupling is the budgetΣ d_K ≤ cycle.Window order/placement is a provable no-op on these bounds — which is precisely why the paper's lever (window splitting, arXiv:2407.00987) is scoped out into REQ-TSN-SYNTH-QBV-001 (deferred to v0.21.0), not claimed here.
Oracle (written first, red→green)
The existing checker is a free, exact oracle for the synthesizer's output. Every test round-trips:
The synthesizer is self-certifying: the binary-search predicate AND a final pass both use the real
tas_residual_service+delay_bound(no parallel closed-form), andsynthesize_gclre-parses its own emitted blob before returning — so integer-nanosecond rounding cannot diverge from the analyzer's bound.GateSchedule::parseconsumes nanoseconds, so windows are sized in whole ns.6 new tests: multiclass round-trip + all-deadlines-met, tighter-deadline-widens-window (monotonicity), leftover→closed guard, rejects sub-transmission-delay class, rejects oversubscribed port, input validation.
Falsification statement
Scope notes (honest to the primitive)
synthesize_gclis a library primitive with a unit oracle; there is no AADL→synth→export path yet. The DEC-TSN-OSS-001 competitive wedge is not demonstrated until that bridge exists (a separate follow-up;extract_network_graphgives topology+rates, not per-class arrivals with per-hop deadline budgets).Gates (local)
cargo test -p spar-network— 144 pass (6 synth + 127 lib + 11 nc_validation)cargo clippy -p spar-network --all-targets -- -D warnings— cleancargo fmt -p spar-network -- --check— cleancargo build -p spar-network --no-default-features— OK🤖 Generated with Claude Code