Skip to content

Commit

Permalink
[CPU][CACHE_DIR] hash optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
nshchego committed Aug 1, 2024
1 parent ba681ed commit 81cdaaf
Show file tree
Hide file tree
Showing 12 changed files with 1,125 additions and 116 deletions.
2 changes: 2 additions & 0 deletions src/cmake/ov_parallel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ function(ov_set_threading_interface_for TARGET_NAME)
endif()

get_target_property(target_type ${TARGET_NAME} TYPE)
message(TARGET_NAME="${TARGET_NAME}")
message(target_type="${target_type}")

if(target_type STREQUAL "INTERFACE_LIBRARY")
set(LINK_TYPE "INTERFACE")
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ ov_build_target_faster(openvino_core_obj

ov_add_version_defines(src/version.cpp openvino_core_obj)

ov_set_threading_interface_for(openvino_core_obj)

target_link_libraries(openvino_core_obj PRIVATE openvino::reference openvino::util
openvino::pugixml openvino::shape_inference openvino::core::dev)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <cstddef>

namespace ov {
namespace runtime {

size_t combine_hash(const void* src, size_t size);

} // namespace runtime
} // namespace ov
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright (C) 2018-2024 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

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

#include <functional>
#include <xbyak/xbyak.h>

namespace ov {
namespace runtime {
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,
#ifdef _WIN32
Xbyak::Operand::RDI,
Xbyak::Operand::RSI,
#endif
};

#ifdef _WIN32
#define abi_param1 Xbyak::Reg64(Xbyak::Operand::RCX) // RCX
#else
#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
{
#ifdef _WIN32
static constexpr size_t xmm_to_preserve_start = 6;
static constexpr size_t xmm_to_preserve = 10;
#else
static constexpr size_t xmm_to_preserve_start = 0;
static constexpr size_t xmm_to_preserve = 0;
#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;

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

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;

static bool mayiuse(const cpu_isa_t cpu_isa);
static bool is_x64();

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);

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

} // namespace jit
} // namespace runtime
} // namespace ov
Loading

0 comments on commit 81cdaaf

Please sign in to comment.