Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit f006726

Browse files
committed
[ESIMD] Add tests for atomic operations.
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent 45a96ee commit f006726

File tree

3 files changed

+594
-0
lines changed

3 files changed

+594
-0
lines changed

SYCL/ESIMD/dword_atomic_smoke.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//==---------------- dword_atomic_smoke.cpp - DPC++ ESIMD on-device test --==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// This test checks DWORD atomic operations.
9+
//===----------------------------------------------------------------------===//
10+
// REQUIRES: gpu
11+
// UNSUPPORTED: cuda || hip
12+
// RUN: %clangxx -fsycl %s -o %t.out
13+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
14+
15+
#define UNDEF_USE_LSC_ATOMICS
16+
17+
#include "lsc/atomic_smoke.cpp"

SYCL/ESIMD/esimd_test_utils.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,20 @@ inline void iterate_ops(OpSeq<OpClass, Ops...> ops, F f) {
522522
ConstexprForLoop<0, sizeof...(Ops)>::unroll(act);
523523
}
524524

525+
struct USMDeleter {
526+
queue Q;
527+
void operator()(void *Ptr) {
528+
if (Ptr) {
529+
sycl::free(Ptr, Q);
530+
}
531+
}
532+
};
533+
534+
template <class T>
535+
std::unique_ptr<T, USMDeleter> usm_malloc_shared(queue q, int n) {
536+
std::unique_ptr<T, USMDeleter> res(sycl::malloc_shared<T>(n, q),
537+
USMDeleter{q});
538+
return std::move(res);
539+
}
540+
525541
} // namespace esimd_test

0 commit comments

Comments
 (0)