Skip to content

Chemistry on generic amdflang builds is capped at ten species by a literal array bound #1848

Description

@sbryngelson

Generic amdflang builds cap chemistry at ten species. The bound is a literal dimension(10) repeated across 21 declarations in nine files, swapped in for dimension(num_species) by the USING_AMD fypp guard when case optimization is off, and it is stated as a constraint in m_checker_common.fpp:

@:PROHIBIT(chemistry .and. num_species > 10, "num_species > 10 for AMDFLang when Case optimization is off")

Two problems.

The check never runs. m_thermochem.f90 is generated per mechanism with concrete bounds, so an eleven-species mechanism gives a dimension(11) dummy against a dimension(10) actual and the build dies first:

error: Actual argument array has fewer elements (10) than dummy

repeated across m_chemistry.fpp, m_cbc.fpp, m_riemann_state.fpp, m_ibm.fpp and the three Riemann solvers. The reader gets a wall of argument-mismatch errors rather than the sentence explaining the limit. Hit while adding an eleven-species mechanism in #1821.

Raising the literal is not free. These are per-thread arrays in the hot kernels. m_riemann_solver_hllc.fpp:63 alone declares eleven of them:

real(wp), dimension(10) :: Ys_L, Ys_R, Xs_L, Xs_R, Gamma_iL, Gamma_iR, Cp_iL, Cp_iR, R_species, h_iL, h_iR

110 doubles per thread at the current bound, 220 at dimension(20). On gfx90a a kernel drops from three waves per SIMD to two at 170 registers, so a bound raised for one mechanism is paid by every generic-build chemistry case on that backend.

Worth deciding between:

  1. Raise the bound and measure what it costs the chemistry kernels.
  2. Keep it and make the limit legible: a fypp-time failure carrying the message above, so the constraint is stated rather than inferred from argument mismatches.
  3. Drop the guards once the amdgpu compiler bug they work around is fixed, which removes the class.

Case-optimized builds are unaffected: the guard is not MFC_CASE_OPTIMIZATION and USING_AMD, so those take dimension(num_species) and any species count works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions