Skip to content

Commit

Permalink
Make atomic references use correct address spaces.
Browse files Browse the repository at this point in the history
With CUDA there is no difference in the API for using
atomic operations on global or shared memory. But with
SYCL there is...
  • Loading branch information
krasznaa committed Nov 18, 2024
1 parent e077c83 commit 268a632
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions device/common/include/traccc/finding/device/impl/find_tracks.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ TRACCC_DEVICE inline void find_tracks(
vecmem::device_vector<char> out_params_liveness(
payload.out_params_liveness_view);
vecmem::device_vector<candidate_link> links(payload.links_view);
vecmem::device_atomic_ref<unsigned int> num_total_candidates(
*payload.n_total_candidates);
vecmem::device_atomic_ref<unsigned int,
vecmem::device_address_space::global>
num_total_candidates(*payload.n_total_candidates);
vecmem::device_vector<const detray::geometry::barcode> barcodes(
payload.barcodes_view);
vecmem::device_vector<const unsigned int> upper_bounds(
Expand Down Expand Up @@ -158,9 +159,11 @@ TRACCC_DEVICE inline void find_tracks(
for (; curr_meas < num_meas &&
shared_payload.shared_candidates_size < thread_id.getBlockDimX();
curr_meas++) {
unsigned int idx = vecmem::device_atomic_ref<unsigned int>(
shared_payload.shared_candidates_size)
.fetch_add(1u);
unsigned int idx =
vecmem::device_atomic_ref<unsigned int,
vecmem::device_address_space::local>(
shared_payload.shared_candidates_size)
.fetch_add(1u);

/*
* The buffer elemements are tuples of the measurement index and
Expand Down Expand Up @@ -229,7 +232,8 @@ TRACCC_DEVICE inline void find_tracks(

// Increase the number of candidates (or branches) per input
// parameter
vecmem::device_atomic_ref<unsigned int>(
vecmem::device_atomic_ref<
unsigned int, vecmem::device_address_space::local>(
shared_payload
.shared_num_candidates[owner_local_thread_id])
.fetch_add(1u);
Expand Down

0 comments on commit 268a632

Please sign in to comment.