Skip to content

Commit

Permalink
fixup! perf: the dynamic_dory_commitment_helper_gpu module should use…
Browse files Browse the repository at this point in the history
… Blitzar's vlen_msm function
  • Loading branch information
JayWhite2357 committed Oct 12, 2024
1 parent a539c7f commit 6b14187
Showing 1 changed file with 43 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,54 +180,51 @@ fn create_blitzar_metadata_tables(

// Populate the scalars array.
let span = span!(Level::INFO, "pack_blitzar_scalars").entered();
if !blitzar_scalars.is_empty() {
blitzar_scalars
.chunks_exact_mut(num_scalar_columns)
.enumerate()
.for_each(|(scalar_row, scalar_row_slice)| {
// Iterate over the columns and populate the scalars array.
for scalar_col in 0..max_height {
// Find index in the committable columns. Note, the scalar is in
// column major order, that is why the (row, col) arguments are flipped.
if let Some(index) = index_from_row_and_column(scalar_col, scalar_row).and_then(
|committable_column_idx| committable_column_idx.checked_sub(offset),
) {
for (i, committable_column) in committable_columns
.iter()
.enumerate()
.filter(|(_, committable_column)| index < committable_column.len())
{
let start = cumulative_byte_length_table
[i + scalar_col * single_entry_in_blitzar_output_bit_table.len()];
let end = start
+ (single_entry_in_blitzar_output_bit_table[i] / BYTE_SIZE)
as usize;

copy_column_data_to_slice(
committable_column,
scalar_row_slice,
start,
end,
index,
);
}

ones_columns_lengths
.iter()
.positions(|ones_columns_length| index < *ones_columns_length)
.for_each(|i| {
let ones_index = i
+ scalar_col
* (num_of_bytes_in_committable_columns
+ ones_columns_lengths.len())
+ num_of_bytes_in_committable_columns;

scalar_row_slice[ones_index] = 1_u8;
});
blitzar_scalars
.chunks_exact_mut(num_scalar_columns)
.enumerate()
.for_each(|(scalar_row, scalar_row_slice)| {
// Iterate over the columns and populate the scalars array.
for scalar_col in 0..max_height {
// Find index in the committable columns. Note, the scalar is in
// column major order, that is why the (row, col) arguments are flipped.
if let Some(index) = index_from_row_and_column(scalar_col, scalar_row)
.and_then(|committable_column_idx| committable_column_idx.checked_sub(offset))
{
for (i, committable_column) in committable_columns
.iter()
.enumerate()
.filter(|(_, committable_column)| index < committable_column.len())
{
let start = cumulative_byte_length_table
[i + scalar_col * single_entry_in_blitzar_output_bit_table.len()];
let end = start
+ (single_entry_in_blitzar_output_bit_table[i] / BYTE_SIZE) as usize;

copy_column_data_to_slice(
committable_column,
scalar_row_slice,
start,
end,
index,
);
}

ones_columns_lengths
.iter()
.positions(|ones_columns_length| index < *ones_columns_length)
.for_each(|i| {
let ones_index = i
+ scalar_col
* (num_of_bytes_in_committable_columns
+ ones_columns_lengths.len())
+ num_of_bytes_in_committable_columns;

scalar_row_slice[ones_index] = 1_u8;
});
}
});
}
}
});
span.exit();

(
Expand Down

0 comments on commit 6b14187

Please sign in to comment.