[CPU] Cache for runtime data (#9192)
Caching added for Eltwise and MatMul nodes
This commit is contained in:
1 parent
cb9fe0910d
commit
2870dc7d3f
37 files changed
+2776
-1422
No files matched your search
+69
@@ -0,0 +1,69 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include "lru_cache.h"
|
||||
|
||||
namespace MKLDNNPlugin {
|
||||
|
||||
class CacheEntryBase {
|
||||
public:
|
||||
enum class LookUpStatus : int8_t {
|
||||
Hit,
|
||||
Miss
|
||||
};
|
||||
public:
|
||||
virtual ~CacheEntryBase() = default;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class represents a templated record in multi cache
|
||||
* @tparam KeyType is a key type that must define hash() const method with return type convertible to size_t and define comparison operator.
|
||||
* @tparam ValType is a type that must meet all the requirements to the std::unordered_map mapped type
|
||||
* @tparam ImplType is a type for the internal storage. It must provide put(KeyType, ValueType) and ValueType get(const KeyType&)
|
||||
* interface and must have constructor of type ImplType(size_t).
|
||||
*
|
||||
* @note In this implementation default constructed value objects are treated as empty objects.
|
||||
*/
|
||||
|
||||
template<typename KeyType,
|
||||
typename ValType,
|
||||
typename ImplType = LruCache<KeyType, ValType>>
|
||||
class CacheEntry : public CacheEntryBase {
|
||||
public:
|
||||
using ResultType = std::pair<ValType, LookUpStatus>;
|
||||
|
||||
public:
|
||||
explicit CacheEntry(size_t capacity) : _impl(capacity) {}
|
||||
|
||||
/**
|
||||
* @brief Searches the key in the underlying storage and returns value if it exists, or creates a value using the builder functor and adds it to
|
||||
* the underlying storage.
|
||||
* @param key is the search key
|
||||
* @param builder is a callable object that creates the ValType object from the KeyType lval reference
|
||||
* @return result of the operation which is a pair of the requested object of ValType and the status of whether the cache hit or miss occurred
|
||||
*/
|
||||
|
||||
ResultType getOrCreate(const KeyType& key, std::function<ValType(const KeyType&)> builder) {
|
||||
if (0 == _impl.getCapacity()) {
|
||||
// fast track
|
||||
return {builder(key), CacheEntryBase::LookUpStatus::Miss};
|
||||
}
|
||||
auto retStatus = LookUpStatus::Hit;
|
||||
ValType retVal = _impl.get(key);
|
||||
if (retVal == ValType()) {
|
||||
retStatus = LookUpStatus::Miss;
|
||||
retVal = builder(key);
|
||||
_impl.put(key, retVal);
|
||||
}
|
||||
return {retVal, retStatus};
|
||||
}
|
||||
|
||||
public:
|
||||
ImplType _impl;
|
||||
};
|
||||
}// namespace MKLDNNPlugin
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
|
||||
/**
|
||||
* @brief This is yet another implementation of a preemptive cache with LRU eviction policy.
|
||||
* @tparam Key is a key type that must define hash() const method with return type convertible to size_t and define comparison operator.
|
||||
* @tparam Value is a type that must meet all the requirements to the std::unordered_map mapped type
|
||||
*
|
||||
* @attention This cache implementation IS NOT THREAD SAFE!
|
||||
*/
|
||||
|
||||
namespace MKLDNNPlugin {
|
||||
|
||||
template<typename Key, typename Value>
|
||||
class LruCache {
|
||||
public:
|
||||
using value_type = std::pair<Key, Value>;
|
||||
|
||||
public:
|
||||
explicit LruCache(size_t capacity) : _capacity(capacity) {}
|
||||
|
||||
/**
|
||||
* @brief Puts the value associated with the key into the cache.
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
|
||||
void put(Key key, Value val) {
|
||||
if (0 == _capacity) {
|
||||
return;
|
||||
}
|
||||
auto mapItr = _cacheMapper.find(key);
|
||||
if (mapItr != _cacheMapper.end()) {
|
||||
touch(mapItr->second);
|
||||
mapItr->second->second = std::move(val);
|
||||
} else {
|
||||
if (_cacheMapper.size() == _capacity) {
|
||||
evict(1);
|
||||
}
|
||||
auto itr = _lruList.insert(_lruList.begin(), {key, std::move(val)});
|
||||
_cacheMapper.insert({std::move(key), itr});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Searches a value associated with the key.
|
||||
* @param key
|
||||
* @return Value associated with the key or default constructed instance of the Value type.
|
||||
*/
|
||||
|
||||
Value get(const Key &key) {
|
||||
auto itr = _cacheMapper.find(key);
|
||||
if (itr == _cacheMapper.end()) {
|
||||
return Value();
|
||||
}
|
||||
|
||||
touch(itr->second);
|
||||
return _lruList.front().second;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Evicts n least recently used cache records
|
||||
* @param n number of records to be evicted, can be greater than capacity
|
||||
*/
|
||||
|
||||
void evict(size_t n) {
|
||||
for (size_t i = 0; i < n && !_lruList.empty(); ++i) {
|
||||
_cacheMapper.erase(_lruList.back().first);
|
||||
_lruList.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the current capacity value
|
||||
* @return the current capacity value
|
||||
*/
|
||||
size_t getCapacity() const noexcept {
|
||||
return _capacity;
|
||||
}
|
||||
|
||||
private:
|
||||
struct key_hasher {
|
||||
std::size_t operator()(const Key &k) const {
|
||||
return k.hash();
|
||||
}
|
||||
};
|
||||
|
||||
using lru_list_type = std::list<value_type>;
|
||||
using cache_map_value_type = typename lru_list_type::iterator;
|
||||
|
||||
void touch(typename lru_list_type::iterator itr) {
|
||||
_lruList.splice(_lruList.begin(), _lruList, itr);
|
||||
}
|
||||
|
||||
lru_list_type _lruList;
|
||||
std::unordered_map<Key, cache_map_value_type, key_hasher> _cacheMapper;
|
||||
size_t _capacity;
|
||||
};
|
||||
|
||||
} // namespace MKLDNNPlugin
|
||||
@@ -0,0 +1,9 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "multi_cache.h"
|
||||
|
||||
using namespace MKLDNNPlugin;
|
||||
|
||||
std::atomic_size_t MultiCache::_typeIdCounter{0};
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
#include <atomic>
|
||||
#include "cache_entry.h"
|
||||
|
||||
namespace MKLDNNPlugin {
|
||||
|
||||
/**
|
||||
* @brief Class that represent a preemptive cache for different key/value pair types.
|
||||
*
|
||||
* @attention This implementation IS NOT THREAD SAFE!
|
||||
*/
|
||||
|
||||
class MultiCache {
|
||||
public:
|
||||
template<typename KeyType, typename ValueType>
|
||||
using EntryTypeT = CacheEntry<KeyType, ValueType>;
|
||||
using EntryBasePtr = std::shared_ptr<CacheEntryBase>;
|
||||
template<typename KeyType, typename ValueType>
|
||||
using EntryPtr = std::shared_ptr<EntryTypeT<KeyType, ValueType>>;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param capacity here means maximum records limit FOR EACH entry specified by a pair of Key/Value types.
|
||||
* @note zero capacity means empty cache so no records are stored and no entries are created
|
||||
*/
|
||||
explicit MultiCache(size_t capacity) : _capacity(capacity) {}
|
||||
|
||||
/**
|
||||
* @brief Searches a value of ValueType in the cache using the provided key or creates a new ValueType instance (if nothing was found)
|
||||
* using the key and the builder functor and adds the new record to the cache
|
||||
* @param key is the search key
|
||||
* @param builder is a callable object that creates the ValType object from the KeyType lval reference.
|
||||
* Also the builder type is used for the ValueType deduction
|
||||
* @return result of the operation which is a pair of the requested object of ValType and the status of whether the cache hit or miss occurred
|
||||
*/
|
||||
|
||||
template<typename KeyType, typename BuilderType, typename ValueType = typename std::result_of<BuilderType&(const KeyType&)>::type>
|
||||
typename CacheEntry<KeyType, ValueType>::ResultType
|
||||
getOrCreate(const KeyType& key, BuilderType builder) {
|
||||
auto entry = getEntry<KeyType, ValueType>();
|
||||
return entry->getOrCreate(key, std::move(builder));
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
size_t getTypeId();
|
||||
template<typename KeyType, typename ValueType>
|
||||
EntryPtr<KeyType, ValueType> getEntry();
|
||||
|
||||
private:
|
||||
static std::atomic_size_t _typeIdCounter;
|
||||
size_t _capacity;
|
||||
std::unordered_map<size_t, EntryBasePtr> _storage;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
size_t MultiCache::getTypeId() {
|
||||
static size_t id = _typeIdCounter.fetch_add(1);
|
||||
return id;
|
||||
}
|
||||
|
||||
template<typename KeyType, typename ValueType>
|
||||
MultiCache::EntryPtr<KeyType, ValueType> MultiCache::getEntry() {
|
||||
using EntryType = EntryTypeT<KeyType, ValueType>;
|
||||
size_t id = getTypeId<EntryType>();
|
||||
auto itr = _storage.find(id);
|
||||
if (itr == _storage.end()) {
|
||||
auto result = _storage.insert({id, std::make_shared<EntryType>(_capacity)});
|
||||
itr = result.first;
|
||||
}
|
||||
return std::static_pointer_cast<EntryType>(itr->second);
|
||||
}
|
||||
|
||||
using MultiCachePtr = std::shared_ptr<MultiCache>;
|
||||
using MultiCacheCPtr = std::shared_ptr<const MultiCache>;
|
||||
|
||||
} // namespace MKLDNNPlugin
|
||||
@@ -117,6 +117,17 @@ void Config::readProperties(const std::map<std::string, std::string> &prop) {
|
||||
}
|
||||
} else if (key == PluginConfigParams::KEY_CACHE_DIR) {
|
||||
cache_dir = val;
|
||||
} else if (PluginConfigInternalParams::KEY_CPU_RUNTIME_CACHE_CAPACITY == key) {
|
||||
int val_i = -1;
|
||||
try {
|
||||
val_i = std::stoi(val);
|
||||
} catch (const std::exception&) {
|
||||
IE_THROW() << "Wrong value for property key " << PluginConfigInternalParams::KEY_CPU_RUNTIME_CACHE_CAPACITY
|
||||
<< ". Expected only integer numbers";
|
||||
}
|
||||
// any negative value will be treated
|
||||
// as zero that means disabling the cache
|
||||
rtCacheCapacity = std::max(val_i, 0);
|
||||
} else {
|
||||
IE_THROW(NotFound) << "Unsupported property " << key << " by CPU plugin";
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ struct Config {
|
||||
bool enableDynamicBatch = false;
|
||||
std::string dumpToDot = "";
|
||||
int batchLimit = 0;
|
||||
size_t rtCacheCapacity = 100ul;
|
||||
InferenceEngine::IStreamsExecutor::Config streamExecutorConfig;
|
||||
InferenceEngine::PerfHintsConfig perfHintsConfig;
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace MKLDNNPlugin {
|
||||
|
||||
class jit_emu_vcvtneps2bf16 : public jit_emitter {
|
||||
public:
|
||||
jit_emu_vcvtneps2bf16(mkldnn::impl::cpu::x64::jit_generator* host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::BF16) : jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_emu_vcvtneps2bf16(mkldnn::impl::cpu::x64::jit_generator* host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::BF16) : jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace MKLDNNPlugin {
|
||||
/// ADD ///
|
||||
jit_add_emitter::jit_add_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_add_emitter::jit_add_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_add_emitter::jit_add_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_add_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -55,8 +55,8 @@ void jit_add_emitter::emit_isa(const std::vector<size_t> &in_vec_idxs, const std
|
||||
/// MUL_ADD ///
|
||||
jit_mul_add_emitter::jit_mul_add_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_mul_add_emitter::jit_mul_add_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_mul_add_emitter::jit_mul_add_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_mul_add_emitter::get_inputs_num() const { return 3; }
|
||||
|
||||
@@ -117,8 +117,8 @@ size_t jit_mul_add_emitter::aux_vecs_count() const {
|
||||
/// SUB ///
|
||||
jit_subtract_emitter::jit_subtract_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_subtract_emitter::jit_subtract_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_subtract_emitter::jit_subtract_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_subtract_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -155,8 +155,8 @@ void jit_subtract_emitter::emit_isa(const std::vector<size_t> &in_vec_idxs, cons
|
||||
/// MULTIPLY ///
|
||||
jit_multiply_emitter::jit_multiply_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_multiply_emitter::jit_multiply_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_multiply_emitter::jit_multiply_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_multiply_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -193,8 +193,8 @@ void jit_multiply_emitter::emit_isa(const std::vector<size_t> &in_vec_idxs, cons
|
||||
/// DIVIDE ///
|
||||
jit_divide_emitter::jit_divide_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_divide_emitter::jit_divide_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_divide_emitter::jit_divide_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_divide_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -260,8 +260,8 @@ size_t jit_divide_emitter::aux_vecs_count() const {
|
||||
/// FLOOR_MOD ///
|
||||
jit_floor_mod_emitter::jit_floor_mod_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_floor_mod_emitter::jit_floor_mod_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_floor_mod_emitter::jit_floor_mod_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_floor_mod_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -312,8 +312,8 @@ size_t jit_floor_mod_emitter::aux_vecs_count() const {
|
||||
/// MOD ///
|
||||
jit_mod_emitter::jit_mod_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_mod_emitter::jit_mod_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_mod_emitter::jit_mod_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_mod_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -364,8 +364,8 @@ size_t jit_mod_emitter::aux_vecs_count() const {
|
||||
/// MAXIMUM ///
|
||||
jit_maximum_emitter::jit_maximum_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_maximum_emitter::jit_maximum_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_maximum_emitter::jit_maximum_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_maximum_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -414,8 +414,8 @@ std::set<InferenceEngine::Precision> jit_maximum_emitter::get_supported_precisio
|
||||
/// MINIMUM ///
|
||||
jit_minimum_emitter::jit_minimum_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_minimum_emitter::jit_minimum_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_minimum_emitter::jit_minimum_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_minimum_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -465,8 +465,8 @@ std::set<InferenceEngine::Precision> jit_minimum_emitter::get_supported_precisio
|
||||
jit_squared_difference_emitter::jit_squared_difference_emitter(
|
||||
jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_squared_difference_emitter::jit_squared_difference_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_squared_difference_emitter::jit_squared_difference_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_squared_difference_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -506,8 +506,8 @@ void jit_squared_difference_emitter::emit_isa(const std::vector<size_t> &in_vec_
|
||||
/// POWER_DYNAMIC ///
|
||||
jit_power_dynamic_emitter::jit_power_dynamic_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_power_dynamic_emitter::jit_power_dynamic_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_power_dynamic_emitter::jit_power_dynamic_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_power_dynamic_emitter::get_inputs_num() const { return 2; }
|
||||
|
||||
@@ -617,8 +617,8 @@ jit_equal_emitter::jit_equal_emitter(jit_generator *host, cpu_isa_t host_isa, co
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_equal_emitter::jit_equal_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_equal_emitter::jit_equal_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -678,8 +678,8 @@ jit_not_equal_emitter::jit_not_equal_emitter(jit_generator *host, cpu_isa_t host
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_not_equal_emitter::jit_not_equal_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_not_equal_emitter::jit_not_equal_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -739,8 +739,8 @@ jit_greater_emitter::jit_greater_emitter(jit_generator *host, cpu_isa_t host_isa
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_greater_emitter::jit_greater_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_greater_emitter::jit_greater_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -800,8 +800,8 @@ jit_greater_equal_emitter::jit_greater_equal_emitter(jit_generator *host, cpu_is
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_greater_equal_emitter::jit_greater_equal_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_greater_equal_emitter::jit_greater_equal_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -861,8 +861,8 @@ jit_less_emitter::jit_less_emitter(jit_generator *host, cpu_isa_t host_isa, cons
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_less_emitter::jit_less_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_less_emitter::jit_less_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -922,8 +922,8 @@ jit_less_equal_emitter::jit_less_equal_emitter(jit_generator *host, cpu_isa_t ho
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_less_equal_emitter::jit_less_equal_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_less_equal_emitter::jit_less_equal_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -984,8 +984,8 @@ jit_logical_and_emitter::jit_logical_and_emitter(jit_generator *host, cpu_isa_t
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_logical_and_emitter::jit_logical_and_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_logical_and_emitter::jit_logical_and_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -1066,8 +1066,8 @@ jit_logical_or_emitter::jit_logical_or_emitter(jit_generator *host, cpu_isa_t ho
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_logical_or_emitter::jit_logical_or_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_logical_or_emitter::jit_logical_or_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -1147,8 +1147,8 @@ jit_logical_xor_emitter::jit_logical_xor_emitter(jit_generator *host, cpu_isa_t
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_logical_xor_emitter::jit_logical_xor_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_logical_xor_emitter::jit_logical_xor_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -1228,8 +1228,8 @@ jit_logical_not_emitter::jit_logical_not_emitter(jit_generator *host, cpu_isa_t
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_logical_not_emitter::jit_logical_not_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_logical_not_emitter::jit_logical_not_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -1298,16 +1298,10 @@ jit_power_static_emitter::jit_power_static_emitter(jit_generator *host, cpu_isa_
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
jit_power_static_emitter::jit_power_static_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
const MKLDNNEltwiseNode *powerNode = dynamic_cast<const MKLDNNEltwiseNode *>(node);
|
||||
if (powerNode == nullptr) {
|
||||
IE_THROW() << "Can't cast to MKLDNNEltwiseNode";
|
||||
}
|
||||
power = powerNode->getAlpha();
|
||||
scale = powerNode->getBeta();
|
||||
shift = powerNode->getGamma();
|
||||
|
||||
jit_power_static_emitter::jit_power_static_emitter(jit_generator *host, cpu_isa_t host_isa,
|
||||
float inpPower, float inpScale, float inpShift,
|
||||
Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc), power(inpPower), scale(inpScale), shift(inpShift) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
@@ -1483,8 +1477,8 @@ jit_prelu_emitter::jit_prelu_emitter(jit_generator *host, cpu_isa_t host_isa, co
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
jit_prelu_emitter::jit_prelu_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_prelu_emitter::jit_prelu_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
size_t jit_prelu_emitter::get_inputs_num() const { return 2; }
|
||||
@@ -1541,8 +1535,8 @@ size_t jit_prelu_emitter::aux_vecs_count() const {
|
||||
/// SQRT ///
|
||||
jit_sqrt_emitter::jit_sqrt_emitter(jit_generator *host, cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_sqrt_emitter::jit_sqrt_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {}
|
||||
jit_sqrt_emitter::jit_sqrt_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {}
|
||||
|
||||
size_t jit_sqrt_emitter::get_inputs_num() const { return 1; }
|
||||
|
||||
@@ -1599,8 +1593,8 @@ void jit_negative_emitter::emit_isa(const std::vector<size_t> &in_vec_idxs, cons
|
||||
}
|
||||
|
||||
/// ERF ///
|
||||
jit_erf_emitter::jit_erf_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_erf_emitter::jit_erf_emitter(jit_generator *host, cpu_isa_t host_isa, Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc) {
|
||||
prepare_table();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace MKLDNNPlugin {
|
||||
|
||||
class jit_add_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_add_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_add_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_add_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
|
||||
class jit_mul_add_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_mul_add_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_mul_add_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_mul_add_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
|
||||
class jit_subtract_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_subtract_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_subtract_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_subtract_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
|
||||
class jit_multiply_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_multiply_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_multiply_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_multiply_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
|
||||
class jit_divide_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_divide_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_divide_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_divide_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
|
||||
class jit_floor_mod_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_floor_mod_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_floor_mod_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_floor_mod_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
|
||||
class jit_mod_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_mod_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_mod_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_mod_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
|
||||
class jit_maximum_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_maximum_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_maximum_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_maximum_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -170,7 +170,7 @@ private:
|
||||
|
||||
class jit_minimum_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_minimum_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_minimum_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_minimum_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -191,7 +191,6 @@ private:
|
||||
class jit_squared_difference_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_squared_difference_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
const MKLDNNNode* node,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_squared_difference_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
const std::shared_ptr<ngraph::Node>& n,
|
||||
@@ -211,7 +210,7 @@ private:
|
||||
|
||||
class jit_power_dynamic_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_power_dynamic_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_power_dynamic_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_power_dynamic_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -230,7 +229,7 @@ private:
|
||||
|
||||
class jit_equal_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -252,7 +251,7 @@ private:
|
||||
|
||||
class jit_not_equal_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_not_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_not_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_not_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -274,7 +273,7 @@ private:
|
||||
|
||||
class jit_greater_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_greater_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_greater_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_greater_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -296,7 +295,7 @@ private:
|
||||
|
||||
class jit_greater_equal_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_greater_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_greater_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_greater_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -318,7 +317,7 @@ private:
|
||||
|
||||
class jit_less_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_less_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_less_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_less_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -340,7 +339,7 @@ private:
|
||||
|
||||
class jit_less_equal_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_less_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_less_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
|
||||
jit_less_equal_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
@@ -363,7 +362,7 @@ private:
|
||||
|
||||
class jit_logical_and_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_logical_and_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_logical_and_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_logical_and_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -385,7 +384,7 @@ private:
|
||||
|
||||
class jit_logical_or_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_logical_or_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_logical_or_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_logical_or_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -407,7 +406,7 @@ private:
|
||||
|
||||
class jit_logical_xor_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_logical_xor_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_logical_xor_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_logical_xor_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -428,7 +427,7 @@ private:
|
||||
|
||||
class jit_logical_not_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_logical_not_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_logical_not_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_logical_not_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -449,8 +448,9 @@ private:
|
||||
|
||||
class jit_power_static_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_power_static_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_power_static_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
float inpPower, float inpScale, float inpShift,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_power_static_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
|
||||
@@ -474,7 +474,7 @@ private:
|
||||
|
||||
class jit_prelu_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_prelu_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_prelu_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_prelu_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -494,7 +494,7 @@ private:
|
||||
|
||||
class jit_sqrt_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_sqrt_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_sqrt_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_sqrt_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -528,7 +528,7 @@ private:
|
||||
|
||||
class jit_erf_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_erf_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_erf_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
|
||||
jit_erf_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
|
||||
@@ -28,7 +28,7 @@ struct emitter_context {
|
||||
|
||||
class jit_emitter : public ngraph::snippets::Emitter {
|
||||
public:
|
||||
jit_emitter(dnnl::impl::cpu::x64::jit_generator* host, dnnl::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_emitter(dnnl::impl::cpu::x64::jit_generator* host, dnnl::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32, emitter_in_out_map in_out_type = emitter_in_out_map::vec_to_vec)
|
||||
: Emitter(nullptr), h(host), host_isa_(host_isa), exec_prc_(exec_prc), in_out_type_(in_out_type), l_table (new Xbyak::Label()) {
|
||||
k_mask = Xbyak::Opmask(1); // FIXME: in general case we need preserve k_mask state as well
|
||||
|
||||
@@ -18,9 +18,9 @@ using namespace Xbyak::util;
|
||||
namespace MKLDNNPlugin {
|
||||
|
||||
/// LOAD ///
|
||||
jit_load_emitter::jit_load_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_load_emitter::jit_load_emitter(jit_generator *host, cpu_isa_t host_isa,
|
||||
Precision exec_prc, emitter_in_out_map in_out_type)
|
||||
: jit_emitter(host, host_isa, node, exec_prc, in_out_type), name(node ? node->getName() : "unknown") {
|
||||
: jit_emitter(host, host_isa, exec_prc, in_out_type), name("unknown") {
|
||||
prepare_table();
|
||||
v_len_elt = get_vec_length() / exec_prc.size();
|
||||
}
|
||||
@@ -486,12 +486,12 @@ void jit_load_emitter::register_table_entries() {
|
||||
}
|
||||
|
||||
/// STORE ///
|
||||
jit_store_emitter::jit_store_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_store_emitter::jit_store_emitter(jit_generator *host, cpu_isa_t host_isa,
|
||||
Precision exec_prc, emitter_in_out_map in_out_type)
|
||||
: jit_emitter(host, host_isa, node, exec_prc, in_out_type), name(node ? node->getName() : "unknown") {
|
||||
: jit_emitter(host, host_isa, exec_prc, in_out_type), name("unknown") {
|
||||
v_len_elt = get_vec_length() / exec_prc.size();
|
||||
if (!mayiuse(cpu::x64::avx512_core_bf16) && mayiuse(cpu::x64::avx512_core)) {
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(host, host_isa, nullptr));
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(host, host_isa));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ struct store_emitter_context : public emitter_context {
|
||||
|
||||
class jit_load_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_load_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_load_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32, emitter_in_out_map in_out_type = emitter_in_out_map::gpr_to_vec);
|
||||
/**
|
||||
* load_num values with src_prc precision are loaded from ptr[Reg64(in_idxs[0]) + offset_byte] address to Vmm[out_idxs[0]] as dst_prc.
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
|
||||
class jit_store_emitter : public jit_emitter {
|
||||
public:
|
||||
jit_store_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_store_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32, emitter_in_out_map in_out_type = emitter_in_out_map::vec_to_gpr);
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,15 +22,10 @@ jit_mkldnn_emitter::jit_mkldnn_emitter(jit_generator *host, cpu_isa_t host_isa,
|
||||
set_injector();
|
||||
}
|
||||
|
||||
jit_mkldnn_emitter::jit_mkldnn_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, InferenceEngine::Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, node, exec_prc) {
|
||||
auto eltwiseNode = dynamic_cast<const MKLDNNEltwiseNode*>(node);
|
||||
if (!eltwiseNode) {
|
||||
IE_THROW() << "Cannot cast " << node->getName() << " to MKLDNNEltwiseNode";
|
||||
}
|
||||
kind = static_cast<mkldnn_alg_kind_t>(eltwiseNode->getMKLDNNAlgorithm());
|
||||
alpha = eltwiseNode->getAlpha();
|
||||
beta = eltwiseNode->getBeta();
|
||||
jit_mkldnn_emitter::jit_mkldnn_emitter(jit_generator *host, cpu_isa_t host_isa,
|
||||
mkldnn_alg_kind_t algKind, float alpha, float beta,
|
||||
InferenceEngine::Precision exec_prc)
|
||||
: jit_emitter(host, host_isa, exec_prc), kind(algKind), alpha(alpha), beta(beta) {
|
||||
|
||||
set_injector();
|
||||
}
|
||||
@@ -83,8 +78,10 @@ void jit_mkldnn_emitter::emit_data() const {
|
||||
}
|
||||
}
|
||||
|
||||
jit_mkldnn_aux_emitter::jit_mkldnn_aux_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, InferenceEngine::Precision exec_prc)
|
||||
: jit_mkldnn_emitter(host, host_isa, node, exec_prc) {
|
||||
jit_mkldnn_aux_emitter::jit_mkldnn_aux_emitter(jit_generator *host, cpu_isa_t host_isa,
|
||||
mkldnn_alg_kind_t algKind, float inpAlpha, float inpBeta,
|
||||
InferenceEngine::Precision exec_prc)
|
||||
: jit_mkldnn_emitter(host, host_isa, algKind, inpAlpha, inpBeta, exec_prc) {
|
||||
}
|
||||
|
||||
} // namespace MKLDNNPlugin
|
||||
@@ -25,7 +25,8 @@ public:
|
||||
const emitter_context *emit_context = nullptr) const override {};
|
||||
|
||||
protected:
|
||||
jit_mkldnn_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_mkldnn_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
mkldnn_alg_kind_t algKind, float inpAlpha, float inpBeta,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
jit_mkldnn_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const std::shared_ptr<ngraph::Node>& n,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
@@ -45,7 +46,8 @@ private:
|
||||
|
||||
class jit_mkldnn_aux_emitter : public jit_mkldnn_emitter {
|
||||
public:
|
||||
jit_mkldnn_aux_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa, const MKLDNNNode* node,
|
||||
jit_mkldnn_aux_emitter(mkldnn::impl::cpu::x64::jit_generator *host, mkldnn::impl::cpu::x64::cpu_isa_t host_isa,
|
||||
mkldnn_alg_kind_t algKind, float inpAlpha, float inpBeta,
|
||||
InferenceEngine::Precision exec_prc = InferenceEngine::Precision::FP32);
|
||||
|
||||
private:
|
||||
|
||||
@@ -67,9 +67,11 @@ void MKLDNNGraph::CreateGraph(NET &net, const MKLDNNExtensionManager::Ptr& extMg
|
||||
|
||||
if (IsReady())
|
||||
ForgetGraphData();
|
||||
// disable caching if graph was created only once
|
||||
// disable weights caching if graph was created only once
|
||||
weightsCache = config.streamExecutorConfig._streams != 1 ? w_cache : nullptr;
|
||||
|
||||
rtParamsCache = std::make_shared<MultiCache>(config.rtCacheCapacity);
|
||||
|
||||
Replicate(net, extMgr);
|
||||
InitGraph();
|
||||
|
||||
@@ -113,6 +115,7 @@ void MKLDNNGraph::Replicate(const std::shared_ptr<const ngraph::Function> &subgr
|
||||
if (isQuantized()) {
|
||||
node->setQuantizedGraphFlag(true);
|
||||
}
|
||||
node->setRuntimeCache(rtParamsCache);
|
||||
|
||||
graphNodes.push_back(node);
|
||||
|
||||
@@ -209,6 +212,7 @@ void MKLDNNGraph::Replicate(const CNNNetwork &network, const MKLDNNExtensionMana
|
||||
if (isQuantized()) {
|
||||
node->setQuantizedGraphFlag(true);
|
||||
}
|
||||
node->setRuntimeCache(rtParamsCache);
|
||||
graphNodes.push_back(node);
|
||||
|
||||
if (op->get_type_info() == ngraph::op::v0::Parameter::get_type_info_static()) {
|
||||
@@ -1191,6 +1195,7 @@ bool MKLDNNGraph::InsertNode(MKLDNNNodePtr parent, MKLDNNNodePtr child, MKLDNNNo
|
||||
if (isQuantized()) {
|
||||
node->setQuantizedGraphFlag(true);
|
||||
}
|
||||
node->setRuntimeCache(rtParamsCache);
|
||||
|
||||
if (initNode) {
|
||||
node->getSupportedDescriptors();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "normalize_preprocess.h"
|
||||
#include "mkldnn_node.h"
|
||||
#include "mkldnn_edge.h"
|
||||
#include "cache/multi_cache.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -247,6 +248,8 @@ private:
|
||||
std::vector<MKLDNNNodePtr> constantGraphNodes;
|
||||
std::vector<MKLDNNNodePtr> executableGraphNodes;
|
||||
|
||||
MultiCachePtr rtParamsCache;
|
||||
|
||||
void EnforceBF16();
|
||||
};
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "cpu_types.h"
|
||||
#include "cpu_shape.h"
|
||||
#include "memory_desc/cpu_memory_desc.h"
|
||||
#include "cache/multi_cache.h"
|
||||
|
||||
namespace MKLDNNPlugin {
|
||||
|
||||
@@ -582,6 +583,19 @@ public:
|
||||
*/
|
||||
std::pair<std::vector<float>, std::vector<float>> getScalesAndShifts(const MKLDNNNode *parentNode) const;
|
||||
|
||||
/**
|
||||
* @brief Appends new item into ops list with the information on how the node should be executed as post operation.
|
||||
* Seed node should call this routine and pass its post operations list as parameter.
|
||||
* @param ops List of fused post operations
|
||||
*/
|
||||
virtual void appendPostOps(mkldnn::post_ops& ops, const VectorDims& postOpDims);
|
||||
|
||||
virtual void appendBinPostOps(mkldnn::post_ops& ops, const VectorDims& postOpDims, std::vector<MKLDNNMemoryPtr>& binaryPostOpsMem);
|
||||
|
||||
void setRuntimeCache(MultiCachePtr cache) {
|
||||
rtParamsCache = cache;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool canFuseSimpleOperation(const MKLDNNNodePtr& node) const;
|
||||
|
||||
@@ -597,15 +611,7 @@ protected:
|
||||
virtual MemoryDescPtr getSrcMemDesc(mkldnn::primitive_desc_iterator &primitive_desc_it, size_t idx);
|
||||
virtual MemoryDescPtr getDstMemDesc(mkldnn::primitive_desc_iterator &primitive_desc_it, size_t idx);
|
||||
|
||||
/**
|
||||
* @brief Appends new item into ops list with the information on how the node should be executed as post operation.
|
||||
* Seed node should call this routine and pass its post operations list as parameter.
|
||||
* @param ops List of fused post operations
|
||||
*/
|
||||
virtual void appendPostOps(mkldnn::post_ops& ops, const VectorDims& postOpDims);
|
||||
virtual void appendBinPostOps(mkldnn::post_ops& ops, const VectorDims& postOpDims, std::vector<MKLDNNMemoryPtr>& binaryPostOpsMem);
|
||||
|
||||
virtual std::shared_ptr<mkldnn::primitive_attr> initPrimitiveAttr() { return nullptr; }
|
||||
virtual AttrPtr initPrimitiveAttr() { return nullptr; }
|
||||
|
||||
typedef std::function<DnnlMemoryDescPtr (mkldnn::primitive_desc_iterator &primitive_desc_it, size_t idx)>
|
||||
GetPrimitiveMemoryFormatFunc;
|
||||
@@ -755,6 +761,10 @@ protected:
|
||||
IE_THROW(NotImplemented) << "[DS] prapareParams not implemented for node with type " << NameFromType(getType());
|
||||
}
|
||||
|
||||
MultiCachePtr getRuntimeCache() const {
|
||||
return rtParamsCache;
|
||||
}
|
||||
|
||||
std::vector<VectorDims> lastInputDims = {};
|
||||
|
||||
std::shared_ptr<ngraph::Node> opToShapeInfer;
|
||||
@@ -780,6 +790,8 @@ private:
|
||||
PerfCount perfCounter;
|
||||
PerfCounters profiling;
|
||||
|
||||
MultiCachePtr rtParamsCache;
|
||||
|
||||
bool isEdgesEmpty(const std::vector<MKLDNNEdgeWeakPtr>& edges) const;
|
||||
|
||||
void createShapeInferSubgraph(const std::shared_ptr<ngraph::Node>& op);
|
||||
|
||||
@@ -64,7 +64,7 @@ struct jit_uni_softmax_kernel_f32 : public jit_uni_softmax_kernel, public jit_ge
|
||||
exp_injector.reset(new jit_uni_eltwise_injector_f32<isa>(this, mkldnn::impl::alg_kind::eltwise_exp, 0.f, 0.f, 1.0f));
|
||||
|
||||
if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core))
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa, nullptr));
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa));
|
||||
|
||||
this->preamble();
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -38,6 +38,8 @@ struct jit_eltwise_params {
|
||||
struct jit_eltwise_call_args_ptrs {
|
||||
const void *src_ptr[MAX_ELTWISE_INPUTS];
|
||||
void *dst_ptr;
|
||||
//ptr to array of post op inputs pointers (flat list)
|
||||
const void** post_op_data;
|
||||
};
|
||||
|
||||
struct jit_eltwise_call_args_indexes {
|
||||
@@ -54,16 +56,37 @@ struct jit_uni_eltwise_kernel {
|
||||
ker_(const_args, indexes);
|
||||
}
|
||||
|
||||
explicit jit_uni_eltwise_kernel(const jit_eltwise_params& jep, MKLDNNEltwiseNode& node) : ker_(nullptr), jep_(jep), eltwiseNode(node) {}
|
||||
explicit jit_uni_eltwise_kernel(const jit_eltwise_params& jep) : ker_(nullptr), jep_(jep) {}
|
||||
virtual ~jit_uni_eltwise_kernel() {}
|
||||
|
||||
virtual void create_ker() = 0;
|
||||
|
||||
jit_eltwise_params jep_;
|
||||
MKLDNNEltwiseNode& eltwiseNode;
|
||||
};
|
||||
|
||||
class MKLDNNEltwiseNode : public MKLDNNNode {
|
||||
public:
|
||||
struct EltwiseData {
|
||||
Algorithm algo;
|
||||
mkldnn::algorithm mkldnnAlgorithm;
|
||||
float alpha;
|
||||
float beta;
|
||||
float gamma;
|
||||
|
||||
bool operator==(const EltwiseData& rhs) const noexcept;
|
||||
};
|
||||
|
||||
class IEltwiseExecutor {
|
||||
public:
|
||||
IEltwiseExecutor() = default;
|
||||
virtual void exec(const jit_eltwise_call_args_ptrs &args_ptrs, const VectorDims &dims_out) = 0;
|
||||
virtual size_t getBatchDimIdx() const = 0;
|
||||
virtual const VectorDims& getOutDims() const = 0;
|
||||
virtual ~IEltwiseExecutor() = default;
|
||||
};
|
||||
|
||||
using executorPtr = std::shared_ptr<IEltwiseExecutor>;
|
||||
|
||||
public:
|
||||
MKLDNNEltwiseNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache);
|
||||
|
||||
@@ -108,41 +131,11 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
struct EltwiseExecutor {
|
||||
EltwiseExecutor(size_t batch) : batchDimIdx(batch) {}
|
||||
virtual void exec(const MKLDNNEltwiseNode& node, const jit_eltwise_call_args_ptrs &args_ptrs, const VectorDims &dims_out) = 0;
|
||||
virtual const jit_eltwise_params& getJep() const = 0;
|
||||
virtual ~EltwiseExecutor() = default;
|
||||
|
||||
size_t batchDimIdx = 0;
|
||||
};
|
||||
using executorPtr = std::shared_ptr<EltwiseExecutor>;
|
||||
executorPtr execPtr = nullptr;
|
||||
|
||||
struct EltwiseJitExecutor : public EltwiseExecutor {
|
||||
EltwiseJitExecutor(const jit_eltwise_params &_jep, MKLDNNEltwiseNode& node, const size_t schedWA, const size_t batch);
|
||||
void exec(const MKLDNNEltwiseNode& node, const jit_eltwise_call_args_ptrs &args_ptrs, const VectorDims &dims_out) override;
|
||||
const jit_eltwise_params& getJep() const override;
|
||||
|
||||
std::unique_ptr<jit_uni_eltwise_kernel> pKernel;
|
||||
size_t schedulerWorkAmount = 0;
|
||||
};
|
||||
|
||||
struct EltwiseRefExecutor : public EltwiseExecutor {
|
||||
EltwiseRefExecutor(const jit_eltwise_params &_jep, const size_t fullWA, const size_t batch) : jep(_jep), fullWorkAmount(fullWA),
|
||||
EltwiseExecutor(batch) {}
|
||||
void exec(const MKLDNNEltwiseNode& node, const jit_eltwise_call_args_ptrs &args_ptrs, const VectorDims &dims_out) override;
|
||||
const jit_eltwise_params& getJep() const override { return jep; }
|
||||
|
||||
jit_eltwise_params jep;
|
||||
size_t fullWorkAmount = 0;
|
||||
};
|
||||
|
||||
BroadcastingPolicy broadcastingPolicy;
|
||||
|
||||
mkldnn::algorithm mkldnnAlgorithm = mkldnn::algorithm::undef;
|
||||
|
||||
static const int optimalTensorRank = 6;
|
||||
bool canUseOptimizedImpl = false;
|
||||
bool isDynBatchEnabled = false;
|
||||
bool specialConvolutionAddFusing = false;
|
||||
@@ -163,22 +156,13 @@ private:
|
||||
std::vector<float> shiftsBuffer = {};
|
||||
|
||||
std::vector<MKLDNNMemoryPtr> memPtrs = {};
|
||||
std::vector<const void*> fqDataPtrs;
|
||||
|
||||
using Initializer = std::function<void(const std::shared_ptr<ngraph::Node>&, MKLDNNEltwiseNode& node)>;
|
||||
static const std::map<const ngraph::DiscreteTypeInfo, Initializer> initializers;
|
||||
|
||||
static BroadcastingPolicy determineBroadcastingPolicy(const std::shared_ptr<ngraph::Node>& op);
|
||||
|
||||
void executeOptimized6D(const std::unique_ptr<jit_uni_eltwise_kernel> &pKernel, const jit_eltwise_call_args_ptrs &args_ptrs,
|
||||
const VectorDims &dims_out) const;
|
||||
void executeOptimizedGeneric(const std::unique_ptr<jit_uni_eltwise_kernel> &pKernel, const jit_eltwise_call_args_ptrs &args_ptrs,
|
||||
const VectorDims &dims_out, const size_t schedulerWorkAmount) const;
|
||||
void executeReference(const jit_eltwise_params &jep, const jit_eltwise_call_args_ptrs &args_ptrs, const VectorDims &dims_out,
|
||||
const size_t fullWorkAmount) const;
|
||||
|
||||
void offset_out_calc(VectorDims& offset, VectorDims& dims);
|
||||
void offset_in_calc(VectorDims& offset, VectorDims& dims_in, VectorDims& dims_out);
|
||||
|
||||
size_t getOpInputsNum() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ struct jit_uni_interpolate_kernel_f32 : public jit_uni_interpolate_kernel, publi
|
||||
}
|
||||
|
||||
if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core))
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa, nullptr));
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa));
|
||||
|
||||
this->preamble();
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <mkldnn_types.h>
|
||||
#include "common/cpu_memcpy.h"
|
||||
#include <ngraph/opsets/opset1.hpp>
|
||||
#include "memory_desc/dnnl_blocked_memory_desc.h"
|
||||
@@ -21,12 +20,63 @@
|
||||
#include "utils/general_utils.h"
|
||||
#include "memory_desc/cpu_memory_desc_utils.h"
|
||||
#include "mkldnn_extension_utils.h"
|
||||
#include "utils/cpu_utils.hpp"
|
||||
#include <common/primitive_hashing_utils.hpp>
|
||||
|
||||
using namespace mkldnn;
|
||||
using namespace MKLDNNPlugin;
|
||||
using namespace InferenceEngine;
|
||||
|
||||
namespace {
|
||||
struct MatMulKey {
|
||||
DnnlMemoryDescCPtr inp0;
|
||||
DnnlMemoryDescCPtr inp1;
|
||||
DnnlMemoryDescCPtr bias;
|
||||
DnnlMemoryDescCPtr out;
|
||||
mkldnn::primitive_attr attr;
|
||||
impl_desc_type implType;
|
||||
|
||||
size_t hash() const;
|
||||
bool operator==(const MatMulKey& rhs) const;
|
||||
};
|
||||
|
||||
size_t MatMulKey::hash() const {
|
||||
using namespace dnnl::impl;
|
||||
using namespace dnnl::impl::primitive_hashing;
|
||||
|
||||
size_t seed = 0;
|
||||
|
||||
for (const auto& ptr : {inp0, inp1, bias, out}) {
|
||||
if (ptr) {
|
||||
seed = hash_combine(seed, get_md_hash(ptr->getDnnlDesc().data));
|
||||
}
|
||||
}
|
||||
|
||||
seed = hash_combine(seed, get_attr_hash(*attr.get()));
|
||||
seed = hash_combine(seed, implType);
|
||||
return seed;
|
||||
}
|
||||
|
||||
bool MatMulKey::operator==(const MatMulKey &rhs) const {
|
||||
bool retVal = true;
|
||||
if (inp0 != rhs.inp0) {
|
||||
retVal = retVal && inp0 && rhs.inp0 && inp0->getDnnlDesc() == rhs.inp0->getDnnlDesc();
|
||||
}
|
||||
if (inp1 != rhs.inp1) {
|
||||
retVal = retVal && inp1 && rhs.inp1 && inp1->getDnnlDesc() == rhs.inp1->getDnnlDesc();
|
||||
}
|
||||
if (bias != rhs.bias) {
|
||||
retVal = retVal && bias && rhs.bias && bias->getDnnlDesc() == rhs.bias->getDnnlDesc();
|
||||
}
|
||||
if (out != rhs.out) {
|
||||
retVal = retVal && out && rhs.out && out->getDnnlDesc() == rhs.out->getDnnlDesc();
|
||||
}
|
||||
retVal = retVal && *attr.get() == *rhs.attr.get() &&
|
||||
implType == rhs.implType;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool MKLDNNMatMulNode::isSupportedOperation(const std::shared_ptr<const ngraph::Node>& op, std::string& errorMessage) noexcept {
|
||||
try {
|
||||
const auto matMul = std::dynamic_pointer_cast<const ngraph::opset1::MatMul>(op);
|
||||
@@ -377,35 +427,58 @@ void MKLDNNMatMulNode::prepareParams() {
|
||||
|
||||
auto dstDnnlDesc = dstMemPtr->GetDescWithType<DnnlMemoryDesc>();
|
||||
|
||||
std::shared_ptr<mkldnn::matmul::desc> matmul_desc;
|
||||
|
||||
DnnlMemoryDescPtr dnnlBiasMemDesc = nullptr;
|
||||
if (withBiases) {
|
||||
matmul_desc.reset(new mkldnn::matmul::desc{src0TransposedDesc->getDnnlDesc(),
|
||||
src1TransposedDesc->getDnnlDesc(),
|
||||
getBiasDescFrom(dstDnnlDesc),
|
||||
dstDnnlDesc->getDnnlDesc()});
|
||||
} else {
|
||||
matmul_desc.reset(new mkldnn::matmul::desc(src0TransposedDesc->getDnnlDesc(),
|
||||
src1TransposedDesc->getDnnlDesc(),
|
||||
dstDnnlDesc->getDnnlDesc()));
|
||||
auto& biasMemory = getParentEdgeAt(2)->getMemoryPtr();
|
||||
if (!biasMemory || !biasMemory->GetPrimitivePtr())
|
||||
IE_THROW() << errorPrefix << " did not allocate bias memory";
|
||||
dnnlBiasMemDesc = biasMemory->GetDescWithType<DnnlMemoryDesc>();
|
||||
}
|
||||
|
||||
MKLDNNDescriptor desc(matmul_desc);
|
||||
primitive_desc_iterator itpd = desc.createPrimitiveDescriptorIterator(getEngine(), *attr);
|
||||
matmul::primitive_desc prim_desc;
|
||||
MatMulKey key = {src0TransposedDesc, src1TransposedDesc, dnnlBiasMemDesc,
|
||||
dstDnnlDesc, *attr, selected_pd->getImplementationType()};
|
||||
|
||||
while (static_cast<bool>(itpd)) {
|
||||
impl_desc_type impl_type = parse_impl_name(itpd.impl_info_str());
|
||||
auto engine = getEngine();
|
||||
|
||||
if (impl_type == selected_pd->getImplementationType()) {
|
||||
prim_desc = itpd.get();
|
||||
break;
|
||||
auto builder = [&engine](const MatMulKey& key) -> std::shared_ptr<mkldnn::primitive> {
|
||||
std::shared_ptr<mkldnn::matmul::desc> matmul_desc;
|
||||
|
||||
if (key.bias) {
|
||||
matmul_desc.reset(new mkldnn::matmul::desc{key.inp0->getDnnlDesc(),
|
||||
key.inp1->getDnnlDesc(),
|
||||
key.bias->getDnnlDesc(),
|
||||
key.out->getDnnlDesc()});
|
||||
} else {
|
||||
matmul_desc.reset(new mkldnn::matmul::desc(key.inp0->getDnnlDesc(),
|
||||
key.inp1->getDnnlDesc(),
|
||||
key.out->getDnnlDesc()));
|
||||
}
|
||||
if (!itpd.next_impl())
|
||||
IE_THROW() << "Primitive descriptor was not found for node " << getName() << ".";
|
||||
|
||||
MKLDNNDescriptor desc(matmul_desc);
|
||||
primitive_desc_iterator itpd = desc.createPrimitiveDescriptorIterator(engine, key.attr);
|
||||
matmul::primitive_desc prim_desc;
|
||||
|
||||
while (static_cast<bool>(itpd)) {
|
||||
impl_desc_type impl_type = parse_impl_name(itpd.impl_info_str());
|
||||
|
||||
if (impl_type == key.implType) {
|
||||
prim_desc = itpd.get();
|
||||
break;
|
||||
}
|
||||
if (!itpd.next_impl())
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<matmul>(prim_desc);
|
||||
};
|
||||
|
||||
auto cache = getRuntimeCache();
|
||||
auto result = cache->getOrCreate(key, builder);
|
||||
|
||||
if (!result.first) {
|
||||
IE_THROW() << "Primitive descriptor was not found for node " << getName() << ".";
|
||||
}
|
||||
|
||||
prim.reset(new matmul(prim_desc));
|
||||
prim = result.first;
|
||||
|
||||
primArgs[DNNL_ARG_SRC_0] = src0MemPtr->GetPrimitive();
|
||||
primArgs[DNNL_ARG_WEIGHTS_0] = src1MemPtr->GetPrimitive();
|
||||
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
|
||||
std::array<DnnlBlockedMemoryDescPtr, 2> inDataDesc;
|
||||
DnnlBlockedMemoryDescPtr outDataDesc;
|
||||
AttrPtr pAttr;
|
||||
};
|
||||
|
||||
} // namespace MKLDNNPlugin
|
||||
|
||||
@@ -59,7 +59,7 @@ struct jit_uni_mvn_mean_variance_kernel_f32 : public jit_uni_mvn_mean_variance_k
|
||||
}
|
||||
|
||||
void generate() override {
|
||||
load_emitter.reset(new jit_load_emitter(this, isa, nullptr));
|
||||
load_emitter.reset(new jit_load_emitter(this, isa));
|
||||
|
||||
this->preamble();
|
||||
mov(reg_src, ptr[reg_params + GET_OFF(src)]);
|
||||
@@ -384,8 +384,8 @@ struct jit_uni_mvn_kernel_f32 : public jit_uni_mvn_kernel, public jit_generator
|
||||
}
|
||||
}
|
||||
|
||||
load_emitter.reset(new jit_load_emitter(this, isa, nullptr));
|
||||
store_emitter.reset(new jit_store_emitter(this, isa, nullptr));
|
||||
load_emitter.reset(new jit_load_emitter(this, isa));
|
||||
store_emitter.reset(new jit_store_emitter(this, isa));
|
||||
|
||||
this->preamble();
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ struct jit_uni_nms_kernel_f32 : public jit_uni_nms_kernel, public jit_generator
|
||||
}
|
||||
|
||||
void generate() override {
|
||||
load_emitter.reset(new jit_load_emitter(this, isa, nullptr));
|
||||
store_emitter.reset(new jit_store_emitter(this, isa, nullptr));
|
||||
load_emitter.reset(new jit_load_emitter(this, isa));
|
||||
store_emitter.reset(new jit_store_emitter(this, isa));
|
||||
exp_injector.reset(new jit_uni_eltwise_injector_f32<isa>(this, mkldnn::impl::alg_kind::eltwise_exp, 0.f, 0.f, 1.0f));
|
||||
|
||||
this->preamble();
|
||||
|
||||
@@ -189,7 +189,7 @@ struct jit_uni_normalize_kernel_f32 : public jit_uni_normalize_kernel, public ji
|
||||
}
|
||||
|
||||
if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core))
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa, nullptr));
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa));
|
||||
|
||||
this->preamble();
|
||||
|
||||
@@ -1356,10 +1356,16 @@ private:
|
||||
|
||||
auto quant = post_op.quantization;
|
||||
|
||||
float crop_low = quant.crop_low_data->shifts_[quant.crop_low_data->count_ == 1 ? 0 : index_c];
|
||||
float crop_high = quant.crop_high_data->shifts_[quant.crop_high_data->count_ == 1 ? 0 : index_c];
|
||||
float input_scale = quant.input_scale_data->scales_[quant.input_scale_data->count_ == 1 ? 0 : index_c];
|
||||
float input_shift = quant.input_shift_data->shifts_[quant.input_shift_data->count_ == 1 ? 0 : index_c];
|
||||
using quantization_fields = post_ops_t::entry_t::quantization_t::quantization_fields;
|
||||
auto dataVal = [&](const quantization_fields& field) {
|
||||
const int channelIdx = quant.per_channel[field] ? index_c : 0;
|
||||
return quant.data[field][channelIdx];
|
||||
};
|
||||
|
||||
float crop_low = dataVal(quant.crop_low);
|
||||
float crop_high = dataVal(quant.crop_high);
|
||||
float input_scale = dataVal(quant.inp_scale);
|
||||
float input_shift = dataVal(quant.inp_shift);
|
||||
|
||||
dst_value = nstl::min(crop_high, nstl::max(crop_low, dst_value));
|
||||
dst_value = dst_value * input_scale + input_shift;
|
||||
@@ -1369,8 +1375,8 @@ private:
|
||||
}
|
||||
|
||||
if (do_dequantization) {
|
||||
float output_scale = quant.output_scale_data->scales_[quant.output_scale_data->count_ == 1 ? 0 : index_c];
|
||||
float output_shift = quant.output_shift_data->shifts_[quant.output_shift_data->count_ == 1 ? 0 : index_c];
|
||||
float output_scale = dataVal(quant.output_scale);
|
||||
float output_shift = dataVal(quant.output_shift);
|
||||
dst_value = dst_value * output_scale + output_shift;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ struct jit_uni_reduce_kernel_f32 : public jit_uni_reduce_kernel, public jit_gene
|
||||
}
|
||||
|
||||
if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core))
|
||||
emu_vcvtneps2bf16 = std::make_shared<jit_emu_vcvtneps2bf16>(this, isa, nullptr);
|
||||
emu_vcvtneps2bf16 = std::make_shared<jit_emu_vcvtneps2bf16>(this, isa);
|
||||
|
||||
this->preamble();
|
||||
|
||||
@@ -1075,7 +1075,7 @@ struct jit_uni_reduce_post_kernel_f32 : public jit_uni_reduce_post_kernel, publi
|
||||
}
|
||||
|
||||
if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core))
|
||||
emu_vcvtneps2bf16 = std::make_shared<jit_emu_vcvtneps2bf16>(this, isa, nullptr);
|
||||
emu_vcvtneps2bf16 = std::make_shared<jit_emu_vcvtneps2bf16>(this, isa);
|
||||
|
||||
this->preamble();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ struct jit_uni_logistic_kernel_f32 : public jit_uni_logistic_kernel, public jit_
|
||||
exp_injector.reset(new jit_uni_eltwise_injector_f32<isa>(this, mkldnn::impl::alg_kind::eltwise_exp, 0.f, 0.f, 1.f));
|
||||
|
||||
if (!mayiuse(avx512_core_bf16) && mayiuse(avx512_core))
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa, nullptr));
|
||||
emu_vcvtneps2bf16.reset(new jit_emu_vcvtneps2bf16(this, isa));
|
||||
|
||||
this->preamble();
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ struct jit_uni_roi_pooling_kernel_f32 : public jit_uni_roi_pooling_kernel, publi
|
||||
};
|
||||
|
||||
void generate() override {
|
||||
load_emitter.reset(new jit_load_emitter(this, isa, nullptr));
|
||||
store_emitter.reset(new jit_store_emitter(this, isa, nullptr));
|
||||
load_emitter.reset(new jit_load_emitter(this, isa));
|
||||
store_emitter.reset(new jit_store_emitter(this, isa));
|
||||
|
||||
this->preamble();
|
||||
|
||||
|
||||
+1
-1
Submodule src/plugins/intel_cpu/thirdparty/mkl-dnn updated: 7cd4218a3d...f06708e9cf.
Reference in new issue
Block a user