Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic contention in triplet counting kernel could be alleviated #818

Open
stephenswat opened this issue Jan 22, 2025 · 0 comments
Open
Labels
good first issue Good for newcomers improvement Improve an existing feature performance Performance-relevant changes shared Changes related to shared code

Comments

@stephenswat
Copy link
Member

The triplet counting kernel is our third-hottest kernel in terms of throughput. However, this kernel introduces some atomic contention through the way it pushes data to the output array:

// if the number of triplets per mb is larger than 0, write the triplet
// counter into the collection
if (num_triplets_per_mb > 0) {
triplet_counter_spM& header = spM_triplet_counter.at(counter_link);
vecmem::device_atomic_ref<unsigned int> nTriplets(header.m_nTriplets);
const unsigned int posTriplets =
nTriplets.fetch_add(num_triplets_per_mb);
mb_triplet_counter.push_back(
{spB_loc, counter_link, num_triplets_per_mb, posTriplets});
}

Although modern GPGPU architectures do automatically coalesce atomic accesses to some extent, we might still benefit from coalescing the atomic addition on a block-scale first (using, e.g., barrier::blockCount) and issuing only a single atomic increment per block.

This relatively simple and well-contained issue should be very suitable for developers trying to get started with traccc or with GPGPU programming in general.

@stephenswat stephenswat added good first issue Good for newcomers improvement Improve an existing feature performance Performance-relevant changes shared Changes related to shared code labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers improvement Improve an existing feature performance Performance-relevant changes shared Changes related to shared code
Projects
None yet
Development

No branches or pull requests

1 participant