Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bitwise.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
4#include <string_view>
5
9
10namespace bb::avm2 {
11
12template <typename FF_> class bitwiseImpl {
13 public:
14 using FF = FF_;
15
16 static constexpr std::array<size_t, 30> SUBRELATION_PARTIAL_LENGTHS = {
17 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 5, 4, 4, 5
18 };
19
20 template <typename AllEntities> inline static bool skip(const AllEntities& in)
21 {
22 using C = ColumnAndShifts;
23
24 return (in.get(C::bitwise_sel)).is_zero();
25 }
26
27 template <typename ContainerOverSubrelations, typename AllEntities>
28 void static accumulate(ContainerOverSubrelations& evals,
29 const AllEntities& in,
30 [[maybe_unused]] const RelationParameters<FF>&,
31 [[maybe_unused]] const FF& scaling_factor);
32};
33
34template <typename FF> class bitwise : public Relation<bitwiseImpl<FF>> {
35 public:
36 static constexpr const std::string_view NAME = "bitwise";
37
38 // Subrelation indices constants, to be used in tests.
39 static constexpr size_t SR_INPUT_TAG_CANNOT_BE_FF = 9;
40 static constexpr size_t SR_INPUT_TAGS_SHOULD_MATCH = 10;
41 static constexpr size_t SR_RES_TAG_SHOULD_MATCH_INPUT = 12;
42 static constexpr size_t SR_BITW_NO_EXTERNAL_ON_ERROR = 13;
43 static constexpr size_t SR_BITW_SIMD_ONLY_ON_U128 = 18;
44 static constexpr size_t SR_BITW_TAG_LEN_DECOMPOSITION = 19;
45 static constexpr size_t SR_BITW_RECOMP_A = 24;
46 static constexpr size_t SR_BITW_RECOMP_B = 25;
47 static constexpr size_t SR_BITW_RECOMP_C = 26;
48 static constexpr size_t SR_BITW_RECOMP_A_SIMD = 27;
49 static constexpr size_t SR_BITW_RECOMP_B_SIMD = 28;
50 static constexpr size_t SR_BITW_RECOMP_C_SIMD = 29;
51
52 static std::string get_subrelation_label(size_t index)
53 {
54#ifdef AVM_INCLUDE_COLUMN_INFORMATION
55 switch (index) {
57 return "INPUT_TAG_CANNOT_BE_FF";
59 return "INPUT_TAGS_SHOULD_MATCH";
61 return "RES_TAG_SHOULD_MATCH_INPUT";
63 return "BITW_NO_EXTERNAL_ON_ERROR";
65 return "BITW_SIMD_ONLY_ON_U128";
67 return "BITW_TAG_LEN_DECOMPOSITION";
69 return "BITW_RECOMP_A";
71 return "BITW_RECOMP_B";
73 return "BITW_RECOMP_C";
75 return "BITW_RECOMP_A_SIMD";
77 return "BITW_RECOMP_B_SIMD";
79 return "BITW_RECOMP_C_SIMD";
80 }
81#endif
82 return std::to_string(index);
83 }
84};
85
86} // namespace bb::avm2
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static constexpr size_t SR_BITW_RECOMP_C_SIMD
Definition bitwise.hpp:50
static constexpr size_t SR_BITW_RECOMP_A_SIMD
Definition bitwise.hpp:48
static constexpr size_t SR_BITW_SIMD_ONLY_ON_U128
Definition bitwise.hpp:43
static constexpr size_t SR_BITW_TAG_LEN_DECOMPOSITION
Definition bitwise.hpp:44
static constexpr size_t SR_BITW_RECOMP_A
Definition bitwise.hpp:45
static constexpr size_t SR_INPUT_TAG_CANNOT_BE_FF
Definition bitwise.hpp:39
static constexpr size_t SR_BITW_RECOMP_B
Definition bitwise.hpp:46
static constexpr size_t SR_BITW_RECOMP_C
Definition bitwise.hpp:47
static constexpr size_t SR_RES_TAG_SHOULD_MATCH_INPUT
Definition bitwise.hpp:41
static constexpr const std::string_view NAME
Definition bitwise.hpp:36
static constexpr size_t SR_BITW_NO_EXTERNAL_ON_ERROR
Definition bitwise.hpp:42
static std::string get_subrelation_label(size_t index)
Definition bitwise.hpp:52
static constexpr size_t SR_INPUT_TAGS_SHOULD_MATCH
Definition bitwise.hpp:40
static constexpr size_t SR_BITW_RECOMP_B_SIMD
Definition bitwise.hpp:49
static constexpr std::array< size_t, 30 > SUBRELATION_PARTIAL_LENGTHS
Definition bitwise.hpp:16
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
static bool skip(const AllEntities &in)
Definition bitwise.hpp:20
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:35
std::string to_string(bb::avm2::ValueTag tag)
Container for parameters used by the grand product (permutation, lookup) Honk relations.