Skip to content

Commit

Permalink
Clean up backend code (#2259)
Browse files Browse the repository at this point in the history
The PR proposed to remove unused code from the backend.
Specially it's about removing local constant `striped` which produces
compilation warnings.
  • Loading branch information
antonwolfy authored Jan 14, 2025
1 parent 44bb068 commit ce3ef5e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 151 deletions.
14 changes: 0 additions & 14 deletions dpnp/backend/kernels/dpnp_krnl_elemwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,9 @@
#include <dpnp_iface.hpp>

#include "dpnp_fptr.hpp"
#include "dpnp_iterator.hpp"
#include "dpnp_utils.hpp"
#include "dpnpc_memory_adapter.hpp"
#include "queue_sycl.hpp"

// dpctl tensor headers
#include "kernels/alignment.hpp"

using dpctl::tensor::kernels::alignment_utils::is_aligned;
using dpctl::tensor::kernels::alignment_utils::required_alignment;

namespace syclex = sycl::ext::oneapi::experimental;
using syclex::group_load;
using syclex::group_store;

constexpr auto striped = syclex::properties{syclex::data_placement_striped};

template <typename T>
constexpr T dispatch_erf_op(T elem)
{
Expand Down
102 changes: 0 additions & 102 deletions dpnp/backend/src/dpnp_fptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,93 +69,6 @@ const DPNPFuncType eft_C64 = DPNPFuncType::DPNP_FT_CMPLX64;
const DPNPFuncType eft_C128 = DPNPFuncType::DPNP_FT_CMPLX128;
const DPNPFuncType eft_BLN = DPNPFuncType::DPNP_FT_BOOL;

/**
* An internal structure to build a pair of Data type enum value with C++ type
*/
template <DPNPFuncType FuncType, typename T>
struct func_type_pair_t
{
using type = T;

static func_type_pair_t
get_pair(std::integral_constant<DPNPFuncType, FuncType>)
{
return {};
}
};

/**
* An internal structure to create a map of Data type enum value associated with
* C++ type
*/
template <typename... Ps>
struct func_type_map_factory_t : public Ps...
{
using Ps::get_pair...;

template <DPNPFuncType FuncType>
using find_type = typename decltype(get_pair(
std::integral_constant<DPNPFuncType, FuncType>{}))::type;
};

/**
* A map of the FPTR interface to link Data type enum value with associated C++
* type
*/
typedef func_type_map_factory_t<
func_type_pair_t<eft_BLN, bool>,
func_type_pair_t<eft_INT, std::int32_t>,
func_type_pair_t<eft_LNG, std::int64_t>,
func_type_pair_t<eft_FLT, float>,
func_type_pair_t<eft_DBL, double>,
func_type_pair_t<eft_C64, std::complex<float>>,
func_type_pair_t<eft_C128, std::complex<double>>>
func_type_map_t;

/**
* Return an enum value of result type populated from input types.
*/
template <DPNPFuncType FT1, DPNPFuncType FT2>
static constexpr DPNPFuncType populate_func_types()
{
if constexpr (FT1 == DPNPFuncType::DPNP_FT_NONE) {
throw std::runtime_error("Templated enum value of FT1 is None");
}
else if constexpr (FT2 == DPNPFuncType::DPNP_FT_NONE) {
throw std::runtime_error("Templated enum value of FT2 is None");
}
return (FT1 < FT2) ? FT2 : FT1;
}

/**
* @brief A helper function to cast SYCL vector between types.
*/
template <typename Op, typename Vec, std::size_t... I>
static auto dpnp_vec_cast_impl(const Vec &v, std::index_sequence<I...>)
{
return Op{v[I]...};
}

/**
* @brief A casting function for SYCL vector.
*
* @tparam dstT A result type upon casting.
* @tparam srcT An incoming type of the vector.
* @tparam N A number of elements with the vector.
* @tparam Indices A sequence of integers
* @param s An incoming SYCL vector to cast.
* @return SYCL vector casted to desctination type.
*/
template <typename dstT,
typename srcT,
std::size_t N,
typename Indices = std::make_index_sequence<N>>
static auto dpnp_vec_cast(const sycl::vec<srcT, N> &s)
{
return dpnp_vec_cast_impl<sycl::vec<dstT, N>, sycl::vec<srcT, N>>(
s, Indices{});
}

/**
* Implements std::is_same<> with variadic number of types to compare with
* and when type T has to match only one of types Ts.
Expand Down Expand Up @@ -188,21 +101,6 @@ template <typename T1, typename T2, typename... Ts>
constexpr auto both_types_are_same =
std::conjunction_v<is_any<T1, Ts...>, are_same<T1, T2>>;

/**
* A template constat to check if both types T1 and T2 match any type from Ts.
*/
template <typename T1, typename T2, typename... Ts>
constexpr auto both_types_are_any_of =
std::conjunction_v<is_any<T1, Ts...>, is_any<T2, Ts...>>;

/**
* A template constat to check if both types T1 and T2 don't match any type from
* Ts sequence.
*/
template <typename T1, typename T2, typename... Ts>
constexpr auto none_of_both_types =
!std::disjunction_v<is_any<T1, Ts...>, is_any<T2, Ts...>>;

/**
* @brief If the type _Tp is a reference type, provides the member typedef type
* which is the type referred to by _Tp with its topmost cv-qualifiers removed.
Expand Down
35 changes: 0 additions & 35 deletions dpnp/backend/src/dpnp_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@
#define __SYCL_COMPILER_VECTOR_ABS_CHANGED 20230503L
#endif

/**
* 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_VERSION_REQUIRED
#define __SYCL_COMPILER_VERSION_REQUIRED 20221102L
#endif

/**
* Version of Intel MKL at which transition to OneMKL release 2023.0.0 occurs.
*/
Expand Down Expand Up @@ -221,32 +212,6 @@ static inline bool array_equal(const _DataType *input1,
std::begin(input2_vec));
}

/**
* @ingroup BACKEND_UTILS
* @brief Cast vector of DPCtl events to vector of SYCL enents.
*
* @param [in] events_ref Reference to vector of DPCtl events.
*
* @return Vector of SYCL events.
*/
namespace
{
[[maybe_unused]] std::vector<sycl::event>
cast_event_vector(const DPCTLEventVectorRef event_vec_ref)
{
const size_t event_vec_size = DPCTLEventVector_Size(event_vec_ref);

std::vector<sycl::event> event_vec;
event_vec.reserve(event_vec_size);
for (size_t i = 0; i < event_vec_size; ++i) {
DPCTLSyclEventRef event_ref = DPCTLEventVector_GetAt(event_vec_ref, i);
sycl::event event = *(reinterpret_cast<sycl::event *>(event_ref));
event_vec.push_back(event);
}
return event_vec;
}
} // namespace

/**
* @ingroup BACKEND_UTILS
* @brief Normalizes an axes into a non-negative integer axes.
Expand Down

0 comments on commit ce3ef5e

Please sign in to comment.