Skip to content

[SYCL] Enable rand with CUDA and HIP #19001

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

Merged
merged 3 commits into from
Jun 17, 2025
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
6 changes: 0 additions & 6 deletions libdevice/crt_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@

#include <cstdint>

#ifndef __NVPTX__
#define RAND_NEXT_LEN 1024
DeviceGlobal<uint64_t[RAND_NEXT_LEN]> RandNext;
#endif

#if defined(__SPIR__) || defined(__SPIRV__) || defined(__NVPTX__) || \
defined(__AMDGCN__)
Expand All @@ -34,8 +32,6 @@ int memcmp(const void *s1, const void *s2, size_t n) {
return __devicelib_memcmp(s1, s2, n);
}

#ifndef __NVPTX__

// This simple rand is for ease of use only, the implementation aligns with
// LLVM libc rand which is based on xorshift64star pseudo random number
// generator. If work item number <= 1024, each work item has its own internal
Expand Down Expand Up @@ -107,8 +103,6 @@ void srand(unsigned int seed) {
RAND_NEXT_ACC[gid1] = seed;
}

#endif

#if defined(_WIN32)
// Truncates a wide (16 or 32 bit) string (wstr) into an ASCII string (str).
// Any non-ASCII characters are replaced by question mark '?'.
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/DeviceLib/rand_test.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

// UNSUPPORTED: target-nvidia || target-amd

#include <sycl/builtins.hpp>
#include <sycl/detail/core.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
// tests to match the required format and in that case you should just update
// (i.e. reduce) the number and the list below.
//
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 254
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 253
//
// List of improperly UNSUPPORTED tests.
// Remove the CHECK once the test has been properly UNSUPPORTED.
Expand Down Expand Up @@ -114,7 +114,6 @@
// CHECK-NEXT: DeviceLib/imf_half_type_cast.cpp
// CHECK-NEXT: DeviceLib/imf_half_type_cast.cpp
// CHECK-NEXT: DeviceLib/imf_simd_emulate_test.cpp
// CHECK-NEXT: DeviceLib/rand_test.cpp
// CHECK-NEXT: DeviceLib/separate_compile_test.cpp
// CHECK-NEXT: ESIMD/PerformanceTests/BitonicSortK.cpp
// CHECK-NEXT: ESIMD/PerformanceTests/BitonicSortKv2.cpp
Expand Down