Skip to content

Commit 1919fc6

Browse files
Only run test submit if device has aspect fp64
1 parent a72c004 commit 1919fc6

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

libsyclinterface/tests/test_sycl_queue_submit.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ struct TestQueueSubmitFP64 : public ::testing::Test
256256
std::ifstream spirvFile;
257257
size_t spirvFileSize_;
258258
std::vector<char> spirvBuffer_;
259+
DPCTLSyclDeviceRef DRef = nullptr;
259260
DPCTLSyclQueueRef QRef = nullptr;
260261
DPCTLSyclKernelBundleRef KBRef = nullptr;
261262

262263
TestQueueSubmitFP64()
263264
{
264265
DPCTLSyclDeviceSelectorRef DSRef = nullptr;
265-
DPCTLSyclDeviceRef DRef = nullptr;
266266

267267
spirvFile.open("./oneD_range_kernel_fp64.spv",
268268
std::ios::binary | std::ios::ate);
@@ -279,13 +279,13 @@ struct TestQueueSubmitFP64 : public ::testing::Test
279279

280280
KBRef = DPCTLKernelBundle_CreateFromSpirv(
281281
CRef, DRef, spirvBuffer_.data(), spirvFileSize_, nullptr);
282-
DPCTLDevice_Delete(DRef);
283282
DPCTLDeviceSelector_Delete(DSRef);
284283
}
285284

286285
~TestQueueSubmitFP64()
287286
{
288287
spirvFile.close();
288+
DPCTLDevice_Delete(DRef);
289289
DPCTLQueue_Delete(QRef);
290290
DPCTLKernelBundle_Delete(KBRef);
291291
}
@@ -356,9 +356,11 @@ TEST_F(TestQueueSubmit, CheckForFloat)
356356

357357
TEST_F(TestQueueSubmitFP64, CheckForDouble)
358358
{
359-
submit_kernel<double>(QRef, KBRef, spirvBuffer_, spirvFileSize_,
360-
DPCTLKernelArgType::DPCTL_FLOAT64_T,
361-
"_ZTS11RangeKernelIdE");
359+
if (DPCTLDevice_HasAspect(DRef, DPCTLSyclAspectType::fp64)) {
360+
submit_kernel<double>(QRef, KBRef, spirvBuffer_, spirvFileSize_,
361+
DPCTLKernelArgType::DPCTL_FLOAT64_T,
362+
"_ZTS11RangeKernelIdE");
363+
}
362364
}
363365

364366
TEST_F(TestQueueSubmit, CheckForUnsupportedArgTy)

libsyclinterface/tests/test_sycl_queue_submit_local_accessor_arg.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,13 @@ struct TestQueueSubmitWithLocalAccessorFP64 : public ::testing::Test
239239
std::ifstream spirvFile;
240240
size_t spirvFileSize_;
241241
std::vector<char> spirvBuffer_;
242+
DPCTLSyclDeviceRef DRef = nullptr;
242243
DPCTLSyclQueueRef QRef = nullptr;
243244
DPCTLSyclKernelBundleRef KBRef = nullptr;
244245

245246
TestQueueSubmitWithLocalAccessorFP64()
246247
{
247248
DPCTLSyclDeviceSelectorRef DSRef = nullptr;
248-
DPCTLSyclDeviceRef DRef = nullptr;
249249

250250
spirvFile.open("./local_accessor_kernel_fp64.spv",
251251
std::ios::binary | std::ios::ate);
@@ -262,13 +262,13 @@ struct TestQueueSubmitWithLocalAccessorFP64 : public ::testing::Test
262262

263263
KBRef = DPCTLKernelBundle_CreateFromSpirv(
264264
CRef, DRef, spirvBuffer_.data(), spirvFileSize_, nullptr);
265-
DPCTLDevice_Delete(DRef);
266265
DPCTLDeviceSelector_Delete(DSRef);
267266
}
268267

269268
~TestQueueSubmitWithLocalAccessorFP64()
270269
{
271270
spirvFile.close();
271+
DPCTLDevice_Delete(DRef);
272272
DPCTLQueue_Delete(QRef);
273273
DPCTLKernelBundle_Delete(KBRef);
274274
}
@@ -339,9 +339,11 @@ TEST_F(TestQueueSubmitWithLocalAccessor, CheckForFloat)
339339

340340
TEST_F(TestQueueSubmitWithLocalAccessorFP64, CheckForDouble)
341341
{
342-
submit_kernel<double>(QRef, KBRef, spirvBuffer_, spirvFileSize_,
343-
DPCTLKernelArgType::DPCTL_FLOAT64_T,
344-
"_ZTS14SyclKernel_SLMIdE");
342+
if (DPCTLDevice_HasAspect(DRef, DPCTLSyclAspectType::fp64)) {
343+
submit_kernel<double>(QRef, KBRef, spirvBuffer_, spirvFileSize_,
344+
DPCTLKernelArgType::DPCTL_FLOAT64_T,
345+
"_ZTS14SyclKernel_SLMIdE");
346+
}
345347
}
346348

347349
TEST_F(TestQueueSubmitWithLocalAccessor, CheckForUnsupportedArgTy)

0 commit comments

Comments
 (0)