Skip to content

Bus refactor#493

Open
RogerTaule wants to merge 3 commits into
pre-develop-1.0.0-betafrom
feature/bus-refactor
Open

Bus refactor#493
RogerTaule wants to merge 3 commits into
pre-develop-1.0.0-betafrom
feature/bus-refactor

Conversation

@RogerTaule

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors “bus”/std-lookup debugging and buffer-layout handling across Rust ↔ C/CUDA boundaries by introducing separate CPU/GPU layout metadata, updating FFI, and adding a structured debug report + a new debug.json schema.

Changes:

  • Split STARK buffer layout metadata into CPU vs GPU variants (offset maps and total buffer sizes), and thread those sizes through Rust and C/CUDA call sites.
  • Replace the old StdMode-driven debug configuration with a new debug.json schema (instances/constraints/bus/output), including per-opid bucketing (“group_by”) and a structured DebugReport output.
  • Add explicit packed-trace unpacking entrypoints and wire them into witness/constraint flows.

Reviewed changes

Copilot reviewed 63 out of 63 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
witness/src/witness_manager.rs Switch debug gating to new DebugInfo fields (verify_constraints, bus_mode.enabled).
provers/starks-lib-c/src/ffi_starks.rs Update Rust-side C FFI wrappers: split get_map_total_n into CPU/GPU, extend witness expr call signature, add unpack_trace_c.
provers/starks-lib-c/bindings_starks.rs Update raw extern bindings to match new C API (CPU/GPU totals, witness expr args, unpack).
proofman/src/verify_constraints.rs Remove a per-instance info log line during constraint verification.
proofman/src/utils.rs Report memory summary using CPU vs GPU buffer sizes.
proofman/src/snark_wrapper.rs Use CPU/GPU-specific recursivef buffer sizing when allocating/initializing buffers.
proofman/src/recursion.rs Compute recursive buffer sizes with an explicit gpu selector.
pil2-stark/src/starkpil/verify_constraints.hpp Switch constraint verifier to CPU offset map.
pil2-stark/src/starkpil/verify_constraints.cuh Switch GPU constraint verifier to GPU offset map.
pil2-stark/src/starkpil/starks.hpp Switch CPU proving/merkelization paths to CPU offset map.
pil2-stark/src/starkpil/starks_gpu.cu Switch GPU proving paths to GPU offset map; add packed-trace-related updates.
pil2-stark/src/starkpil/starks_gpu_bn128.cu Switch BN128 GPU paths to GPU offset map.
pil2-stark/src/starkpil/stark_verify.hpp Switch CPU verifier allocations/offsets to CPU totals/offset map.
pil2-stark/src/starkpil/stark_info.hpp Introduce mapOffsetsCPU/mapOffsetsGPU and mapTotalNCPU/mapTotalNGPU; add impl helpers.
pil2-stark/src/starkpil/stark_info.cpp Implement dual-layout offset/total computation and dual-layout memory-expression sizing.
pil2-stark/src/starkpil/hints.cu Switch GPU hints to GPU offset map.
pil2-stark/src/starkpil/hints.cpp Switch CPU hints to CPU offset map.
pil2-stark/src/starkpil/gen_recursivef_proof.hpp Switch CPU recursivef proof offsets to CPU map.
pil2-stark/src/starkpil/gen_recursivef_proof.cuh Switch GPU recursivef proof offsets to GPU map.
pil2-stark/src/starkpil/gen_proof.hpp Switch CPU proof generation offsets to CPU map.
pil2-stark/src/starkpil/gen_proof.cuh Switch GPU proof generation offsets to GPU map.
pil2-stark/src/starkpil/expressions_pack.hpp Ensure CPU expression evaluation uses CPU layout when constructing ExpressionsCtx.
pil2-stark/src/starkpil/expressions_gpu.cu Ensure GPU expression evaluation uses GPU layout when constructing ExpressionsCtx and offsets.
pil2-stark/src/starkpil/expressions_ctx.hpp Parameterize ExpressionsCtx by layout (CPU vs GPU) and populate offsets from the chosen map.
pil2-stark/src/goldilocks/src/goldilocks_tooling.cuh Switch eval offsets to GPU map; refactor device buffer struct inheritance.
pil2-stark/src/api/starks_backend.hpp Add backend hook for unpack_trace.
pil2-stark/src/api/starks_backend.cpp Wire unpack_trace through the active backend.
pil2-stark/src/api/starks_api.hpp Expose CPU/GPU total-N getters; extend witness expr signature; add unpack API.
pil2-stark/src/api/starks_api.cu Use GPU offset map throughout; persist packed-trace metadata when loading device setup.
pil2-stark/src/api/starks_api.cpp Implement CPU/GPU total-N getters; add CPU unpack; update witness expr signature; switch CPU offsets to CPU map.
pil2-components/test/common/rs/src/lib.rs Update test helper to pass optional debug config to verify_proof_constraints.
pil2-components/lib/std/rs/src/visualization.rs Remove per-instance hint/row filtering (aligns with new debug config shape).
pil2-components/lib/std/rs/src/std.rs Remove embedded StdMode state from std lib.
pil2-components/lib/std/rs/src/std_sum.rs Switch debug gating and fast-mode flags to bus_mode.
pil2-components/lib/std/rs/src/std_prod.rs Switch debug gating and fast-mode flags to bus_mode.
pil2-components/lib/std/rs/src/lib.rs Export new bucket module.
pil2-components/lib/std/rs/src/debug_fast.rs Add bucketed fast-mode accumulation and richer mismatch reporting.
pil2-components/lib/std/rs/src/debug_common.rs Add bucketing + new output config plumbing; integrate structured printing paths.
pil2-components/lib/std/rs/src/common.rs Read value filters from bus_mode.values_filter.
pil2-components/lib/std/rs/src/bucket.rs New: bucket evaluation logic + tests for value/range/prefix/step classifiers.
macros/src/packed_row.rs Fix packed-bit boundary check by precomputing max valid bit start.
macros-test/src/lib.rs Update tests to match packed-row + minor loop cleanups.
examples/fibonacci-square/src/debug.json Update example to new debug.json schema (instances/constraints).
DEBUG_REPORT.md New: documentation for structured debug report JSON format.
common/src/utils.rs Trim module to runtime/system helpers; move debug parsing elsewhere.
common/src/std_mode.rs Remove legacy StdMode config module.
common/src/setup.rs Track CPU vs GPU prover buffer sizes from C API.
common/src/setup_ctx.rs Track CPU vs GPU maxima across setup repositories and recursion.
common/src/proof_ctx.rs Add DebugReport storage and update GPU buffer sizing to use GPU maxima.
common/src/logger.rs New: extracted tracing subscriber/logger setup.
common/src/lib.rs Register new debug/logger modules and updated exports.
common/src/debug_report.rs New: in-memory structured DebugReport model.
common/src/debug_json.rs New: debug.json parsing + runtime query helpers.
common/src/debug_config.rs New: in-memory debug config model (instances/constraints/bus/output + bucketing types).
cli/src/main.rs Remove debug-info subcommand from CLI.
cli/src/commands/verify_constraints.rs Treat --debug as optional config; error out if debug report indicates mismatches.
cli/src/commands/prove.rs Gate constraint verification on debug_info.verify_constraints; propagate report failures.
cli/src/commands/mod.rs Drop debug_info command module export.
cli/src/commands/debug_info.rs Remove obsolete debug-info command implementation.
.github/workflows/ci.yaml Run clippy on all targets (--all-targets).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread proofman/src/snark_wrapper.rs Outdated
Comment thread pil2-stark/src/starkpil/starks_gpu.cu
Comment thread common/src/debug_json.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 64 out of 64 changed files in this pull request and generated 2 comments.

Comment thread proofman/src/utils.rs
Comment thread proofman/src/utils.rs
@RogerTaule RogerTaule force-pushed the feature/bus-refactor branch 2 times, most recently from ef4dbc7 to 0a10bb8 Compare June 10, 2026 11:17
@RogerTaule RogerTaule force-pushed the feature/bus-refactor branch from 0a10bb8 to 65eeb41 Compare June 10, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants