CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
88 lines
2.4 KiB
C++
88 lines
2.4 KiB
C++
// REQUIRES: any-device
|
|
// RUN: %clangxx -fsycl -Wno-error=deprecated-declarations %s -o %t.out
|
|
// RUN: %t.out
|
|
|
|
#include <sycl/sycl.hpp>
|
|
|
|
#include <cassert>
|
|
#include <memory>
|
|
|
|
using namespace sycl;
|
|
|
|
// TODO: original test works with buffers, revert changes to USM once they are
|
|
// implemented.
|
|
int main() {
|
|
bool Fail{};
|
|
|
|
constexpr size_t DataSize = 10;
|
|
const range<1> GlobalRange(6);
|
|
// Id indexer
|
|
{
|
|
queue Q;
|
|
int *Data = sycl::malloc_shared<int>(DataSize, Q);
|
|
for (size_t i = 0; i < DataSize; ++i)
|
|
Data[i] = -1;
|
|
|
|
Q.parallel_for<class id1>(GlobalRange,
|
|
[=](id<1> Index) { Data[Index] = Index[0]; });
|
|
Q.wait();
|
|
|
|
Fail |= [&]() {
|
|
for (size_t i = 0; i < DataSize; ++i) {
|
|
const int ExpectedVal = i < GlobalRange[0] ? i : -1;
|
|
if (Data[i] != ExpectedVal) {
|
|
std::cout << "line: " << __LINE__ << " Data[" << i << "] is "
|
|
<< Data[i] << " expected " << ExpectedVal << std::endl;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}();
|
|
|
|
free(Data, Q);
|
|
}
|
|
|
|
// Item indexer without offset
|
|
{
|
|
// TODO: replace strcut with sycl::int2 once implemented.
|
|
struct DoubleInt {
|
|
int Id;
|
|
int Range;
|
|
};
|
|
queue Q;
|
|
DoubleInt *Data = sycl::malloc_shared<DoubleInt>(DataSize, Q);
|
|
for (size_t i = 0; i < DataSize; ++i)
|
|
Data[i] = {-1, -1};
|
|
|
|
Q.parallel_for<class item1_nooffset>(
|
|
GlobalRange, [=](item<1, false> Index) {
|
|
Data[Index.get_id()] = {int(Index.get_id()[0]),
|
|
int(Index.get_range()[0])};
|
|
});
|
|
Q.wait();
|
|
|
|
Fail |= [&]() {
|
|
for (size_t i = 0; i < DataSize; ++i) {
|
|
const int ExpectedValID = i < GlobalRange[0] ? i : -1;
|
|
const int ExpectedValRange = i < GlobalRange[0] ? GlobalRange[0] : -1;
|
|
if (Data[i].Id != ExpectedValID || Data[i].Range != ExpectedValRange) {
|
|
std::cout << "line: " << __LINE__ << " Data[" << i << "] is {"
|
|
<< Data[i].Id << ", " << Data[i].Range << "} expected {"
|
|
<< ExpectedValID << ", " << ExpectedValRange << "}"
|
|
<< std::endl;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}();
|
|
free(Data, Q);
|
|
}
|
|
|
|
// TODO: Item indexer with offset
|
|
// blocked by liboffload support
|
|
// blocked by absence of sycl::handler implementation
|
|
|
|
// TODO: add nd_item check
|
|
return Fail;
|
|
}
|