Skip to content

Commit

Permalink
chore: clean up comments in native compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-sun committed Jan 3, 2025
1 parent aecb173 commit f1e01a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions extensions/native/compiler/src/ir/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ impl<C: Config> Builder<C> {
var_count: self.var_count,
felt_count: self.felt_count,
ext_count: self.ext_count,
// Witness counts are only used when the target is a gnark circuit. And sub-builders are
// not used when the target is a gnark circuit, so it's fine to set the witness counts to 0.
// Witness counts are only used when the target is a circuit. And sub-builders are
// not used when the target is a circuit, so it is fine to set the witness counts to 0.
witness_var_count: 0,
witness_felt_count: 0,
witness_ext_count: 0,
Expand Down
32 changes: 16 additions & 16 deletions extensions/native/compiler/src/ir/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub enum DslIr<C: Config> {
SubFIN(Felt<C::F>, C::F, Felt<C::F>),
/// Subtracts two extension field elements (ext = ext - ext).
SubE(Ext<C::F, C::EF>, Ext<C::F, C::EF>, Ext<C::F, C::EF>),
/// Subtrancts an extension field element and an extension field immediate (ext = ext - ext field imm).
/// Subtracts an extension field element and an extension field immediate (ext = ext - ext field imm).
SubEI(Ext<C::F, C::EF>, Ext<C::F, C::EF>, C::EF),
/// Subtracts an extension field immediate and an extension field element (ext = ext field imm - ext).
SubEIN(Ext<C::F, C::EF>, C::EF, Ext<C::F, C::EF>),
Expand Down Expand Up @@ -190,9 +190,9 @@ pub enum DslIr<C: Config> {
StoreHeapPtr(Ptr<C::N>),

// Bits.
/// Decompose a variable into size bits (bits = num2bits(var, size)). Should only be used when target is a gnark circuit.
/// Decompose a variable into size bits (bits = num2bits(var, size)). Should only be used when target is a circuit.
CircuitNum2BitsV(Var<C::N>, usize, Vec<Var<C::N>>),
/// Decompose a field element into bits (bits = num2bits(felt)). Should only be used when target is a gnark circuit.
/// Decompose a field element into bits (bits = num2bits(felt)). Should only be used when target is a circuit.
CircuitNum2BitsF(Felt<C::F>, Vec<Var<C::N>>),

// Hashing.
Expand All @@ -205,7 +205,7 @@ pub enum DslIr<C: Config> {
Array<C, Felt<C::F>>,
),
/// Permutes an array of Bn254 elements using Poseidon2 (output = p2_permute(array)). Should only
/// be used when target is a gnark circuit.
/// be used when target is a circuit.
CircuitPoseidon2Permute([Var<C::N>; 3]),

// Miscellaneous instructions.
Expand All @@ -229,11 +229,11 @@ pub enum DslIr<C: Config> {

StoreHintWord(Ptr<C::N>, MemIndex<C::N>),

/// Witness a variable. Should only be used when target is a gnark circuit.
/// Witness a variable. Should only be used when target is a circuit.
WitnessVar(Var<C::N>, u32),
/// Witness a field element. Should only be used when target is a gnark circuit.
/// Witness a field element. Should only be used when target is a circuit.
WitnessFelt(Felt<C::F>, u32),
/// Witness an extension field element. Should only be used when target is a gnark circuit.
/// Witness an extension field element. Should only be used when target is a circuit.
WitnessExt(Ext<C::F, C::EF>, u32),
/// Label a field element as the ith public input.
Publish(Felt<C::F>, Var<C::N>),
Expand All @@ -242,32 +242,32 @@ pub enum DslIr<C: Config> {

// Public inputs for circuits.
/// Asserts that the inputted var is equal the circuit's vkey hash public input. Should only be
/// used when target is a gnark circuit.
/// used when target is a circuit.
CircuitCommitVkeyHash(Var<C::N>),
/// Asserts that the inputted var is equal the circuit's commited values digest public input. Should
/// only be used when target is a gnark circuit.
/// Asserts that the inputted var is equal the circuit's committed values digest public input. Should
/// only be used when target is a circuit.
CircuitCommitCommitedValuesDigest(Var<C::N>),
/// Publish a field element as the ith public value. Should only be used when target is a halo2 circuit.
/// Publish a field element as the ith public value. Should only be used when target is a circuit.
CircuitPublish(Var<C::N>, usize),

// FRI specific instructions.
/// Select's a variable based on a condition. (select(cond, true_val, false_val) => output).
/// Should only be used when target is a gnark circuit.
/// Should only be used when target is a circuit.
CircuitSelectV(Var<C::N>, Var<C::N>, Var<C::N>, Var<C::N>),
/// Select's a field element based on a condition. (select(cond, true_val, false_val) => output).
/// Should only be used when target is a gnark circuit.
/// Should only be used when target is a circuit.
CircuitSelectF(Var<C::N>, Felt<C::F>, Felt<C::F>, Felt<C::F>),
/// Select's an extension field element based on a condition. (select(cond, true_val, false_val) => output).
/// Should only be used when target is a gnark circuit.
/// Should only be used when target is a circuit.
CircuitSelectE(
Var<C::N>,
Ext<C::F, C::EF>,
Ext<C::F, C::EF>,
Ext<C::F, C::EF>,
),
/// Converts an ext to a slice of felts. Should only be used when target is a gnark circuit.
/// Converts an ext to a slice of felts. Should only be used when target is a circuit.
CircuitExt2Felt([Felt<C::F>; 4], Ext<C::F, C::EF>),
/// Converts a slice of felts to an ext. Should only be used when target is a gnark circuit.
/// Converts a slice of felts to an ext. Should only be used when target is a circuit.
CircuitFelts2Ext([Felt<C::F>; 4], Ext<C::F, C::EF>),
/// FriReducedOpening(alpha, curr_alpha_pow, at_x_array, at_z_array, result)
FriReducedOpening(
Expand Down

0 comments on commit f1e01a7

Please sign in to comment.