Skip to content

Conversation

@darth-cy
Copy link

@darth-cy darth-cy commented Feb 2, 2026

  • This PR extends the NativeSumcheck opcode's ability to accept hint space Ids for its evaluation inputs.
  • Hint space Ids and indicator for this mode of operation are added to the context when calling this opcode.
  • Building upon Feat: read prod_evals and logup_evals from hint in sumcheck_layer_eval #30, this PR ensures the read values are written back to default-initialized witness arrays if the evaluations come from hint space.

Choose a reason for hiding this comment

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

this read is no longer needed.

/// write p_evals
pub write_record: MemoryWriteAuxCols<T, EXT_DEG>,
/// write p1, p2 values back to witness array if the source is hint space id
pub write_ps_record: MemoryWriteAuxCols<T, { EXT_DEG * 2 }>,

Choose a reason for hiding this comment

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

since we already have write_ps_record, let's remove the above read_records.

/// write both p_evals and q_evals
pub write_records: [MemoryWriteAuxCols<T, EXT_DEG>; 2],
/// write p1, p2, q1, q2 back to witness array if the source is hint space id
pub write_pqs_record: MemoryWriteAuxCols<T, { EXT_DEG * 4 }>,

Choose a reason for hiding this comment

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

ditto.

Comment on lines 394 to 404
self.memory_bridge
.read(
MemoryAddress::new(native_as, register_ptrs[2] + prod_row_specific.data_ptr),
prod_row_specific.p,
start_timestamp,
&prod_row_specific.read_records[0],
)
.eval(
builder,
(prod_in_round_evaluation + prod_next_round_evaluation) * not(is_hint_src_id),
);

Choose a reason for hiding this comment

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

opt: we can mimic the memory read behavior by reusing write_ps_record with one additional requirement that write_ps_record.prev_data == prod_row_specific.p if it's not(is_hint_src_id).

Comment on lines 496 to 506
self.memory_bridge
.read(
MemoryAddress::new(native_as, register_ptrs[3] + logup_row_specific.data_ptr),
logup_row_specific.pq,
start_timestamp,
&logup_row_specific.read_records[0],
)
.eval(
builder,
(logup_in_round_evaluation + logup_next_round_evaluation) * not(is_hint_src_id),
);

Choose a reason for hiding this comment

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

ditto.

let num_prod_evals = num_prod_specs * num_layers * 2;
let prod_spec_evals: Array<C, Ext<C::F, C::EF>> = builder.dyn_array(num_prod_evals);
for idx in 0..num_prod_evals {
let e: Ext<C::F, C::EF> = builder.constant(prod_evals[idx]);

Choose a reason for hiding this comment

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

You restored the original test back, it's better to add one more test case to cover the case that evals comes from hint space.

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.

3 participants