Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Fix that some memory is not allocated by the host allocator#816

Open
GraDKh wants to merge 1 commit intomainfrom
dgordon/fix_using_memory_not_allocated_by_host_allocator
Open

Fix that some memory is not allocated by the host allocator#816
GraDKh wants to merge 1 commit intomainfrom
dgordon/fix_using_memory_not_allocated_by_host_allocator

Conversation

@GraDKh
Copy link
Contributor

@GraDKh GraDKh commented Jun 18, 2025

TL;DR

Optimize memory usage in FRI protocol implementation by avoiding unnecessary vector allocations and copies.

What changed?

  • Modified the FRI prover to use borrowed slices instead of owned vectors for codewords
  • Added host allocator parameters to FRI methods to manage memory more efficiently
  • Changed TerminateCodeword<F> from Vec<F> to &'a [F] to avoid unnecessary cloning
  • Replaced vector allocations with allocator-managed buffers
  • Eliminated redundant copies between host and device memory
  • Increased buffer sizes in test utilities to accommodate larger test cases

How to test?

Run the existing test suite, particularly focusing on:

  • test_commit_prove_verify_success in the FRI tests
  • PIOP tests with extreme rate parameters
  • Ring switch tests with the updated buffer sizes

Why make this change?

This change improves memory efficiency in the FRI protocol implementation by:

  1. Reducing unnecessary memory allocations and copies between host and device
  2. Using borrowed references instead of owned data structures where possible
  3. Leveraging the compute allocator infrastructure more effectively
  4. Providing better memory management for large codewords and high-rate codes

These optimizations are particularly important for performance in resource-intensive zero-knowledge proof generation.

Copy link
Contributor Author

GraDKh commented Jun 18, 2025


How to use the Graphite Merge Queue

Add the label merge-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@GraDKh GraDKh marked this pull request as ready for review June 18, 2025 13:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants