Skip to content

trace generation: follow-up refactoring + couple perf improvements#2953

Open
Nashtare wants to merge 13 commits intonextfrom
robin/trace_gen_followups
Open

trace generation: follow-up refactoring + couple perf improvements#2953
Nashtare wants to merge 13 commits intonextfrom
robin/trace_gen_followups

Conversation

@Nashtare
Copy link
Copy Markdown
Contributor

@Nashtare Nashtare commented Mar 31, 2026

Describe your changes

Follow-up of #2937, consisting in:

  • making chiplets and core traces RowMajorMatrix
  • remove binary search for last_program_row
  • precomputing the transposed main trace for aux builder
  • parallelize trace row padding
  • remove padding column
  • some couple other tweaks

Performance

Output of

$ make exec-info
$ MIDEN_LOG=info ./target/optimized/miden-vm prove ./miden-vm/masm-examples/hashing/blake3_1to1/blake3_1to1.masm --release

averaged over 5 runs, against next and this branch:

Step next this branch delta Note
build_trace 90.3 ms 86.8 ms -3.5 ms mostly from padding change
to_row_major_matrix 18.4 ms 17.6 ms -0.8 ms noise
build_aux_trace 155 ms 124 ms -31 ms mostly from precomputed transpose
total trace gen. 263.7 ms 228.4 ms -35.3 ms (-13.4%)

Fixes #2847

@Nashtare Nashtare requested review from adr1anh and huitseeker March 31, 2026 15:47
@Nashtare Nashtare self-assigned this Mar 31, 2026
@Nashtare Nashtare force-pushed the robin/trace_gen_followups branch from b242391 to ed76d67 Compare March 31, 2026 15:48
Copy link
Copy Markdown
Collaborator

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

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

There's a couple of nits, otherwise this LGTM. Beware of #2948 for merging, as this PR and that one will interact.

Comment thread processor/src/trace/mod.rs Outdated
Comment thread processor/src/trace/parallel/mod.rs
Comment thread air/src/trace/main_trace.rs Outdated
Comment thread processor/src/trace/mod.rs Outdated
Comment thread processor/src/trace/mod.rs Outdated
let shared = Arc::new(row_major);
let for_transpose = shared.clone();
let lock = self.aux_trace_builders.precomputed_main_transpose.clone();
rayon::spawn(move || {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is this for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's to compute the transpose of the main trace as a background job, so it can be reused when building the aux trace without having to wait for it.

Comment thread processor/src/trace/mod.rs
@Nashtare
Copy link
Copy Markdown
Contributor Author

Nashtare commented Apr 6, 2026

@adr1anh lmk if this looks good for you!

@adr1anh
Copy link
Copy Markdown
Contributor

adr1anh commented Apr 8, 2026

Fixes #2847

@adr1anh
Copy link
Copy Markdown
Contributor

adr1anh commented Apr 20, 2026

We might want to slightly revisit this in the context of #2962, since the auxiliary trace will be entirely constructed in row-major order.

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.

chore: remove trace padding

3 participants