Repository navigation
Commit 3e64a79
committed
Add GPUdoubleCalc and use it for the double-precision track math
The track propagation computes its Jacobian and covariance intermediates in
double even when the track is float, because the terms cancel:
jj = dx * (dy2dx - f2 * r2inv) is a difference of nearly equal quantities. MSL
has no double, and plain float is not an option there.
GPUdoubleCalc is compensated two-float arithmetic: the value is mHi + mLo, so
the rounding error of each operation is carried explicitly. Over 500k samples of
the isolated jj expression, float intermediates reach 3.6e-2 relative error with
23 samples past 1e-3, while the two-float form lands at 5.9e-8, half a float ulp,
with none past 1e-3. End to end over 524288 tracks with strongly correlated
covariances it keeps the covariance within 1.8e-6 of sqrt(C_ii C_jj) of the CPU
double result, where plain float is at 1.2e-5 and the CPU double is itself
1.1e-6 away from a cancellation-free reference.
Off Metal it is a plain double, so nothing else moves: substituting the alias
back reproduces the previous source exactly, and the files compile unchanged
with their real build flags.
Cost on an M1 Max, over the whole propagateTo kernel with fast math off: 2.85x
the plain float path. Metal has no fp64 at all, so the comparison is against not
compiling.
The type is defined for every backend so the arithmetic can be tested on the
host, where GPUCA_FORCE_DOUBLECALC and GPUCA_FORCE_FLOATCALC select the
representation explicitly.1 parent 1f3f269 commit 3e64a79
5 files changed
Lines changed: 249 additions & 144 deletions
File tree
- DataFormats/Reconstruction
- include/ReconstructionDataFormats
- src
- Detectors/Base/src
- GPU/Common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
250 | | - | |
251 | | - | |
| 251 | + | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
477 | 478 | | |
478 | 479 | | |
479 | 480 | | |
480 | | - | |
| 481 | + | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
| |||
692 | 693 | | |
693 | 694 | | |
694 | 695 | | |
695 | | - | |
| 696 | + | |
696 | 697 | | |
697 | 698 | | |
698 | 699 | | |
| |||
711 | 712 | | |
712 | 713 | | |
713 | 714 | | |
714 | | - | |
| 715 | + | |
715 | 716 | | |
716 | 717 | | |
717 | 718 | | |
| |||
786 | 787 | | |
787 | 788 | | |
788 | 789 | | |
789 | | - | |
| 790 | + | |
790 | 791 | | |
791 | 792 | | |
792 | 793 | | |
| |||
815 | 816 | | |
816 | 817 | | |
817 | 818 | | |
818 | | - | |
| 819 | + | |
819 | 820 | | |
820 | 821 | | |
821 | 822 | | |
| |||
0 commit comments