Skip to content

Commit

Permalink
Use default arch alignment as default alignment for xsimd::aligned_al…
Browse files Browse the repository at this point in the history
…locator

That way we match the behavior of xsimd::batch.
  • Loading branch information
serge-sans-paille committed Jan 20, 2025
1 parent e28ef98 commit cb9412f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benchmark/xsimd_benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace xsimd
using duration_type = std::chrono::duration<double, std::milli>;

template <class T>
using bench_vector = std::vector<T, xsimd::aligned_allocator<T, default_arch::alignment()>>;
using bench_vector = std::vector<T, xsimd::aligned_allocator<T>>;

template <class T>
void init_benchmark(bench_vector<T>& lhs, bench_vector<T>& rhs, bench_vector<T>& res, size_t size)
Expand Down
2 changes: 1 addition & 1 deletion examples/mandelbrot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ int main()
const float y1 = 1;
const int maxIters = 256;

std::vector<int, xsimd::aligned_allocator<int, xsimd::default_arch::alignment()>> buf(width * height);
std::vector<int, xsimd::aligned_allocator<int>> buf(width * height);

auto bencher = pico_bench::Benchmarker<milliseconds> { 64, seconds { 10 } };

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/memory/xsimd_aligned_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace xsimd
* @tparam T type of objects to allocate.
* @tparam Align alignment in bytes.
*/
template <class T, size_t Align>
template <class T, size_t Align = std::conditional<std::is_same<unsupported, default_arch>::value, generic, default_arch>::type::alignment()>
class aligned_allocator
{
public:
Expand Down

0 comments on commit cb9412f

Please sign in to comment.