Skip to content

SIMD: Portable Masks, C++20#4607

Merged
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom
ax3l:fix-simd-mask-cvt
Aug 13, 2025
Merged

SIMD: Portable Masks, C++20#4607
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom
ax3l:fix-simd-mask-cvt

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Aug 13, 2025

Summary

Ensure we can use any producing type's simd_mask, e.g., double, when setting (in)valid particles, by manipulating our uint64 in idcpu. This currently requires a conversion/cast in C++. Make this conversion portable, so far it only worked on GCC/Linux.

This helper needs C++20. Thus, build AMReX conditionally always with C++20 or newer when SIMD is requested (non-default). Eventually, we will require C++26 once this becomes standard, and C++29 will have even more updates.

Additional background

Portability to macOS/Windows:

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@ax3l ax3l requested a review from WeiqunZhang August 13, 2025 19:18
@ax3l ax3l added the bug label Aug 13, 2025
ax3l added a commit to ax3l/amrex-feedstock that referenced this pull request Aug 13, 2025
Ensure we can use any producing type's `simd_mask`, e.g., `double`,
when setting (in)valid particles, by manipulating our `uint64` in
`idcpu`. This currently requires a conversion/cast in C++.
Make this conversion portable, so far it only worked on GCC/Linux.

This helper needs C++20. Thus, build AMReX conditionally always with
C++20 or newer when SIMD is requested (non-default). Eventually, we
will require C++26 once this becomes standard, and C++29 will have
even more updates.
@ax3l ax3l force-pushed the fix-simd-mask-cvt branch from bad894e to 1ce4e62 Compare August 13, 2025 19:22
ax3l added a commit to ax3l/amrex-feedstock that referenced this pull request Aug 13, 2025
ax3l added a commit to ax3l/warpx that referenced this pull request Aug 13, 2025
Will make development easier and is fully optional.
See: AMReX-Codes/amrex#4607
ax3l added a commit to ax3l/impactx that referenced this pull request Aug 13, 2025
@WeiqunZhang WeiqunZhang merged commit bd315df into AMReX-Codes:development Aug 13, 2025
75 checks passed
@ax3l ax3l deleted the fix-simd-mask-cvt branch August 13, 2025 22:19
ax3l added a commit to BLAST-ImpactX/impactx that referenced this pull request Aug 13, 2025
* SIMD: Portable Masks, C++20

See AMReX-Codes/amrex#4607

* Fix C++20 Warning

```
src/elements/QuadEdge.H:113:26: error:
  arithmetic between enumeration type
  ‘impactx::elements::QuadEdge::Location’
  and floating-point type ‘amrex::ParticleReal’
  {aka ‘double’} is deprecated
  [-Werror=deprecated-enum-float-conversion]
```
EZoni pushed a commit to BLAST-WarpX/warpx that referenced this pull request Aug 19, 2025
@ax3l ax3l mentioned this pull request Feb 6, 2026
5 tasks
ax3l added a commit that referenced this pull request Feb 7, 2026
## Summary

Needed to cover SIMD features and generic SIMD/non-SIMD patterns.
Bravely vibe coded, but now reviewed and improved for sensibility.

## Additional background

#4924 #4607 #4600  #4520

## Checklist

The proposed changes:
- [ ] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate

---------

Co-authored-by: Weiqun Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants