Skip to content

Commit 33e0da5

Browse files
authored
Leave is_host() call with old compiler only (#1224)
* Leave is_host() call with old compiler only * Incremented 2023-SWITCHOVER timestamp
1 parent 0a19b73 commit 33e0da5

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

dpnp/backend/src/dpnp_utils.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2022, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,15 @@
4040
(__LIBSYCL_MAJOR_VERSION > major) || (__LIBSYCL_MAJOR_VERSION == major and __LIBSYCL_MINOR_VERSION > minor) || \
4141
(__LIBSYCL_MAJOR_VERSION == major and __LIBSYCL_MINOR_VERSION == minor and __LIBSYCL_PATCH_VERSION >= patch)
4242

43+
/**
44+
* Version of SYCL DPC++ 2023 compiler at which transition to SYCL 2020 occurs.
45+
* Intel(R) oneAPI DPC++ 2022.2.1 compiler has version 20221020L on Linux and
46+
* 20221101L on Windows.
47+
*/
48+
#ifndef __SYCL_COMPILER_2023_SWITCHOVER
49+
#define __SYCL_COMPILER_2023_SWITCHOVER 20221102L
50+
#endif
51+
4352
/**
4453
* @defgroup BACKEND_UTILS Backend C++ library utilities
4554
* @{

dpnp/backend/src/dpnpc_memory_adapter.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2022, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,7 @@
2828
#define DPNP_MEMORY_ADAPTER_H
2929

3030
#include "queue_sycl.hpp"
31+
#include "dpnp_utils.hpp"
3132

3233
/**
3334
* @ingroup BACKEND_UTILS
@@ -84,8 +85,10 @@ class DPNPC_ptr_adapter final
8485
std::cerr << "\n\t size_in_bytes=" << size_in_bytes;
8586
std::cerr << "\n\t pointer type=" << (long)src_ptr_type;
8687
std::cerr << "\n\t queue inorder=" << queue.is_in_order();
88+
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
8789
std::cerr << "\n\t queue is_host=" << queue.is_host();
8890
std::cerr << "\n\t queue device is_host=" << queue.get_device().is_host();
91+
#endif
8992
std::cerr << "\n\t queue device is_cpu=" << queue.get_device().is_cpu();
9093
std::cerr << "\n\t queue device is_gpu=" << queue.get_device().is_gpu();
9194
std::cerr << "\n\t queue device is_accelerator=" << queue.get_device().is_accelerator();

dpnp/backend/src/queue_sycl.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include <dpnp_iface.hpp>
3131
#include "queue_sycl.hpp"
32+
#include "dpnp_utils.hpp"
3233

3334
#if defined(DPNP_LOCAL_QUEUE)
3435
sycl::queue* backend_sycl::queue = nullptr;
@@ -211,10 +212,14 @@ bool backend_sycl::backend_sycl_is_cpu()
211212
{
212213
sycl::queue& qptr = get_queue();
213214

214-
if (qptr.is_host() || qptr.get_device().is_cpu() || qptr.get_device().is_host())
215-
{
215+
if (qptr.get_device().is_cpu()) {
216+
return true;
217+
}
218+
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
219+
else if (qptr.is_host() || qptr.get_device().is_host()) {
216220
return true;
217221
}
222+
#endif
218223

219224
return false;
220225
}

0 commit comments

Comments
 (0)