Skip to content

Commit

Permalink
SYCL: Get Pointer Type
Browse files Browse the repository at this point in the history
This SYCL 2020 feature has been available in recent compilers.
  • Loading branch information
WeiqunZhang committed Jul 20, 2023
1 parent dbfa3b0 commit d6bed52
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions Src/Base/AMReX_GpuUtility.H
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ namespace Gpu {
CUresult r = cuPointerGetAttributes(1, &attrib, data, (CUdeviceptr)p);
return r == CUDA_SUCCESS && is_managed;
#elif defined(AMREX_USE_SYCL)
amrex::ignore_unused(p);
// xxxxx SYCL todo: get_pointer_type
// auto const info = sycl::get_pointer_info(p);
// auto type = sycl::get_pointer_type(p,Device::syclContext());
return false;
auto type = sycl::get_pointer_type(p,Device::syclContext());
return type == sycl::usm::alloc::shared;
#else
amrex::ignore_unused(p);
return false;
Expand All @@ -74,9 +71,8 @@ namespace Gpu {
CUresult r = cuPointerGetAttributes(1, &attrib, data, (CUdeviceptr)p);
return r == CUDA_SUCCESS && mem_type == CU_MEMORYTYPE_DEVICE;
#elif defined(AMREX_USE_SYCL)
amrex::ignore_unused(p);
// xxxxx SYCL todo: get_pointer_type
return false;
auto type = sycl::get_pointer_type(p,Device::syclContext());
return type == sycl::usm::alloc::device;
#else
amrex::ignore_unused(p);
return false;
Expand All @@ -95,9 +91,8 @@ namespace Gpu {
CUresult r = cuPointerGetAttributes(1, &attrib, data, (CUdeviceptr)p);
return r == CUDA_SUCCESS && mem_type == CU_MEMORYTYPE_HOST;
#elif defined(AMREX_USE_SYCL)
amrex::ignore_unused(p);
// xxxxx SYCL todo: get_pointer_type
return false;
auto type = sycl::get_pointer_type(p,Device::syclContext());
return type == sycl::usm::alloc::host;
#else
amrex::ignore_unused(p);
return false;
Expand Down Expand Up @@ -126,9 +121,8 @@ namespace Gpu {
mem_type == CU_MEMORYTYPE_ARRAY ||
mem_type == CU_MEMORYTYPE_UNIFIED);
#elif defined(AMREX_USE_SYCL)
amrex::ignore_unused(p);
// xxxxx SYCL todo: get_pointer_type
return false;
auto type = sycl::get_pointer_type(p,Device::syclContext());
return type != sycl::usm::alloc::unknown;
#else
amrex::ignore_unused(p);
return false;
Expand Down

0 comments on commit d6bed52

Please sign in to comment.