Skip to content

Commit

Permalink
[CORE][CACHE][HASH] DYNAMIC_CODE_POLICY check on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nshchego committed Feb 15, 2025
1 parent 6f7519a commit 36e2c1b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/src/runtime/compute_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# include "openvino/reference/utils/registers_pool.hpp"
#endif // OV_CORE_USE_XBYAK_JIT

#if defined(_WIN32)
# include <processthreadsapi.h>
#endif

namespace ov {
namespace runtime {

Expand Down Expand Up @@ -822,6 +826,13 @@ void ComputeHash<isa>::fold_to_64(const Vmm& v_dst) {

size_t compute_hash(const void* src, size_t size) {
#ifdef OV_CORE_USE_XBYAK_JIT
# if defined(_WIN32)
HANDLE handle = GetCurrentProcess();
PROCESS_MITIGATION_DYNAMIC_CODE_POLICY dynamic_code_policy = {0};
GetProcessMitigationPolicy(handle, ProcessDynamicCodePolicy, &dynamic_code_policy, sizeof(dynamic_code_policy));
if (dynamic_code_policy.ProhibitDynamicCode != TRUE) {
# endif

if (Generator::mayiuse(avx2)) {
uint64_t result = 0lu;

Expand Down Expand Up @@ -895,6 +906,10 @@ size_t compute_hash(const void* src, size_t size) {
return result;
}

#if defined(_WIN32)
}
#endif

#endif // OV_CORE_USE_XBYAK_JIT

constexpr auto cel_size = sizeof(size_t);
Expand Down

0 comments on commit 36e2c1b

Please sign in to comment.