-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CTS] Added test for sequencing events
This tests that the `urEnqueueEventsWaitWithBarrier` function functions as a barrier. That is, it blocks until all events prior to it in the queue are completed. Since this test may fail non-deterministically, it is ran a few times. Note that current adapters seem to always execute events sequentially, so this is a no-op.
- Loading branch information
1 parent
6c98e0e
commit 3b5dece
Showing
4 changed files
with
196 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <stdint.h> | ||
#include <sycl/sycl.hpp> | ||
|
||
class Add; | ||
class Mul; | ||
|
||
int main() { | ||
sycl::queue deviceQueue; | ||
uint32_t val = 0; | ||
|
||
auto buff = sycl::buffer<uint32_t>(&val, 1); | ||
|
||
deviceQueue.submit([&](sycl::handler &cgh) { | ||
auto acc = buff.get_access<sycl::access::mode::read_write>(cgh); | ||
cgh.single_task<Add>([=]() { | ||
for (uint32_t i = 0; i < 1000; i++) { | ||
volatile uint32_t tmp = acc[0]; | ||
acc[0] = tmp + 1; | ||
} | ||
}); | ||
}); | ||
|
||
deviceQueue.submit([&](sycl::handler &cgh) { | ||
auto acc = buff.get_access<sycl::access::mode::read_write>(cgh); | ||
cgh.single_task<Mul>([=]() { | ||
for (uint32_t i = 0; i < 2; i++) { | ||
volatile uint32_t tmp = acc[0]; | ||
acc[0] = tmp * 2; | ||
} | ||
}); | ||
}); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters