0011-third-party-highway-src.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. diff --git a/hwy/aligned_allocator.cc b/hwy/aligned_allocator.cc
  2. index bec7c3b..677fcf1 100644
  3. --- a/hwy/aligned_allocator.cc
  4. +++ b/hwy/aligned_allocator.cc
  5. @@ -27,7 +27,14 @@
  6. namespace hwy {
  7. namespace {
  8. +#if HWY_ARCH_RVV && defined(__riscv_vector)
  9. +// Not actually an upper bound on the size, but this value prevents crossing a
  10. +// 4K boundary (relevant on Andes).
  11. +constexpr size_t kAlignment = HWY_MAX(HWY_ALIGNMENT, 4096);
  12. +#else
  13. constexpr size_t kAlignment = HWY_MAX(HWY_ALIGNMENT, kMaxVectorSize);
  14. +#endif
  15. +
  16. // On x86, aliasing can only occur at multiples of 2K, but that's too wasteful
  17. // if this is used for single-vector allocations. 256 is more reasonable.
  18. constexpr size_t kAlias = kAlignment * 4;
  19. diff --git a/hwy/base.h b/hwy/base.h
  20. index d87eb34..db5df58 100644
  21. --- a/hwy/base.h
  22. +++ b/hwy/base.h
  23. @@ -319,7 +319,7 @@ static constexpr HWY_MAYBE_UNUSED size_t kMaxVectorSize = 64; // AVX-512
  24. #elif HWY_ARCH_RVV
  25. // Not actually an upper bound on the size, but this value prevents crossing a
  26. // 4K boundary (relevant on Andes).
  27. -static constexpr HWY_MAYBE_UNUSED size_t kMaxVectorSize = 4096;
  28. +static constexpr HWY_MAYBE_UNUSED size_t kMaxVectorSize = 64;
  29. #define HWY_ALIGN_MAX alignas(8) // only elements need be aligned
  30. #else
  31. static constexpr HWY_MAYBE_UNUSED size_t kMaxVectorSize = 16;
  32. @@ -333,7 +333,7 @@ static constexpr HWY_MAYBE_UNUSED size_t kMaxVectorSize = 16;
  33. // by concatenating base type and bits.
  34. // RVV already has a builtin type and the GCC intrinsics require it.
  35. -#if HWY_ARCH_RVV && HWY_COMPILER_GCC
  36. +#if HWY_ARCH_RVV && HWY_COMPILER_GCC && 0
  37. #define HWY_NATIVE_FLOAT16 1
  38. #else
  39. #define HWY_NATIVE_FLOAT16 0