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

Create custom Layout for UInt to avoid excessive type-level computations #297

Open
TurtlePU opened this issue Oct 14, 2024 · 0 comments · May be fixed by #407
Open

Create custom Layout for UInt to avoid excessive type-level computations #297

TurtlePU opened this issue Oct 14, 2024 · 0 comments · May be fixed by #407
Assignees

Comments

@TurtlePU
Copy link
Contributor

Currently, a Layout (UInt n r c) is a Vector (NumberOfRegisters (BaseField c) n r), which is a can of worms:

  1. To work with low and high registers, we need to push/pop them from the vector, which is suboptimal;
  2. Most operations end up requiring KnownNat (NumberOfRegisters (BaseField c) n r) which clutter the constraints;
  3. All in all, we need to compute NumberOfRegisters (BaseField c) n r, which leads to slow compilation and unreadable compilation errors.

All of this can be solved with a custom Layout (UInt n r c) with a custom Representable instance which would only require Symbolic c, KnownNat n and KnownRegisterSize r, which is much more tractable.

P.S. Note that we do not need to make a custom SymbolicData instance for UInt, it's the functor which is used inside that has to be changed from Vector to something else.

@TurtlePU TurtlePU self-assigned this Dec 16, 2024
@TurtlePU TurtlePU linked a pull request Dec 17, 2024 that will close this issue
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 a pull request may close this issue.

1 participant