Skip to content

Better SIMD Complex Support #4609

@ax3l

Description

@ax3l

At the moment, compiling amrex::Complex<> as a ad-hoc SIMD fails on MSVC with

 │ │ %PREFIX%\Library\include\AMReX_GpuComplex.H(28,8): error: requested alignment is not a power of 2
 │ │    28 | struct alignas(2*sizeof(T)) GpuComplex
 │ │       |        ^       ~~~~~~~~~~~

It is possible this is actually an alignment requirement in general (not only MSVC) and magic happens.

We might need to wait for mattkretz/vir-simd#42 / C++26 with a proper implementation, which will likely not be 2xSIMD but SIMDx2 layouted.

User code: this is currently used in ImpactX elements like Multipole.H where the complex math is simple. For more involved complex math, we cannot yet vectorize.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions