Skip to content

Test: SIMD#4938

Merged
ax3l merged 13 commits intoAMReX-Codes:developmentfrom
ax3l:topic-test-simd
Feb 7, 2026
Merged

Test: SIMD#4938
ax3l merged 13 commits intoAMReX-Codes:developmentfrom
ax3l:topic-test-simd

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Feb 6, 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

Test generic SIMD patterns with new unit tests.
@ax3l ax3l requested a review from WeiqunZhang February 6, 2026 00:03
@ax3l ax3l added the test label Feb 6, 2026
Add SIMD runners to CI.
@ax3l ax3l changed the title Topic test simd Test: SIMD Feb 6, 2026
@ax3l ax3l mentioned this pull request Feb 6, 2026
5 tasks
@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 6, 2026

/run-hpsf-gitlab-ci

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

@amrex-gitlab-ci-reporter
Copy link
Copy Markdown

GitLab CI 1415577 finished with status: failed. See details at https://gitlab.spack.io/amrex/amrex/-/pipelines/1415577.

@ax3l ax3l changed the title Test: SIMD [WIP] Test: SIMD Feb 6, 2026
@ax3l ax3l changed the title [WIP] Test: SIMD Test: SIMD Feb 6, 2026
False-positive on `-Wnull-dereference` for
```
In member function ‘void amrex::ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::WriteParticles(int, std::ofstream&, int, amrex::Vector<int>&, amrex::Vector<int>&, amrex::Vector<long int>&, const amrex::Vector<int>&, const amrex::Vector<int>&, const amrex::Vector<std::map<std::pair<int, int>, typename amrex::ParticleTile<T_ParticleType, NArrayReal, NArrayInt, Allocator>::SoA::IntVector> >&, bool) const [with T_ParticleType = amrex::Particle<3, 0>; int T_NArrayReal = 0; int T_NArrayInt = 0; Allocator = std::allocator; T_CellAssignor = amrex::DefaultAssignor]’:
cc1plus: error: potential null pointer dereference [-Werror=null-dereference]
cc1plus: error: potential null pointer dereference [-Werror=null-dereference]
```
@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 6, 2026

@WeiqunZhang can you please remove the [email protected] C++20 OMP [tests] test from required in the AMReX branch protection settings? I will need to modify this one to be named GNU@12 C++20 OMP SIMD [tests] for clarity if that is ok.

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 6, 2026

/run-hpsf-gitlab-ci

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 6, 2026

Oh wow, GCC has so many false positives. I might bump to 13...

False-positive on `-Wnull-dereference` for
```
    inlined from ‘void amrex::ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::WriteParticles(int, std::ofstream&, int, amrex::Vector<int>&, amrex::Vector<int>&, amrex::Vector<long int>&, const amrex::Vector<int>&, const amrex::Vector<int>&, const amrex::Vector<std::map<std::pair<int, int>, typename amrex::ParticleTile<T_ParticleType, NArrayReal, NArrayInt, Allocator>::SoA::IntVector> >&, bool) const [with T_ParticleType = amrex::Particle<3, 0>; int T_NArrayReal = 0; int T_NArrayInt = 0; Allocator = std::allocator; T_CellAssignor = amrex::DefaultAssignor]’ at /home/runner/work/amrex/amrex/Src/Particle/AMReX_ParticleIO.H:623:36:
/usr/include/c++/12/bits/stl_construct.h:119:7: error: potential null pointer dereference [-Werror=null-dereference]
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
```
@WeiqunZhang
Copy link
Copy Markdown
Member

Sometimes, it's not entirely the compiler's fault. They always assume the worse case scenario. But if we also do that, it will affect the code's performance.

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 6, 2026

Yeah it seems a bit unhappy in GCC 11 & 12 with the ParticleIO routines. I could disable that nullptr check, but since I try to build a first SIMD runner, I would like to not turn that one off to keep this covered for purely SIMD code paths.

Let me know if I shall add a purely new runner, there might be a reason to keep GCC 10 around as a runner as well for now.

@amrex-gitlab-ci-reporter
Copy link
Copy Markdown

GitLab CI 1416671 finished with status: success. See details at https://gitlab.spack.io/amrex/amrex/-/pipelines/1416671.

Error:
```
    inlined from ‘void amrex::particle_detail::packIOData(amrex::Vector<int>&, amrex::Vector<double>&, const PC&, int, int, const amrex::Vector<int>&, const amrex::Vector<int>&, const amrex::Vector<std::map<std::pair<int, int>, typename PC::IntVector> >&, const amrex::Vector<int>&, int, bool) [with PC = amrex::ParticleContainer_impl<amrex::Particle<3, 0>, 0, 0, std::allocator, amrex::DefaultAssignor>]’ at /home/runner/work/amrex/amrex/Src/Particle/AMReX_WriteBinaryParticleData.H:457:26,
    inlined from ‘void amrex::ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssignor>::WriteParticles(int, std::ofstream&, int, amrex::Vector<int>&, amrex::Vector<int>&, amrex::Vector<long int>&, const amrex::Vector<int>&, const amrex::Vector<int>&, const amrex::Vector<std::map<std::pair<int, int>, typename amrex::ParticleTile<T_ParticleType, NArrayReal, NArrayInt, Allocator>::SoA::IntVector> >&, bool) const [with T_ParticleType = amrex::Particle<3, 0>; int T_NArrayReal = 0; int T_NArrayInt = 0; Allocator = std::allocator; T_CellAssignor = amrex::DefaultAssignor]’ at /home/runner/work/amrex/amrex/Src/Particle/AMReX_ParticleIO.H:623:36:
/usr/include/c++/13/bits/stl_construct.h:119:7: error: potential null pointer dereference [-Werror=null-dereference]
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
@WeiqunZhang
Copy link
Copy Markdown
Member

The null-dereference is due to this GCC bug. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108860 I think we have to add -Wno-null-dereference.

where[grid] = VisMF::FileOffset(ofs);

if (count[grid] == 0) { continue; }
if (count[grid] <= 0) { continue; }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you, Weiqun!

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 7, 2026

Thank you for your help, it works 🎉

And fixes a warning 🎉

@ax3l ax3l added the warning label Feb 7, 2026
@ax3l ax3l enabled auto-merge (squash) February 7, 2026 01:11
@ax3l ax3l merged commit d7da504 into AMReX-Codes:development Feb 7, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants