Skip to content

Leave is_host() call with old compiler only #1224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion dpnp/backend/src/dpnp_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2022, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -40,6 +40,15 @@
(__LIBSYCL_MAJOR_VERSION > major) || (__LIBSYCL_MAJOR_VERSION == major and __LIBSYCL_MINOR_VERSION > minor) || \
(__LIBSYCL_MAJOR_VERSION == major and __LIBSYCL_MINOR_VERSION == minor and __LIBSYCL_PATCH_VERSION >= patch)

/**
* Version of SYCL DPC++ 2023 compiler at which transition to SYCL 2020 occurs.
* Intel(R) oneAPI DPC++ 2022.2.1 compiler has version 20221020L on Linux and
* 20221101L on Windows.
*/
#ifndef __SYCL_COMPILER_2023_SWITCHOVER
#define __SYCL_COMPILER_2023_SWITCHOVER 20221102L
#endif

/**
* @defgroup BACKEND_UTILS Backend C++ library utilities
* @{
Expand Down
5 changes: 4 additions & 1 deletion dpnp/backend/src/dpnpc_memory_adapter.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//*****************************************************************************
// Copyright (c) 2016-2020, Intel Corporation
// Copyright (c) 2016-2022, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -28,6 +28,7 @@
#define DPNP_MEMORY_ADAPTER_H

#include "queue_sycl.hpp"
#include "dpnp_utils.hpp"

/**
* @ingroup BACKEND_UTILS
Expand Down Expand Up @@ -84,8 +85,10 @@ class DPNPC_ptr_adapter final
std::cerr << "\n\t size_in_bytes=" << size_in_bytes;
std::cerr << "\n\t pointer type=" << (long)src_ptr_type;
std::cerr << "\n\t queue inorder=" << queue.is_in_order();
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
std::cerr << "\n\t queue is_host=" << queue.is_host();
std::cerr << "\n\t queue device is_host=" << queue.get_device().is_host();
#endif
std::cerr << "\n\t queue device is_cpu=" << queue.get_device().is_cpu();
std::cerr << "\n\t queue device is_gpu=" << queue.get_device().is_gpu();
std::cerr << "\n\t queue device is_accelerator=" << queue.get_device().is_accelerator();
Expand Down
9 changes: 7 additions & 2 deletions dpnp/backend/src/queue_sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <dpnp_iface.hpp>
#include "queue_sycl.hpp"
#include "dpnp_utils.hpp"

#if defined(DPNP_LOCAL_QUEUE)
sycl::queue* backend_sycl::queue = nullptr;
Expand Down Expand Up @@ -211,10 +212,14 @@ bool backend_sycl::backend_sycl_is_cpu()
{
sycl::queue& qptr = get_queue();

if (qptr.is_host() || qptr.get_device().is_cpu() || qptr.get_device().is_host())
{
if (qptr.get_device().is_cpu()) {
return true;
}
#if (__SYCL_COMPILER_VERSION < __SYCL_COMPILER_2023_SWITCHOVER)
else if (qptr.is_host() || qptr.get_device().is_host()) {
return true;
}
#endif

return false;
}
Expand Down