@@ -99,18 +99,19 @@ struct ExecutionTraceUsageTracker {
9999 active_ranges.push_back (Range{ start_idx, end_idx });
100100 }
101101
102- // The active range for lookup-style blocks consists of two components: (1) rows containing the lookup/read
103- // gates and (2) rows containing the table data itself. The Mega arithmetization contains two such blocks:
104- // conventional lookups (lookup block) and the databus (busread block). Here we add the ranges corresponding
105- // to the "table" data for these two blocks. The corresponding gate ranges were added above.
106- size_t databus_data_start = 0 ; // Databus column data starts at idx 0
107- size_t databus_data_end = databus_data_start + max_databus_size;
108- active_ranges.push_back (Range{ databus_data_start, databus_data_end }); // region where databus contains data
109-
110- // Note: start of table data is aligned with start of the lookup gates block
111- size_t tables_start = fixed_sizes.lookup .trace_offset ();
112- size_t tables_end = tables_start + max_tables_size;
113- active_ranges.emplace_back (Range{ tables_start, tables_end }); // region where table data is stored
102+ // The active ranges must also include the rows where the actual databus and lookup table data are stored.
103+ // (Note: lookup tables are constructed from the beginning of the lookup block ; databus data is constructed at
104+ // the start of the trace).
105+
106+ // TODO(https://github.com/AztecProtocol/barretenberg/issues/1152): should be able to use simply Range{ 0,
107+ // max_databus_size } but this breaks for certain choices of num_threads. It should also be possible to have the
108+ // lookup table data be Range{lookup_start, max_tables_size} but that also breaks.
109+ size_t databus_end =
110+ std::max (max_databus_size, static_cast <size_t >(fixed_sizes.busread .trace_offset () + max_sizes.busread ));
111+ active_ranges.push_back (Range{ 0 , databus_end });
112+ size_t lookups_start = fixed_sizes.lookup .trace_offset ();
113+ size_t lookups_end = lookups_start + std::max (max_tables_size, static_cast <size_t >(max_sizes.lookup ));
114+ active_ranges.emplace_back (Range{ lookups_start, lookups_end });
114115 }
115116
116117 void print ()
0 commit comments