LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
WitgenDriver.h
Go to the documentation of this file.
1//===-- WitgenDriver.h - llzk-witgen driver entrypoints ---------*- C++ -*-===//
2//
3// Part of the LLZK Project, under the Apache License v2.0.
4// See LICENSE.txt for license information.
5// Copyright 2026 Project LLZK
6// SPDX-License-Identifier: Apache-2.0
7//
8//===----------------------------------------------------------------------===//
9
10#pragma once
11
12#include "ValueModel.h"
13
14#include "llzk/Util/Field.h"
15
16#include <mlir/IR/BuiltinOps.h>
17
18#include <llvm/Support/Error.h>
19#include <llvm/Support/JSON.h>
20
21#include <cstdint>
22#include <optional>
23#include <random>
24
25namespace llzk::witgen {
26
28enum class Backend : std::uint8_t {
31};
32
34enum class OutputScope : std::uint8_t {
37};
38
49
52public:
55 mlir::ModuleOp moduleOp, mlir::SymbolTableCollection &tables, const llzk::Field &field,
56 UninitializedBehavior uninitializedBehavior, std::mt19937_64 rng
57 );
58
60 void setOutputScope(OutputScope newOutputScope) { outputScope = newOutputScope; }
61
63 llvm::Expected<llvm::json::Value> runMainFromJSON(const llvm::json::Value &input);
64
65private:
66 mlir::ModuleOp moduleOp;
67 mlir::SymbolTableCollection &tables;
68 const llzk::Field &field;
69 OutputScope outputScope = OutputScope::Public;
71 std::mt19937_64 rng;
72};
73
75llvm::Expected<llvm::json::Value>
76runWitgen(mlir::ModuleOp moduleOp, const llvm::json::Value &input, const WitgenOptions &options);
77
78} // namespace llzk::witgen
Information about the prime finite field used for the interval analysis.
Definition Field.h:36
Drive witness generation for the concrete llzk.main instance.
Interpreter(mlir::ModuleOp moduleOp, mlir::SymbolTableCollection &tables, const llzk::Field &field, UninitializedBehavior uninitializedBehavior, std::mt19937_64 rng)
Build a driver for one parsed module and validated field.
void setOutputScope(OutputScope newOutputScope)
Select which witness JSON scope this interpreter emits.
llvm::Expected< llvm::json::Value > runMainFromJSON(const llvm::json::Value &input)
Execute the main compute() function using JSON inputs.
OutputScope
Select the JSON scope emitted by llzk-witgen.
llvm::Expected< llvm::json::Value > runWitgen(ModuleOp moduleOp, const llvm::json::Value &input, const WitgenOptions &options)
Run include preprocessing, field validation, and backend execution.
UninitializedBehavior
Control how witgen materializes uninitialized/default values.
Definition ValueModel.h:55
Backend
Select the execution backend used by llzk-witgen.
Configure one llzk-witgen execution.
UninitializedBehavior uninitializedBehavior
std::optional< uint64_t > randomSeed