DPCT1070#

Message#

<pointer variable name> is allocated by dpct::dpct_malloc. Use dpct::get_host_ptr<type>(pointer variable name) to access the pointer from the host code.

Detailed Help#

The memory referenced by this pointer is allocated by dpct::dpct_malloc and cannot be directly accessed from the host code. You can access the memory from the host code by transforming the pointer using the dpct::get_host_ptr function.

Suggestions to Fix#

  1. Re-migrate the code without specifing --usm-level=none; or

  2. Review the code and adjust it manually.

For example, this original CUDA* code:

1void bar(float *a) {
2  a[0] = 1;
3}
4
5void foo() {
6  float* a;
7  cudaMallocManaged(&a, 10 * sizeof(float));
8  bar(a);
9}

results in the following migrated SYCL* code:

 1#define DPCT_USM_LEVEL_NONE
 2#include <sycl/sycl.hpp>
 3#include <dpct/dpct.hpp>
 4void bar(float *a) {
 5  a[0] = 1;
 6}
 7
 8void foo() {
 9  float* a;
10  /*
11  DPCT1070:0: 'a' is allocated by dpct::dpct_malloc. Use
12  dpct::get_host_ptr<float>(a) to access the pointer from the host code.
13  */
14  a = (float *)dpct::dpct_malloc(10 * sizeof(float));
15  bar(a);
16}

which is rewritten to:

 1#define DPCT_USM_LEVEL_NONE
 2#include <sycl/sycl.hpp>
 3#include <dpct/dpct.hpp>
 4void bar(float *a) {
 5  dpct::get_host_ptr<float>(a)[0] = 1;
 6}
 7
 8void foo() {
 9  float* a;
10  a = (float *)dpct::dpct_malloc(10 * sizeof(float));
11  bar(a);
12}