-
Notifications
You must be signed in to change notification settings - Fork 39
Add ccs backend #281
Add ccs backend #281
Conversation
I noted the details of the key parts of the CCS backend code. |
There are two representations, ir::Circuit and backend::ccs::CCSCircuit. Is this second one only specific for Sonobe?
|
Why is not passing the tests? |
@leolara Okay, got it. |
@leolara There are errors while compiling |
Ok, so my interpretation of what you say is that CCSCircuit is the actual IR of CCS, what is the different with the current IR. Why do we need to do it in two steps? Ideally they would be merged |
Yes, I got it. I am merging these parts now. |
454d634
to
6858064
Compare
src/ccs/ir/circuit.rs
Outdated
} | ||
|
||
// input vector z = [1, x, w] | ||
pub struct Z<F: Field + From<u64>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@10to4 is Z pub or pub(crate) or pub(super), if it is pub it needs more documentation and explanation of what it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/ccs/ir/circuit.rs
Outdated
} | ||
} | ||
|
||
pub fn write( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@10to4 there should be a way to create Z with an intitial value. If you are always calling new
and then write
they should be the same method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Z is a container, perhaps some of this logic should be outside, this seems that you are converting something into Z, so write
is not the right name, and perhaps you need a method that is not a member, and creates this from scratch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
} | ||
} | ||
|
||
pub fn write(&mut self, values: &[(usize, usize, F)]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again write
is only necessary if Matrix is modified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/ccs/ir/circuit.rs
Outdated
self.n - self.l - 1 | ||
} | ||
|
||
pub fn write( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@10to4 write
is only necessary if this is modified, but it should not be modified as it is an IR. It is created by the compiler and then read by the backend
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct CCSCircuit<F> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is an IR should have not so much logic, it is just a container for informaation, the compiler should create this information in the unit and then set it in this IR.
@10to4 I think you put a log of logic in the IR that belongs to the compiler. Look how plonkish IR code is just containing the IR, but not the logic to create the information in it: https://github.com/privacy-scaling-explorations/chiquito/blob/chiquito-2024/src/plonkish/ir/mod.rs |
27a10c7
to
da8a22d
Compare
Add ccs backend
Add Fibonacci example for ccs and hypernova from sonobe