Skip to content

Commit 7320f9c

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (2 commits)
2 parents f9b10b3 + 2dedcee commit 7320f9c

File tree

3 files changed

+151
-18
lines changed

3 files changed

+151
-18
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
= sycl_ext_oneapi_device_is_integrated_gpu
2+
3+
:source-highlighter: coderay
4+
:coderay-linenums-mode: table
5+
6+
// This section needs to be after the document title.
7+
:doctype: book
8+
:toc2:
9+
:toc: left
10+
:encoding: utf-8
11+
:lang: en
12+
:dpcpp: pass:[DPC++]
13+
:endnote: —{nbsp}end{nbsp}note
14+
15+
// Set the default source code type in this document to C++,
16+
// for syntax highlighting purposes. This is needed because
17+
// docbook uses c++ and html5 uses cpp.
18+
:language: {basebackend@docbook:c++:cpp}
19+
20+
21+
== Notice
22+
23+
[%hardbreaks]
24+
Copyright (C) 2025 Intel Corporation. All rights reserved.
25+
26+
Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks
27+
of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by
28+
permission by Khronos.
29+
30+
31+
== Contact
32+
33+
To report problems with this extension, please open a new issue at:
34+
35+
https://github.com/intel/llvm/issues
36+
37+
38+
== Dependencies
39+
40+
This extension is written against the SYCL 2020 revision 10 specification.
41+
All references below to the "core SYCL specification" or to section numbers in
42+
the SYCL specification refer to that revision.
43+
44+
45+
== Status
46+
47+
This is a proposed extension specification, intended to gather community
48+
feedback. Interfaces defined in this specification may not be implemented yet
49+
or may be in a preliminary state. The specification itself may also change in
50+
incompatible ways before it is finalized. *Shipping software products should
51+
not rely on APIs defined in this specification.*
52+
53+
54+
== Overview
55+
56+
This extension allows host code to check whether a SYCL GPU device is "integrated"
57+
or "discrete". An integrated GPU device often shares memory with the host CPU,
58+
while a discrete GPU is often a separate card with its own memory. However, some
59+
GPU devices may not fit neatly into either category, so implementors may provide
60+
their own judgement when categorizing a GPU device as "integrated" vs. "discrete".
61+
62+
63+
== Specification
64+
65+
=== Feature test macro
66+
67+
This extension provides a feature-test macro as described in the core SYCL
68+
specification. An implementation supporting this extension must predefine the
69+
macro `SYCL_EXT_ONEAPI_DEVICE_IS_INTEGRATED_GPU` to one of the values defined
70+
in the implementation supports this feature, or applications can test the
71+
macro's value to determine which of the extension's features the implementation
72+
supports.
73+
74+
[%header,cols="1,5"]
75+
|===
76+
|Value
77+
|Description
78+
79+
|1
80+
|The APIs of this experimental extension are not versioned, so the feature-test
81+
macro always has this value.
82+
|===
83+
84+
=== New device aspect
85+
86+
This extension adds new device aspect:
87+
88+
```c++
89+
namespace sycl {
90+
91+
enum class aspect : /*unspecified*/ {
92+
ext_oneapi_is_integrated_gpu
93+
};
94+
95+
} // namespace sycl
96+
```
97+
98+
[width="100%",%header,cols="50%,50%"]
99+
|===
100+
|Aspect
101+
|Description
102+
103+
|`ext_oneapi_is_integrated_gpu`
104+
|Indicates that the implementation identifies this device as integrated GPU. All devices
105+
that have this aspect also have `aspect::gpu`.
106+
|===
107+
108+
== Issues
109+
110+
None.

sycl/unittests/helpers/CommandSubmitWrappers.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <sycl/event.hpp>
1212
#include <sycl/handler.hpp>
13+
#include <sycl/queue.hpp>
1314

1415
namespace sycl {
1516

sycl/unittests/queue/Barrier.cpp

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include <helpers/CommandSubmitWrappers.hpp>
910
#include <helpers/TestKernel.hpp>
1011
#include <helpers/UrMock.hpp>
1112
#include <sycl/sycl.hpp>
@@ -15,6 +16,8 @@
1516
static unsigned NumOfEventsWaitWithBarrierCalls = 0;
1617
static unsigned NumEventsInWaitList = 0;
1718

19+
class Queue : public testing::TestWithParam<bool> {};
20+
1821
static ur_result_t redefined_urEnqueueEventsWaitWithBarrierExt(void *pParams) {
1922
NumOfEventsWaitWithBarrierCalls++;
2023
// Get the number of events in the wait list
@@ -25,92 +28,111 @@ static ur_result_t redefined_urEnqueueEventsWaitWithBarrierExt(void *pParams) {
2528
return UR_RESULT_SUCCESS;
2629
}
2730

28-
TEST(Queue, HandlerBarrier) {
31+
TEST_P(Queue, HandlerBarrier) {
2932
sycl::unittest::UrMock<> Mock;
3033
mock::getCallbacks().set_before_callback(
3134
"urEnqueueEventsWaitWithBarrierExt",
3235
&redefined_urEnqueueEventsWaitWithBarrierExt);
3336
NumOfEventsWaitWithBarrierCalls = 0;
37+
bool UseShortcutFunction = GetParam();
3438

3539
sycl::queue Q;
3640

37-
Q.submit([&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
38-
Q.submit([&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
41+
sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction, Q,
42+
[=]() {});
43+
sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction, Q,
44+
[=]() {});
3945

4046
Q.submit([&](sycl::handler &cgh) { cgh.ext_oneapi_barrier(); });
4147

4248
ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
4349
}
4450

45-
TEST(Queue, ExtOneAPISubmitBarrier) {
51+
TEST_P(Queue, ExtOneAPISubmitBarrier) {
4652
sycl::unittest::UrMock<> Mock;
4753
mock::getCallbacks().set_before_callback(
4854
"urEnqueueEventsWaitWithBarrierExt",
4955
&redefined_urEnqueueEventsWaitWithBarrierExt);
5056
NumOfEventsWaitWithBarrierCalls = 0;
57+
bool UseShortcutFunction = GetParam();
5158

5259
sycl::queue Q;
5360

54-
Q.submit([&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
55-
Q.submit([&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
61+
sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction, Q,
62+
[=]() {});
63+
sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction, Q,
64+
[=]() {});
5665

5766
Q.ext_oneapi_submit_barrier();
5867

5968
ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
6069
}
6170

62-
TEST(Queue, HandlerBarrierWithWaitList) {
71+
TEST_P(Queue, HandlerBarrierWithWaitList) {
6372
sycl::unittest::UrMock<> Mock;
6473
mock::getCallbacks().set_before_callback(
6574
"urEnqueueEventsWaitWithBarrierExt",
6675
&redefined_urEnqueueEventsWaitWithBarrierExt);
6776
NumOfEventsWaitWithBarrierCalls = 0;
77+
bool UseShortcutFunction = GetParam();
6878

6979
sycl::queue Q1;
7080
sycl::queue Q2;
7181
sycl::queue Q3;
7282

73-
auto E1 = Q1.submit(
74-
[&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
75-
auto E2 = Q2.submit(
76-
[&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
83+
auto E1 = sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction,
84+
Q1, [=]() {});
85+
auto E2 = sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction,
86+
Q2, [=]() {});
7787

7888
Q3.submit([&](sycl::handler &cgh) { cgh.ext_oneapi_barrier({E1, E2}); });
7989

8090
ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
8191
}
8292

83-
TEST(Queue, ExtOneAPISubmitBarrierWithWaitList) {
93+
TEST_P(Queue, ExtOneAPISubmitBarrierWithWaitList) {
8494
sycl::unittest::UrMock<> Mock;
8595
mock::getCallbacks().set_before_callback(
8696
"urEnqueueEventsWaitWithBarrierExt",
8797
&redefined_urEnqueueEventsWaitWithBarrierExt);
8898
NumOfEventsWaitWithBarrierCalls = 0;
99+
bool UseShortcutFunction = GetParam();
89100

90101
sycl::queue Q1;
91102
sycl::queue Q2;
92103
sycl::queue Q3;
93104

94-
auto E1 = Q1.submit(
95-
[&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
96-
auto E2 = Q2.submit(
97-
[&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
105+
auto E1 = sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction,
106+
Q1, [=]() {});
107+
auto E2 = sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction,
108+
Q2, [=]() {});
98109

99110
Q3.ext_oneapi_submit_barrier({E1, E2});
100111

101112
ASSERT_EQ(NumOfEventsWaitWithBarrierCalls, 1u);
102113
}
103114

104-
TEST(Queue, BarrierWithBarrierDep) {
115+
TEST_P(Queue, BarrierWithBarrierDep) {
105116
sycl::unittest::UrMock<> Mock;
106117
mock::getCallbacks().set_before_callback(
107118
"urEnqueueEventsWaitWithBarrierExt",
108119
&redefined_urEnqueueEventsWaitWithBarrierExt);
120+
bool UseShortcutFunction = GetParam();
121+
109122
sycl::queue Q1(sycl::property::queue::in_order{});
110123
sycl::queue Q2(sycl::property::queue::in_order{});
111-
Q1.submit([&](sycl::handler &cgh) { cgh.single_task<TestKernel>([=]() {}); });
124+
125+
sycl::unittest::single_task_wrapper<TestKernel>(UseShortcutFunction, Q1,
126+
[=]() {});
127+
112128
sycl::event Barrier1 = Q1.ext_oneapi_submit_barrier();
113129
NumEventsInWaitList = 0;
114130
Q2.ext_oneapi_submit_barrier({Barrier1});
115131
ASSERT_EQ(NumEventsInWaitList, 1u);
116132
}
133+
134+
INSTANTIATE_TEST_SUITE_P(
135+
QueueTestInstance, Queue,
136+
testing::Values(
137+
true,
138+
false)); /* Whether to use the shortcut command submission function */

0 commit comments

Comments
 (0)