Skip to content

Commit

Permalink
Fixes as per comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nshchego committed Oct 21, 2024
1 parent d4f26ea commit 38879a1
Show file tree
Hide file tree
Showing 12 changed files with 1,274 additions and 1,033 deletions.
3 changes: 3 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ target_include_directories(openvino_core_dev INTERFACE
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/common/transformations/include>
$<BUILD_INTERFACE:${OpenVINO_SOURCE_DIR}/src/common/low_precision_transformations/include>)

target_include_directories(openvino_core_dev SYSTEM INTERFACE
$<BUILD_INTERFACE:$<$<TARGET_EXISTS:xbyak::xbyak>:$<TARGET_PROPERTY:xbyak::xbyak,INTERFACE_INCLUDE_DIRECTORIES>>>)

target_link_libraries(openvino_core_dev INTERFACE openvino::itt openvino::util)

set_target_properties(openvino_core_dev PROPERTIES EXPORT_NAME core::dev)
Expand Down
20 changes: 20 additions & 0 deletions src/core/dev_api/openvino/runtime/compute_hash.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <cstddef>

namespace ov {
namespace runtime {

/**
* @brief Computes the hash value for the input data
* @param src A pointer to the input data
* @param size The length of the input data in bytes
*/
size_t compute_hash(const void* src, size_t size);

} // namespace runtime
} // namespace ov
5 changes: 0 additions & 5 deletions src/core/reference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ ov_build_target_faster(${TARGET_NAME}

ov_set_threading_interface_for(${TARGET_NAME})

target_compile_definitions(${TARGET_NAME} PRIVATE XBYAK_NO_OP_NAMES XBYAK64)

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${TARGET_NAME} PUBLIC OPENVINO_STATIC_LIBRARY)
endif()
Expand All @@ -50,9 +48,6 @@ target_include_directories(${TARGET_NAME} PUBLIC
$<BUILD_INTERFACE:${OV_CORE_DEV_API_PATH}>
$<BUILD_INTERFACE:${OV_CORE_INCLUDE_PATH}>)

target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
$<BUILD_INTERFACE:$<$<TARGET_EXISTS:xbyak::xbyak>:$<TARGET_PROPERTY:xbyak::xbyak,INTERFACE_INCLUDE_DIRECTORIES>>>)

find_package(Threads REQUIRED)
target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads openvino::core::dev)

Expand Down

This file was deleted.

131 changes: 67 additions & 64 deletions src/core/reference/include/openvino/reference/utils/jit_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,97 @@
#pragma once

#if defined _WIN32 && !defined NOMINMAX
#define NOMINMAX
# define NOMINMAX
#endif

#include <functional>
#define XBYAK64
#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak.h>

#include <functional>

namespace ov {
namespace reference {
namespace jit {
#ifdef XBYAK64
static const Xbyak::Operand::Code abi_save_gpr_regs[] = {
Xbyak::Operand::RBX,
Xbyak::Operand::RBP,
Xbyak::Operand::R12,
Xbyak::Operand::R13,
Xbyak::Operand::R14,
Xbyak::Operand::R15,
static const Xbyak::Operand::Code abi_save_gpr_regs[] = {
Xbyak::Operand::RBX,
Xbyak::Operand::RBP,
Xbyak::Operand::R12,
Xbyak::Operand::R13,
Xbyak::Operand::R14,
Xbyak::Operand::R15,
#ifdef _WIN32
Xbyak::Operand::RDI,
Xbyak::Operand::RSI,
Xbyak::Operand::RDI,
Xbyak::Operand::RSI,
#endif
};
};

#ifdef _WIN32
#define abi_param1 Xbyak::Reg64(Xbyak::Operand::RCX) // RCX
# define abi_param1 Xbyak::Reg64(Xbyak::Operand::RCX) // RCX
#else
#define abi_param1 Xbyak::Reg64(Xbyak::Operand::RDI) // RDI
# define abi_param1 Xbyak::Reg64(Xbyak::Operand::RDI) // RDI
#endif
#endif // XBYAK64

typedef enum {
isa_any,
sse42,
avx,
avx2,
avx512_common,
avx512_core,
avx512_core_vnni,
avx512_mic,
avx512_mic_4ops,
avx512_core_bf16,
avx512_vpopcnt,
fp16,
pclmulqdq,
vpclmulqdq
} cpu_isa_t;

class Generator : public Xbyak::CodeGenerator
{

typedef enum {
isa_any,
sse42,
avx,
avx2,
avx512_common,
avx512_core,
avx512_core_vnni,
avx512_mic,
avx512_mic_4ops,
avx512_core_bf16,
avx512_vpopcnt,
fp16,
pclmulqdq,
vpclmulqdq
} cpu_isa_t;

class Generator : public Xbyak::CodeGenerator {
#ifdef _WIN32
static constexpr size_t xmm_to_preserve_start = 6;
static constexpr size_t xmm_to_preserve = 10;
static constexpr size_t xmm_to_preserve_start = 6llu;
static constexpr size_t xmm_to_preserve = 10llu;
#else
static constexpr size_t xmm_to_preserve_start = 0;
static constexpr size_t xmm_to_preserve = 0;
static constexpr size_t xmm_to_preserve_start = 0lu;
static constexpr size_t xmm_to_preserve = 0lu;
#endif

static const size_t num_abi_save_gpr_regs = sizeof(abi_save_gpr_regs) / sizeof(abi_save_gpr_regs[0]);
const size_t size_of_abi_save_regs;
static const size_t num_abi_save_gpr_regs = sizeof(abi_save_gpr_regs) / sizeof(abi_save_gpr_regs[0]);
const size_t size_of_abi_save_regs;

const Xbyak::Reg64 reg_EVEX_max_8b_offt;
static constexpr int EVEX_max_8b_offt = 0x200;
size_t m_vlen = ymm_len;

const Xbyak::Reg64 reg_EVEX_max_8b_offt;
static constexpr int EVEX_max_8b_offt = 0x200;
public:
static constexpr size_t xmm_len = 16lu;
static constexpr size_t ymm_len = 32lu;
static constexpr size_t zmm_len = 64lu;

public:
static constexpr size_t xmm_len = 16;
static constexpr size_t ymm_len = 32;
static constexpr size_t zmm_len = 64;
const Xbyak::Reg64 param = abi_param1;

const Xbyak::Reg64 param = abi_param1;
static bool mayiuse(const cpu_isa_t cpu_isa);
static bool is_x64();

static bool mayiuse(const cpu_isa_t cpu_isa);
static bool is_x64();
Generator(cpu_isa_t isa = avx2, void* code_ptr = nullptr, size_t code_size = 16lu * 1024lu);
void preamble();
void postamble();

Generator(void* code_ptr = nullptr, size_t code_size = 16 * 1024);
void preamble();
void postamble();
void foreach (const Xbyak::Reg64& idx,
size_t step,
const Xbyak::Reg64& end,
std::function<void(const Xbyak::Reg64&)> && fn);

void foreach (const Xbyak::Reg64& idx,
size_t step,
const Xbyak::Reg64& end,
std::function<void(const Xbyak::Reg64&)> && fn);
template <typename T>
void copy(const Xbyak::Reg64& dst, const Xbyak::Reg64& src, const Xbyak::Reg64& size);

template <typename T>
void copy(const Xbyak::Reg64& dst,
const Xbyak::Reg64& src,
const Xbyak::Reg64& size);
};
size_t get_vlen() {
return m_vlen;
}
};

} // namespace jit
} // namespace reference
} // namespace reference
} // namespace ov
Loading

0 comments on commit 38879a1

Please sign in to comment.