Repository navigation
Conversation
TYPE: text only KEYWORDS: license, Apache-2.0, contributor license, doc/licenses SOURCE: Yoel Sevi (Google) DESCRIPTION OF CHANGES: Problem: Following the contributor-license mechanism established in PR wrf-model#2242 (doc/licenses/fraunhofer_license.txt), Google-authored code blocks in subsequent performance pull requests need a standalone permissive license file under doc/licenses/ while leaving WRF's root LICENSE.txt unmodified. Solution: Add doc/licenses/google_license.txt containing the Apache License, Version 2.0 (Copyright 2026 Google LLC), referenced by `! THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/google_license.txt` and `! END LICENSE` comment markers around Google-authored code blocks. If maintainers prefer lower inline marker density on PRs with interleaved edits, I am happy to explore a lighter per-routine notice option. License: Notwithstanding anything else to the contrary set out in https://github.com/wrf-model/WRF, the material here is being released under the Apache 2.0 licence at https://www.apache.org/licenses/LICENSE-2.0 (see doc/licenses/google_license.txt). ISSUE: None LIST OF MODIFIED FILES: A doc/licenses/google_license.txt TESTS CONDUCTED: 1. Documentation-only addition under doc/licenses/; zero source, build, or runtime changes. 2. Pending upstream Jenkins CI. RELEASE NOTE: Add doc/licenses/google_license.txt (Apache-2.0) for Google-contributed performance patches.
TYPE: enhancement KEYWORDS: dyn_em, horizontal diffusion, diff_opt=2, cache locality, stack memory SOURCE: Yoel Sevi (Google) DESCRIPTION OF CHANGES: Problem: When full-metric 3D horizontal diffusion is enabled (diff_opt == 2), horizontal_diffusion_u_2, horizontal_diffusion_v_2, horizontal_diffusion_w_2, and horizontal_diffusion_s in dyn_em/module_diffusion_em.F allocate 3D tile-sized automatic arrays (titau1avg, titau2avg, zx_at_u/v/w, zy_at_u/v/w, H1avg, H2avg, xkxavg, zx_at_m, zy_at_m, tmptendf, plus unused xkxavg and rravg in the momentum routines) and sweep separate 3D loops over j. None of these arrays carry dependencies across j, so they spill out of L1/L2 cache before reuse. Solution: - Replace those per-row scratch arrays with 2D (i, k) j-slabs and fuse the per-row j sweeps with identical floating-point operand order. - Keep titau1, titau2, H1, and H2 3D where j stencil differences exist. - Remove the unused xkxavg and rravg declarations in the three momentum routines (net -57 code lines). License: Notwithstanding anything else to the contrary set out in https://github.com/wrf-model/WRF, the material here is being released under the Apache 2.0 licence at https://www.apache.org/licenses/LICENSE-2.0 (see doc/licenses/google_license.txt). ISSUE: None LIST OF MODIFIED FILES: M dyn_em/module_diffusion_em.F TESTS CONDUCTED: 1. On gfortran 15.2.0 (x86-64 Linux), passed -fcheck=all and FPE-trap (zero, overflow) tests with quiet-NaN initialized locals across all four routines (r4 and -r8, OMP_NUM_THREADS=1,4) with max_abs_diff = 0.0. With signalling-NaN initialization the harness traps identically for unmodified and patched code, so bit-identity was checked in the quiet-NaN build. Earlier 16-rank x86-64 isolated runs measured ~31% less standalone horizontal_diffusion_2 kernel time; the ~1.4% solo solver time saved on a smaller 3D TKE LES proxy domain is within run-to-run spread. Built and verified as part of the full optimization series on x86-64 Linux (gfortran 15.2.0, MPICH, 4-core VMs, 5 interleaved repeats across 5 em_real workflows) across Make (serial, dmpar r4 and -r8, dm+sm), CMake (dmpar), and -DWRF_CHEM=1 with 0 new compiler warnings and bit-for-bit identical wrf.exe outputs (diffwrf = 0 with gfortran on x86-64 without fused multiply-add). 2. Pending upstream Jenkins CI (including Intel and non-x86 compilers). RELEASE NOTE: Replace 3D tile scratch arrays with 2D (i, k) j-slabs in horizontal_diffusion_u_2, v_2, w_2, and s (dyn_em/module_diffusion_em.F).
Collaborator
|
The regression test results: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use 2D j-slab scratch arrays in horizontal_diffusion_2 routines.
TYPE: enhancement
KEYWORDS: dyn_em, horizontal diffusion, diff_opt=2, cache locality, stack memory
SOURCE: Yoel Sevi (Google)
DESCRIPTION OF CHANGES:
Problem:
When full-metric 3D horizontal diffusion is enabled (diff_opt == 2),
horizontal_diffusion_u_2, horizontal_diffusion_v_2, horizontal_diffusion_w_2,
and horizontal_diffusion_s in dyn_em/module_diffusion_em.F allocate 3D
tile-sized automatic arrays (titau1avg, titau2avg, zx_at_u/v/w, zy_at_u/v/w,
H1avg, H2avg, xkxavg, zx_at_m, zy_at_m, tmptendf, plus unused xkxavg and rravg
in the momentum routines) and sweep separate 3D loops over j. None of these
arrays carry dependencies across j, so they spill out of L1/L2 cache before reuse.
Solution:
per-row j sweeps with identical floating-point operand order.
routines (net -57 code lines).
License: Notwithstanding anything else to the contrary set out in https://github.com/wrf-model/WRF, the material here is being released under the Apache 2.0 licence at https://www.apache.org/licenses/LICENSE-2.0 (see doc/licenses/google_license.txt).
LIST OF MODIFIED FILES:
A doc/licenses/google_license.txt
M dyn_em/module_diffusion_em.F
TESTS CONDUCTED:
overflow) tests with quiet-NaN initialized locals across all four routines
(r4 and -r8, OMP_NUM_THREADS=1,4) with max_abs_diff = 0.0. With
signalling-NaN initialization the harness traps identically for unmodified
and patched code, so bit-identity was checked in the quiet-NaN build.
Earlier 16-rank x86-64 isolated runs measured ~31% less standalone
horizontal_diffusion_2 kernel time; the ~1.4% solo solver time saved on a
smaller 3D TKE LES proxy domain is within run-to-run spread.
Built and verified as part of the full optimization series on x86-64 Linux
(gfortran 15.2.0, MPICH, 4-core VMs, 5 interleaved repeats across 5 em_real
workflows) across Make (serial, dmpar r4 and -r8, dm+sm), CMake (dmpar),
and -DWRF_CHEM=1 with 0 new compiler warnings and bit-for-bit identical
wrf.exe outputs (diffwrf = 0 with gfortran on x86-64 without fused
multiply-add).
RELEASE NOTE: Replace 3D tile scratch arrays with 2D (i, k) j-slabs in horizontal_diffusion_u_2, v_2, w_2, and s (dyn_em/module_diffusion_em.F).
Part of the modular CPU performance series; combined multi-workflow benchmarks, hardware/compiler setup, and per-PR summary table are in the Series Overview comment on PR 01 (#2470).
Prepared with AI assistance (Google Gemini).