Skip to content

feat: standalone sixg-bench deployment with tiered optional packages - #36

Merged
j143 merged 4 commits into
mainfrom
copilot/principal-engineer-review-6g-system
Apr 27, 2026
Merged

j143 merged 4 commits into
mainfrom
copilot/principal-engineer-review-6g-system

Conversation

Copilot AI commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Turns the workspace into a clone-and-run bench. Core tier has zero native dependencies; ONNX inference, Python plots, and Level-2 baseline CSVs are opt-in.

Tier model

Tier Flag What's added
Core (default) All 11 crates, 9 experiments, Validate checks
Baselines --baselines Level-2 CSV comparisons (Liu TSP 2018, srsRAN, NIST)
Plotting --plotting Python matplotlib scripts for all experiment categories
ONNX --onnx Real ort-backed sentence-transformer (swaps simulation stub)

New: sixg-bench CLI binary (src/bin/bench.rs)

sixg-bench list                   # experiment registry with tier labels
sixg-bench run exp_001            # run one experiment (delegates to pre-built example binary)
sixg-bench run --all              # run all 9 experiments
sixg-bench run exp_009 --json     # structured JSON output for notebooks/CI
sixg-bench validate               # all Validate impls wired directly from crate deps
sixg-bench validate --baselines   # + Level-2 baseline experiment
sixg-bench info                   # shows which tiers are compiled in

Exit code is non-zero on any failure — usable in CI pipelines.

install.sh

  • Checks for cargo; installs via rustup if absent
  • cargo build --release with appropriate --features based on flags
  • --onnx: guides model file placement (models/all-MiniLM-L6-v2.onnx), sets SIXG_ONNX_MODEL
  • --baselines: sets SIXG_BASELINES=baselines/
  • --plotting: pip install -r requirements-plot.txt
  • Prints summary table of active/skipped tiers

Cargo feature flags

Added to workspace Cargo.toml:

[features]
baseline-comparison = ["sixg-phy/baseline-comparison"]  # already existed in 6g-phy
onnx    = ["sixg-ai/onnx", "sixg-semantic/onnx"]        # gates real ort inference
plotting = []                                            # compile-time marker

6g-ai and 6g-semantic gain an onnx feature flag. The existing deterministic OnnxModel simulation remains the default; real ort::Session is the intended swap behind #[cfg(feature = "onnx")].

Docker

  • Dockerfile — multi-stage (rust:1.79-slim builder → debian:bookworm-slim runtime), core tier
  • Dockerfile.onnx — adds libonnxruntime layer
  • docker-compose.yml — three services: bench, bench-baselines, bench-onnx
docker run --rm ghcr.io/j143/6g sixg-bench run --all

Python plotting (scripts/plot_*.py)

  • plot_phy.py — path loss vs distance, BER vs Eb/N0
  • plot_mac.py — Jain fairness index, HARQ rounds vs SNR
  • plot_isac.py — DFRC Pareto frontier (CRB vs capacity, with Liu TSP 2018 overlay)
  • plot_semantic.py — compression ratio vs task success, channel estimator NMSE

CI additions (.github/workflows/ci.yml)

  • matrix-features — builds and tests with "", baseline-comparison, plotting (three-way matrix)
  • docker-build — builds Dockerfile on every PR; pushes ghcr.io/j143/6g:latest + SHA tag on merge to main

@j143

j143 commented Apr 27, 2026

Copy link
Copy Markdown
Owner

@copilot

error: consider using sort_by_key
--> crates/6g-core/src/nrf.rs:188:9
|
188 | matches.sort_by(|a, b| b.capacity.cmp(&a.capacity));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#unnecessary_sort_by
help: try
|
188 - matches.sort_by(|a, b| b.capacity.cmp(&a.capacity));
188 + matches.sort_by_key(|b| std::cmp::Reverse(b.capacity));
|

Checking sixg-mac v0.1.0 (/home/runner/work/6g/6g/crates/6g-mac)

error: could not compile sixg-core (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

[builder 7/7] RUN cargo build --release && cargo build --release --examples:
13.66 151 | | .is_none_or(|&old_load| (new_load - old_load).abs() > 1.0)
13.66 | |_____________________-^^^^^^^^^^
13.66 |
13.66 help: there is a method is_none with a similar name, but with different arguments
13.66 --> /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/option.rs:650:5
13.66
13.75 Compiling sixg-mac v0.1.0 (/build/crates/6g-mac)
13.77 For more information about this error, try rustc --explain E0599.
13.78 error: could not compile sixg-core (lib) due to 1 previous error
13.78 warning: build failed, waiting for other jobs to finish...


WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:14

13 | # Build the sixg-bench binary and all example experiment binaries.
14 | >>> RUN cargo build --release
15 | >>> && cargo build --release --examples
16 |

ERROR: failed to build: failed to solve: process "/bin/sh -c cargo build --release && cargo build --release --examples" did not complete successfully: exit code: 101
Error: buildx failed with: ERROR: failed to build: failed to solve: process "/bin/sh -c cargo build --release && cargo build --release --examples" did not complete successfully: exit code: 101

Copilot AI commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

error: consider using sort_by_key
...

Fixed in commit 603c93f:

  1. crates/6g-core/src/nrf.rs — both sort_by(|a, b| b.capacity.cmp(&a.capacity)) calls replaced with sort_by_key(|b| std::cmp::Reverse(b.capacity)) as clippy suggested.

  2. Dockerfile / Dockerfile.onnx — base image bumped from rust:1.79-slim to rust:1.82-slim. The is_none_or method in digital_twin.rs was stabilized in Rust 1.82, so the older image couldn't compile it. The local clippy (1.94) also explicitly prefers is_none_or over map_or(true, ...), so the code stays as-is and the Docker image is the thing that needed updating.

Copilot AI requested a review from j143 April 27, 2026 01:51
Copilot finished work on behalf of j143 April 27, 2026 01:51
@j143

j143 commented Apr 27, 2026

Copy link
Copy Markdown
Owner

@copilot

#16 13.21    Compiling sixg-rlc v0.1.0 (/build/crates/6g-rlc)
#16 13.26 error[E0658]: use of unstable library feature 'unsigned_is_multiple_of'
#16 13.26    --> crates/6g-rlc/src/lib.rs:232:45
#16 13.26     |
#16 13.26 232 |             let poll = am && self.pdu_count.is_multiple_of(POLL_INTERVAL);
#16 13.26     |                                             ^^^^^^^^^^^^^^
#16 13.26     |
#16 13.26     = note: see issue #128101 <https://github.com/rust-lang/rust/issues/128101> for more information
#16 13.26 
#16 13.28 For more information about this error, try `rustc --explain E0658`.
#16 13.28 error: could not compile `sixg-rlc` (lib) due to 1 previous error
#16 13.28 warning: build failed, waiting for other jobs to finish...
#16 ERROR: process "/bin/sh -c cargo build --release     && cargo build --release --examples" did not complete successfully: exit code: 101

#17 [runtime 2/7] RUN apt-get update && apt-get install -y --no-install-recommends     ca-certificates     && rm -rf /var/lib/apt/lists/*
#17 0.100 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
#17 0.130 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
#17 0.140 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#17 0.255 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8792 kB]
#17 0.371 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [6924 B]
#17 0.372 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [297 kB]
#17 1.387 Fetched 9350 kB in 1s (7116 kB/s)
#17 1.387 Reading package lists...
#17 CANCELED
------
 > [builder 7/7] RUN cargo build --release     && cargo build --release --examples:
13.26    --> crates/6g-rlc/src/lib.rs:232:45
13.26     |
13.26 232 |             let poll = am && self.pdu_count.is_multiple_of(POLL_INTERVAL);
13.26     |                                             ^^^^^^^^^^^^^^
13.26     |
13.26     = note: see issue #128101 <https://github.com/rust-lang/rust/issues/128101> for more information
13.26 
13.28 For more information about this error, try `rustc --explain E0658`.
13.28 error: could not compile `sixg-rlc` (lib) due to 1 previous error
13.28 warning: build failed, waiting for other jobs to finish...
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:14
--------------------
  13 |     # Build the sixg-bench binary and all example experiment binaries.
  14 | >>> RUN cargo build --release \
  15 | >>>     && cargo build --release --examples
  16 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c cargo build --release     && cargo build --release --examples" did not complete successfully: exit code: 101
Error: buildx failed with: ERROR: failed to build: failed to solve: process "/bin/sh -c cargo build --release     && cargo build --release --examples" did not complete successfully: exit code: 101

Copilot AI commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

...

Fixed in commit 2cc6980. is_multiple_of on unsigned integers was stabilized in Rust 1.87 (tracking issue #128101), but the Docker image was rust:1.82-slim. Bumped both Dockerfile and Dockerfile.onnx to rust:1.87-slim — the code stays idiomatic and local clippy (1.94) also prefers is_multiple_of over the % == 0 alternative.

Copilot finished work on behalf of j143 April 27, 2026 02:07
@j143
j143 marked this pull request as ready for review April 27, 2026 02:32
@j143
j143 merged commit 4ecf662 into main Apr 27, 2026
14 checks passed
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.

2 participants