@@ -44,15 +44,6 @@ constexpr size_t SIZE = 100;
4444
4545using namespace dpctl ::syclinterface;
4646
47- typedef struct MDLocalAccessorTy
48- {
49- size_t ndim;
50- DPCTLKernelArgType dpctl_type_id;
51- size_t dim0;
52- size_t dim1;
53- size_t dim2;
54- } MDLocalAccessor;
55-
5647template <typename T>
5748void submit_kernel (DPCTLSyclQueueRef QRef,
5849 DPCTLSyclKernelBundleRef KBRef,
@@ -75,28 +66,49 @@ void submit_kernel(DPCTLSyclQueueRef QRef,
7566 a_ptr[i] = 0 ;
7667 }
7768
78- auto la = MDLocalAccessor{1 , kernelArgTy, SIZE / 10 , 1 , 1 };
69+ auto la1 = MDLocalAccessor{1 , kernelArgTy, SIZE / 10 , 1 , 1 };
7970
8071 // Create kernel args for vector_add
8172 size_t gRange [] = {SIZE};
8273 size_t lRange[] = {SIZE / 10 };
83- void *args [NARGS] = {unwrap<void >(a), (void *)&la };
74+ void *args_1d [NARGS] = {unwrap<void >(a), (void *)&la1 };
8475 DPCTLKernelArgType addKernelArgTypes[] = {DPCTL_VOID_PTR,
8576 DPCTL_LOCAL_ACCESSOR};
8677
87- auto ERef =
88- DPCTLQueue_SubmitNDRange (kernel, QRef, args, addKernelArgTypes, NARGS,
89- gRange , lRange, RANGE_NDIMS, nullptr , 0 );
90- ASSERT_TRUE (ERef != nullptr );
91- DPCTLQueue_Wait (QRef);
78+ DPCTLSyclEventRef E1Ref = DPCTLQueue_SubmitNDRange (
79+ kernel, QRef, args_1d, addKernelArgTypes, NARGS, gRange , lRange,
80+ RANGE_NDIMS, nullptr , 0 );
81+ ASSERT_TRUE (E1Ref != nullptr );
82+
83+ DPCTLSyclEventRef DepEv1[] = {E1Ref};
84+ auto la2 = MDLocalAccessor{2 , kernelArgTy, SIZE / 10 , 1 , 1 };
85+ void *args_2d[NARGS] = {unwrap<void >(a), (void *)&la2};
86+
87+ DPCTLSyclEventRef E2Ref =
88+ DPCTLQueue_SubmitNDRange (kernel, QRef, args_2d, addKernelArgTypes,
89+ NARGS, gRange , lRange, RANGE_NDIMS, DepEv1, 1 );
90+ ASSERT_TRUE (E2Ref != nullptr );
91+
92+ DPCTLSyclEventRef DepEv2[] = {E1Ref, E2Ref};
93+ auto la3 = MDLocalAccessor{3 , kernelArgTy, SIZE / 10 , 1 , 1 };
94+ void *args_3d[NARGS] = {unwrap<void >(a), (void *)&la3};
95+
96+ DPCTLSyclEventRef E3Ref =
97+ DPCTLQueue_SubmitNDRange (kernel, QRef, args_3d, addKernelArgTypes,
98+ NARGS, gRange , lRange, RANGE_NDIMS, DepEv2, 2 );
99+ ASSERT_TRUE (E3Ref != nullptr );
100+
101+ DPCTLEvent_Wait (E3Ref);
92102
93103 if (kernelArgTy != DPCTL_FLOAT32_T && kernelArgTy != DPCTL_FLOAT64_T)
94104 ASSERT_TRUE (a_ptr[0 ] == 20 );
95105 else
96106 ASSERT_TRUE (a_ptr[0 ] == 20.0 );
97107
98108 // clean ups
99- DPCTLEvent_Delete (ERef);
109+ DPCTLEvent_Delete (E1Ref);
110+ DPCTLEvent_Delete (E2Ref);
111+ DPCTLEvent_Delete (E3Ref);
100112 DPCTLKernel_Delete (kernel);
101113 DPCTLfree_with_queue ((DPCTLSyclUSMRef)a, QRef);
102114}
@@ -239,13 +251,13 @@ struct TestQueueSubmitWithLocalAccessorFP64 : public ::testing::Test
239251 std::ifstream spirvFile;
240252 size_t spirvFileSize_;
241253 std::vector<char > spirvBuffer_;
254+ DPCTLSyclDeviceRef DRef = nullptr ;
242255 DPCTLSyclQueueRef QRef = nullptr ;
243256 DPCTLSyclKernelBundleRef KBRef = nullptr ;
244257
245258 TestQueueSubmitWithLocalAccessorFP64 ()
246259 {
247260 DPCTLSyclDeviceSelectorRef DSRef = nullptr ;
248- DPCTLSyclDeviceRef DRef = nullptr ;
249261
250262 spirvFile.open (" ./local_accessor_kernel_fp64.spv" ,
251263 std::ios::binary | std::ios::ate);
@@ -262,13 +274,13 @@ struct TestQueueSubmitWithLocalAccessorFP64 : public ::testing::Test
262274
263275 KBRef = DPCTLKernelBundle_CreateFromSpirv (
264276 CRef, DRef, spirvBuffer_.data (), spirvFileSize_, nullptr );
265- DPCTLDevice_Delete (DRef);
266277 DPCTLDeviceSelector_Delete (DSRef);
267278 }
268279
269280 ~TestQueueSubmitWithLocalAccessorFP64 ()
270281 {
271282 spirvFile.close ();
283+ DPCTLDevice_Delete (DRef);
272284 DPCTLQueue_Delete (QRef);
273285 DPCTLKernelBundle_Delete (KBRef);
274286 }
@@ -339,9 +351,11 @@ TEST_F(TestQueueSubmitWithLocalAccessor, CheckForFloat)
339351
340352TEST_F (TestQueueSubmitWithLocalAccessorFP64, CheckForDouble)
341353{
342- submit_kernel<double >(QRef, KBRef, spirvBuffer_, spirvFileSize_,
343- DPCTLKernelArgType::DPCTL_FLOAT64_T,
344- " _ZTS14SyclKernel_SLMIdE" );
354+ if (DPCTLDevice_HasAspect (DRef, DPCTLSyclAspectType::fp64)) {
355+ submit_kernel<double >(QRef, KBRef, spirvBuffer_, spirvFileSize_,
356+ DPCTLKernelArgType::DPCTL_FLOAT64_T,
357+ " _ZTS14SyclKernel_SLMIdE" );
358+ }
345359}
346360
347361TEST_F (TestQueueSubmitWithLocalAccessor, CheckForUnsupportedArgTy)
0 commit comments