Longfellow ZK 0290cb32

Loading...
Searching...
No Matches
circuit_dump.h
1// Copyright 2025 Google LLC.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef PRIVACY_PROOFS_ZK_LIB_CIRCUITS_COMPILER_CIRCUIT_DUMP_H_
16#define PRIVACY_PROOFS_ZK_LIB_CIRCUITS_COMPILER_CIRCUIT_DUMP_H_
17
18#include <stddef.h>
19
20#include "circuits/compiler/compiler.h"
21#include "util/log.h"
22
23// Debug printing routines for circuit tests.
24 namespace proofs {
25
26 template <class Field>
27 inline void dump_info(const char* name, size_t size,
28 const QuadCircuit<Field>& Q) {
29 log(INFO, "Compiled circuit: %s[%zu]", name, size);
30 dump_q(Q);
31}
32
33 template <class Field>
34 inline void dump_info(const char* name, size_t sz0, size_t sz1,
35 const QuadCircuit<Field>& Q) {
36 log(INFO, "Compiled circuit: %s[%zu][%zu]", name, sz0, sz1);
37 dump_q(Q);
38}
39
40 template <class Field>
41 inline void dump_info(const char* name, size_t sz0, size_t sz1, size_t sz2,
42 const QuadCircuit<Field>& Q) {
43 log(INFO, "Compiled circuit: %s[%zu][%zu][%zu]", name, sz0, sz1, sz2);
44 dump_q(Q);
45}
46
47 template <class Field>
48 inline void dump_info(const char* name, const QuadCircuit<Field>& Q) {
49 log(INFO, "Compiled circuit: %s", name);
50 dump_q(Q);
51}
52
53 template <class Field>
54 inline void dump_q(const QuadCircuit<Field>& Q) {
55 log(INFO,
56 " depth: %zu wires: %zu in: %zu out:%zu use:%zu ovh:%zu t:%zu cse:%zu "
57 "notn:%zu",
58 Q.depth_, Q.nwires_, Q.ninput_, Q.noutput_,
59 Q.nwires_ - Q.nwires_overhead_, Q.nwires_overhead_, Q.nquad_terms_,
60 Q.nwires_cse_eliminated_, Q.nwires_not_needed_);
61}
62
63} // namespace proofs
64
65#endif // PRIVACY_PROOFS_ZK_LIB_CIRCUITS_COMPILER_CIRCUIT_DUMP_H_
proofs::QuadCircuit
Definition compiler.h:50