Skip to content

perf(detray): Align transform3 struct to 16 bytes - #6027

Draft
stephenswat wants to merge 1 commit into
acts-project:mainfrom
stephenswat:detray/perf/align_transform3_to_16_bytes
Draft

perf(detray): Align transform3 struct to 16 bytes#6027
stephenswat wants to merge 1 commit into
acts-project:mainfrom
stephenswat:detray/perf/align_transform3_to_16_bytes

Conversation

@stephenswat

Copy link
Copy Markdown
Member

The transform3 struct is exactly 128 bytes (although it can go down to 48 without issue), but is aligned to 4 byte boundaries. This means that any loads into the struct must assume non-alignment. Aligning the struct to 16 bytes allows the compiler to issue 128 bit loads if it wants, which should improve latency and throughput.

@github-actions github-actions Bot added this to the next milestone Sep 4, 2026
@github-actions github-actions Bot added the Component - Detray Affects the Detray project label Sep 4, 2026
@stephenswat

Copy link
Copy Markdown
Member Author

Performance summary

Here is a summary of the performance effects of this PR:

Graphical

Tabular

KernelReciprocal ThroughputParallelism
56c4b9d574ba42Delta56c4b9d574ba42
propagate_to_next_surface4.20 ms4.20 ms-0.0%4.884.88
find_tracks1.19 ms1.19 ms0.3%1.841.83
count_doublets792.51 μs787.51 μs-0.6%1.611.61
count_triplets556.24 μs556.27 μs0.0%1.021.02
find_doublets513.61 μs513.82 μs0.0%3.083.07
ccl_kernel434.26 μs435.47 μs0.3%1.711.71
Thrust::sort384.34 μs384.21 μs-0.0%7.277.27
condense_tracks250.84 μs250.40 μs-0.2%5.765.76
find_triplets161.16 μs160.79 μs-0.2%1.321.31
build_tracks125.25 μs125.43 μs0.1%3.713.72
select_seeds58.78 μs59.25 μs0.8%1.341.34
estimate_track_params26.43 μs26.40 μs-0.1%2.692.69
populate_grid23.57 μs23.58 μs0.0%1.221.22
count_grid_capacities21.91 μs21.90 μs-0.1%1.221.22
remove_duplicates19.97 μs19.86 μs-0.5%25.6825.72
fill_sorted_measurements16.16 μs16.14 μs-0.1%1.131.13
update_triplet_weights14.80 μs14.65 μs-1.0%1.271.27
fill_finding_propagation_sort_keys9.85 μs9.84 μs-0.1%7.227.23
form_spacepoints7.42 μs7.46 μs0.5%1.471.47
reduce_triplet_counts5.49 μs5.48 μs-0.3%3.083.08
unknown5.05 μs5.04 μs-0.2%4.274.27
count_spacepoints2.99 μs2.99 μs-0.2%1.471.47
Thrust::scan1.79 μs1.78 μs-0.6%92.5492.90
fill_finding_duplicate_removal_sort_keys1.56 μs1.55 μs-0.3%38.0738.14
create_device_detectorNoneNone-0.2%32764.7232764.72
Total8.82 ms8.82 ms-0.0%3.733.73

Important

All metrics in this report are given as reciprocal throughput, not as wallclock runtime.

Note

This is an automated message produced upon the explicit request of a human being.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Public API surface diff

No change to the public API surface. ✅

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

📊: Physics performance monitoring for 7a6e7b6

Full contents

physmon summary

niermann999
niermann999 previously approved these changes Sep 4, 2026

@niermann999 niermann999 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also have been playing around with alignment of these during the vectorization studies and never saw much of a difference...

@paulgessinger
paulgessinger added this pull request to the merge queue Sep 4, 2026
@paulgessinger
paulgessinger removed this pull request from the merge queue due to a manual request Sep 4, 2026
@paulgessinger
paulgessinger marked this pull request as draft September 4, 2026 13:37
The transform3 struct is exactly 128 bytes (although it can go down to
48 without issue), but is aligned to 4 byte boundaries. This means that
any loads into the struct must assume non-alignment. Aligning the struct
to 16 bytes allows the compiler to issue 128 bit loads if it wants,
which should improve latency and throughput.
@stephenswat
stephenswat force-pushed the detray/perf/align_transform3_to_16_bytes branch from 574ba42 to 7a6e7b6 Compare September 7, 2026 11:34
@acts-policybot
acts-policybot Bot dismissed niermann999’s stale review September 7, 2026 11:34

Invalidated by push of 7a6e7b6

@stephenswat

Copy link
Copy Markdown
Member Author

Performance summary

Here is a summary of the performance effects of this PR:

Graphical

Tabular

KernelReciprocal ThroughputParallelism
56c4b9d7a6e7b6Delta56c4b9d7a6e7b6
propagate_to_next_surface4.20 ms4.17 ms-0.6%4.884.89
find_tracks1.19 ms1.20 ms0.3%1.831.83
count_doublets786.16 μs792.78 μs0.8%1.611.60
count_triplets557.41 μs558.18 μs0.1%1.021.02
find_doublets515.40 μs512.44 μs-0.6%3.083.08
ccl_kernel434.81 μs434.41 μs-0.1%1.711.71
Thrust::sort384.58 μs383.71 μs-0.2%7.277.27
condense_tracks250.61 μs250.84 μs0.1%5.755.76
find_triplets161.06 μs161.04 μs-0.0%1.311.31
build_tracks125.58 μs125.40 μs-0.1%3.723.72
select_seeds58.71 μs58.91 μs0.3%1.341.34
estimate_track_params26.39 μs26.44 μs0.2%2.692.69
populate_grid23.58 μs23.55 μs-0.1%1.221.22
count_grid_capacities21.93 μs21.92 μs-0.0%1.221.22
remove_duplicates19.90 μs19.94 μs0.2%25.7225.67
fill_sorted_measurements16.15 μs16.07 μs-0.4%1.131.13
update_triplet_weights14.69 μs14.72 μs0.2%1.271.27
fill_finding_propagation_sort_keys9.87 μs9.84 μs-0.2%7.237.23
form_spacepoints7.42 μs7.46 μs0.5%1.471.48
reduce_triplet_counts5.48 μs5.48 μs0.1%3.083.08
unknown5.04 μs5.05 μs0.0%4.274.28
count_spacepoints2.99 μs2.99 μs0.2%1.471.47
Thrust::scan1.79 μs1.79 μs0.1%92.6392.63
fill_finding_duplicate_removal_sort_keys1.56 μs1.56 μs-0.0%38.1238.14
create_device_detectorNoneNone-0.1%32764.7232764.72
Total8.82 ms8.80 ms-0.2%3.733.72

Important

All metrics in this report are given as reciprocal throughput, not as wallclock runtime.

Note

This is an automated message produced upon the explicit request of a human being.

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

/// @param m is the matrix
/// @param col is the column index
DETRAY_HOST_DEVICE
static constexpr array_type<4> column(const matrix44 &m, index_t col) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to implement this as specialized block getter? That could benefit more code than just the transform3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See e.g. acts-project/algebra-plugins#140
Also, could this go into a dedicated PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Detray Affects the Detray project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants