]> git.pld-linux.org Git - packages/libjxl.git/blob - libjxl-hwy.patch
c7817e3e16ac6806f318435daf0ad163fbfd4dac
[packages/libjxl.git] / libjxl-hwy.patch
1 commit e0107a6ca637eb3997131e966e19fcd6001b37ad
2 Author: Jan Wassenberg <janwas@google.com>
3 Date:   Fri Nov 12 09:12:35 2021 +0100
4
5     Avoid deprecated Highway functions
6     
7     Instead use the newer overloads with the extra d arg required to
8     support SVE/RISC-V.
9
10 diff --git a/lib/jxl/dec_reconstruct.cc b/lib/jxl/dec_reconstruct.cc
11 index 9d1eb61..69a4361 100644
12 --- a/lib/jxl/dec_reconstruct.cc
13 +++ b/lib/jxl/dec_reconstruct.cc
14 @@ -357,8 +357,8 @@ void DoYCbCrUpsampling(size_t hs, size_t vs, ImageF* plane_in, const Rect& rect,
15          Store(left, d, out + x);
16          Store(right, d, out + x + 1);
17  #else
18 -        Store(InterleaveLower(left, right), d, out + x);
19 -        Store(InterleaveUpper(left, right), d, out + x + Lanes(d));
20 +        Store(InterleaveLower(d, left, right), d, out + x);
21 +        Store(InterleaveUpper(d, left, right), d, out + x + Lanes(d));
22  #endif
23        }
24      }
25 diff --git a/lib/jxl/dec_upsample.cc b/lib/jxl/dec_upsample.cc
26 index 7277e4f..3cb3f36 100644
27 --- a/lib/jxl/dec_upsample.cc
28 +++ b/lib/jxl/dec_upsample.cc
29 @@ -176,8 +176,8 @@ void Upsample(const ImageF& src, const Rect& src_rect, ImageF* dst,
30          min = Min(LoadU(df, raw_min_row + sx + fx), min);
31          max = Max(LoadU(df, raw_max_row + sx + fx), max);
32        }
33 -      min = MinOfLanes(min);
34 -      max = MaxOfLanes(max);
35 +      min = MinOfLanes(df, min);
36 +      max = MaxOfLanes(df, max);
37        for (size_t lx = 0; lx < N; lx += V) {
38          StoreU(min, df, min_row + N * sx + lx);
39          StoreU(max, df, max_row + N * sx + lx);
40 diff --git a/lib/jxl/enc_ac_strategy.cc b/lib/jxl/enc_ac_strategy.cc
41 index bc50465..c0ed68f 100644
42 --- a/lib/jxl/enc_ac_strategy.cc
43 +++ b/lib/jxl/enc_ac_strategy.cc
44 @@ -429,8 +429,8 @@ float EstimateEntropy(const AcStrategy& acs, size_t x, size_t y,
45      }
46      entropy_v += nzeros_v * cost1;
47  
48 -    entropy += GetLane(SumOfLanes(entropy_v));
49 -    size_t num_nzeros = GetLane(SumOfLanes(nzeros_v));
50 +    entropy += GetLane(SumOfLanes(df, entropy_v));
51 +    size_t num_nzeros = GetLane(SumOfLanes(df, nzeros_v));
52      // Add #bit of num_nonzeros, as an estimate of the cost for encoding the
53      // number of non-zeros of the block.
54      size_t nbits = CeilLog2Nonzero(num_nzeros + 1) + 1;
55 @@ -441,9 +441,9 @@ float EstimateEntropy(const AcStrategy& acs, size_t x, size_t y,
56    float ret =
57        entropy +
58        masking *
59 -          ((config.info_loss_multiplier * GetLane(SumOfLanes(info_loss))) +
60 +          ((config.info_loss_multiplier * GetLane(SumOfLanes(df, info_loss))) +
61             (config.info_loss_multiplier2 *
62 -            sqrt(num_blocks * GetLane(SumOfLanes(info_loss2)))));
63 +            sqrt(num_blocks * GetLane(SumOfLanes(df, info_loss2)))));
64    return ret;
65  }
66  
67 diff --git a/lib/jxl/enc_adaptive_quantization.cc b/lib/jxl/enc_adaptive_quantization.cc
68 index 7a6c772..51cea65 100644
69 --- a/lib/jxl/enc_adaptive_quantization.cc
70 +++ b/lib/jxl/enc_adaptive_quantization.cc
71 @@ -189,7 +189,7 @@ V GammaModulation(const D d, const size_t x, const size_t y,
72        overall_ratio += avg_ratio;
73      }
74    }
75 -  overall_ratio = SumOfLanes(overall_ratio);
76 +  overall_ratio = SumOfLanes(d, overall_ratio);
77    overall_ratio *= Set(d, 1.0f / 64);
78    // ideally -1.0, but likely optimal correction adds some entropy, so slightly
79    // less than that.
80 @@ -246,12 +246,12 @@ V ColorModulation(const D d, const size_t x, const size_t y,
81    // blue we consider as if it was fully red or blue.
82    static const float ratio = 30.610615782142737f;  // out of 64 pixels.
83  
84 -  auto overall_red_coverage = SumOfLanes(red_coverage);
85 +  auto overall_red_coverage = SumOfLanes(d, red_coverage);
86    overall_red_coverage =
87        Min(overall_red_coverage, Set(d, ratio * kRedRampLength));
88    overall_red_coverage *= Set(d, red_strength / ratio);
89  
90 -  auto overall_blue_coverage = SumOfLanes(blue_coverage);
91 +  auto overall_blue_coverage = SumOfLanes(d, blue_coverage);
92    overall_blue_coverage =
93        Min(overall_blue_coverage, Set(d, ratio * kBlueRampLength));
94    overall_blue_coverage *= Set(d, blue_strength / ratio);
95 @@ -295,7 +295,7 @@ V HfModulation(const D d, const size_t x, const size_t y, const ImageF& xyb,
96      }
97    }
98  
99 -  sum = SumOfLanes(sum);
100 +  sum = SumOfLanes(d, sum);
101    return MulAdd(sum, Set(d, -2.0052193233688884f / 112), out_val);
102  }
103  
104 diff --git a/lib/jxl/enc_ar_control_field.cc b/lib/jxl/enc_ar_control_field.cc
105 index f43340e..f8025ac 100644
106 --- a/lib/jxl/enc_ar_control_field.cc
107 +++ b/lib/jxl/enc_ar_control_field.cc
108 @@ -157,7 +157,7 @@ void ProcessTile(const Image3F& opsin, PassesEncoderState* enc_state,
109            sum += LoadU(df4, rows_in[iy] + x * 4 + ix + 2);
110          }
111        }
112 -      row_out[x] = GetLane(Sqrt(SumOfLanes(sum))) * (1.0f / 4.0f);
113 +      row_out[x] = GetLane(Sqrt(SumOfLanes(df4, sum))) * (1.0f / 4.0f);
114      }
115    }
116    // Indexing iy and ix is a bit tricky as we include a 2 pixel border
117 @@ -193,7 +193,7 @@ void ProcessTile(const Image3F& opsin, PassesEncoderState* enc_state,
118              sum += Load(df4, rows_in[iy] + sx + ix);
119            }
120          }
121 -        row_out[x] = GetLane(Sqrt(SumOfLanes(sum))) * (1.0f / 4.0f);
122 +        row_out[x] = GetLane(Sqrt(SumOfLanes(df4, sum))) * (1.0f / 4.0f);
123        } else {
124          float sum = 0;
125          for (size_t iy = sy; iy < ey; iy++) {
126 diff --git a/lib/jxl/enc_butteraugli_pnorm.cc b/lib/jxl/enc_butteraugli_pnorm.cc
127 index 32623b8..b7feac0 100644
128 --- a/lib/jxl/enc_butteraugli_pnorm.cc
129 +++ b/lib/jxl/enc_butteraugli_pnorm.cc
130 @@ -87,13 +87,13 @@ double ComputeDistanceP(const ImageF& distmap, const ButteraugliParams& params,
131      }
132      double v = 0;
133      v += pow(
134 -        onePerPixels * (sum1[0] + GetLane(SumOfLanes(Load(d, sum_totals0)))),
135 +        onePerPixels * (sum1[0] + GetLane(SumOfLanes(d, Load(d, sum_totals0)))),
136          1.0 / (p * 1.0));
137      v += pow(
138 -        onePerPixels * (sum1[1] + GetLane(SumOfLanes(Load(d, sum_totals1)))),
139 +        onePerPixels * (sum1[1] + GetLane(SumOfLanes(d, Load(d, sum_totals1)))),
140          1.0 / (p * 2.0));
141      v += pow(
142 -        onePerPixels * (sum1[2] + GetLane(SumOfLanes(Load(d, sum_totals2)))),
143 +        onePerPixels * (sum1[2] + GetLane(SumOfLanes(d, Load(d, sum_totals2)))),
144          1.0 / (p * 4.0));
145      v /= 3.0;
146      return v;
147 diff --git a/lib/jxl/enc_chroma_from_luma.cc b/lib/jxl/enc_chroma_from_luma.cc
148 index e5c3f38..370595c 100644
149 --- a/lib/jxl/enc_chroma_from_luma.cc
150 +++ b/lib/jxl/enc_chroma_from_luma.cc
151 @@ -91,9 +91,9 @@ struct CFLFunction {
152        fdme_v += IfThenElse(av >= thres, zero, dme);
153      }
154  
155 -    *fpeps = first_derivative_peps + GetLane(SumOfLanes(fdpe_v));
156 -    *fmeps = first_derivative_meps + GetLane(SumOfLanes(fdme_v));
157 -    return first_derivative + GetLane(SumOfLanes(fd_v));
158 +    *fpeps = first_derivative_peps + GetLane(SumOfLanes(df, fdpe_v));
159 +    *fmeps = first_derivative_meps + GetLane(SumOfLanes(df, fdme_v));
160 +    return first_derivative + GetLane(SumOfLanes(df, fd_v));
161    }
162  
163    const float* JXL_RESTRICT values_m;
164 @@ -124,8 +124,8 @@ int32_t FindBestMultiplier(const float* values_m, const float* values_s,
165        cb = MulAdd(a, b, cb);
166      }
167      // + distance_mul * x^2 * num
168 -    x = -GetLane(SumOfLanes(cb)) /
169 -        (GetLane(SumOfLanes(ca)) + num * distance_mul * 0.5f);
170 +    x = -GetLane(SumOfLanes(df, cb)) /
171 +        (GetLane(SumOfLanes(df, ca)) + num * distance_mul * 0.5f);
172    } else {
173      constexpr float eps = 1;
174      constexpr float kClamp = 20.0f;
175 diff --git a/lib/jxl/enc_cluster.cc b/lib/jxl/enc_cluster.cc
176 index 1f12a29..8ae863c 100644
177 --- a/lib/jxl/enc_cluster.cc
178 +++ b/lib/jxl/enc_cluster.cc
179 @@ -49,7 +49,7 @@ void HistogramEntropy(const Histogram& a) {
180      const auto counts = LoadU(di, &a.data_[i]);
181      entropy_lanes += Entropy(ConvertTo(df, counts), inv_tot, total);
182    }
183 -  a.entropy_ += GetLane(SumOfLanes(entropy_lanes));
184 +  a.entropy_ += GetLane(SumOfLanes(df, entropy_lanes));
185  }
186  
187  float HistogramDistance(const Histogram& a, const Histogram& b) {
188 @@ -71,7 +71,7 @@ float HistogramDistance(const Histogram& a, const Histogram& b) {
189      const auto counts = ConvertTo(df, a_counts + b_counts);
190      distance_lanes += Entropy(counts, inv_tot, total);
191    }
192 -  const float total_distance = GetLane(SumOfLanes(distance_lanes));
193 +  const float total_distance = GetLane(SumOfLanes(df, distance_lanes));
194    return total_distance - a.entropy_ - b.entropy_;
195  }
196  
197 diff --git a/lib/jxl/enc_entropy_coder.cc b/lib/jxl/enc_entropy_coder.cc
198 index 0946300..07fe5a0 100644
199 --- a/lib/jxl/enc_entropy_coder.cc
200 +++ b/lib/jxl/enc_entropy_coder.cc
201 @@ -86,7 +86,7 @@ int32_t NumNonZeroExceptLLF(const size_t cx, const size_t cy,
202  
203    // We want area - sum_zero, add because neg_sum_zero is already negated.
204    const int32_t nzeros =
205 -      int32_t(cx * cy * kDCTBlockSize) + GetLane(SumOfLanes(neg_sum_zero));
206 +      int32_t(cx * cy * kDCTBlockSize) + GetLane(SumOfLanes(di, neg_sum_zero));
207  
208    const int32_t shifted_nzeros = static_cast<int32_t>(
209        (nzeros + covered_blocks - 1) >> log2_covered_blocks);
210 @@ -135,7 +135,7 @@ int32_t NumNonZero8x8ExceptDC(const int32_t* JXL_RESTRICT block,
211  
212    // We want 64 - sum_zero, add because neg_sum_zero is already negated.
213    const int32_t nzeros =
214 -      int32_t(kDCTBlockSize) + GetLane(SumOfLanes(neg_sum_zero));
215 +      int32_t(kDCTBlockSize) + GetLane(SumOfLanes(di, neg_sum_zero));
216  
217    *nzeros_pos = nzeros;
218  
219 diff --git a/lib/jxl/enc_fast_heuristics.cc b/lib/jxl/enc_fast_heuristics.cc
220 index 16f7670..0551782 100644
221 --- a/lib/jxl/enc_fast_heuristics.cc
222 +++ b/lib/jxl/enc_fast_heuristics.cc
223 @@ -94,8 +94,8 @@ Status Heuristics(PassesEncoderState* enc_state,
224                cb = MulAdd(a, b, cb);
225              }
226            }
227 -          float best =
228 -              -GetLane(SumOfLanes(cb)) / (GetLane(SumOfLanes(ca)) + 1e-9f);
229 +          float best = -GetLane(SumOfLanes(df, cb)) /
230 +                       (GetLane(SumOfLanes(df, ca)) + 1e-9f);
231            int8_t& res = (c == 0 ? shared.cmap.ytox_map : shared.cmap.ytob_map)
232                              .Row(ty)[tx];
233            res = std::max(-128.0f, std::min(127.0f, roundf(best)));
234 @@ -124,8 +124,8 @@ Status Heuristics(PassesEncoderState* enc_state,
235                  max = IfThenElse(max > nn, max, nn);
236                }
237              }
238 -            row_out_avg[x] = GetLane(SumOfLanes(sum));
239 -            row_out[x] = GetLane(MaxOfLanes(max));
240 +            row_out_avg[x] = GetLane(SumOfLanes(df4, sum));
241 +            row_out[x] = GetLane(MaxOfLanes(df4, max));
242            }
243          }
244        },
245 diff --git a/lib/jxl/gauss_blur.cc b/lib/jxl/gauss_blur.cc
246 index f9babe7..f24a74c 100644
247 --- a/lib/jxl/gauss_blur.cc
248 +++ b/lib/jxl/gauss_blur.cc
249 @@ -421,7 +421,7 @@ ImageF ConvolveXSampleAndTranspose(const ImageF& in,
250        for (int i = -r; i <= r; i += Lanes(df)) {
251          sum = MulAdd(LoadU(df, rowp + x + i), LoadU(df, kernelp + i), sum);
252        }
253 -      out.Row(ox)[y] = GetLane(SumOfLanes(sum));
254 +      out.Row(ox)[y] = GetLane(SumOfLanes(df, sum));
255      }
256      for (; x < in.xsize(); x += res, ++ox) {
257        float sum = 0.0f;
258 diff --git a/lib/jxl/modular/encoding/enc_ma.cc b/lib/jxl/modular/encoding/enc_ma.cc
259 index f847db6..7700ecc 100644
260 --- a/lib/jxl/modular/encoding/enc_ma.cc
261 +++ b/lib/jxl/modular/encoding/enc_ma.cc
262 @@ -60,7 +60,7 @@ float EstimateBits(const int32_t *counts, int32_t *rounded_counts,
263      bits_lanes -=
264          IfThenElse(counts_v == zero, zero, counts_v * BitCast(df, nbps));
265    }
266 -  return GetLane(SumOfLanes(bits_lanes));
267 +  return GetLane(SumOfLanes(df, bits_lanes));
268  }
269  
270  void MakeSplitNode(size_t pos, int property, int splitval, Predictor lpred,
271 diff --git a/lib/jxl/rational_polynomial_test.cc b/lib/jxl/rational_polynomial_test.cc
272 index d0e628d..e0d5a6e 100644
273 --- a/lib/jxl/rational_polynomial_test.cc
274 +++ b/lib/jxl/rational_polynomial_test.cc
275 @@ -50,7 +50,7 @@ struct EvalLog2 {
276      const HWY_FULL(int32_t) di;
277      const auto x_bits = BitCast(di, vx);
278      // Cannot handle negative numbers / NaN.
279 -    JXL_DASSERT(AllTrue(Abs(x_bits) == x_bits));
280 +    JXL_DASSERT(AllTrue(di, Abs(x_bits) == x_bits));
281  
282      // Range reduction to [-1/3, 1/3] - 3 integer, 2 float ops
283      const auto exp_bits = x_bits - Set(di, 0x3f2aaaab);  // = 2/3
284 diff --git a/lib/jxl/splines.cc b/lib/jxl/splines.cc
285 index 58ebfd6..0026fa9 100644
286 --- a/lib/jxl/splines.cc
287 +++ b/lib/jxl/splines.cc
288 @@ -53,7 +53,7 @@ float ContinuousIDCT(const float dct[32], float t) {
289      auto local_res = LoadU(df, dct + i) * cos;
290      result = MulAdd(Set(df, square_root<2>::value), local_res, result);
291    }
292 -  return GetLane(SumOfLanes(result));
293 +  return GetLane(SumOfLanes(df, result));
294  }
295  
296  template <typename DF>
297 diff --git a/lib/jxl/transpose-inl.h b/lib/jxl/transpose-inl.h
298 index d12b129..e89e8af 100644
299 --- a/lib/jxl/transpose-inl.h
300 +++ b/lib/jxl/transpose-inl.h
301 @@ -137,25 +137,26 @@ JXL_INLINE_TRANSPOSE void GenericTransposeBlock(TransposeSimdTag<true>,
302    static_assert(COLS_or_0 % 4 == 0, "Invalid number of columns");
303    for (size_t n = 0; n < ROWS; n += 4) {
304      for (size_t m = 0; m < COLS; m += 4) {
305 -      const auto p0 = from.LoadPart(BlockDesc<4>(), n + 0, m + 0);
306 -      const auto p1 = from.LoadPart(BlockDesc<4>(), n + 1, m + 0);
307 -      const auto p2 = from.LoadPart(BlockDesc<4>(), n + 2, m + 0);
308 -      const auto p3 = from.LoadPart(BlockDesc<4>(), n + 3, m + 0);
309 -
310 -      const auto q0 = InterleaveLower(p0, p2);
311 -      const auto q1 = InterleaveLower(p1, p3);
312 -      const auto q2 = InterleaveUpper(p0, p2);
313 -      const auto q3 = InterleaveUpper(p1, p3);
314 -
315 -      const auto r0 = InterleaveLower(q0, q1);
316 -      const auto r1 = InterleaveUpper(q0, q1);
317 -      const auto r2 = InterleaveLower(q2, q3);
318 -      const auto r3 = InterleaveUpper(q2, q3);
319 -
320 -      to.StorePart(BlockDesc<4>(), r0, m + 0, n + 0);
321 -      to.StorePart(BlockDesc<4>(), r1, m + 1, n + 0);
322 -      to.StorePart(BlockDesc<4>(), r2, m + 2, n + 0);
323 -      to.StorePart(BlockDesc<4>(), r3, m + 3, n + 0);
324 +      const BlockDesc<4> d;
325 +      const auto p0 = from.LoadPart(d, n + 0, m + 0);
326 +      const auto p1 = from.LoadPart(d, n + 1, m + 0);
327 +      const auto p2 = from.LoadPart(d, n + 2, m + 0);
328 +      const auto p3 = from.LoadPart(d, n + 3, m + 0);
329 +
330 +      const auto q0 = InterleaveLower(d, p0, p2);
331 +      const auto q1 = InterleaveLower(d, p1, p3);
332 +      const auto q2 = InterleaveUpper(d, p0, p2);
333 +      const auto q3 = InterleaveUpper(d, p1, p3);
334 +
335 +      const auto r0 = InterleaveLower(d, q0, q1);
336 +      const auto r1 = InterleaveUpper(d, q0, q1);
337 +      const auto r2 = InterleaveLower(d, q2, q3);
338 +      const auto r3 = InterleaveUpper(d, q2, q3);
339 +
340 +      to.StorePart(d, r0, m + 0, n + 0);
341 +      to.StorePart(d, r1, m + 1, n + 0);
342 +      to.StorePart(d, r2, m + 2, n + 0);
343 +      to.StorePart(d, r3, m + 3, n + 0);
344      }
345    }
346  }
347 From 0902f85ca6e9e305338baf7974192acab8c53ac5 Mon Sep 17 00:00:00 2001
348 From: Jan Wassenberg <janwas@google.com>
349 Date: Thu, 6 Jan 2022 09:36:20 +0100
350 Subject: [PATCH] Avoid deprecated Hwy functions - add d arg. Also remove
351  unnecessary include
352
353 ---
354  .../test_render_pipeline_stages.h             |  1 -
355  lib/jxl/transpose-inl.h                       | 85 ++++++++++---------
356  2 files changed, 43 insertions(+), 43 deletions(-)
357
358 #diff --git a/lib/jxl/render_pipeline/test_render_pipeline_stages.h b/lib/jxl/render_pipeline/test_render_pipeline_stages.h
359 #index 6b33b677a..fc6b38a83 100644
360 #--- a/lib/jxl/render_pipeline/test_render_pipeline_stages.h
361 #+++ b/lib/jxl/render_pipeline/test_render_pipeline_stages.h
362 #@@ -11,7 +11,6 @@
363 # #include <utility>
364 # #include <vector>
365
366 #-#include "gtest/gtest.h"
367 # #include "lib/jxl/render_pipeline/render_pipeline_stage.h"
368
369 # namespace jxl {
370 diff --git a/lib/jxl/transpose-inl.h b/lib/jxl/transpose-inl.h
371 index e89e8af0a..467442073 100644
372 --- a/lib/jxl/transpose-inl.h
373 +++ b/lib/jxl/transpose-inl.h
374 @@ -74,50 +74,51 @@ JXL_INLINE_TRANSPOSE void GenericTransposeBlock(TransposeSimdTag<true>,
375    static_assert(COLS_or_0 % 8 == 0, "Invalid number of columns");
376    for (size_t n = 0; n < ROWS; n += 8) {
377      for (size_t m = 0; m < COLS; m += 8) {
378 -      auto i0 = from.LoadPart(BlockDesc<8>(), n + 0, m + 0);
379 -      auto i1 = from.LoadPart(BlockDesc<8>(), n + 1, m + 0);
380 -      auto i2 = from.LoadPart(BlockDesc<8>(), n + 2, m + 0);
381 -      auto i3 = from.LoadPart(BlockDesc<8>(), n + 3, m + 0);
382 -      auto i4 = from.LoadPart(BlockDesc<8>(), n + 4, m + 0);
383 -      auto i5 = from.LoadPart(BlockDesc<8>(), n + 5, m + 0);
384 -      auto i6 = from.LoadPart(BlockDesc<8>(), n + 6, m + 0);
385 -      auto i7 = from.LoadPart(BlockDesc<8>(), n + 7, m + 0);
386 +      const BlockDesc<8> d;
387 +      auto i0 = from.LoadPart(d, n + 0, m + 0);
388 +      auto i1 = from.LoadPart(d, n + 1, m + 0);
389 +      auto i2 = from.LoadPart(d, n + 2, m + 0);
390 +      auto i3 = from.LoadPart(d, n + 3, m + 0);
391 +      auto i4 = from.LoadPart(d, n + 4, m + 0);
392 +      auto i5 = from.LoadPart(d, n + 5, m + 0);
393 +      auto i6 = from.LoadPart(d, n + 6, m + 0);
394 +      auto i7 = from.LoadPart(d, n + 7, m + 0);
395        // Surprisingly, this straightforward implementation (24 cycles on port5)
396        // is faster than load128+insert and LoadDup128+ConcatUpperLower+blend.
397 -      const auto q0 = InterleaveLower(i0, i2);
398 -      const auto q1 = InterleaveLower(i1, i3);
399 -      const auto q2 = InterleaveUpper(i0, i2);
400 -      const auto q3 = InterleaveUpper(i1, i3);
401 -      const auto q4 = InterleaveLower(i4, i6);
402 -      const auto q5 = InterleaveLower(i5, i7);
403 -      const auto q6 = InterleaveUpper(i4, i6);
404 -      const auto q7 = InterleaveUpper(i5, i7);
405 -
406 -      const auto r0 = InterleaveLower(q0, q1);
407 -      const auto r1 = InterleaveUpper(q0, q1);
408 -      const auto r2 = InterleaveLower(q2, q3);
409 -      const auto r3 = InterleaveUpper(q2, q3);
410 -      const auto r4 = InterleaveLower(q4, q5);
411 -      const auto r5 = InterleaveUpper(q4, q5);
412 -      const auto r6 = InterleaveLower(q6, q7);
413 -      const auto r7 = InterleaveUpper(q6, q7);
414 -
415 -      i0 = ConcatLowerLower(r4, r0);
416 -      i1 = ConcatLowerLower(r5, r1);
417 -      i2 = ConcatLowerLower(r6, r2);
418 -      i3 = ConcatLowerLower(r7, r3);
419 -      i4 = ConcatUpperUpper(r4, r0);
420 -      i5 = ConcatUpperUpper(r5, r1);
421 -      i6 = ConcatUpperUpper(r6, r2);
422 -      i7 = ConcatUpperUpper(r7, r3);
423 -      to.StorePart(BlockDesc<8>(), i0, m + 0, n + 0);
424 -      to.StorePart(BlockDesc<8>(), i1, m + 1, n + 0);
425 -      to.StorePart(BlockDesc<8>(), i2, m + 2, n + 0);
426 -      to.StorePart(BlockDesc<8>(), i3, m + 3, n + 0);
427 -      to.StorePart(BlockDesc<8>(), i4, m + 4, n + 0);
428 -      to.StorePart(BlockDesc<8>(), i5, m + 5, n + 0);
429 -      to.StorePart(BlockDesc<8>(), i6, m + 6, n + 0);
430 -      to.StorePart(BlockDesc<8>(), i7, m + 7, n + 0);
431 +      const auto q0 = InterleaveLower(d, i0, i2);
432 +      const auto q1 = InterleaveLower(d, i1, i3);
433 +      const auto q2 = InterleaveUpper(d, i0, i2);
434 +      const auto q3 = InterleaveUpper(d, i1, i3);
435 +      const auto q4 = InterleaveLower(d, i4, i6);
436 +      const auto q5 = InterleaveLower(d, i5, i7);
437 +      const auto q6 = InterleaveUpper(d, i4, i6);
438 +      const auto q7 = InterleaveUpper(d, i5, i7);
439 +
440 +      const auto r0 = InterleaveLower(d, q0, q1);
441 +      const auto r1 = InterleaveUpper(d, q0, q1);
442 +      const auto r2 = InterleaveLower(d, q2, q3);
443 +      const auto r3 = InterleaveUpper(d, q2, q3);
444 +      const auto r4 = InterleaveLower(d, q4, q5);
445 +      const auto r5 = InterleaveUpper(d, q4, q5);
446 +      const auto r6 = InterleaveLower(d, q6, q7);
447 +      const auto r7 = InterleaveUpper(d, q6, q7);
448 +
449 +      i0 = ConcatLowerLower(d, r4, r0);
450 +      i1 = ConcatLowerLower(d, r5, r1);
451 +      i2 = ConcatLowerLower(d, r6, r2);
452 +      i3 = ConcatLowerLower(d, r7, r3);
453 +      i4 = ConcatUpperUpper(d, r4, r0);
454 +      i5 = ConcatUpperUpper(d, r5, r1);
455 +      i6 = ConcatUpperUpper(d, r6, r2);
456 +      i7 = ConcatUpperUpper(d, r7, r3);
457 +      to.StorePart(d, i0, m + 0, n + 0);
458 +      to.StorePart(d, i1, m + 1, n + 0);
459 +      to.StorePart(d, i2, m + 2, n + 0);
460 +      to.StorePart(d, i3, m + 3, n + 0);
461 +      to.StorePart(d, i4, m + 4, n + 0);
462 +      to.StorePart(d, i5, m + 5, n + 0);
463 +      to.StorePart(d, i6, m + 6, n + 0);
464 +      to.StorePart(d, i7, m + 7, n + 0);
465      }
466    }
467  }
468 From cacad76ac565a9e008409207de5b2197f5128f1f Mon Sep 17 00:00:00 2001
469 From: Evgenii Kliuchnikov <eustas@google.com>
470 Date: Tue, 1 Feb 2022 15:09:13 +0000
471 Subject: [PATCH] Ramp-up EMCC and V8 versions for CI
472
473 Drive-by: ramp-up HWY version to 0.16.0rc
474 ---
475  .github/workflows/build_test.yml | 6 +++---
476  deps.sh                          | 2 +-
477  lib/jxl/quant_weights.cc         | 4 ++--
478  third_party/CMakeLists.txt       | 1 +
479  third_party/highway              | 2 +-
480  5 files changed, 8 insertions(+), 7 deletions(-)
481
482 #diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml
483 #index 7c1e9fd72..2c99b0ab7 100644
484 #--- a/.github/workflows/build_test.yml
485 #+++ b/.github/workflows/build_test.yml
486 #@@ -461,8 +461,8 @@ jobs:
487 #     runs-on: ubuntu-latest
488 #     env:
489 #       CCACHE_DIR: ${{ github.workspace }}/.ccache
490 #-      EM_VERSION: 2.0.23
491 #-      V8_VERSION: 9.3.22
492 #+      EM_VERSION: 3.1.4
493 #+      V8_VERSION: 9.8.177
494 #       V8: ${{ github.workspace }}/.jsvu/v8
495 #       BUILD_TARGET: wasm32
496
497 #@@ -506,7 +506,7 @@ jobs:
498 #           ${{ runner.os }}-${{ steps.git-env.outputs.parent }}-${{ matrix.variant }}
499
500 #     - name: Install emsdk
501 #-      uses: mymindstorm/setup-emsdk@v10
502 #+      uses: mymindstorm/setup-emsdk@v11
503 #       # TODO(deymo): We could cache this action but it doesn't work when running
504 #       # in a matrix.
505 #       with:
506 #diff --git a/deps.sh b/deps.sh
507 #index 1abf18742..e2bbd755a 100755
508 #--- a/deps.sh
509 #+++ b/deps.sh
510 #@@ -14,7 +14,7 @@ MYDIR=$(dirname $(realpath "$0"))
511 # # Git revisions we use for the given submodules. Update these whenever you
512 # # update a git submodule.
513 # THIRD_PARTY_GFLAGS="827c769e5fc98e0f2a34c47cef953cc6328abced"
514 #-THIRD_PARTY_HIGHWAY="e69083a12a05caf037cabecdf1b248b7579705a5"
515 #+THIRD_PARTY_HIGHWAY="f13e3b956eb226561ac79427893ec0afd66f91a8"
516 # THIRD_PARTY_SKCMS="64374756e03700d649f897dbd98c95e78c30c7da"
517 # THIRD_PARTY_SJPEG="868ab558fad70fcbe8863ba4e85179eeb81cc840"
518 # THIRD_PARTY_ZLIB="cacf7f1d4e3d44d871b605da3b647f07d718623f"
519 #diff --git a/lib/jxl/quant_weights.cc b/lib/jxl/quant_weights.cc
520 #index 2acd639b0..e8d9a10ed 100644
521 #--- a/lib/jxl/quant_weights.cc
522 #+++ b/lib/jxl/quant_weights.cc
523 #@@ -318,8 +318,8 @@ Status ComputeQuantTable(const QuantEncoding& encoding,
524 #   HWY_CAPPED(float, 64) d;
525 #   for (size_t i = 0; i < num * 3; i += Lanes(d)) {
526 #     auto inv_val = LoadU(d, weights.data() + i);
527 #-    if (JXL_UNLIKELY(!AllFalse(inv_val >= Set(d, 1.0f / kAlmostZero)) |
528 #-                     !AllFalse(inv_val < Set(d, kAlmostZero)))) {
529 #+    if (JXL_UNLIKELY(!AllFalse(d, inv_val >= Set(d, 1.0f / kAlmostZero)) ||
530 #+                     !AllFalse(d, inv_val < Set(d, kAlmostZero)))) {
531 #       return JXL_FAILURE("Invalid quantization table");
532 #     }
533 #     auto val = Set(d, 1.0f) / inv_val;
534 #diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
535 #index 82d55d47a..afefbaa80 100644
536 #--- a/third_party/CMakeLists.txt
537 #+++ b/third_party/CMakeLists.txt
538 #@@ -82,6 +82,7 @@ endif()  # BUILD_TESTING
539
540 # # Highway
541 # set(HWY_SYSTEM_GTEST ON CACHE INTERNAL "")
542 #+set(HWY_FORCE_STATIC_LIBS ON CACHE INTERNAL "")
543 # if((SANITIZER STREQUAL "asan") OR (SANITIZER STREQUAL "msan"))
544 #   set(HWY_EXAMPLES_TESTS_INSTALL OFF CACHE INTERNAL "")
545 # endif()
546 #diff --git a/third_party/highway b/third_party/highway
547 #index e69083a12..f13e3b956 160000
548 #--- a/third_party/highway
549 #+++ b/third_party/highway
550 #@@ -1 +1 @@
551 #-Subproject commit e69083a12a05caf037cabecdf1b248b7579705a5
552 #+Subproject commit f13e3b956eb226561ac79427893ec0afd66f91a8
553 commit 600b591538827247f1b2ad6ee6ae627a2173b7ec
554 Author: Jan Wassenberg <janwas@google.com>
555 Date:   Fri Feb 4 11:37:43 2022 +0100
556
557     Rename deprecated StoreFence to FlushStream
558
559 diff --git a/lib/profiler/profiler.cc b/lib/profiler/profiler.cc
560 index 63d8569..c72656e 100644
561 --- a/lib/profiler/profiler.cc
562 +++ b/lib/profiler/profiler.cc
563 @@ -138,7 +138,7 @@ class Results {
564    void AnalyzePackets(const Packet* HWY_RESTRICT packets,
565                        const size_t num_packets) {
566      // Ensures prior weakly-ordered streaming stores are globally visible.
567 -    hwy::StoreFence();
568 +    hwy::FlushStream();
569  
570      const uint64_t t0 = TicksBefore();
571  
572 @@ -448,12 +448,12 @@ void ThreadSpecific::ComputeOverhead() {
573        const size_t kReps = 10000;
574        // Analysis time should not be included => must fit within buffer.
575        HWY_ASSERT(kReps * 2 < max_packets_);
576 -      hwy::StoreFence();
577 +      hwy::FlushStream();
578        const uint64_t t0 = TicksBefore();
579        for (size_t i = 0; i < kReps; ++i) {
580          PROFILER_ZONE("Dummy");
581        }
582 -      hwy::StoreFence();
583 +      hwy::FlushStream();
584        const uint64_t t1 = TicksAfter();
585        HWY_ASSERT(num_packets_ + buffer_size_ == kReps * 2);
586        buffer_size_ = 0;
587 #diff --git a/lib/profiler/tsc_timer.h b/lib/profiler/tsc_timer.h
588 #index d3c1bee..802e40d 100644
589 #--- a/lib/profiler/tsc_timer.h
590 #+++ b/lib/profiler/tsc_timer.h
591 #@@ -22,7 +22,6 @@
592 # #include <windows.h>
593 # // Undef macros to avoid collisions
594 # #undef LoadFence
595 #-#undef StoreFence
596 # #endif
597
598 # #if defined(__MACH__)
This page took 0.116724 seconds and 2 git commands to generate.