Skip to content

[Particle][GPU] Potential bug from AI-agent audit: RedistributeMPI uses Real instead of ParticleReal #4965

@hanfluid

Description

@hanfluid

Baseline checked on 2026-02-22:

  • development: 98bce0678fe1129b3df19e558c0fb21350e5f0b0 (2026-02-21)
  • release 26.02: 33007cb7d8798b53082323275ae70ead3e1e9ffa (2026-02-02)

In GPU path of RedistributeMPI, unpack uses Real/sizeof(Real) where packed payload uses ParticleReal:

  • Src/Particle/AMReX_ParticleContainerI.H:2481-2483

Current code:

Real rdata;
std::memcpy(&rdata, pbuf, sizeof(Real));
pbuf += sizeof(Real);

CPU path nearby uses ParticleReal correctly.

Trigger

Builds with Real != ParticleReal (e.g. mixed precision via AMREX_SINGLE_PRECISION_PARTICLES) and this GPU redistribution path.

Expected

Use ParticleReal and sizeof(ParticleReal).

Impact

Misaligned unpack and potential corruption of particle real attributes in mixed-precision configs.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions