The protected helpers may contract on CUDA and HIP, and no device test says whether they do

Aperta
#358 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, python

Direzione di ricerca

Start with native/include/solprop_native/fp.hpp, where the protection is empty on CUDA and HIP builds, then compare far_field.hpp's __dmul_rn/__dadd_rn usage in far_field_radius. Read test_fp.cpp to see the CPU counterpart the device test should mirror. Done means a device test that fails when protection is removed and passes on CUDA and HIP builds, with benchmark costs recorded.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: gpu area: native priority: low testing
What happens

ADR-049 keeps a set of "protected helpers" from fused multiply-add, because their small results depend on separately rounded products: the φ series, phase sums, compensated defects and the ionised fraction. On CUDA and HIP builds the protection is empty, nvcc's host pass included, so these follow each compiler's contraction default (ADR-049's amendment). Device accuracy is held by the measured device envelopes instead, and build_info().optimization_policy records "compiler-default contraction".

Read, not run. One place is already written the other way: far_field_radius spells each operation with __dmul_rn and __dadd_rn under __CUDA_ARCH__ or __HIP_DEVICE_COMPILE__.

Why it matters

No wrong result is known. But contraction on a device moves fields: when #59 unrolled the device passes, the arithmetic contracted differently and he_rdw_averaged moved 1.3e-11 over 411 steps on an MI325X, inside its envelope. Nothing tests that a protected block is protected on a device, so a compiler upgrade could change those blocks unseen.

To do
  • Give the protected helpers round-to-nearest forms on devices: the intrinsics under __CUDA_ARCH__, and on HIP either the same intrinsics, as far_field.hpp does, or Clang's fp contract(off). Whether the pragma reaches HIP's device pass is unchecked. The setting is lexical, so a block must use the strict helpers, not Kokkos::complex's operators, and the blocks need auditing for this (51 SOLPROP_NATIVE_STRICT_BLOCK occurrences under native/src/general.cpp and native/include/).
  • Add a device test that a protected block does not fuse, the counterpart of test_fp.cpp.
  • Requalify the device envelopes, and time the cost: the intrinsics give up FMA in those passes, with python -m benchmarks ab --device.
  • Update ADR-049's amendment, fp.hpp's comment and optimization_policy.

What must not change: CPU builds, and any bound in the tests. #135 is the CPU march's counterpart of this rule.

Done when

The new test passes on a CUDA and a HIP build and fails with the protection removed. pytest -m gpu passes on both. The cost on he_rdw_averaged and rdw is in the pull request on one NVIDIA and one AMD data-centre GPU.


Checked against commit 8a9f764. Takes over the roadmap's entry "Round-to-nearest arithmetic in the protected helpers on devices".

Lingua principale
Python
Stelle
3
Fork
3
Merge medio
6h 51m
PR unite (30g)
136

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LupoLab/solprop

Tutte le issue di LupoLab/solprop

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.