@@ -25,6 +25,10 @@ class EAMTestKernel2;
2525const char EAMTestKernelName2[] = " LinkCompileTestKernel2" ;
2626constexpr unsigned EAMTestKernelNumArgs2 = 4 ;
2727
28+ class EAMTestKernel3 ;
29+ const char EAMTestKernelName3[] = " LinkCompileTestKernel3" ;
30+ constexpr unsigned EAMTestKernelNumArgs3 = 4 ;
31+
2832namespace sycl {
2933__SYCL_INLINE_VER_NAMESPACE (_V1) {
3034namespace detail {
@@ -54,13 +58,26 @@ template <> struct KernelInfo<EAMTestKernel2> {
5458 static constexpr int64_t getKernelSize () { return 1 ; }
5559};
5660
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+
5774} // namespace detail
5875} // __SYCL_INLINE_VER_NAMESPACE(_V1)
5976} // namespace sycl
6077
6178template <typename T>
6279static sycl::unittest::PiImage
63- generateEAMTestKernel1Image (std::string _cmplOptions, std::string _lnkOptions) {
80+ generateEAMTestKernelImage (std::string _cmplOptions, std::string _lnkOptions) {
6481 using namespace sycl ::unittest;
6582
6683 std::vector<unsigned char > KernelEAM1{0b00000101 };
@@ -75,36 +92,8 @@ generateEAMTestKernel1Image(std::string _cmplOptions, std::string _lnkOptions) {
7592
7693 std::vector<unsigned char > Bin{0 , 1 , 2 , 3 , 4 , 5 }; // Random data
7794
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 ()});
10897
10998 PiImage Img{PI_DEVICE_BINARY_TYPE_SPIRV, // Format
11099 __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, // DeviceTargetSpec
@@ -122,9 +111,12 @@ inline pi_result redefinedProgramLink(pi_context, pi_uint32, const pi_device *,
122111 void (*)(pi_program, void *), void *,
123112 pi_program *) {
124113 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+ }
128120 return PI_SUCCESS;
129121}
130122
@@ -134,9 +126,12 @@ inline pi_result redefinedProgramCompile(pi_program, pi_uint32,
134126 const pi_program *, const char **,
135127 void (*)(pi_program, void *), void *) {
136128 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+ }
140135 return PI_SUCCESS;
141136}
142137
@@ -159,8 +154,8 @@ TEST(Link_Compile_Options, compile_link_Options_Test_empty_options) {
159154 current_compile_options.clear ();
160155 std::string expected_options = " " ;
161156 static sycl::unittest::PiImage DevImage =
162- generateEAMTestKernel1Image <EAMTestKernel1>(expected_options,
163- expected_options);
157+ generateEAMTestKernelImage <EAMTestKernel1>(expected_options,
158+ expected_options);
164159 static sycl::unittest::PiImageArray<1 > DevImageArray_{&DevImage};
165160 auto KernelID_1 = sycl::get_kernel_id<EAMTestKernel1>();
166161 sycl::queue Queue{Dev};
@@ -188,11 +183,11 @@ TEST(Link_Compile_Options, compile_link_Options_Test_filled_options) {
188183 expected_link_options_1 =
189184 " -cl-denorms-are-zero -cl-no-signed-zeros" ;
190185 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);
193188
194189 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 >();
196191 sycl::queue Queue{Dev};
197192 const sycl::context Ctx = Queue.get_context ();
198193 sycl::kernel_bundle KernelBundle =
@@ -221,10 +216,10 @@ TEST(Link_Compile_Options, check_sycl_build) {
221216 std::string expected_compile_options = " -cl-opt-disable" ,
222217 expected_link_options = " -cl-denorms-are-zero" ;
223218 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);
226221 static sycl::unittest::PiImageArray<1 > DevImageArray{&DevImage};
227- auto KernelID = sycl::get_kernel_id<EAMTestKernel1 >();
222+ auto KernelID = sycl::get_kernel_id<EAMTestKernel3 >();
228223 sycl::context Ctx{Dev};
229224 sycl::queue Queue{Ctx, Dev};
230225 sycl::kernel_bundle KernelBundle =
0 commit comments