Skip to content

[SYCL] Cleanup/refactor device_code_tests #14063

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

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
9f94263
[SYCL] Changed some check_device_code lit tests to use SYCL_EXTERNAL
ianayl May 23, 2024
5fb2b92
[SYCL] Changed more check_device_code lit tests to use SYCL_EXTERNAL
ianayl Jun 5, 2024
78d0169
Merge branch 'sycl' of https://github.com/intel/llvm into SYCLEXTERNA…
ianayl Jun 5, 2024
983fb4b
[SYCL} Temporarily revert changes to select check_device_code lit tests
ianayl Jun 6, 2024
f47da5c
[SYCL] Simplified some lit tests in check_device_code
ianayl Jun 6, 2024
3521682
[SYCL] Move group_ballot.cpp into sycl/test/extensions
ianayl Jun 6, 2024
a081f88
[SYCL] Remove redundant includes in check_device_code/ap_fixed.cpp
ianayl Jun 7, 2024
01c7b1a
[SYCL] Revert certain check_device_code tests to use queues instead
ianayl Jun 7, 2024
65e81c7
[SYCL] Split check_device_code/device_has.cpp into a function version…
ianayl Jun 7, 2024
a47bc04
[SYCL] Move non device code checks out of check_device_code, and refa…
ianayl Jun 11, 2024
736eb1b
[ESIMD] Allow full autodeduction for prefetch APIs accepting simd_vie…
fineg74 Jun 5, 2024
05b29ef
[SYCL] Disable flaky test EnqueueNoMemObjTwoHostTasks on Windows (#14…
sarnex Jun 5, 2024
95edc70
[SYCL][Joint Matrix] Test combinations are queried Part 3 (#13991)
artemrad Jun 6, 2024
b1dc13a
[SYCL][Joint Matrix] Test combinations are queried Part 4 (#14019)
artemrad Jun 6, 2024
874846e
[SYCL][Graph] Clarify graph enable_profiling property in finalize() (…
guoyejun Jun 6, 2024
eeac017
[SYCL] Force-emit more member functions into device code (#13985)
AlexeySachkov Jun 6, 2024
91f78bd
[SYCL][COMPAT] Added filter_device and list_devices (#14016)
Alcpz Jun 6, 2024
c1687a5
[SYCL][COMPAT] Add wait_and_free plus rename async_free in syclcompat…
AidanBeltonS Jun 6, 2024
3396907
[SYCL][TEST-E2E] Disallow `dep_events.cpp` test built for CUDA backen…
mmoadeli Jun 6, 2024
b0572cb
[CI] pre-commit/aws pointed back to old image. (#14074)
JackAKirk Jun 6, 2024
125c771
[SYCL][TEST-E2E] Refactor the test to address Windows not printing th…
mmoadeli Jun 6, 2024
034236c
[SYCL][TEST-E2E] Extend `sycl-ls-gpu-default.cpp` test to cover Inte…
mmoadeli Jun 6, 2024
7c6c0dd
[SYCL][E2E] Refactor/fix bfloat16 test (#14062)
aelovikov-intel Jun 6, 2024
2f8a39d
[SYCL][E2E] Disable NonUniformGroups/ballot_group_algorithms.cpp on C…
aelovikov-intel Jun 6, 2024
54355e0
[SYCL][E2E] Remove warnings in Basic e2e tests (#13994)
ayylol Jun 6, 2024
d9f6097
[Doc] Add Mar'24 Release Notes (#13879)
uditagarwal97 Jun 6, 2024
fd43f02
[ESIMD] Allow full autodeduction of template parameters for atomic_up…
fineg74 Jun 6, 2024
fee74b1
[ESIMD] Allow full autodeduction of template parameters for atomic_up…
fineg74 Jun 6, 2024
5f3866a
[SYCL][E2E] Disable memory_management_test3.cpp on Gen12 linux (#14087)
sarnex Jun 6, 2024
e6418d9
[SYCL][Matrix] Amend CODEOWNERS for check_device_code matrix tests (#…
ianayl Jun 6, 2024
0d3ecc4
[CI] Don't run E2E tests on self-hosted CUDA in Nightly (#14041)
aelovikov-intel Jun 6, 2024
f7653cb
[SYCL] Add `vec<bfloat16>` support to math builtins (#14002)
uditagarwal97 Jun 7, 2024
2e51c65
[SYCL] Change check_device_code CUDA tests to use SYCL_EXTERNAL (#13943)
ianayl Jun 7, 2024
f732ef3
[SYCL][Bindless] Enable non-Vulkan tests on Windows (#14045)
ProGTX Jun 7, 2024
089dafc
[SYCL][HIP] Remove unsupported from O0 tests on AMD (#13967)
npmiller Jun 7, 2024
48c4c0b
[NFCI][SYCL] Move SYCL Module Splitting to library. Part 2 (#13282)
maksimsab Jun 7, 2024
dfbf258
[SYCL][COMPAT] Add math `extend_v*2` to SYCLCompat (#13953)
OuadiElfarouki Jun 7, 2024
7a940f2
[ESIMD]Replace use of vc intrinsic with spirv extension for rdtsc API…
fineg74 Jun 7, 2024
a26c7fb
[SYCL][Docs] Move sycl_ext_oneapi_enqueue_functions to experimental (…
steffenlarsen Jun 7, 2024
e8f0bb3
[SYCL][ESIMD][E2E] Fix bit shift vector test to not use c++20 (#14081)
sarnex Jun 7, 2024
f642cd3
[SYCL][ESIMD] Instruction count performance test (#14033)
jasonlizhengjian Jun 7, 2024
c726fd1
[SYCL] Record aspect names when computing device requirements (#13974)
jzc Jun 7, 2024
fbcb8bd
[SYCL][Doc] Extension spec for "work_group_memory" (#13725)
gmlueck Jun 7, 2024
e9ba164
[SYCL][E2E] Remove uses of OpenCL primitives in Basic/image e2e tests…
ayylol Jun 7, 2024
001d8fb
[SYCL] Fix post-commit issue with library dependencies (#14094)
AlexeySachkov Jun 7, 2024
649453d
[SYCL] Restrict `sycl::vec` and swizzle operations to types mentioned…
uditagarwal97 Jun 7, 2024
caaa88c
[SYCL] Fix UB and alignment issues in the SYCL default sorter (#13975)
againull Jun 8, 2024
77c2a78
[SYCL][E2E] Remove use of deprecated exceptions in USM e2e tests (#14…
ayylol Jun 8, 2024
04e4ee3
[SYCL][COMPAT] Fix memory_management_test3 (#14080)
AidanBeltonS Jun 10, 2024
a56c680
[SYCL][Graph] fix the address pointer in graph print (#13595)
guoyejun Jun 10, 2024
a5e6d68
[SYCL][Graph] Missing test dependency after data init (#14092)
EwanC Jun 10, 2024
5f41693
[SYCL][COMPAT] Added two-way and four-way dot product accumulate (dp4…
Alcpz Jun 10, 2024
52111a7
[UR] Bump main tag to f06bc02a (#14047)
kbenzie Jun 10, 2024
9f76cfb
[SYCL][E2E] Disable ProfilingTag tests on CUDA (#14073)
steffenlarsen Jun 10, 2024
c1853cb
[SYCL][Graph] Combined L0 Graph Update fixes (#14111)
EwanC Jun 10, 2024
10958fa
[SYCL][Graph] Disable flaky Windows test (#14070)
EwanC Jun 10, 2024
43a0eb2
[UR] Remove redundant mem type (#13058)
omarahmed1111 Jun 10, 2024
8632f90
[SYCL] Initial changes for the second version of sycl_ext_oneapi_grou…
againull Jun 10, 2024
829ff92
[SYCL] Change check_device_code HIP tests to use SYCL_EXTERNAL (#13990)
ianayl Jun 10, 2024
42f2e49
[Clang] Clarify error for implicit `this` capture in a kernel (#14100)
aelovikov-intel Jun 10, 2024
640e8db
[SYCL] Add sm90a Cuda target architecture support (#14075)
GeorgeWeb Jun 10, 2024
d5fcbe9
[ESIMD]Enable tests for DG2 (#14099)
fineg74 Jun 10, 2024
9af1fb0
[SYCL][E2E] Disable discard_events_l0_inorder.cpp on Arc (#14122)
sarnex Jun 10, 2024
64914a2
[Driver][SYCL][NewOffload] Update option passing for packager and AOT…
mdtoguchi Jun 10, 2024
e6872f1
[Driver][NFC] Update equals usage in driver sources (#14090)
mdtoguchi Jun 10, 2024
5407ac6
[GHA] Uplift Linux IGC Dev RT version to igc-dev-3bd1d5e (#14107)
bb-sycl Jun 10, 2024
e15729e
[NFC][SYCL] Minor refactoring in `sycl::vec<>` (#13949)
uditagarwal97 Jun 10, 2024
63f811c
[Driver][SYCL][NewOffload] Fix duplication of device targets (#14091)
mdtoguchi Jun 10, 2024
3df8223
[SYCL][Graph] 3D kernel update regression test (#14110)
EwanC Jun 11, 2024
df02093
[SYCL] Introduce new properties for virtual functions (#14014)
AlexeySachkov Jun 11, 2024
1e07f59
[SYCL][Docs] fix a typo in sycl_ext_oneapi_profiling_tag (#14133)
guoyejun Jun 11, 2024
88560c4
[SYCL][COMPAT] Add bfe_safe and bfi_safe APIs (#14006)
joeatodd Jun 11, 2024
8c284b6
[SYCL][COMPAT] Migrate currently unsupported memcpy_parameter overloa…
joeatodd Jun 11, 2024
8cfa566
Revert "[Driver][SYCL][NewOffload] Fix duplication of device targets"…
steffenlarsen Jun 11, 2024
ba5e9ca
[New offload driver][sycl-post-link] Move sycl-post-link target speci…
asudarsa Jun 11, 2024
88851d5
[CI] Allow aux CUDA jobs to run on more machines (#14124)
sarnex Jun 11, 2024
de58e29
[Driver][SYCL][NewOffload] Fix duplication of device targets (#14143)
mdtoguchi Jun 11, 2024
6f4d939
[New offload driver][Device lib] Add SYCL device library files for al…
asudarsa Jun 11, 2024
fb22562
[SYCL] Enable CET for wqlibsycl-devicelib-host.a (#14135)
jinge90 Jun 12, 2024
df6eaad
[UR] Fix size confusion for several device property queries (#12488)
al42and Jun 12, 2024
b54aefe
[SYCL][COMPAT] Added non-const image2d_max and image3d_max getters (#…
Alcpz Jun 12, 2024
03b2e21
[SYCL][Graph] Update L0 aspect test (#14093)
EwanC Jun 12, 2024
75bfeac
[SYCL][E2E] Fix CUDA include and lib paths. (#14118)
mmoadeli Jun 12, 2024
8e445ed
[UR] Bump main tag to 78d02039 (#12269)
aarongreig Jun 12, 2024
1e0efd8
[SYCL][COMPAT] Add math extend_v*4 to SYCLCompat (#14078)
OuadiElfarouki Jun 12, 2024
f226ce3
[SYCL] Remove unneeded parameter from `getOrInsertMemObjRecord` (#13807)
sergey-semenov Jun 12, 2024
284f419
[E2E] Modify commands to address running on Windows. (#13682)
mmoadeli Jun 12, 2024
5d94708
[SYCL][E2E] Fix deprecated warnings in `InorderQueue` e2e tests (#14120)
ayylol Jun 12, 2024
ca32941
[UR] Update UR tag to include L0 loader related changes (#14109)
againull Jun 12, 2024
69186a8
[UR] Bump main tag to b13c5e1f (#14042)
hdelan Jun 12, 2024
c394f03
[SYCL] Remove redundant code from L0 plugin's cmake file (#14108)
againull Jun 12, 2024
f8f109a
[SYCL] Add support for key/value sorting APIs (#13942)
againull Jun 12, 2024
f625bde
[SYCL][NewOffload][E2E] add a single test for --offload-new-driver (#…
jasonlizhengjian Jun 12, 2024
82ea253
[SYCL] [libdevice] Add vector overloads of ConvertBFloat16ToFINTEL an…
uditagarwal97 Jun 12, 2024
a48a126
[SYCL] Use `std::array` as storage for `sycl::vec` on device (#14130)
uditagarwal97 Jun 12, 2024
fd07268
[SYCL] Adding support for missing math ops (#14132)
MaryaSharf Jun 13, 2024
80eb9f5
[Doc] Document Unified Runtime update process (#14097)
kbenzie Jun 13, 2024
292fdda
[SYCL] Disable in-order queue barrier optimization while profiling (#…
sergey-semenov Jun 13, 2024
bf585a0
[SYCL] Add atomic64 aspect decoration to atomic_ref<T *> (#14052)
maksimsab Jun 13, 2024
5a68a78
[SYCL] Clear cache in case of PI_ERROR_OUT_OF_HOST_MEMORY (#14119)
KornevNikita Jun 13, 2024
c3eadc9
[CI] Turn on sycl-cts/test_accessor in Nightly (#14159)
KornevNikita Jun 13, 2024
11df203
[GHA] Uplift Linux IGC Dev RT version to igc-dev-480f8b6 (#14155)
bb-sycl Jun 13, 2024
d7622c1
[SYCL] Fix FloatVecToBF16Vec build (#14161)
npmiller Jun 13, 2024
1ce91da
Bump braces from 3.0.2 to 3.0.3 in /mlir/utils/vscode (#14144)
dependabot[bot] Jun 13, 2024
e533d5d
[CLC][AMDGPU] Refactor fence helper to process order semantic explici…
GeorgeWeb Jun 13, 2024
e194ce1
[SYCL] Re-enable `Basic/barrier_order.cpp` (#14154)
aelovikov-intel Jun 13, 2024
242fe06
[SYCL][ESIMD][E2E] Fix rotate.cpp on Windows (#14152)
sarnex Jun 13, 2024
abfd64a
[Driver][SYCL][NewOffloadModel] Incorporate -device settings for GPU …
mdtoguchi Jun 13, 2024
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
92 changes: 24 additions & 68 deletions sycl/test/check_device_code/ap_fixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,103 +8,59 @@
//
//===----------------------------------------------------------------------===//

#include "CL/__spirv/spirv_ops.hpp"
#include <sycl/sycl.hpp>

template <int W, int rW, bool S, int I, int rI>
void sqrt() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Sqrt = __spirv_FixedSqrtINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_sqrt(sycl::detail::ap_int<13> a) {
return __spirv_FixedSqrtINTEL<13, 5>(a, false, 2, 2);
// CHECK: %{{.*}} = call spir_func signext i5 @_Z[[#]]__spirv_FixedSqrtINTEL{{.*}}(i13 signext %[[#]], i1 zeroext false, i32 2, i32 2, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void recip() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Recip = __spirv_FixedRecipINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_recip(sycl::detail::ap_int<3> a) {
return __spirv_FixedRecipINTEL<3, 8>(a, true, 4, 4);
// CHECK: %{{.*}} = call spir_func signext i8 @_Z[[#]]__spirv_FixedRecipINTEL{{.*}}(i3 signext %[[#]], i1 zeroext true, i32 4, i32 4, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void rsqrt() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Rsqrt = __spirv_FixedRsqrtINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_rsqrt(sycl::detail::ap_int<11> a) {
return __spirv_FixedRsqrtINTEL<11, 10>(a, false, 8, 6);
// CHECK: %{{.*}} = call spir_func signext i10 @_Z[[#]]__spirv_FixedRsqrtINTEL{{.*}}(i11 signext %[[#]], i1 zeroext false, i32 8, i32 6, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void sin() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Sin = __spirv_FixedSinINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_sin(sycl::detail::ap_int<17> a) {
return __spirv_FixedSinINTEL<17, 11>(a, true, 7, 5);
// CHECK: %{{.*}} = call spir_func signext i11 @_Z[[#]]__spirv_FixedSinINTEL{{.*}}(i17 signext %[[#]], i1 zeroext true, i32 7, i32 5, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void cos() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Cos = __spirv_FixedCosINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_cos(sycl::detail::ap_int<35> a) {
return __spirv_FixedCosINTEL<35, 28>(a, false, 9, 3);
// CHECK: %{{.*}} = call spir_func signext i28 @_Z[[#]]__spirv_FixedCosINTEL{{.*}}(i35 %[[#]], i1 zeroext false, i32 9, i32 3, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void sin_cos() {
sycl::detail::ap_int<W> a;
auto ap_fixed_SinCos = __spirv_FixedSinCosINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_sin_cos(sycl::detail::ap_int<31> a) {
return __spirv_FixedSinCosINTEL<31, 20>(a, true, 10, 12);
// CHECK: %{{.*}} = call spir_func i40 @_Z[[#]]__spirv_FixedSinCosINTEL{{.*}}(i31 signext %[[#]], i1 zeroext true, i32 10, i32 12, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void sin_pi() {
sycl::detail::ap_int<W> a;
auto ap_fixed_SinPi = __spirv_FixedSinPiINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_sin_pi(sycl::detail::ap_int<60> a) {
return __spirv_FixedSinPiINTEL<60, 5>(a, false, 2, 2);
// CHECK: %{{.*}} = call spir_func signext i5 @_Z[[#]]__spirv_FixedSinPiINTEL{{.*}}(i60 %[[#]], i1 zeroext false, i32 2, i32 2, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void cos_pi() {
sycl::detail::ap_int<W> a;
auto ap_fixed_CosPi = __spirv_FixedCosPiINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_cos_pi(sycl::detail::ap_int<28> a) {
return __spirv_FixedCosPiINTEL<28, 16>(a, false, 8, 5);
// CHECK: %{{.*}} = call spir_func signext i16 @_Z[[#]]__spirv_FixedCosPiINTEL{{.*}}(i28 signext %[[#]], i1 zeroext false, i32 8, i32 5, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void sin_cos_pi() {
sycl::detail::ap_int<W> a;
auto ap_fixed_SinCosPi = __spirv_FixedSinCosPiINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_sin_cos_pi(sycl::detail::ap_int<13> a) {
return __spirv_FixedSinCosPiINTEL<13, 5>(a, false, 2, 2);
// CHECK: %{{.*}} = call spir_func signext i10 @_Z[[#]]__spirv_FixedSinCosPiINTEL{{.*}}(i13 signext %[[#]], i1 zeroext false, i32 2, i32 2, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void log() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Log = __spirv_FixedLogINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_log(sycl::detail::ap_int<64> a) {
return __spirv_FixedLogINTEL<64, 44>(a, true, 24, 22);
// CHECK: %{{.*}} = call spir_func i44 @_Z[[#]]__spirv_FixedLogINTEL{{.*}}(i64 %[[#]], i1 zeroext true, i32 24, i32 22, i32 0, i32 0)
}

template <int W, int rW, bool S, int I, int rI>
void exp() {
sycl::detail::ap_int<W> a;
auto ap_fixed_Exp = __spirv_FixedExpINTEL<W, rW>(a, S, I, rI);
SYCL_EXTERNAL auto test_exp(sycl::detail::ap_int<44> a) {
return __spirv_FixedExpINTEL<44, 34>(a, false, 20, 20);
// CHECK: %{{.*}} = call spir_func i34 @_Z[[#]]__spirv_FixedExpINTEL{{.*}}(i44 %[[#]], i1 zeroext false, i32 20, i32 20, i32 0, i32 0)
}

template <typename name, typename Func>
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
kernelFunc();
}

int main() {
kernel_single_task<class kernel_function>([]() {
sqrt<13, 5, false, 2, 2>();
recip<3, 8, true, 4, 4>();
rsqrt<11, 10, false, 8, 6>();
sin<17, 11, true, 7, 5>();
cos<35, 28, false, 9, 3>();
sin_cos<31, 20, true, 10, 12>();
sin_pi<60, 5, false, 2, 2>();
cos_pi<28, 16, false, 8, 5>();
sin_cos_pi<13, 5, false, 2, 2>();
log<64, 44, true, 24, 22>();
exp<44, 34, false, 20, 20>();
});
return 0;
}
}
72 changes: 34 additions & 38 deletions sycl/test/check_device_code/device_global_const_eval_use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,42 +80,38 @@ constexpr device_global<TestStruct2, decltype(properties(device_image_scope))>
dg_constexpr_constructor_struct{TS4};
// CHECK: @{{[A-Za-z0-9_]*}}dg_constexpr_constructor_struct = internal addrspace(1) constant { %struct.TestStruct2 } { %struct.TestStruct2 { i32 4 } }, align 4, !spirv.Decorations

int main() {
sycl::queue Q;
Q.submit([&](sycl::handler &h) {
// Simple kernel that just copies over the values from the device_globals so
// that we can observe the GlobalVariables that are created to represent
// them in the IR
h.single_task([=] {
// Int and array of ints
std::ignore = dg_int;
std::ignore = dg_int_arr[0];

// Char and array of chars
std::ignore = dg_char;
std::ignore = dg_char_arr[0];

// Multidimensional array of integers
std::ignore = dg_multi_dim_arr[1][1];

// Float and array of floats
std::ignore = dg_float;
std::ignore = dg_float_arr[0];

// Double and array of doubles
std::ignore = dg_double;
std::ignore = dg_double_arr[0];

// Bool and array of bools
std::ignore = dg_bool;
std::ignore = dg_bool_arr[0];

// Struct and array of structs
std::ignore = dg_struct.get().field1;
std::ignore = dg_struct_arr[0];

// Struct with constexpr constructor
std::ignore = dg_constexpr_constructor_struct.get().value;
});
});
SYCL_EXTERNAL void device_global_const_eval_use() {
// Simple kernel that just copies over the values from the device_globals so
// that we can observe the GlobalVariables that are created to represent
// them in the IR

// Int and array of ints
std::ignore = dg_int;
std::ignore = dg_int_arr[0];

// Char and array of chars
std::ignore = dg_char;
std::ignore = dg_char_arr[0];

// Multidimensional array of integers
std::ignore = dg_multi_dim_arr[1][1];

// Float and array of floats
std::ignore = dg_float;
std::ignore = dg_float_arr[0];

// Double and array of doubles
std::ignore = dg_double;
std::ignore = dg_double_arr[0];

// Bool and array of bools
std::ignore = dg_bool;
std::ignore = dg_bool_arr[0];

// Struct and array of structs
std::ignore = dg_struct.get().field1;
std::ignore = dg_struct_arr[0];

// Struct with constexpr constructor
std::ignore = dg_constexpr_constructor_struct.get().value;
}
37 changes: 13 additions & 24 deletions sycl/test/check_device_code/device_has.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
#include <sycl/sycl.hpp>

using namespace sycl;
queue q;

// CHECK-ASPECTS: define weak_odr dso_local spir_kernel void @{{.*}}kernel_name_1{{.*}} !sycl_declared_aspects ![[ASPECTS1:[0-9]+]] {{.*}}
// CHECK-SRCLOC: define weak_odr dso_local spir_kernel void @{{.*}}kernel_name_1{{.*}} !srcloc ![[SRCLOC1:[0-9]+]] {{.*}}
// CHECK-ASPECTS: define dso_local spir_func void @{{.*}}kernel_name_1{{.*}} !sycl_declared_aspects ![[ASPECTS1:[0-9]+]] {{.*}}
// CHECK-SRCLOC: define dso_local spir_func void @{{.*}}kernel_name_1{{.*}} !srcloc ![[SRCLOC1:[0-9]+]] {{.*}}

// CHECK-ASPECTS: define {{.*}}spir_func void @{{.*}}func1{{.*}} !sycl_declared_aspects ![[ASPECTS1]]
// CHECK-ASPECTS-SAME: !sycl_used_aspects ![[ASPECTS1]]
Expand Down Expand Up @@ -45,29 +44,19 @@ constexpr sycl::aspect getAspect() { return sycl::aspect::cpu; }
// CHECK-SRCLOC: define {{.*}}spir_func void @{{.*}}func6{{.*}} !srcloc ![[SRCLOC7:[0-9]+]]
[[sycl::device_has(getAspect())]] void func6() {}

class KernelFunctor {
public:
[[sycl::device_has(sycl::aspect::cpu)]] void operator()() const {
func1();
func2();
func3();
func4<sycl::aspect::host>();
func5();
func6();
}
};

void foo() {
q.submit([&](handler &h) {
KernelFunctor f1;
h.single_task<class kernel_name_1>(f1);
// CHECK-ASPECTS: define weak_odr dso_local spir_kernel void @{{.*}}kernel_name_2{{.*}} !sycl_declared_aspects ![[ASPECTS4:[0-9]+]]
// CHECK-SRCLOC: define weak_odr dso_local spir_kernel void @{{.*}}kernel_name_2{{.*}} !srcloc ![[SRCLOC8:[0-9]+]] {{.*}}
h.single_task<class kernel_name_2>(
[]() [[sycl::device_has(sycl::aspect::gpu)]] {});
});
SYCL_EXTERNAL [[sycl::device_has(sycl::aspect::cpu)]] void kernel_name_1() {
func1();
func2();
func3();
func4<sycl::aspect::host>();
func5();
func6();
}

// CHECK-ASPECTS: define dso_local spir_func void @{{.*}}kernel_name_2{{.*}} !sycl_declared_aspects ![[ASPECTS4:[0-9]+]]
// CHECK-SRCLOC: define dso_local spir_func void @{{.*}}kernel_name_2{{.*}} !srcloc ![[SRCLOC8:[0-9]+]] {{.*}}
SYCL_EXTERNAL [[sycl::device_has(sycl::aspect::gpu)]] void kernel_name_2() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need both new and old code, actually. Someone from @intel/dpcpp-tools-reviewers should review changes in this file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attribute can be applied to both kernels and SYCL_EXTERNAL functions, I agree with @aelovikov-intel that we should have both variants tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split the test cases into 2 files, one for kernels and one for functions. Am I good to proceed with this?


// CHECK-ASPECTS-DAG: [[ASPECTS1]] = !{![[ASPECTCPU:[0-9]+]]}
// CHECK-ASPECTS-DAG: [[ASPECTCPU]] = !{!"cpu", i32 1}
// CHECK-SRCLOC-DAG: [[SRCLOC1]] = !{i32 {{[0-9]+}}}
Expand Down
Loading