Skip to content

Commit d3f4061

Browse files
1 parent 1a49fd2 commit d3f4061

File tree

19 files changed

+295
-6
lines changed

19 files changed

+295
-6
lines changed

llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def Aspectext_oneapi_exportable_device_mem : Aspect<"ext_oneapi_exportable_devic
9797
def Aspectext_oneapi_clock_sub_group : Aspect<"ext_oneapi_clock_sub_group">;
9898
def Aspectext_oneapi_clock_work_group : Aspect<"ext_oneapi_clock_work_group">;
9999
def Aspectext_oneapi_clock_device : Aspect<"ext_oneapi_clock_device">;
100+
def Aspectext_oneapi_is_integrated_gpu : Aspect<"ext_oneapi_is_integrated_gpu">;
100101

101102
// Deprecated aspects
102103
def AspectInt64_base_atomics : Aspect<"int64_base_atomics">;
@@ -174,7 +175,8 @@ def : TargetInfo<"__TestAspectList",
174175
Aspectext_oneapi_exportable_device_mem,
175176
Aspectext_oneapi_clock_sub_group,
176177
Aspectext_oneapi_clock_work_group,
177-
Aspectext_oneapi_clock_device],
178+
Aspectext_oneapi_clock_device,
179+
Aspectext_oneapi_is_integrated_gpu],
178180
[]>;
179181
// This definition serves the only purpose of testing whether the deprecated aspect list defined in here and in SYCL RT
180182
// match.

sycl/doc/extensions/proposed/sycl_ext_oneapi_device_is_integrated_gpu.asciidoc renamed to sycl/doc/extensions/experimental/sycl_ext_oneapi_device_is_integrated_gpu.asciidoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ the SYCL specification refer to that revision.
4444

4545
== Status
4646

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.*
47+
This is an experimental extension specification, intended to provide early
48+
access to features and gather community feedback. Interfaces defined in this
49+
specification are implemented in {dpcpp}, but they are not finalized and may
50+
change incompatibly in future versions of {dpcpp} without prior notice.
51+
*Shipping software products should not rely on APIs defined in this
52+
specification.*
5253

5354

5455
== Overview

sycl/include/sycl/info/aspects.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ __SYCL_ASPECT(ext_oneapi_exportable_device_mem, 90)
8383
__SYCL_ASPECT(ext_oneapi_clock_sub_group, 91)
8484
__SYCL_ASPECT(ext_oneapi_clock_work_group, 92)
8585
__SYCL_ASPECT(ext_oneapi_clock_device, 93)
86+
__SYCL_ASPECT(ext_oneapi_is_integrated_gpu, 94)

sycl/source/detail/device_impl.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,11 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
15921592
return get_info_impl_nocheck<UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP>()
15931593
.value_or(0);
15941594
}
1595+
CASE(ext_oneapi_is_integrated_gpu) {
1596+
return is_gpu() &&
1597+
get_info_impl_nocheck<UR_DEVICE_INFO_IS_INTEGRATED_GPU>().value_or(
1598+
0);
1599+
}
15951600
else {
15961601
return false; // This device aspect has not been implemented yet.
15971602
}

sycl/source/detail/ur_device_info_ret_types.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,5 @@ MAP(UR_DEVICE_INFO_MEMORY_EXPORT_EXPORTABLE_DEVICE_MEM_EXP, ur_bool_t)
196196
MAP(UR_DEVICE_INFO_CLOCK_SUB_GROUP_SUPPORT_EXP, ur_bool_t)
197197
MAP(UR_DEVICE_INFO_CLOCK_WORK_GROUP_SUPPORT_EXP, ur_bool_t)
198198
MAP(UR_DEVICE_INFO_CLOCK_DEVICE_SUPPORT_EXP, ur_bool_t)
199+
MAP(UR_DEVICE_INFO_IS_INTEGRATED_GPU, ur_bool_t)
199200
// clang-format on

sycl/source/feature_test.hpp.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ inline namespace _V1 {
121121
#define SYCL_KHR_QUEUE_EMPTY_QUERY 1
122122
#define SYCL_EXT_ONEAPI_MEMORY_EXPORT 1
123123
#define SYCL_EXT_ONEAPI_CLOCK 1
124+
#define SYCL_EXT_ONEAPI_DEVICE_IS_INTEGRATED_GPU 1
124125
// In progress yet
125126
#define SYCL_EXT_ONEAPI_ATOMIC16 0
126127
#define SYCL_KHR_DEFAULT_CONTEXT 1
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//==--- device_is_cpu.cpp - sycl_ext_oneapi_device_is_integrated_gpu test --==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// REQUIRES: cpu
9+
// RUN: %{build} -o %t.out
10+
// RUN: %{run} %t.out
11+
12+
// Test checks that aspect::ext_oneapi_is_integrated_gpu is false if device is
13+
// not GPU (e.g., CPU).
14+
15+
#include <sycl/detail/core.hpp>
16+
17+
using namespace sycl;
18+
19+
int main() {
20+
queue Queue;
21+
auto dev = Queue.get_device();
22+
23+
if (!dev.has(aspect::ext_oneapi_is_integrated_gpu))
24+
return 0;
25+
26+
assert(false && "aspect::ext_oneapi_is_integrated_gpu must be false");
27+
return 1;
28+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//==- device_is_integrated_gpu.cpp - sycl_ext_oneapi_device_is_integrated_gpu
2+
// test -==//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
// REQUIRES: gpu-intel-gen12
10+
// RUN: %{build} -o %t.out
11+
// RUN: %{run} %t.out
12+
13+
// Test checks that aspect::ext_oneapi_is_integrated_gpu is true if GPU device
14+
// is integrated.
15+
16+
#include <sycl/detail/core.hpp>
17+
18+
using namespace sycl;
19+
20+
int main() {
21+
queue Queue;
22+
auto dev = Queue.get_device();
23+
24+
if (dev.has(aspect::ext_oneapi_is_integrated_gpu))
25+
return 0;
26+
27+
assert(false && "aspect::ext_oneapi_is_integrated_gpu must be true");
28+
return 1;
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//==- device_is_not_integrated_gpu.cpp -
2+
// sycl_ext_oneapi_device_is_integrated_gpu test -==//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
// REQUIRES: arch-intel_gpu_pvc || arch-intel_gpu_bmg_g21
10+
// RUN: %{build} -o %t.out
11+
// RUN: %{run} %t.out
12+
13+
// Test checks that aspect::ext_oneapi_is_integrated_gpu is false if GPU device
14+
// is discrete.
15+
16+
#include <sycl/detail/core.hpp>
17+
18+
using namespace sycl;
19+
20+
int main() {
21+
queue Queue;
22+
auto dev = Queue.get_device();
23+
24+
if (!dev.has(aspect::ext_oneapi_is_integrated_gpu))
25+
return 0;
26+
27+
assert(false && "aspect::ext_oneapi_is_integrated_gpu must be false");
28+
return 1;
29+
}

sycl/unittests/Extensions/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
33
add_sycl_unittest(ExtensionsTests OBJECT
44
CurrentDevice.cpp
55
DefaultContext.cpp
6+
DeviceIsIntegratedGPU.cpp
67
FPGADeviceSelectors.cpp
78
DeviceArchitecture.cpp
89
USMMemcpy2D.cpp

0 commit comments

Comments
 (0)