Skip to content

Commit 37c9e8f

Browse files
chore: rename **Step to **Executor (#1949)
Now that our traits are unified around Executor This was a find/replace excluding the following: codec.rs,memcpy.s,memset.s,ECDSA.md,**/recursion/**,**/pairing/**,**/ff_derive/** closes INT-4350
1 parent be8d0d4 commit 37c9e8f

File tree

116 files changed

+788
-712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+788
-712
lines changed

crates/circuits/mod-builder/src/core_chip.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<F, A> FieldExpressionMetadata<F, A> {
203203

204204
impl<F, A> AdapterCoreMetadata for FieldExpressionMetadata<F, A>
205205
where
206-
A: AdapterTraceStep<F>,
206+
A: AdapterTraceExecutor<F>,
207207
{
208208
#[inline(always)]
209209
fn get_adapter_width() -> usize {
@@ -234,7 +234,7 @@ impl<'a, F, A> CustomBorrow<'a, FieldExpressionCoreRecordMut<'a>, FieldExpressio
234234
}
235235

236236
unsafe fn extract_layout(&self) -> FieldExpressionRecordLayout<F, A> {
237-
panic!("Should get the Layout information from FieldExpressionStep");
237+
panic!("Should get the Layout information from FieldExpressionExecutor");
238238
}
239239
}
240240

@@ -273,7 +273,7 @@ impl<'a> FieldExpressionCoreRecordMut<'a> {
273273
}
274274

275275
#[derive(Clone)]
276-
pub struct FieldExpressionStep<A> {
276+
pub struct FieldExpressionExecutor<A> {
277277
adapter: A,
278278
pub expr: FieldExpr,
279279
pub offset: usize,
@@ -282,7 +282,7 @@ pub struct FieldExpressionStep<A> {
282282
pub name: String,
283283
}
284284

285-
impl<A> FieldExpressionStep<A> {
285+
impl<A> FieldExpressionExecutor<A> {
286286
#[allow(clippy::too_many_arguments)]
287287
pub fn new(
288288
adapter: A,
@@ -301,7 +301,7 @@ impl<A> FieldExpressionStep<A> {
301301
};
302302
assert_eq!(opcode_flag_idx.len(), local_opcode_idx.len() - 1);
303303
tracing::info!(
304-
"FieldExpressionCoreStep: opcode={name}, main_width={}",
304+
"FieldExpressionCoreExecutor: opcode={name}, main_width={}",
305305
BaseAir::<BabyBear>::width(&expr)
306306
);
307307
Self {
@@ -376,10 +376,11 @@ impl<A> FieldExpressionFiller<A> {
376376
}
377377
}
378378

379-
impl<F, A, RA> PreflightExecutor<F, RA> for FieldExpressionStep<A>
379+
impl<F, A, RA> PreflightExecutor<F, RA> for FieldExpressionExecutor<A>
380380
where
381381
F: PrimeField32,
382-
A: 'static + AdapterTraceStep<F, ReadData: Into<DynArray<u8>>, WriteData: From<DynArray<u8>>>,
382+
A: 'static
383+
+ AdapterTraceExecutor<F, ReadData: Into<DynArray<u8>>, WriteData: From<DynArray<u8>>>,
383384
for<'buf> RA: RecordArena<
384385
'buf,
385386
FieldExpressionRecordLayout<F, A>,

crates/vm/src/arch/integration_api.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ pub struct AdapterAirContext<T, I: VmAdapterInterface<T>> {
9494
/// Helper trait for CPU tracegen.
9595
pub trait TraceFiller<F>: Send + Sync {
9696
/// Populates `trace`. This function will always be called after
97-
/// [`TraceStep::execute`], so the `trace` should already contain the records necessary to fill
98-
/// in the rest of it.
97+
/// [`TraceExecutor::execute`], so the `trace` should already contain the records necessary to
98+
/// fill in the rest of it.
9999
fn fill_trace(
100100
&self,
101101
mem_helper: &MemoryAuxColsFactory<F>,
@@ -118,7 +118,7 @@ pub trait TraceFiller<F>: Send + Sync {
118118
}
119119

120120
/// Populates `row_slice`. This function will always be called after
121-
/// [`TraceStep::execute`], so the `row_slice` should already contain context necessary to
121+
/// [`TraceExecutor::execute`], so the `row_slice` should already contain context necessary to
122122
/// fill in the rest of the row. This function will be called for each row in the trace which
123123
/// is being used, and for all other rows in the trace see `fill_dummy_trace_row`.
124124
///
@@ -167,10 +167,10 @@ where
167167
}
168168

169169
/// A helper trait for expressing generic state accesses within the implementation of
170-
/// [TraceStep]. Note that this is only a helper trait when the same interface of state access
170+
/// [TraceExecutor]. Note that this is only a helper trait when the same interface of state access
171171
/// is reused or shared by multiple implementations. It is not required to implement this trait if
172-
/// it is easier to implement the [TraceStep] trait directly without this trait.
173-
pub trait AdapterTraceStep<F>: Clone {
172+
/// it is easier to implement the [TraceExecutor] trait directly without this trait.
173+
pub trait AdapterTraceExecutor<F>: Clone {
174174
const WIDTH: usize;
175175
type ReadData;
176176
type WriteData;

crates/vm/src/arch/record_arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ impl<M> AdapterCoreLayout<M> {
569569
}
570570

571571
/// Empty metadata that implements `AdapterCoreMetadata`
572-
/// **NOTE**: `AS` is the adapter type that implements `AdapterTraceStep`
572+
/// **NOTE**: `AS` is the adapter type that implements `AdapterTraceExecutor`
573573
/// **WARNING**: `AS::WIDTH` is the number of field elements, not the size in bytes
574574
pub struct AdapterCoreEmptyMetadata<F, AS> {
575575
_phantom: PhantomData<(F, AS)>,
@@ -601,7 +601,7 @@ impl<F, AS> Default for AdapterCoreEmptyMetadata<F, AS> {
601601

602602
impl<F, AS> AdapterCoreMetadata for AdapterCoreEmptyMetadata<F, AS>
603603
where
604-
AS: super::AdapterTraceStep<F>,
604+
AS: super::AdapterTraceExecutor<F>,
605605
{
606606
#[inline(always)]
607607
fn get_adapter_width() -> usize {

crates/vm/src/arch/vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use crate::{
6767
AddressMap, CHUNK,
6868
},
6969
program::{trace::VmCommittedExe, ProgramHandler},
70-
public_values::PublicValuesStep,
70+
public_values::PublicValuesExecutor,
7171
SystemChipComplex, SystemRecords, SystemWithFixedTraceHeights, PV_EXECUTOR_IDX,
7272
},
7373
};
@@ -461,7 +461,7 @@ where
461461
.then(|| {
462462
instance.handler.executors[PV_EXECUTOR_IDX]
463463
.as_any_kind()
464-
.downcast_ref::<PublicValuesStep<Val<E::SC>>>()
464+
.downcast_ref::<PublicValuesExecutor<Val<E::SC>>>()
465465
.unwrap()
466466
.generate_public_values()
467467
})

crates/vm/src/system/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use crate::{
4040
online::GuestMemory,
4141
MemoryAirInventory, MemoryController, TimestampedEquipartition, CHUNK,
4242
},
43-
native_adapter::{NativeAdapterAir, NativeAdapterStep},
43+
native_adapter::{NativeAdapterAir, NativeAdapterExecutor},
4444
phantom::{
4545
CycleEndPhantomExecutor, CycleStartPhantomExecutor, NopPhantomExecutor, PhantomAir,
4646
PhantomChip, PhantomExecutor, PhantomFiller,
@@ -49,7 +49,7 @@ use crate::{
4949
air::Poseidon2PeripheryAir, new_poseidon2_periphery_air, Poseidon2PeripheryChip,
5050
},
5151
program::{ProgramBus, ProgramChip},
52-
public_values::{PublicValuesChip, PublicValuesCoreAir, PublicValuesStep},
52+
public_values::{PublicValuesChip, PublicValuesCoreAir, PublicValuesExecutor},
5353
},
5454
};
5555

@@ -135,7 +135,7 @@ pub enum TouchedMemory<F> {
135135

136136
#[derive(Clone, AnyEnum, Executor, MeteredExecutor, PreflightExecutor, From)]
137137
pub enum SystemExecutor<F: Field> {
138-
PublicValues(PublicValuesStep<F>),
138+
PublicValues(PublicValuesExecutor<F>),
139139
Phantom(PhantomExecutor<F>),
140140
}
141141

@@ -236,8 +236,8 @@ impl<F: PrimeField32> VmExecutionConfig<F> for SystemConfig {
236236
type Executor = SystemExecutor<F>;
237237

238238
/// The only way to create an [ExecutorInventory] is from a [SystemConfig]. This will add an
239-
/// executor for [PublicValuesStep] if continuations is disabled. It will always add an executor
240-
/// for [PhantomChip], which handles all phantom sub-executors.
239+
/// executor for [PublicValuesExecutor] if continuations is disabled. It will always add an
240+
/// executor for [PhantomChip], which handles all phantom sub-executors.
241241
fn create_executors(
242242
&self,
243243
) -> Result<ExecutorInventory<Self::Executor>, ExecutorInventoryError> {
@@ -246,8 +246,8 @@ impl<F: PrimeField32> VmExecutionConfig<F> for SystemConfig {
246246
if self.has_public_values_chip() {
247247
assert_eq!(inventory.executors().len(), PV_EXECUTOR_IDX);
248248

249-
let public_values = PublicValuesStep::new(
250-
NativeAdapterStep::default(),
249+
let public_values = PublicValuesExecutor::new(
250+
NativeAdapterExecutor::default(),
251251
self.num_public_values,
252252
(self.max_constraint_degree as u32).checked_sub(1).unwrap(),
253253
);
@@ -397,8 +397,8 @@ where
397397

398398
let public_values_chip = config.has_public_values_chip().then(|| {
399399
VmChipWrapper::new(
400-
PublicValuesStep::new(
401-
NativeAdapterStep::default(),
400+
PublicValuesExecutor::new(
401+
NativeAdapterExecutor::default(),
402402
config.num_public_values,
403403
config.max_constraint_degree as u32 - 1,
404404
),

crates/vm/src/system/native_adapter/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use util::{tracing_read_or_imm_native, tracing_write_native};
2929

3030
use super::memory::{online::TracingMemory, MemoryAuxColsFactory};
3131
use crate::{
32-
arch::{get_record_from_slice, AdapterTraceFiller, AdapterTraceStep},
32+
arch::{get_record_from_slice, AdapterTraceExecutor, AdapterTraceFiller},
3333
system::memory::offline_checker::{MemoryReadAuxRecord, MemoryWriteAuxRecord},
3434
};
3535

@@ -170,19 +170,19 @@ pub struct NativeAdapterRecord<F, const R: usize, const W: usize> {
170170
/// Operands: b for the first read, c for the second read, a for the first write.
171171
/// If an operand is not used, its address space and pointer should be all 0.
172172
#[derive(Clone, Debug)]
173-
pub struct NativeAdapterStep<F, const R: usize, const W: usize> {
173+
pub struct NativeAdapterExecutor<F, const R: usize, const W: usize> {
174174
_phantom: PhantomData<F>,
175175
}
176176

177-
impl<F, const R: usize, const W: usize> Default for NativeAdapterStep<F, R, W> {
177+
impl<F, const R: usize, const W: usize> Default for NativeAdapterExecutor<F, R, W> {
178178
fn default() -> Self {
179179
Self {
180180
_phantom: PhantomData,
181181
}
182182
}
183183
}
184184

185-
impl<F, const R: usize, const W: usize> AdapterTraceStep<F> for NativeAdapterStep<F, R, W>
185+
impl<F, const R: usize, const W: usize> AdapterTraceExecutor<F> for NativeAdapterExecutor<F, R, W>
186186
where
187187
F: PrimeField32,
188188
{
@@ -252,7 +252,7 @@ where
252252
}
253253

254254
impl<F: PrimeField32, const R: usize, const W: usize> AdapterTraceFiller<F>
255-
for NativeAdapterStep<F, R, W>
255+
for NativeAdapterExecutor<F, R, W>
256256
{
257257
const WIDTH: usize = size_of::<NativeAdapterCols<u8, R, W>>();
258258

crates/vm/src/system/public_values/core.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use openvm_stark_backend::{
2222
use crate::{
2323
arch::{
2424
execution_mode::{E1ExecutionCtx, E2ExecutionCtx},
25-
get_record_from_slice, AdapterAirContext, AdapterTraceFiller, AdapterTraceStep,
25+
get_record_from_slice, AdapterAirContext, AdapterTraceExecutor, AdapterTraceFiller,
2626
BasicAdapterInterface, E2PreCompute, EmptyAdapterCoreLayout, ExecuteFunc, ExecutionError,
2727
Executor, MeteredExecutor, MinimalInstruction, PreflightExecutor, RecordArena,
2828
StaticProgramError, TraceFiller, VmCoreAir, VmExecState, VmStateMut,
@@ -32,7 +32,7 @@ use crate::{
3232
online::{GuestMemory, TracingMemory},
3333
MemoryAuxColsFactory,
3434
},
35-
native_adapter::NativeAdapterStep,
35+
native_adapter::NativeAdapterExecutor,
3636
public_values::columns::PublicValuesCoreColsView,
3737
},
3838
utils::{transmute_field_to_u32, transmute_u32_to_field},
@@ -125,14 +125,14 @@ pub struct PublicValuesRecord<F> {
125125

126126
/// ATTENTION: If a specific public value is not provided, a default 0 will be used when generating
127127
/// the proof but in the perspective of constraints, it could be any value.
128-
pub struct PublicValuesStep<F, A = NativeAdapterStep<F, 2, 0>> {
128+
pub struct PublicValuesExecutor<F, A = NativeAdapterExecutor<F, 2, 0>> {
129129
adapter: A,
130130
encoder: Encoder,
131131
// Mutex is to make the struct Sync. But it actually won't be accessed by multiple threads.
132132
pub(crate) custom_pvs: Mutex<Vec<Option<F>>>,
133133
}
134134

135-
impl<F: Clone, A> PublicValuesStep<F, A> {
135+
impl<F: Clone, A> PublicValuesExecutor<F, A> {
136136
/// **Note:** `max_degree` is the maximum degree of the constraint polynomials to represent the
137137
/// flags. If you want the overall AIR's constraint degree to be `<= max_constraint_degree`,
138138
/// then typically you should set `max_degree` to `max_constraint_degree - 1`.
@@ -154,7 +154,7 @@ impl<F: Clone, A> PublicValuesStep<F, A> {
154154
}
155155

156156
// We clone when we want to run a new instance of the program, so we reset the custom public values.
157-
impl<F: Clone, A: Clone> Clone for PublicValuesStep<F, A> {
157+
impl<F: Clone, A: Clone> Clone for PublicValuesExecutor<F, A> {
158158
fn clone(&self) -> Self {
159159
Self {
160160
adapter: self.adapter.clone(),
@@ -164,10 +164,10 @@ impl<F: Clone, A: Clone> Clone for PublicValuesStep<F, A> {
164164
}
165165
}
166166

167-
impl<F, A, RA> PreflightExecutor<F, RA> for PublicValuesStep<F, A>
167+
impl<F, A, RA> PreflightExecutor<F, RA> for PublicValuesExecutor<F, A>
168168
where
169169
F: PrimeField32,
170-
A: 'static + Clone + AdapterTraceStep<F, ReadData = [[F; 1]; 2], WriteData = [[F; 1]; 0]>,
170+
A: 'static + Clone + AdapterTraceExecutor<F, ReadData = [[F; 1]; 2], WriteData = [[F; 1]; 0]>,
171171
for<'buf> RA: RecordArena<
172172
'buf,
173173
EmptyAdapterCoreLayout<F, A>,
@@ -212,7 +212,7 @@ where
212212
}
213213
}
214214

215-
impl<F, A> TraceFiller<F> for PublicValuesStep<F, A>
215+
impl<F, A> TraceFiller<F> for PublicValuesExecutor<F, A>
216216
where
217217
F: PrimeField32,
218218
A: 'static + AdapterTraceFiller<F>,
@@ -252,7 +252,7 @@ struct PublicValuesPreCompute<F> {
252252
pvs: *const Mutex<Vec<Option<F>>>,
253253
}
254254

255-
impl<F, A> Executor<F> for PublicValuesStep<F, A>
255+
impl<F, A> Executor<F> for PublicValuesExecutor<F, A>
256256
where
257257
F: PrimeField32,
258258
{
@@ -284,7 +284,7 @@ where
284284
}
285285
}
286286

287-
impl<F, A> MeteredExecutor<F> for PublicValuesStep<F, A>
287+
impl<F, A> MeteredExecutor<F> for PublicValuesExecutor<F, A>
288288
where
289289
F: PrimeField32,
290290
{
@@ -374,7 +374,7 @@ unsafe fn execute_e12_impl<F: PrimeField32, CTX, const B_IS_IMM: bool, const C_I
374374
state.instret += 1;
375375
}
376376

377-
impl<F, A> PublicValuesStep<F, A>
377+
impl<F, A> PublicValuesExecutor<F, A>
378378
where
379379
F: PrimeField32,
380380
{

crates/vm/src/system/public_values/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ pub use core::*;
1212
mod tests;
1313

1414
pub type PublicValuesAir = VmAirWrapper<NativeAdapterAir<2, 0>, PublicValuesCoreAir>;
15-
pub type PublicValuesChip<F> = VmChipWrapper<F, PublicValuesStep<F>>;
15+
pub type PublicValuesChip<F> = VmChipWrapper<F, PublicValuesExecutor<F>>;

extensions/algebra/circuit/src/fp2_chip/addsub.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ use openvm_circuit_primitives::{
1111
};
1212
use openvm_instructions::riscv::RV32_CELL_BITS;
1313
use openvm_mod_circuit_builder::{
14-
ExprBuilder, ExprBuilderConfig, FieldExpr, FieldExpressionCoreAir, FieldExpressionFiller,
15-
FieldExpressionStep,
14+
ExprBuilder, ExprBuilderConfig, FieldExpr, FieldExpressionCoreAir, FieldExpressionExecutor,
15+
FieldExpressionFiller,
1616
};
1717
use openvm_rv32_adapters::{
18-
Rv32VecHeapAdapterAir, Rv32VecHeapAdapterFiller, Rv32VecHeapAdapterStep,
18+
Rv32VecHeapAdapterAir, Rv32VecHeapAdapterExecutor, Rv32VecHeapAdapterFiller,
1919
};
2020

21-
use super::{Fp2Air, Fp2Chip, Fp2Step};
22-
use crate::{FieldExprVecHeapStep, Fp2};
21+
use super::{Fp2Air, Fp2Chip, Fp2Executor};
22+
use crate::{FieldExprVecHeapExecutor, Fp2};
2323

2424
pub fn fp2_addsub_expr(
2525
config: ExprBuilderConfig,
@@ -92,11 +92,11 @@ pub fn get_fp2_addsub_step<const BLOCKS: usize, const BLOCK_SIZE: usize>(
9292
range_checker_bus: VariableRangeCheckerBus,
9393
pointer_max_bits: usize,
9494
offset: usize,
95-
) -> Fp2Step<BLOCKS, BLOCK_SIZE> {
95+
) -> Fp2Executor<BLOCKS, BLOCK_SIZE> {
9696
let (expr, local_opcode_idx, opcode_flag_idx) = gen_base_expr(config, range_checker_bus);
9797

98-
FieldExprVecHeapStep(FieldExpressionStep::new(
99-
Rv32VecHeapAdapterStep::new(pointer_max_bits),
98+
FieldExprVecHeapExecutor(FieldExpressionExecutor::new(
99+
Rv32VecHeapAdapterExecutor::new(pointer_max_bits),
100100
expr,
101101
offset,
102102
local_opcode_idx,
@@ -152,16 +152,20 @@ mod tests {
152152
use openvm_stark_sdk::{p3_baby_bear::BabyBear, utils::create_seeded_rng};
153153

154154
use crate::fp2_chip::{
155-
get_fp2_addsub_air, get_fp2_addsub_chip, get_fp2_addsub_step, Fp2Air, Fp2Chip, Fp2Step,
155+
get_fp2_addsub_air, get_fp2_addsub_chip, get_fp2_addsub_step, Fp2Air, Fp2Chip, Fp2Executor,
156156
};
157157

158158
const NUM_LIMBS: usize = 32;
159159
const LIMB_BITS: usize = 8;
160160
const MAX_INS_CAPACITY: usize = 128;
161161
const OFFSET: usize = Fp2Opcode::CLASS_OFFSET;
162162
type F = BabyBear;
163-
type Harness =
164-
TestChipHarness<F, Fp2Step<2, NUM_LIMBS>, Fp2Air<2, NUM_LIMBS>, Fp2Chip<F, 2, NUM_LIMBS>>;
163+
type Harness = TestChipHarness<
164+
F,
165+
Fp2Executor<2, NUM_LIMBS>,
166+
Fp2Air<2, NUM_LIMBS>,
167+
Fp2Chip<F, 2, NUM_LIMBS>,
168+
>;
165169

166170
fn set_and_execute_rand(
167171
tester: &mut VmChipTestBuilder<F>,

0 commit comments

Comments
 (0)