Skip to content
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
12 changes: 8 additions & 4 deletions sycl/include/sycl/detail/spirv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,22 +1225,26 @@ EnableIfGenericShuffle<T> ShuffleUp(GroupT g, T x, uint32_t delta) {
template <typename Group>
typename std::enable_if_t<
ext::oneapi::experimental::is_fixed_topology_group_v<Group>>
ControlBarrier(Group, memory_scope FenceScope, memory_order Order) {
ControlBarrier(Group, [[maybe_unused]] memory_scope FenceScope,
[[maybe_unused]] memory_order Order) {
#ifdef __SYCL_DEVICE_ONLY__
__spirv_ControlBarrier(group_scope<Group>::value, getScope(FenceScope),
getMemorySemanticsMask(Order) |
__spv::MemorySemanticsMask::SubgroupMemory |
__spv::MemorySemanticsMask::WorkgroupMemory |
__spv::MemorySemanticsMask::CrossWorkgroupMemory);
#endif
}

template <typename Group>
typename std::enable_if_t<
ext::oneapi::experimental::is_user_constructed_group_v<Group>>
ControlBarrier(Group g, memory_scope FenceScope, memory_order Order) {
ControlBarrier([[maybe_unused]] Group g,
[[maybe_unused]] memory_scope FenceScope,
[[maybe_unused]] memory_order Order) {
#if defined(__NVPTX__)
__nvvm_bar_warp_sync(detail::ExtractMask(detail::GetMask(g))[0]);
#else
(void)g;
#elif defined(__SYCL_DEVICE_ONLY__)
// SPIR-V does not define an instruction to synchronize partial groups.
// However, most (possibly all?) of the current SPIR-V targets execute
// work-items in lockstep, so we can probably get away with a MemoryBarrier.
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ set(SYCL_COMMON_SOURCES
"queue.cpp"
"sampler.cpp"
"stream.cpp"
"spirv_ops.cpp"
"virtual_mem.cpp"
"detail/memory_pool_impl.cpp"
"detail/async_alloc.cpp"
Expand All @@ -341,6 +340,7 @@ set(SYCL_COMMON_SOURCES
)

set(SYCL_NON_PREVIEW_SOURCES "${SYCL_COMMON_SOURCES}"
"spirv_ops.cpp"
)


Expand Down
20 changes: 0 additions & 20 deletions sycl/source/detail/platform_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,6 @@ uint32_t PlatformUtil::getNativeVectorWidth(PlatformUtil::TypeIndex TIndex) {
return 0;
}

void PlatformUtil::prefetch(const char *Ptr, size_t NumBytes) {
if (!Ptr)
return;

const size_t CacheLineSize = PlatformUtil::getMemCacheLineSize();
const size_t CacheLineMask = ~(CacheLineSize - 1);
const char *PtrEnd = Ptr + NumBytes;

// Set the pointer to the beginning of the current cache line.
Ptr = reinterpret_cast<const char *>(reinterpret_cast<size_t>(Ptr) &
CacheLineMask);
for (; Ptr < PtrEnd; Ptr += CacheLineSize) {
#if defined(__SYCL_RT_OS_LINUX)
__builtin_prefetch(Ptr);
#elif defined(__SYCL_RT_OS_WINDOWS)
_mm_prefetch(Ptr, _MM_HINT_T0);
#endif
}
}

} // namespace detail
} // namespace _V1
} // namespace sycl
2 changes: 0 additions & 2 deletions sycl/source/detail/platform_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ struct PlatformUtil {
static uint32_t getMemCacheLineSize();

static uint64_t getMemCacheSize();

static void prefetch(const char *Ptr, size_t NumBytes);
};

} // namespace detail
Expand Down
3 changes: 3 additions & 0 deletions sycl/source/ld-version-script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
_ZN10__host_std*;

/* Export SPIR-V built-ins for host device */
/* #ifndef __INTEL_PREVIEW_BREAKING_CHANGES */
/* TODO: drop those in the next ABI-breaking window */
_Z23__spirv_GroupWaitEvents*;
_Z22__spirv_ControlBarrier*;
_Z21__spirv_MemoryBarrier*;
_Z20__spirv_ocl_prefetch*;
/* #endif // __INTEL_PREVIEW_BREAKING_CHANGES */

/* Export offload image hooks */
__sycl_register_lib;
Expand Down
5 changes: 1 addition & 4 deletions sycl/source/spirv_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,4 @@ __SYCL_EXPORT void __spirv_MemoryBarrier(__spv::Scope Memory,
atomic_thread_fence(std::memory_order_seq_cst);
}

__SYCL_EXPORT void __spirv_ocl_prefetch(const char *Ptr,
size_t NumBytes) noexcept {
sycl::detail::PlatformUtil::prefetch(Ptr, NumBytes);
}
__SYCL_EXPORT void __spirv_ocl_prefetch(const char *, size_t) noexcept {}
Loading