User Guide

  • 2022.0
  • 05/15/2022
  • Public Content

Pointer from Different Device

Occurs when memory is allocated on a device using a pointer from another device.
Problem type: Memory leak
Code Location
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.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at