Skip to content

Commit 2b68b8c

Browse files
committed
clear out debugging code
1 parent 2911c0b commit 2b68b8c

5 files changed

Lines changed: 6 additions & 146 deletions

File tree

barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_format.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -339,24 +339,7 @@ ConstraintProfile profile_constraint_type(ConstraintType representative, Handler
339339
void prepare_builder_from_profiles(UltraCircuitBuilder& builder, const std::vector<ConstraintProfile>& profiles)
340340
{
341341
// Register all constants from all profiles
342-
for (size_t p = 0; p < profiles.size(); p++) {
343-
const auto& profile = profiles[p];
344-
std::string table_str;
345-
for (auto tid : profile.table_ids)
346-
table_str += " " + std::to_string(static_cast<int>(tid));
347-
info(" profile[",
348-
p,
349-
"]: blk2=",
350-
profile.block_sizes.block_sizes[2],
351-
" vars=",
352-
profile.block_sizes.num_variables,
353-
" constants=",
354-
profile.constants.size(),
355-
" range_targets=",
356-
profile.range_list_targets.size(),
357-
" tables=[",
358-
table_str,
359-
" ]");
342+
for (const auto& profile : profiles) {
360343
for (const auto& value : profile.constants) {
361344
builder.put_constant_variable(value);
362345
}
@@ -569,14 +552,11 @@ void build_constraints_parallel(UltraCircuitBuilder& builder,
569552
}
570553
}
571554

572-
info(" Phase 3: executing ", tasks.size(), " tasks with ", num_threads, " threads");
573-
574555
// Phase 3: Execute ALL instances in parallel
575556
// execute_parallel will set up per-thread ROM/RAM cursors using the num_rom/ram_arrays in task_sizes
576557
if (!tasks.empty()) {
577558
builder.execute_parallel(tasks, task_sizes, num_threads);
578559
}
579-
info(" Phase 3: done");
580560

581561
// Phase 4: Block constraints and recursion constraints are processed sequentially.
582562
for (const auto& [constraint, opcode_indices] :

barretenberg/cpp/src/barretenberg/dsl/acir_format/per_block_gate_count.test.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,24 +2170,18 @@ TEST_P(AcirTestParallelEquivalence, SequentialN1N2)
21702170
}
21712171

21722172
// 1. Build sequentially via create_circuit (uses build_constraints)
2173-
info(" building sequential...");
21742173
AcirProgram seq_program{ constraints, WitnessVector(witness) };
21752174
auto seq_builder = create_circuit<UltraCircuitBuilder>(seq_program, ProgramMetadata{});
2176-
info(" sequential done");
21772175

21782176
// 2. Build via parallel path with N=1
2179-
info("=== N=1 BUILD START ===");
21802177
AcirFormat n1_constraints = constraints;
21812178
UltraCircuitBuilder n1_builder{ WitnessVector(witness), n1_constraints.public_inputs, false };
21822179
build_constraints_parallel(n1_builder, n1_constraints, ProgramMetadata{}, /*num_threads=*/1);
2183-
info("=== N=1 BUILD END ===");
21842180

21852181
// 3. Build via parallel path with N=2
2186-
info("=== N=2 BUILD START ===");
21872182
AcirFormat n2_constraints = constraints;
21882183
UltraCircuitBuilder n2_builder{ WitnessVector(witness), n2_constraints.public_inputs, false };
21892184
build_constraints_parallel(n2_builder, n2_constraints, ProgramMetadata{}, /*num_threads=*/2);
2190-
info("=== N=2 BUILD END ===");
21912185

21922186
// Print block sizes for all three builders
21932187
{
@@ -2205,18 +2199,6 @@ TEST_P(AcirTestParallelEquivalence, SequentialN1N2)
22052199
n1_builder.get_num_variables(),
22062200
" n2=",
22072201
n2_builder.get_num_variables());
2208-
info(" ecc_fusions: seq_add=",
2209-
seq_builder.ecc_add_fuse_count_,
2210-
" seq_dbl=",
2211-
seq_builder.ecc_dbl_fuse_count_,
2212-
" n1_add=",
2213-
n1_builder.ecc_add_fuse_count_,
2214-
" n1_dbl=",
2215-
n1_builder.ecc_dbl_fuse_count_,
2216-
" n2_add=",
2217-
n2_builder.ecc_add_fuse_count_,
2218-
" n2_dbl=",
2219-
n2_builder.ecc_dbl_fuse_count_);
22202202
info(" constants: seq=",
22212203
seq_builder.constant_variable_indices.size(),
22222204
" n1=",

barretenberg/cpp/src/barretenberg/honk/execution_trace/execution_trace_block.hpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ template <typename FF, size_t NUM_WIRES_> class ExecutionTraceBlock {
322322
bool data_freed_ = false; // true after free_data() has been called
323323
uint32_t trace_offset_ = std::numeric_limits<uint32_t>::max(); // where this block starts in the trace
324324
std::vector<size_t> wire_cursors_; // per-thread wire cursors
325-
std::vector<size_t> wire_cursor_starts_; // per-thread cursor start positions (task boundary)
326325

327326
size_t wire_active_cursor() const
328327
{
@@ -378,26 +377,13 @@ template <typename FF, size_t NUM_WIRES_> class ExecutionTraceBlock {
378377
{
379378
if (thread_idx >= wire_cursors_.size()) {
380379
wire_cursors_.resize(thread_idx + 1, Selector<FF>::CURSOR_DISABLED);
381-
wire_cursor_starts_.resize(thread_idx + 1, 0);
382380
}
383381
wire_cursors_[thread_idx] = start;
384-
wire_cursor_starts_[thread_idx] = start;
385382
for (auto& sel : get_selectors()) {
386383
sel.enable_cursor_mode(thread_idx, start);
387384
}
388385
}
389386

390-
/**
391-
* @brief Get the start position of the current task's region in this block.
392-
* @details Returns the position where enable_cursor_mode was last called for this thread.
393-
* Used to prevent gate fusion across task boundaries.
394-
*/
395-
size_t wire_cursor_start() const
396-
{
397-
auto idx = get_parallel_thread_index();
398-
return (wire_cursor_starts_.empty() || idx >= wire_cursor_starts_.size()) ? 0 : wire_cursor_starts_[idx];
399-
}
400-
401387
// Legacy single-thread interface
402388
void enable_cursor_mode(size_t start) { enable_cursor_mode(0, start); }
403389

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.cpp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -378,22 +378,10 @@ void UltraCircuitBuilder_<ExecutionTrace>::create_ecc_add_gate(const ecc_add_gat
378378
// The elliptic curve relation assumes q_sign² = 1 (see elliptic_relation.hpp)
379379
const FF q_sign = in.is_addition ? FF(1) : FF(-1);
380380

381-
// Determine whether we can fuse this addition operation into the previous gate in the block.
382-
// NOTE: This fusion decision depends on wire VALUES (witness-dependent). In sequential mode this is
383-
// deterministic for a given witness. For future work-stealing parallelism where task execution order
384-
// may differ, this fusion pattern could vary and must be handled (e.g., by disabling fusion in
385-
// parallel mode or by ensuring tasks that chain elliptic ops are never split across threads).
386-
//
387-
// In cursor mode, use the cursor position (not block.size()) to find the previous gate.
388-
// NOTE: This fusion decision depends on wire VALUES (witness-dependent). In sequential mode this is
389-
// deterministic for a given witness. For future work-stealing parallelism where task execution order
390-
// may differ, this fusion pattern could vary and must be handled (e.g., by disabling fusion in
391-
// parallel mode or by ensuring tasks that chain elliptic ops are never split across threads).
392-
//
393-
// In cursor mode, use cursor position to find the previous gate (not block.size() which returns
394-
// the pre-allocated total). We can only fuse if the cursor has advanced (i.e., we've written at
395-
// least one gate in this task's region).
396-
// Use cursor position in cursor mode, block.size() otherwise.
381+
// Determine whether we can fuse this addition into the previous gate in the block.
382+
// In cursor mode, use cursor position (not block.size() which returns pre-allocated total).
383+
// NOTE: For future work-stealing parallelism where task execution order may differ, fusion
384+
// across task boundaries must be handled carefully to maintain determinism.
397385
size_t cursor = block.wire_active_cursor();
398386
bool can_fuse_into_previous_gate;
399387
size_t prev_idx;
@@ -405,9 +393,6 @@ void UltraCircuitBuilder_<ExecutionTrace>::create_ecc_add_gate(const ecc_add_gat
405393
can_fuse_into_previous_gate =
406394
block.size() > 0 && block.w_r()[prev_idx] == in.x1 && block.w_o()[prev_idx] == in.y1;
407395
}
408-
if (can_fuse_into_previous_gate) {
409-
ecc_add_fuse_count_++;
410-
}
411396

412397
if (can_fuse_into_previous_gate) {
413398
block.q_1().set(prev_idx, q_sign); // set q_sign of previous gate
@@ -464,10 +449,6 @@ void UltraCircuitBuilder_<ExecutionTrace>::create_ecc_dbl_gate(const ecc_dbl_gat
464449
can_fuse_into_previous_gate =
465450
block.size() > 0 && block.w_r()[dbl_prev_idx] == in.x1 && block.w_o()[dbl_prev_idx] == in.y1;
466451
}
467-
if (can_fuse_into_previous_gate) {
468-
ecc_dbl_fuse_count_++;
469-
}
470-
471452
// If possible, update the previous gate to be the first gate in the pair, otherwise create a new gate
472453
if (can_fuse_into_previous_gate) {
473454
block.q_elliptic().set(dbl_prev_idx, 1); // set q_ecc of previous gate to 1

barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_circuit_builder.hpp

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase<typename ExecutionTrace_:
386386
threads.reserve(num_threads);
387387

388388
for (size_t tid = 0; tid < num_threads; tid++) {
389-
threads.emplace_back([this, tid, &tasks, &task_sizes, &offsets, &thread_tasks]() {
389+
threads.emplace_back([this, tid, &tasks, &offsets, &thread_tasks]() {
390390
set_parallel_thread_index(tid);
391391

392392
for (size_t i = 0; i < thread_tasks[tid].size(); i++) {
@@ -403,65 +403,9 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase<typename ExecutionTrace_:
403403
rom_ram_logic.enable_ram_cursor(tid, offsets[task_idx].num_ram_arrays);
404404
}
405405

406-
// Diagnostic: check cursor position at task start
407-
if (task_sizes[task_idx].block_sizes[4] > 0) {
408-
auto block_refs_pre = blocks.get();
409-
size_t pre_cursor = block_refs_pre[4].wire_active_cursor();
410-
size_t expected_start = offsets[task_idx].block_sizes[4];
411-
if (pre_cursor != expected_start) {
412-
info("PRE-TASK MISMATCH task ",
413-
task_idx,
414-
" block 4: cursor=",
415-
pre_cursor,
416-
" expected_start=",
417-
expected_start);
418-
}
419-
}
420-
421406
// Execute the task
422407
this->set_current_task_index(task_idx);
423408
tasks[task_idx](*this);
424-
425-
// Diagnostic: check cursor advancement matches profiled sizes
426-
{
427-
size_t expected_var_end = offsets[task_idx].num_variables + task_sizes[task_idx].num_variables;
428-
size_t actual_var_pos = this->get_variable_cursor();
429-
if (actual_var_pos != expected_var_end) {
430-
info("CURSOR MISMATCH task ",
431-
task_idx,
432-
": var cursor=",
433-
actual_var_pos,
434-
" expected=",
435-
expected_var_end,
436-
" (diff=",
437-
static_cast<int64_t>(actual_var_pos) - static_cast<int64_t>(expected_var_end),
438-
")");
439-
}
440-
auto block_refs_check = blocks.get();
441-
for (size_t b = 0; b < ExecutionTrace::NUM_BLOCKS; b++) {
442-
size_t offset_b = offsets[task_idx].block_sizes[b];
443-
size_t size_b = task_sizes[task_idx].block_sizes[b];
444-
size_t expected_blk_end = offset_b + size_b;
445-
size_t actual_blk_pos = block_refs_check[b].wire_active_cursor();
446-
if (size_b > 0 && actual_blk_pos != Selector<FF>::CURSOR_DISABLED &&
447-
actual_blk_pos != expected_blk_end) {
448-
info("CURSOR MISMATCH task ",
449-
task_idx,
450-
" block ",
451-
b,
452-
": cursor=",
453-
actual_blk_pos,
454-
" offset=",
455-
offset_b,
456-
" profiled_size=",
457-
size_b,
458-
" expected_end=",
459-
expected_blk_end,
460-
" actual_produced=",
461-
actual_blk_pos - offset_b);
462-
}
463-
}
464-
}
465409
}
466410

467411
// Disable all cursors for this thread
@@ -486,16 +430,6 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase<typename ExecutionTrace_:
486430
apply_deferred_lookup_gates();
487431
apply_deferred_range_constraints();
488432
apply_deferred_non_native_field_muls();
489-
{
490-
size_t total_deferred = 0;
491-
for (size_t t = 0; t < this->deferred_assert_equals_.size(); t++) {
492-
if (!this->deferred_assert_equals_[t].empty()) {
493-
info(" task ", t, ": ", this->deferred_assert_equals_[t].size(), " deferred assert_equals");
494-
}
495-
total_deferred += this->deferred_assert_equals_[t].size();
496-
}
497-
info(" Replaying ", total_deferred, " deferred assert_equals across ", tasks.size(), " tasks");
498-
}
499433
this->apply_deferred_assert_equals();
500434
}
501435

@@ -505,9 +439,6 @@ class UltraCircuitBuilder_ : public CircuitBuilderBase<typename ExecutionTrace_:
505439
// Stores gate index of ROM/RAM reads (required by proving key)
506440
std::vector<uint32_t> memory_read_records;
507441

508-
// Diagnostic counters for ECC gate fusion (temporary, for debugging)
509-
size_t ecc_add_fuse_count_ = 0;
510-
size_t ecc_dbl_fuse_count_ = 0;
511442
// Stores gate index of RAM writes (required by proving key)
512443
std::vector<uint32_t> memory_write_records;
513444
// Range constraints to be batched, keyed by target_range. See create_small_range_constraint() for details.

0 commit comments

Comments
 (0)