LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
LLZKTransformationPassPipelines.cpp
Go to the documentation of this file.
1//===-- LLZKTransformationPassPipelines.cpp ---------------------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2025 Veridise Inc.
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
13//===----------------------------------------------------------------------===//
14
16
17#include <mlir/Pass/PassManager.h>
18#include <mlir/Pass/PassRegistry.h>
19#include <mlir/Transforms/Passes.h>
20
21using namespace mlir;
22
23namespace llzk {
24
25struct FullPolyLoweringOptions : public PassPipelineOptions<FullPolyLoweringOptions> {
26 Option<unsigned> maxDegree {
27 *this, "max-degree", llvm::cl::desc("Maximum polynomial degree (must be ≥ 2)"),
28 llvm::cl::init(2)
29 };
30};
31
37
39 PassPipelineRegistration<>(
40 "llzk-remove-unnecessary-ops",
41 "Remove unnecessary operations, such as redundant reads or repeated constraints",
42 [](OpPassManager &pm) {
45 }
46 );
47
48 PassPipelineRegistration<>(
49 "llzk-remove-unnecessary-ops-and-defs",
50 "Remove unnecessary operations, member definitions, and struct definitions",
51 [](OpPassManager &pm) { addRemoveUnnecessaryOpsAndDefsPipeline(pm); }
52 );
53
54 PassPipelineRegistration<FullPolyLoweringOptions>(
55 "llzk-full-poly-lowering",
56 "Lower all polynomial constraints to a given max degree, then remove unnecessary operations "
57 "and definitions.",
58 [](OpPassManager &pm, const FullPolyLoweringOptions &opts) {
59 // 1. Degree lowering
61
62 // 2. Cleanup
64 }
65 );
66
67 PassPipelineRegistration<>(
68 "llzk-product-program",
69 "Convert @compute/@constrain functions to @product function and perform alignment",
70 [](OpPassManager &pm) {
73 }
74 );
75}
76
77} // namespace llzk
std::unique_ptr< mlir::Pass > createRedundantOperationEliminationPass()
void registerTransformationPassPipelines()
std::unique_ptr< Pass > createComputeConstrainToProductPass()
std::unique_ptr< mlir::Pass > createRedundantReadAndWriteEliminationPass()
std::unique_ptr< mlir::Pass > createUnusedDeclarationEliminationPass()
std::unique_ptr< mlir::Pass > createPolyLoweringPass()
void addRemoveUnnecessaryOpsAndDefsPipeline(OpPassManager &pm)
std::unique_ptr< mlir::Pass > createFuseProductLoopsPass()