Skip to content

Please consider the following formatting changes to #15866 - #405

Closed
alibuild wants to merge 2 commits into
ktf:pr15866from
alibuild:alibot-cleanup-15866
Closed

alibuild wants to merge 2 commits into
ktf:pr15866from
alibuild:alibot-cleanup-15866

Conversation

@alibuild

Copy link
Copy Markdown
Collaborator

Your PR AliceO2Group#15866 cannot be merged as is. You should either run clang-format yourself and update the pull request, or merge this PR in yours.
You can find the AliceO2 coding conventions at https://github.com/AliceO2Group/CodingGuidelines.

ktf and others added 2 commits September 29, 2026 11:45
Metal Shading Language has no double at all, and the tracking needs one in a
handful of places: the track parametrisation, the propagator and the material
budget all carry double members and do double arithmetic.

GPUCommonDoubleBinary64.h implements binary64 on top of a 64-bit integer. Round
to nearest even only, with subnormals, infinities and NaNs, and NaN propagation
in the ARM64 order, so an Apple host is a bit-exact reference down to the
payload. Addition, subtraction, multiplication, division and the conversions to
and from float and the 32-bit integers are exact; sin and cos are fdlibm's and
land within 2 ulp of libm. There is no fused multiply-add and no square root.

GPUCommonMath's own double helpers cannot serve the class: SinCosd's OpenCL arm
passes the cosine by pointer where MSL takes a thread reference, so it does not
compile, and Abs<double> is worse because it does -- fabs resolves to
metal::fabs(float) through the implicit conversion, with no error and no warning,
rounding the mantissa away at 17 call sites including the SMatrixGPU pivot
selection and the Kalman guards against Almost0 and Almost1. Both are defined for
Metal in GPUCommonDouble.h instead, and a static_assert there turns the silent
case into a compile error, since metal::fabs is not constant-evaluable.

The Metal entry point aliases the double keyword to the class, so the shared
headers go on saying double and no call site changes. The header refuses to
build anywhere else, since every other backend has a real double.

It costs of the order of a hundred times plain float on an M-series GPU, which
the tracking can afford because double is a small fraction of its floating point
work. In exchange a Metal build reproduces the CPU result bit for bit wherever
it uses only the exact operations.
@alibuild alibuild closed this Sep 30, 2026
@alibuild
alibuild deleted the alibot-cleanup-15866 branch September 30, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants