Intel® Inspector User Guide for Linux* OS

ID 767796
Date 5/15/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Pointer from Different Device

Occurs when memory is allocated on a device using a pointer from another device.

ID

Code Location

Description

1

Allocation site

Represents source location of memory allocation on device. If a pointer allocated for a certain device is used for memory allocation on a different device, the pointer is considered invalid.

DPC++ Example

cl::sycl::queue queue_1(cl::sycl::cpu_selector{}); 

cl::sycl::queue queue_2(cl::sycl::cpu_selector{}); 

int* deviceData  = (int*)sycl::malloc_device(sizeInBytes, queue_1.get_device(), queue_1.get_context()); 

queue_2.submit([&](cl::sycl::handler &cgh) 

{ 

    cgh.parallel_for<class kernel1>(range, 

                                    [=](cl::sycl::item<1> itemID) 

                                    { 

                                        size_t i = itemID.get_id(0); 

                                        deviceData[i] = i + 1;   

                                    }); 

} 

Possible Correction Strategies

To avoid the problem, use the following hints:

  • Check if the pointer you are using matches the device it was allocated for.
  • Consider converting device pointers into shared memory pointers applicable to multiple device types.