Add comments on possible optimizations

This commit is contained in:
wborgeaud 2021-06-14 13:41:44 +02:00
parent 6132b2ad73
commit fa229d9a27
2 changed files with 6 additions and 0 deletions

View File

@ -151,6 +151,7 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
sum
}
/// TODO: Change this to using an `arithmetic_extension` function once `MulExtensionGate` supports addend.
pub fn sub_extension(
&mut self,
mut a: ExtensionTarget<D>,
@ -231,6 +232,7 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
/// Like `mul_add`, but for `ExtensionTarget`s. Note that, unlike `mul_add`, this has no
/// performance benefit over separate muls and adds.
/// TODO: Change this to using an `arithmetic_extension` function once `MulExtensionGate` supports addend.
pub fn mul_add_extension(
&mut self,
a: ExtensionTarget<D>,
@ -243,6 +245,7 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
/// Like `mul_sub`, but for `ExtensionTarget`s. Note that, unlike `mul_sub`, this has no
/// performance benefit over separate muls and subs.
/// TODO: Change this to using an `arithmetic_extension` function once `MulExtensionGate` supports addend.
pub fn scalar_mul_sub_extension(
&mut self,
a: Target,

View File

@ -7,6 +7,9 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
/// Selects `x` or `y` based on `b`, which is assumed to be binary.
/// In particular, this returns `if b { x } else { y }`.
/// Note: This does not range-check `b`.
// TODO: This uses 10 gates per call. If addends are added to `MulExtensionGate`, this will be
// reduced to 2 gates. We could also use a new degree 2 `SelectGate` for this.
// If `num_routed_wire` is larger than 26, we could batch two `select` in one gate.
pub fn select(
&mut self,
b: Target,