LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
Tool Guides

llzk-opt

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.

LLZK-Specific Options
-I <directory> : Directory of include files

LLZK Pass Documentation

Analysis Passes

-llzk-print-call-graph

Print the LLZK module's call graph.

-llzk-print-call-graph-sccs

Print the SCCs from the LLZK module's call graph.

-llzk-print-constraint-dependency-graphs

Print constraint dependency graph for all LLZK structs.

-llzk-print-interval-analysis

Print interval analysis results for all LLZK structs.

Options
-field : The field to use for interval analysis. Supported fields: bn128/bn254, babybear, goldilocks, mersenne31
-print-solver-constraints : Whether to output SMT solver constraints along with intervals.

General Transformation Passes

-llzk-duplicate-op-elim

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.

-llzk-duplicate-read-write-elim

Remove redundant reads and writes

Remove read and write operations to struct fields and arrays that are redundant or unnecessary.

-llzk-poly-lowering-pass

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.

Options
-max-degree : Maximum degree of constraint polynomials (default 2, minimum 2)

-llzk-unused-declaration-elim

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.

Options
-remove-structs : Whether to remove unused struct definitions as well. Requires module to declare a Main component, otherwise all components will appear unused.

'array' Dialect Transformation Passes

-llzk-array-to-scalar

Replace arrays with scalar values

Replace known-shape arrays with the proper number of scalar values

'polymorphic' Dialect Transformation Passes

-llzk-drop-empty-params

Remove empty struct parameter lists

-llzk-flatten

Flatten structs and unroll loops

Performs the following transformations:

  • Instantiate affine_map parameters of StructType and ArrayType to constant values using the arguments at the instantiation site
  • Replace parameterized structs with flattened (i.e. no parameter) versions of those structs based on requested return type at calls to compute() functions and unroll loops
  • Unroll loops

Validation Passes

-llzk-validate-field-writes

Detect multiple and missing writes to the same field of a component.

llzk-lsp-server

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.

Previous Next
Setup Contribution Guide