Skip to content

GPU Metal: allocate the memory pools from anonymous memory - #16069

Merged
ktf merged 1 commit into
AliceO2Group:devfrom
ktf:pr16069
Nov 7, 2026
Merged

ktf merged 1 commit into
AliceO2Group:devfrom
ktf:pr16069

Conversation

@ktf

@ktf ktf commented Nov 6, 2026

Copy link
Copy Markdown
Member

The full system test publishes its time frames seconds apart, and after
a few idle seconds the first command buffer of a time frame waits until
the driver has made the memory pools resident again: in a Metal System
Trace its driver processing takes about 165 ms, with "Wire 5.59 GiB
System Memory" for the 6 GB device pool. That is the ~160 ms by which a
time frame in the full system test was slower than the same time frame
in the standalone benchmark, which never idles; with 2 s between the
time frames the two take the same time. The driver does this faster for
a buffer around anonymous memory than for one Metal allocates: 77 ms
instead of 125 ms for 6 GB after 8 s idle on an M1 Max, in a standalone
test. So wrap mmap'ed memory with newBufferWithBytesNoCopy for the device
and host pools.

On an M1 Max, interleaved over 4 rounds, the warm time frames of the
TPC-only reconstruction of the 10-collision Pb-Pb full system test take
955 ms instead of 1003 (median of the chain's wall time, 8 s between the
time frames), with the same 1,355,432 clusters. The 30-collision Pb-Pb
benchmark is unchanged (970 against 967 ms per event over 3 rounds), and
its clusters are byte-identical to the CPU's, as on sim5pp.

The full system test publishes its time frames seconds apart, and after
a few idle seconds the first command buffer of a time frame waits until
the driver has made the memory pools resident again: in a Metal System
Trace its driver processing takes about 165 ms, with "Wire 5.59 GiB
System Memory" for the 6 GB device pool. That is the ~160 ms by which a
time frame in the full system test was slower than the same time frame
in the standalone benchmark, which never idles; with 2 s between the
time frames the two take the same time. The driver does this faster for
a buffer around anonymous memory than for one Metal allocates: 77 ms
instead of 125 ms for 6 GB after 8 s idle on an M1 Max, in a standalone
test. So wrap mmap'ed memory with newBufferWithBytesNoCopy for the device
and host pools.

On an M1 Max, interleaved over 4 rounds, the warm time frames of the
TPC-only reconstruction of the 10-collision Pb-Pb full system test take
955 ms instead of 1003 (median of the chain's wall time, 8 s between the
time frames), with the same 1,355,432 clusters. The 30-collision Pb-Pb
benchmark is unchanged (970 against 967 ms per event over 3 rounds), and
its clusters are byte-identical to the CPU's, as on sim5pp.
@ktf
ktf requested a review from davidrohr as a code owner November 6, 2026 21:58
@ktf
ktf merged commit 92368c4 into AliceO2Group:dev Nov 7, 2026
10 of 11 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.

1 participant