|
LLZK 0.1.0
Veridise's ZK Language IR
|
llzk-opt is a version of the mlir-opt tool that supports passes on LLZK IR files. You can refer to the mlir-opt documentation for a general overview of the operation of *-opt tooling, but note that many options and passes available in mlir-opt are not available in llzk-opt. llzk-opt -h will show a list of all available flags and options.
Print the LLZK module's call graph.
Print the SCCs from the LLZK module's call graph.
Print constraint dependency graph for all LLZK structs.
Print interval analysis results for all LLZK structs.
Print symbol definition tree.
Print symbol use graph.
Remove redundant operations
Remove llzk and arith dialect operations that produce the same results as previously executed operations.
Pass should be run after llzk-duplicate-read-write-elim for maximum effect.
Remove redundant reads and writes
Remove read and write operations to struct fields and arrays that are redundant or unnecessary.
Inlines nested structs (i.e., subcomponents).
This pass inlines nested structs (i.e., subcomponents) at struct-type fields and at calls to the subcomponent compute/constrain functions. Inlining decisions are guided by the call graph of "constrain" functions.
The max-merge-complexity parameter can be used to limit the complexity of the resulting structs such that a potential inlining will not take place if doing so would push the sum of constraint and multiplications in the combined struct over the limit. The default value 0 indicates no limits which means all structs will be inlined into the Main struct.
This pass should be run after llzk-flatten to ensure structs do not have template parameters because structs with template parameters cannot (currently) be inlined. Inlining is also not (currently) supported for subcomponent structs stored in an array-type field.
This pass also assumes that all subcomponents that are created by calling a struct "@compute" function are ultimately written to exactly one field within the current struct.
Lowers the degree of all polynomial equations to a specified maximum
Rewrites constraint expressions into an (observationally) equivalent system where the degree of every polynomial is less than or equal to the specified maximum.
This pass is best used as part of the -llzk-full-poly-lowering pipeline, which includes additional cleanup passes to ensure correctness and optimal performance.
Rewrites constraints to be compatible with R1CS constraints i.e a*b - c = 0
Transforms LLZK constraints into an equivalent set of R1CS constraints expressed in the r1cs dialect. This pass is best used as part of the -llzk-full-r1cs-lowering pipeline which includes a degree lowering pass and clean up passes to ensure correctness and performance.
Remove unused field and struct declarations
Remove field and struct declarations that are unused within the current compilation unit. Note that this pass may cause linking issues with external modules that depend on any unused field and struct declarations from this compilation unit.
Pass should be run after llzk-duplicate-read-write-elim and llzk-duplicate-op-elim for maximum effect.
Replace arrays with scalar values
Replace known-shape arrays with the proper number of scalar values
Remove empty struct parameter lists
Flatten structs and unroll loops
Performs the following transformations:
Detect multiple and missing writes to the same field of a component.
cmake --build <build dir> --target llzk-lsp-server will produce an LLZK-specific LSP server that can be used in an IDE to provide language information for LLZK. Refer to the MLIR LSP documentation for a more detailed explanation of the MLIR LSP tools and how to set them up in your IDE.