Skip to content

Commit d71f76a

Browse files
committed
chore: Rename 'ext'/'base' to 'aux'/'main' from upstream redefinition
Follow the renaming that was made with the release of Triton VM 0.42-alpha10.
1 parent 0f7fd7c commit d71f76a

18 files changed

+277
-275
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Bfe_baserowelem",
3+
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Bfe_mainrowelem",
44
"benchmark_result": {
55
"clock_cycle_count": 477,
66
"hash_table_height": 300,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Bfe_baserowelem",
14+
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Bfe_mainrowelem",
1515
"benchmark_result": {
1616
"clock_cycle_count": 477,
1717
"hash_table_height": 300,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Xfe_baserowelem",
3+
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Xfe_mainrowelem",
44
"benchmark_result": {
55
"clock_cycle_count": 477,
66
"hash_table_height": 300,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Xfe_baserowelem",
14+
"name": "tasmlib_array_inner_product_of_three_rows_with_weights_Xfe_mainrowelem",
1515
"benchmark_result": {
1616
"clock_cycle_count": 477,
1717
"hash_table_height": 300,

tasm-lib/benchmarks/tasmlib_verifier_master_ext_table_air_constraint_evaluation.json renamed to tasm-lib/benchmarks/tasmlib_verifier_master_aux_table_air_constraint_evaluation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_verifier_master_ext_table_air_constraint_evaluation",
3+
"name": "tasmlib_verifier_master_aux_table_air_constraint_evaluation",
44
"benchmark_result": {
55
"clock_cycle_count": 35384,
66
"hash_table_height": 38028,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_verifier_master_ext_table_air_constraint_evaluation",
14+
"name": "tasmlib_verifier_master_aux_table_air_constraint_evaluation",
1515
"benchmark_result": {
1616
"clock_cycle_count": 35384,
1717
"hash_table_height": 38028,

tasm-lib/benchmarks/tasmlib_verifier_master_ext_table_divide_out_zerofiers.json renamed to tasm-lib/benchmarks/tasmlib_verifier_master_aux_table_divide_out_zerofiers.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_verifier_master_ext_table_divide_out_zerofiers",
3+
"name": "tasmlib_verifier_master_aux_table_divide_out_zerofiers",
44
"benchmark_result": {
55
"clock_cycle_count": 7425,
66
"hash_table_height": 8244,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_verifier_master_ext_table_divide_out_zerofiers",
14+
"name": "tasmlib_verifier_master_aux_table_divide_out_zerofiers",
1515
"benchmark_result": {
1616
"clock_cycle_count": 7425,
1717
"hash_table_height": 8244,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_verifier_master_ext_table_verify_Extension_table_rows",
3+
"name": "tasmlib_verifier_master_aux_table_verify_Aux_table_rows",
44
"benchmark_result": {
55
"clock_cycle_count": 415,
66
"hash_table_height": 933,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_verifier_master_ext_table_verify_Extension_table_rows",
14+
"name": "tasmlib_verifier_master_aux_table_verify_Aux_table_rows",
1515
"benchmark_result": {
1616
"clock_cycle_count": 445,
1717
"hash_table_height": 1023,

tasm-lib/benchmarks/tasmlib_verifier_master_ext_table_verify_Base_table_rows.json renamed to tasm-lib/benchmarks/tasmlib_verifier_master_aux_table_verify_Main_table_rows.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_verifier_master_ext_table_verify_Base_table_rows",
3+
"name": "tasmlib_verifier_master_aux_table_verify_Main_table_rows",
44
"benchmark_result": {
55
"clock_cycle_count": 445,
66
"hash_table_height": 1137,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_verifier_master_ext_table_verify_Base_table_rows",
14+
"name": "tasmlib_verifier_master_aux_table_verify_Main_table_rows",
1515
"benchmark_result": {
1616
"clock_cycle_count": 475,
1717
"hash_table_height": 1227,

tasm-lib/benchmarks/tasmlib_verifier_master_ext_table_verify_Quotient_table_rows.json renamed to tasm-lib/benchmarks/tasmlib_verifier_master_aux_table_verify_Quotient_table_rows.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "tasmlib_verifier_master_ext_table_verify_Quotient_table_rows",
3+
"name": "tasmlib_verifier_master_aux_table_verify_Quotient_table_rows",
44
"benchmark_result": {
55
"clock_cycle_count": 346,
66
"hash_table_height": 471,
@@ -11,7 +11,7 @@
1111
"case": "CommonCase"
1212
},
1313
{
14-
"name": "tasmlib_verifier_master_ext_table_verify_Quotient_table_rows",
14+
"name": "tasmlib_verifier_master_aux_table_verify_Quotient_table_rows",
1515
"benchmark_result": {
1616
"clock_cycle_count": 376,
1717
"hash_table_height": 561,

tasm-lib/src/array/inner_product_of_three_rows_with_weights.rs

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ impl From<MainElementType> for DataType {
2424
}
2525
}
2626

27+
/// Calculate inner products of with weights.
28+
///
2729
/// Calculate inner product of both main columns and auxiliary columns with weights. Returns one
28-
/// scalar in the form of an extension-field element. Main column can be either a base field
29-
/// element, or an extension-field element.
30+
/// scalar in the form of an auxiliary-field element. Main column can be either a base field
31+
/// element, or an auxiliary-field element.
3032
pub struct InnerProductOfThreeRowsWithWeights {
3133
main_length: usize,
3234
main_element_type: MainElementType,
@@ -36,24 +38,24 @@ pub struct InnerProductOfThreeRowsWithWeights {
3638

3739
impl InnerProductOfThreeRowsWithWeights {
3840
pub fn new(
39-
base_length: usize,
40-
base_element_type: MainElementType,
41-
ext_length: usize,
41+
main_length: usize,
42+
main_element_type: MainElementType,
43+
aux_length: usize,
4244
randomizer_length: usize,
4345
) -> Self {
4446
Self {
45-
main_length: base_length,
46-
main_element_type: base_element_type,
47-
aux_length: ext_length,
47+
main_length,
48+
main_element_type,
49+
aux_length,
4850
randomizer_length,
4951
}
5052
}
5153

52-
pub fn triton_vm_parameters(base_element_type: MainElementType) -> Self {
54+
pub fn triton_vm_parameters(main_element_type: MainElementType) -> Self {
5355
Self {
5456
main_length: MasterMainTable::NUM_COLUMNS,
5557
aux_length: MasterAuxTable::NUM_COLUMNS,
56-
main_element_type: base_element_type,
58+
main_element_type,
5759
// TODO: Use NUM_RANDOMIZERS from TVM here instead, once randomizers
5860
// are handled correctly in TVM.
5961
randomizer_length: 0,
@@ -69,14 +71,14 @@ impl BasicSnippet for InnerProductOfThreeRowsWithWeights {
6971
element_type: DataType::Xfe,
7072
length: self.aux_length,
7173
})),
72-
"*ext_row".to_string(),
74+
"*aux_row".to_string(),
7375
),
7476
(
7577
DataType::Array(Box::new(ArrayType {
7678
element_type: self.main_element_type.into(),
7779
length: self.main_length,
7880
})),
79-
"*base_row".to_string(),
81+
"*main_row".to_string(),
8082
),
8183
(
8284
DataType::Array(Box::new(ArrayType {
@@ -94,7 +96,7 @@ impl BasicSnippet for InnerProductOfThreeRowsWithWeights {
9496

9597
fn entrypoint(&self) -> String {
9698
format!(
97-
"tasmlib_array_inner_product_of_three_rows_with_weights_{}_baserowelem",
99+
"tasmlib_array_inner_product_of_three_rows_with_weights_{}_mainrowelem",
98100
self.main_element_type
99101
)
100102
}
@@ -104,35 +106,35 @@ impl BasicSnippet for InnerProductOfThreeRowsWithWeights {
104106
_library: &mut crate::library::Library,
105107
) -> Vec<triton_vm::prelude::LabelledInstruction> {
106108
let entrypoint = self.entrypoint();
107-
let acc_all_base_rows = match self.main_element_type {
109+
let acc_all_main_rows = match self.main_element_type {
108110
MainElementType::Bfe => triton_asm![xb_dot_step; self.main_length],
109111
MainElementType::Xfe => triton_asm![xx_dot_step; self.main_length],
110112
};
111-
let acc_all_ext_rows = triton_asm![xx_dot_step; self.aux_length - self.randomizer_length];
113+
let acc_all_aux_rows = triton_asm![xx_dot_step; self.aux_length - self.randomizer_length];
112114

113115
triton_asm! {
114-
// BEFORE: _ *ext_row *base_row *weights
116+
// BEFORE: _ *aux_row *main_row *weights
115117
// AFTER: _ [inner_product]
116118
{entrypoint}:
117119

118120

119121
push 0
120122
push 0
121123
push 0
122-
// _ *ext_row *base_row *weights 0 0 0
124+
// _ *aux_row *main_row *weights 0 0 0
123125

124126
swap 3
125127
swap 1
126128
swap 4
127-
// _ *ext_row 0 0 0 *weights *base_row
129+
// _ *aux_row 0 0 0 *weights *main_row
128130

129-
{&acc_all_base_rows}
130-
// _ *ext_row acc2 acc1 acc0 *weights_next *garbage0
131+
{&acc_all_main_rows}
132+
// _ *aux_row acc2 acc1 acc0 *weights_next *garbage0
131133

132134
swap 5
133-
// _ *garbage0 acc2 acc1 acc0 *weights_next *ext_row
135+
// _ *garbage0 acc2 acc1 acc0 *weights_next *aux_row
134136

135-
{&acc_all_ext_rows}
137+
{&acc_all_aux_rows}
136138
// _ *garbage0 acc2 acc1 acc0 *garbage1 garbage2
137139
// _ *garbage0 result2 result1 result0 *garbage1 garbage2 <-- rename
138140

@@ -170,23 +172,23 @@ mod test {
170172
use super::*;
171173

172174
#[test]
173-
fn three_rows_tvm_parameters_xfe_base_test() {
175+
fn three_rows_tvm_parameters_xfe_main_test() {
174176
ShadowedFunction::new(InnerProductOfThreeRowsWithWeights::triton_vm_parameters(
175177
MainElementType::Xfe,
176178
))
177179
.test()
178180
}
179181

180182
#[test]
181-
fn three_rows_tvm_parameters_bfe_base_test() {
183+
fn three_rows_tvm_parameters_bfe_main_test() {
182184
ShadowedFunction::new(InnerProductOfThreeRowsWithWeights::triton_vm_parameters(
183185
MainElementType::Bfe,
184186
))
185187
.test()
186188
}
187189

188190
#[test]
189-
fn works_with_base_or_ext_column_count_of_zero() {
191+
fn works_with_main_or_aux_column_count_of_zero() {
190192
let num_main_columns_is_zero_bfe = InnerProductOfThreeRowsWithWeights {
191193
main_length: 0,
192194
main_element_type: MainElementType::Bfe,
@@ -223,17 +225,17 @@ mod test {
223225

224226
#[proptest(cases = 6)]
225227
fn three_rows_pbt_pbt(
226-
#[strategy(arb())] base_element_type: MainElementType,
227-
#[strategy(0_usize..500)] base_length: usize,
228-
#[strategy(0_usize..500)] ext_length: usize,
229-
#[filter(#randomizer_length<#ext_length)]
228+
#[strategy(arb())] main_element_type: MainElementType,
229+
#[strategy(0_usize..500)] main_length: usize,
230+
#[strategy(0_usize..500)] aux_length: usize,
231+
#[filter(#randomizer_length<#aux_length)]
230232
#[strategy(0_usize..10)]
231233
randomizer_length: usize,
232234
) {
233235
let snippet = InnerProductOfThreeRowsWithWeights {
234-
main_length: base_length,
235-
main_element_type: base_element_type,
236-
aux_length: ext_length,
236+
main_length,
237+
main_element_type,
238+
aux_length,
237239
randomizer_length,
238240
};
239241
ShadowedFunction::new(snippet).test()
@@ -247,41 +249,41 @@ mod test {
247249
) {
248250
// read stack: _ *e *b *w
249251
let weights_address = stack.pop().unwrap();
250-
let base_row_address = stack.pop().unwrap();
251-
let extension_row_address = stack.pop().unwrap();
252+
let main_row_address = stack.pop().unwrap();
253+
let auxiliary_row_address = stack.pop().unwrap();
252254

253255
// read arrays
254256
let weights_len = self.main_length + self.aux_length - self.randomizer_length;
255257
let weights: Vec<XFieldElement> =
256258
array_from_memory(weights_address, weights_len, memory);
257-
let ext_row: Vec<XFieldElement> = array_from_memory(
258-
extension_row_address,
259+
let aux_row: Vec<XFieldElement> = array_from_memory(
260+
auxiliary_row_address,
259261
self.aux_length - self.randomizer_length,
260262
memory,
261263
);
262264

263265
let ip = match self.main_element_type {
264266
MainElementType::Bfe => {
265-
let base_row: Vec<BFieldElement> =
266-
array_from_memory(base_row_address, self.main_length, memory);
267+
let main_row: Vec<BFieldElement> =
268+
array_from_memory(main_row_address, self.main_length, memory);
267269

268270
// compute inner product
269-
base_row
271+
main_row
270272
.iter()
271273
.map(|b| b.lift())
272-
.chain(ext_row)
274+
.chain(aux_row)
273275
.zip_eq(weights)
274276
.map(|(l, r)| l * r)
275277
.sum::<XFieldElement>()
276278
}
277279
MainElementType::Xfe => {
278-
let base_row: Vec<XFieldElement> =
279-
array_from_memory(base_row_address, self.main_length, memory);
280+
let main_row: Vec<XFieldElement> =
281+
array_from_memory(main_row_address, self.main_length, memory);
280282

281283
// compute inner product
282-
base_row
284+
main_row
283285
.into_iter()
284-
.chain(ext_row)
286+
.chain(aux_row)
285287
.zip_eq(weights)
286288
.map(|(l, r)| l * r)
287289
.sum::<XFieldElement>()
@@ -301,21 +303,21 @@ mod test {
301303
_bench_case: Option<BenchmarkCase>,
302304
) -> FunctionInitialState {
303305
let mut rng: StdRng = SeedableRng::from_seed(seed);
304-
let base_address = rng.gen();
305-
let ext_address = rng.gen();
306+
let main_address = rng.gen();
307+
let aux_address = rng.gen();
306308
let weights_address = rng.gen();
307309

308310
let mut memory: HashMap<BFieldElement, BFieldElement> = HashMap::default();
309311

310312
match self.main_element_type {
311313
MainElementType::Bfe => {
312-
insert_random_array(&DataType::Bfe, base_address, self.main_length, &mut memory)
314+
insert_random_array(&DataType::Bfe, main_address, self.main_length, &mut memory)
313315
}
314316
MainElementType::Xfe => {
315-
insert_random_array(&DataType::Xfe, base_address, self.main_length, &mut memory)
317+
insert_random_array(&DataType::Xfe, main_address, self.main_length, &mut memory)
316318
}
317319
}
318-
insert_random_array(&DataType::Xfe, ext_address, self.aux_length, &mut memory);
320+
insert_random_array(&DataType::Xfe, aux_address, self.aux_length, &mut memory);
319321
insert_random_array(
320322
&DataType::Xfe,
321323
weights_address,
@@ -325,7 +327,7 @@ mod test {
325327

326328
let stack = [
327329
self.init_stack_for_isolated_run(),
328-
vec![ext_address, base_address, weights_address],
330+
vec![aux_address, main_address, weights_address],
329331
]
330332
.concat();
331333

@@ -344,7 +346,7 @@ mod benches {
344346
use super::*;
345347

346348
#[test]
347-
fn inner_product_of_three_rows_bench_current_tvm_base_is_bfe() {
349+
fn inner_product_of_three_rows_bench_current_tvm_main_is_bfe() {
348350
// This benchmark is for the calculation of the (inside-of-domain) current row element that
349351
// takes place inside the main-loop where all revealed FRI values are verified.
350352
ShadowedFunction::new(InnerProductOfThreeRowsWithWeights {
@@ -357,7 +359,7 @@ mod benches {
357359
}
358360

359361
#[test]
360-
fn inner_product_of_three_rows_bench_current_tvm_base_is_xfe() {
362+
fn inner_product_of_three_rows_bench_current_tvm_main_is_xfe() {
361363
// This benchmark is for the calculation of the out-of-domain current and next row values.
362364
ShadowedFunction::new(InnerProductOfThreeRowsWithWeights {
363365
main_length: MasterMainTable::NUM_COLUMNS,

0 commit comments

Comments
 (0)