-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,125 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/core/reference/include/openvino/reference/utils/combine_hash.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
98 changes: 98 additions & 0 deletions
98
src/core/reference/include/openvino/reference/utils/jit_generator.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.