Native logup implementation of Stwo backend Powdr -2

following the first post 1

test command

RUST_LOG=stwo=trace cargo test --package powdr-pipeline --test pil --features stwo -- witness_lookup --exact --show-output>result.txt

Implementation notes

Witness to BaseColumn

witness needs to be transformed into BaseColumns and then use the combine function to get fraction.

in Plonk example, all the witness columns are built at the beginning as BaseColumn

BaseColumn is defined as:

The values it contains, are PackedM31

How many columns that logup gen created?

checking the example of stwo repo plonk

The generate interation trace function in plonk use 2 times finalized_col, for two secure field columns?

it gives 8 columns in logup trace, which means, my implementation might has problems here

investigation:

in the info evaluator, the implementation of EvalAtRow for InfoEvaluator has a logup macro, contains the logup related functions implementation.

you can find the definition of logup_proxy! in EvalAtRow, the interesting thing here is, the offset_mask in InfoEvaluator, is empty, it moved to logup interaction?

The zip_eq problems cased by logup batching, now I don’t use batching

the first one is no batching, the second is batching in pairs

After a simple test pass, the most important tasks are:

  • Add constraints for lookup identity in PowdrEval evaluate function, need to check the maximum numbers of the columns that are combined by random linear combination, to put in either left or right side of the logup
  • gen_interaction_trace function
  • provide the related witness columns to gen_interaction_trace function
gen_interaction_trace function
  • the column need to be BaseColumn format, which means it should be bitreverse order, and in stwo base field.
  • very often it needs columns from the constant columns, probably, should come from self.fixed. Even though accessing fixed columns again after setup sounds bit wrong, but setup should mainly save the time of interpolation, commitment. we need more cost in prove if we access fixed, but this should not be the bit cost compare to commit/interpolate it again.
check the maximum numbers of the columns that are combined by random linear combination, to put in either left or right side of the logup

ran riscv keccak test to see the number I should set

I put 50, since there is one in keccak test has 50

I found the pil has problem that the lookup is for bus, always has stage 1 witness, I need to learn more about the bus pil witgen, to ask for help and process further

Leave a Reply

Your email address will not be published. Required fields are marked *