@@ -77,9 +77,9 @@ void AssignResults(ROOT::RVec<T> &resStorage, ROOT::RVec<T> &&tmpResults)
7777}
7878
7979template <typename T>
80- void *GetValuePtrHelper (ROOT ::RVec<T > &v, std::size_t /* colIdx*/ , std::size_t varIdx)
80+ void *GetValuePtrHelper (ROOT ::RVec<ROOT ::RVec<T> > &v, std::size_t /* colIdx*/ , std::size_t varIdx)
8181{
82- return static_cast <void *>(&v[varIdx]);
82+ return static_cast <void *>(&v[0 ][ varIdx]);
8383}
8484// /@}
8585
@@ -119,9 +119,9 @@ void AssignResults(std::vector<ROOT::RVec<T>> &resStorage, ROOT::RVec<ROOT::RVec
119119}
120120
121121template <typename T>
122- void *GetValuePtrHelper (std::vector<ROOT ::RVec<T>> &v, std::size_t colIdx, std::size_t varIdx)
122+ void *GetValuePtrHelper (ROOT ::RVec< std::vector<ROOT ::RVec<T> >> &v, std::size_t colIdx, std::size_t varIdx)
123123{
124- return static_cast <void *>(&v[colIdx][varIdx]);
124+ return static_cast <void *>(&v[0 ][ colIdx][varIdx]);
125125}
126126// /@}
127127
@@ -151,10 +151,11 @@ class R__CLING_PTRCHECK(off) RVariation final : public RVariationBase {
151151 using Ret_t = typename CallableTraits<F>::ret_type;
152152 using VariedCol_t = ColumnType_t<IsSingleColumn, Ret_t>;
153153 using Result_t = std::conditional_t <IsSingleColumn, ROOT ::RVec<VariedCol_t>, std::vector<ROOT ::RVec<VariedCol_t>>>;
154+ using ValuesPerSlot_t = std::vector<ROOT ::RVec<Result_t>>;
154155
155156 F fExpression ;
156- // / Per- slot storage for varied column values ( for one or multiple columns depending on IsSingleColumn).
157- std::vector<Result_t> fLastResults ;
157+ // Each slot accesses a cache of values for the current bulk
158+ ValuesPerSlot_t fCachedResultsPerSlot ;
158159
159160 // / Column readers per slot and per input column
160161 std::vector<std::array<RColumnReaderBase *, ColumnTypes_t::list_size>> fValues ;
@@ -186,7 +187,8 @@ class R__CLING_PTRCHECK(off) RVariation final : public RVariationBase {
186187 std::to_string (fVariationNames .size ()) + " were expected." );
187188 }
188189
189- AssignResults (fLastResults [slot * CacheLineStep<Result_t>()], std::move (results));
190+ AssignResults (fCachedResultsPerSlot [slot * RDFInternal::CacheLineStep<ROOT ::RVec<Result_t>>()][0 ],
191+ std::move (results));
190192 }
191193
192194public:
@@ -195,13 +197,17 @@ public:
195197 RLoopManager &lm, const ColumnNames_t &inputColNames)
196198 : RVariationBase (colNames, variationName, variationTags, type, defines, lm, inputColNames),
197199 fExpression (std::move (expression)),
198- fLastResults (lm.GetNSlots () * CacheLineStep<Result_t>()),
200+ fCachedResultsPerSlot (lm.GetNSlots () * RDFInternal:: CacheLineStep<ROOT ::RVec< Result_t> >()),
199201 fValues (lm.GetNSlots ())
200202 {
201203 fLoopManager ->Register (this );
202204
203- for (auto i = 0u ; i < lm.GetNSlots (); ++i)
204- ResizeResults (fLastResults [i * CacheLineStep<Result_t>()], colNames.size (), variationTags.size ());
205+ // Assume 1-size bulk for now
206+ for (decltype (lm.GetNSlots ()) i = 0 ; i < lm.GetNSlots (); ++i) {
207+ auto &cachedResultsForThisSlot = fCachedResultsPerSlot [i * RDFInternal::CacheLineStep<ROOT ::RVec<Result_t>>()];
208+ cachedResultsForThisSlot.resize (1ul );
209+ ResizeResults (cachedResultsForThisSlot[0 ], colNames.size (), variationTags.size ());
210+ }
205211 }
206212
207213 RVariation (const RVariation &) = delete ;
@@ -215,7 +221,8 @@ public:
215221 fLastCheckedEntry [slot * CacheLineStep<Long64_t>()] = -1 ;
216222 }
217223
218- // / Return the (type-erased) address of the value for the given processing slot.
224+ // / Return the beginning of the cached results of the current bulk for the input processing slot, column and
225+ // / variation
219226 void *GetValuePtr (unsigned int slot, const std::string &column, const std::string &variation) final
220227 {
221228 const auto colIt = std::find (fColNames .begin (), fColNames .end (), column);
@@ -226,7 +233,8 @@ public:
226233 assert (varIt != fVariationNames .end ());
227234 const auto varIdx = std::distance (fVariationNames .begin (), varIt);
228235
229- return GetValuePtrHelper (fLastResults [slot * CacheLineStep<Result_t>()], colIdx, varIdx);
236+ return GetValuePtrHelper (fCachedResultsPerSlot [slot * RDFInternal::CacheLineStep<ROOT ::RVec<Result_t>>()], colIdx,
237+ varIdx);
230238 }
231239
232240 // / Update the value at the address returned by GetValuePtr with the content corresponding to the given entry
0 commit comments