@@ -19,17 +19,15 @@ using namespace cl::sycl;
1919struct CudaInteropGetNativeTests : public ::testing::TestWithParam<platform> {
2020
2121protected:
22- queue syclQueue_;
23- context syclContext_;
22+ std::unique_ptr<queue> syclQueue_;
2423 device syclDevice_;
2524
2625 void SetUp () override {
2726 syclDevice_ = GetParam ().get_devices ()[0 ];
28- syclQueue_ = queue{syclDevice_};
29- syclContext_ = syclQueue_.get_context ();
27+ syclQueue_ = std::unique_ptr<queue>{new queue{syclDevice_}};
3028 }
3129
32- void TearDown () override {}
30+ void TearDown () override { syclQueue_. reset (); }
3331};
3432
3533TEST_P (CudaInteropGetNativeTests, getNativeDevice) {
@@ -41,31 +39,32 @@ TEST_P(CudaInteropGetNativeTests, getNativeDevice) {
4139}
4240
4341TEST_P (CudaInteropGetNativeTests, getNativeContext) {
44- CUcontext cudaContext = get_native<backend::cuda>(syclContext_ );
42+ CUcontext cudaContext = get_native<backend::cuda>(syclQueue_-> get_context () );
4543 ASSERT_NE (cudaContext, nullptr );
4644}
4745
4846TEST_P (CudaInteropGetNativeTests, getNativeQueue) {
49- CUstream cudaStream = get_native<backend::cuda>(syclQueue_);
47+ CUstream cudaStream = get_native<backend::cuda>(* syclQueue_);
5048 ASSERT_NE (cudaStream, nullptr );
5149
5250 CUcontext streamContext = nullptr ;
5351 CUresult result = cuStreamGetCtx (cudaStream, &streamContext);
5452 ASSERT_EQ (result, CUDA_SUCCESS);
5553
56- CUcontext cudaContext = get_native<backend::cuda>(syclContext_ );
54+ CUcontext cudaContext = get_native<backend::cuda>(syclQueue_-> get_context () );
5755 ASSERT_EQ (streamContext, cudaContext);
5856}
5957
6058TEST_P (CudaInteropGetNativeTests, interopTaskGetMem) {
6159 buffer<int , 1 > syclBuffer (range<1 >{1 });
62- syclQueue_. submit ([&](handler &cgh) {
60+ syclQueue_-> submit ([&](handler &cgh) {
6361 auto syclAccessor = syclBuffer.get_access <access::mode::read>(cgh);
6462 cgh.interop_task ([=](interop_handler ih) {
6563 CUdeviceptr cudaPtr = ih.get_mem <backend::cuda>(syclAccessor);
6664 CUdeviceptr cudaPtrBase;
6765 size_t cudaPtrSize = 0 ;
68- CUcontext cudaContext = get_native<backend::cuda>(syclContext_);
66+ CUcontext cudaContext =
67+ get_native<backend::cuda>(syclQueue_->get_context ());
6968 ASSERT_EQ (CUDA_SUCCESS, cuCtxPushCurrent (cudaContext));
7069 ASSERT_EQ (CUDA_SUCCESS,
7170 cuMemGetAddressRange (&cudaPtrBase, &cudaPtrSize, cudaPtr));
@@ -76,8 +75,8 @@ TEST_P(CudaInteropGetNativeTests, interopTaskGetMem) {
7675}
7776
7877TEST_P (CudaInteropGetNativeTests, interopTaskGetBufferMem) {
79- CUstream cudaStream = get_native<backend::cuda>(syclQueue_);
80- syclQueue_. submit ([&](handler &cgh) {
78+ CUstream cudaStream = get_native<backend::cuda>(* syclQueue_);
79+ syclQueue_-> submit ([&](handler &cgh) {
8180 cgh.interop_task ([=](interop_handler ih) {
8281 CUstream cudaInteropStream = ih.get_queue <backend::cuda>();
8382 ASSERT_EQ (cudaInteropStream, cudaStream);
0 commit comments