Skip to content

GPU: let the constant-address-space constants be built on Metal - #15963

Merged
ktf merged 1 commit into
AliceO2Group:devfrom
ktf:pr15963
Oct 15, 2026
Merged

ktf merged 1 commit into
AliceO2Group:devfrom
ktf:pr15963

Conversation

@ktf

@ktf ktf commented Oct 14, 2026

Copy link
Copy Markdown
Member

A constructor's implicit this is generic in MSL 4.1, and a generic pointer does
not reach the constant address space, so a class-type constant at program scope
could not be constructed at all: gpustd::bitset for the DetID and GlobalTrackID
masks, CfChargePos for INVALID_CHARGE_POS.

MSL lets a member function be qualified with the address space of its this, so
each of the two constructors gains a constant-qualified overload next to the
existing one; for bitset that sits next to the __constant copy constructor
OpenCL already needs for the same reason.

Reading those constants back needs nothing further, with one exception:
sTrackSources is derived with operator| from the constant sMasks and then
indexed by isTrackSource. Rather than give bitset constant-qualified accessors
as well, that pair is left out of device code on Metal exactly as it already is
on OpenCL; its only caller is on the host.

A constructor's implicit `this` is generic in MSL 4.1, and a generic pointer does
not reach the constant address space, so a class-type constant at program scope
could not be constructed at all: gpustd::bitset for the DetID and GlobalTrackID
masks, CfChargePos for INVALID_CHARGE_POS.

MSL lets a member function be qualified with the address space of its `this`, so
each of the two constructors gains a constant-qualified overload next to the
existing one; for bitset that sits next to the __constant copy constructor
OpenCL already needs for the same reason.

Reading those constants back needs nothing further, with one exception:
sTrackSources is derived with operator| from the constant sMasks and then
indexed by isTrackSource. Rather than give bitset constant-qualified accessors
as well, that pair is left out of device code on Metal exactly as it already is
on OpenCL; its only caller is on the host.
@ktf
ktf merged commit b7c157b into AliceO2Group:dev Oct 15, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants