@@ -25,6 +25,10 @@ class EAMTestKernel2;
25
25
const char EAMTestKernelName2[] = " LinkCompileTestKernel2" ;
26
26
constexpr unsigned EAMTestKernelNumArgs2 = 4 ;
27
27
28
+ class EAMTestKernel3 ;
29
+ const char EAMTestKernelName3[] = " LinkCompileTestKernel3" ;
30
+ constexpr unsigned EAMTestKernelNumArgs3 = 4 ;
31
+
28
32
namespace sycl {
29
33
__SYCL_INLINE_VER_NAMESPACE (_V1) {
30
34
namespace detail {
@@ -54,13 +58,26 @@ template <> struct KernelInfo<EAMTestKernel2> {
54
58
static constexpr int64_t getKernelSize () { return 1 ; }
55
59
};
56
60
61
+ template <> struct KernelInfo <EAMTestKernel3> {
62
+ static constexpr unsigned getNumParams () { return EAMTestKernelNumArgs3; }
63
+ static const kernel_param_desc_t &getParamDesc (int ) {
64
+ static kernel_param_desc_t Dummy;
65
+ return Dummy;
66
+ }
67
+ static constexpr const char *getName () { return EAMTestKernelName3; }
68
+ static constexpr bool isESIMD () { return false ; }
69
+ static constexpr bool callsThisItem () { return false ; }
70
+ static constexpr bool callsAnyThisFreeFunction () { return false ; }
71
+ static constexpr int64_t getKernelSize () { return 1 ; }
72
+ };
73
+
57
74
} // namespace detail
58
75
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
59
76
} // namespace sycl
60
77
61
78
template <typename T>
62
79
static sycl::unittest::PiImage
63
- generateEAMTestKernel1Image (std::string _cmplOptions, std::string _lnkOptions) {
80
+ generateEAMTestKernelImage (std::string _cmplOptions, std::string _lnkOptions) {
64
81
using namespace sycl ::unittest;
65
82
66
83
std::vector<unsigned char > KernelEAM1{0b00000101 };
@@ -75,36 +92,8 @@ generateEAMTestKernel1Image(std::string _cmplOptions, std::string _lnkOptions) {
75
92
76
93
std::vector<unsigned char > Bin{0 , 1 , 2 , 3 , 4 , 5 }; // Random data
77
94
78
- PiArray<PiOffloadEntry> Entries = makeEmptyKernels ({EAMTestKernelName1});
79
-
80
- PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format
81
- __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec
82
- _cmplOptions, // Compile options
83
- _lnkOptions, // Link options
84
- std::move (Bin),
85
- std::move (Entries),
86
- std::move (PropSet)};
87
- return Img;
88
- }
89
-
90
- template <typename T>
91
- static sycl::unittest::PiImage
92
- generateEAMTestKernel2Image (std::string _cmplOptions, std::string _lnkOptions) {
93
- using namespace sycl ::unittest;
94
-
95
- std::vector<unsigned char > KernelEAM2{0b00000101 };
96
- PiProperty EAMKernelPOI =
97
- makeKernelParamOptInfo (sycl::detail::KernelInfo<T>::getName (),
98
- EAMTestKernelNumArgs2, KernelEAM2);
99
- PiArray<PiProperty> ImgKPOI{std::move (EAMKernelPOI)};
100
-
101
- PiPropertySet PropSet;
102
- PropSet.insert (__SYCL_PI_PROPERTY_SET_KERNEL_PARAM_OPT_INFO,
103
- std::move (ImgKPOI));
104
-
105
- std::vector<unsigned char > Bin{0 , 1 , 2 , 3 , 4 , 5 }; // Random data
106
-
107
- PiArray<PiOffloadEntry> Entries = makeEmptyKernels ({EAMTestKernelName2});
95
+ PiArray<PiOffloadEntry> Entries =
96
+ makeEmptyKernels ({sycl::detail::KernelInfo<T>::getName ()});
108
97
109
98
PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format
110
99
__SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec
@@ -122,9 +111,12 @@ inline pi_result redefinedProgramLink(pi_context, pi_uint32, const pi_device *,
122
111
void (*)(pi_program, void *), void *,
123
112
pi_program *) {
124
113
assert (_linkOpts != nullptr );
125
- if (!current_link_options.empty ())
126
- current_link_options += " " ;
127
- current_link_options += std::string (_linkOpts);
114
+ auto add_link_opts = std::string (_linkOpts);
115
+ if (!add_link_opts.empty ()) {
116
+ if (!current_link_options.empty ())
117
+ current_link_options += " " ;
118
+ current_link_options += std::string (_linkOpts);
119
+ }
128
120
return PI_SUCCESS;
129
121
}
130
122
@@ -134,9 +126,12 @@ inline pi_result redefinedProgramCompile(pi_program, pi_uint32,
134
126
const pi_program *, const char **,
135
127
void (*)(pi_program, void *), void *) {
136
128
assert (_compileOpts != nullptr );
137
- if (!current_compile_options.empty ())
138
- current_compile_options += " " ;
139
- current_compile_options += std::string (_compileOpts);
129
+ auto add_compile_opts = std::string (_compileOpts);
130
+ if (!add_compile_opts.empty ()) {
131
+ if (!current_compile_options.empty ())
132
+ current_compile_options += " " ;
133
+ current_compile_options += std::string (_compileOpts);
134
+ }
140
135
return PI_SUCCESS;
141
136
}
142
137
@@ -159,8 +154,8 @@ TEST(Link_Compile_Options, compile_link_Options_Test_empty_options) {
159
154
current_compile_options.clear ();
160
155
std::string expected_options = " " ;
161
156
static sycl::unittest::PiImage DevImage =
162
- generateEAMTestKernel1Image <EAMTestKernel1>(expected_options,
163
- expected_options);
157
+ generateEAMTestKernelImage <EAMTestKernel1>(expected_options,
158
+ expected_options);
164
159
static sycl::unittest::PiImageArray<1 > DevImageArray_{&DevImage};
165
160
auto KernelID_1 = sycl::get_kernel_id<EAMTestKernel1>();
166
161
sycl::queue Queue{Dev};
@@ -188,11 +183,11 @@ TEST(Link_Compile_Options, compile_link_Options_Test_filled_options) {
188
183
expected_link_options_1 =
189
184
" -cl-denorms-are-zero -cl-no-signed-zeros" ;
190
185
static sycl::unittest::PiImage DevImage_1 =
191
- generateEAMTestKernel1Image<EAMTestKernel1 >(expected_compile_options_1,
192
- expected_link_options_1);
186
+ generateEAMTestKernelImage<EAMTestKernel2 >(expected_compile_options_1,
187
+ expected_link_options_1);
193
188
194
189
static sycl::unittest::PiImageArray<1 > DevImageArray = {&DevImage_1};
195
- auto KernelID_1 = sycl::get_kernel_id<EAMTestKernel1 >();
190
+ auto KernelID_1 = sycl::get_kernel_id<EAMTestKernel2 >();
196
191
sycl::queue Queue{Dev};
197
192
const sycl::context Ctx = Queue.get_context ();
198
193
sycl::kernel_bundle KernelBundle =
@@ -221,10 +216,10 @@ TEST(Link_Compile_Options, check_sycl_build) {
221
216
std::string expected_compile_options = " -cl-opt-disable" ,
222
217
expected_link_options = " -cl-denorms-are-zero" ;
223
218
static sycl::unittest::PiImage DevImage =
224
- generateEAMTestKernel1Image<EAMTestKernel1 >(expected_compile_options,
225
- expected_link_options);
219
+ generateEAMTestKernelImage<EAMTestKernel3 >(expected_compile_options,
220
+ expected_link_options);
226
221
static sycl::unittest::PiImageArray<1 > DevImageArray{&DevImage};
227
- auto KernelID = sycl::get_kernel_id<EAMTestKernel1 >();
222
+ auto KernelID = sycl::get_kernel_id<EAMTestKernel3 >();
228
223
sycl::context Ctx{Dev};
229
224
sycl::queue Queue{Ctx, Dev};
230
225
sycl::kernel_bundle KernelBundle =
0 commit comments