Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize SparseGrandProductLayer #404

Open
sragss opened this issue Jun 24, 2024 · 0 comments
Open

Optimize SparseGrandProductLayer #404

sragss opened this issue Jun 24, 2024 · 0 comments

Comments

@sragss
Copy link
Collaborator

sragss commented Jun 24, 2024

In grand_product.rs we have a sparse version of GKR which uses the type SparseGrandProductLayer<F> = Vec<(usize, F)>. Due to strict alignment rules I believe this takes up 64 bytes per element rather than 8 + 32 = 40. Switching the order to store the sparse tuples Vec<(F, usize)> might work, but I'd need to look into alignment rules. Does every tuple start on a 32-byte or 64-byte memory boundary adding implicit packing?

Alternatively we could move the indices to their own vector which would have tighter packing.

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

No branches or pull requests

1 participant