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

Use atomic load in SYCL version of the single-pass scan #3419

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Src/Base/AMReX_Scan.H
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,27 @@ struct BlockStatus<T, false>

AMREX_GPU_DEVICE AMREX_FORCE_INLINE
STVA<T> read () volatile {
#if defined(AMREX_USE_SYCL)
constexpr auto mo = sycl::memory_order::relaxed;
constexpr auto ms = sycl::memory_scope::device;
constexpr auto as = sycl::access::address_space::global_space;
#endif
if (status == 'x') {
return {'x', 0};
} else if (status == 'a') {
#if defined(AMREX_USE_SYCL)
sycl::atomic_ref<T,mo,ms,as> ar{const_cast<T&>(aggregate)};
return {'a', ar.load()};
#else
return {'a', aggregate};
#endif
} else {
#if defined(AMREX_USE_SYCL)
sycl::atomic_ref<T,mo,ms,as> ar{const_cast<T&>(inclusive)};
return {'p', ar.load()};
#else
return {'p', inclusive};
#endif
}
}

Expand Down
3 changes: 3 additions & 0 deletions Tools/GNUMake/comps/dpcpp.mak
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CC = icx
FC = ifx
F90 = ifx

amrex_oneapi_version = $(shell $(CXX) --version | head -1)
$(info oneAPI version: $(amrex_oneapi_version))

CXXFLAGS =
CFLAGS =
FFLAGS =
Expand Down
Loading