Skip to content

Commit

Permalink
[syclcompat][CUDA] FIX UB in test / seq_cst requires sm_70 on CUDA (#…
Browse files Browse the repository at this point in the history
…12575)

Fix UB in test by using a single thread task.

A shared USM variable was being simultaneously written to by multiple
threads without using atomics. AFAIK this is generally not a well
defined program, and was leading to invalid values.

seq_cst also requires sm_70 on CUDA, so the compilation invocation is
updated to reflect this.
The CI device is >= sm_70 so it can use seq_cst. However this test did
not compile for >=sm_70.

Signed-off-by: JackAKirk <[email protected]>
  • Loading branch information
JackAKirk authored Feb 2, 2024
1 parent d018b31 commit cf829e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sycl/test-e2e/syclcompat/atomic/atomic_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

// UNSUPPORTED: hip || (windows && level_zero)

// RUN: %clangxx -std=c++20 -fsycl -fsycl-targets=%{sycl_triple} %s -o %t.out
// RUN: %clangxx -std=c++20 -fsycl -fsycl-targets=%{sycl_triple} %if any-device-is-cuda %{ -Xsycl-target-backend --cuda-gpu-arch=sm_70 %} %s -o %t.out
// RUN: %{run} %t.out

#include <sycl/sycl.hpp>
Expand All @@ -41,8 +41,8 @@
#include "../common.hpp"
#include "atomic_fixt.hpp"

constexpr size_t numBlocks = 64;
constexpr size_t numThreads = 256;
constexpr size_t numBlocks = 1;
constexpr size_t numThreads = 1;
constexpr size_t numData = 6;

template <typename T, typename AtomicType>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/syclcompat/atomic/atomic_memory_acq_rel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

// UNSUPPORTED: hip

// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %if any-device-is-cuda %{ -Xsycl-target-backend --cuda-gpu-arch=sm_70 %} %s -o %t.out
// RUN: %{run} %t.out

#include <iostream>
Expand Down

0 comments on commit cf829e0

Please sign in to comment.