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

[SYCL] Updated atomic_memory_order_capabilities query tests for OpenCL and Level Zero backends #8825

Merged
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
21 changes: 13 additions & 8 deletions sycl/test-e2e/AtomicRef/atomic_memory_order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// L0, OpenCL backends don't currently support
// info::device::atomic_memory_order_capabilities
// UNSUPPORTED: level_zero || opencl

// NOTE: General tests for atomic memory order capabilities.
// This test checks whether the minimum required memory order capabilities are
// supported in both context and device queries. Specifically the "relaxed"
// memory order capability, which is used in other tests.

#include "atomic_memory_order.h"
#include <cassert>
Expand All @@ -16,12 +15,18 @@ using namespace sycl;
int main() {
queue q;

std::vector<memory_order> supported_memory_orders =
// Context
std::vector<memory_order> supported_context_memory_orders =
q.get_context()
.get_info<info::context::atomic_memory_order_capabilities>();

assert(is_supported(supported_context_memory_orders, memory_order::relaxed));

// Device
std::vector<memory_order> supported_device_memory_orders =
q.get_device().get_info<info::device::atomic_memory_order_capabilities>();

// Relaxed memory order must be supported. This ordering is used in other
// tests.
assert(is_supported(supported_memory_orders, memory_order::relaxed));
assert(is_supported(supported_device_memory_orders, memory_order::relaxed));

std::cout << "Test passed." << std::endl;
}
11 changes: 4 additions & 7 deletions sycl/test-e2e/AtomicRef/atomic_memory_order_acq_rel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// L0, OpenCL, and HIP backends don't currently support
// info::device::atomic_memory_order_capabilities
// UNSUPPORTED: level_zero, opencl

// NOTE: Tests fetch_add for acquire and release memory ordering.

Expand All @@ -14,7 +11,7 @@
using namespace sycl;

template <memory_order order> void test_acquire_global() {
const size_t N_items = 1024;
const size_t N_items = 256;
const size_t N_iters = 1000;

int error = 0;
Expand Down Expand Up @@ -56,7 +53,7 @@ template <memory_order order> void test_acquire_global() {
}

template <memory_order order> void test_acquire_local() {
const size_t local_size = 1024;
const size_t local_size = 256;
const size_t N_wgs = 16;
const size_t global_size = local_size * N_wgs;
const size_t N_iters = 1000;
Expand Down Expand Up @@ -105,7 +102,7 @@ template <memory_order order> void test_acquire_local() {
}

template <memory_order order> void test_release_global() {
const size_t N_items = 1024;
const size_t N_items = 256;
const size_t N_iters = 1000;

int error = 0;
Expand Down Expand Up @@ -147,7 +144,7 @@ template <memory_order order> void test_release_global() {
}

template <memory_order order> void test_release_local() {
const size_t local_size = 1024;
const size_t local_size = 256;
const size_t N_wgs = 16;
const size_t global_size = local_size * N_wgs;
const size_t N_iters = 1000;
Expand Down
3 changes: 0 additions & 3 deletions sycl/test-e2e/AtomicRef/atomic_memory_order_seq_cst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// L0, OpenCL, and HIP backends don't currently support
// info::device::atomic_memory_order_capabilities
// UNSUPPORTED: level_zero, opencl

#include "atomic_memory_order.h"
#include <iostream>
Expand Down