Skip to content

Commit

Permalink
Merge branch 'master' into gha/clone_timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mryzhov authored Dec 12, 2024
2 parents 4b13671 + 2813758 commit 437efa5
Show file tree
Hide file tree
Showing 659 changed files with 30,496 additions and 23,440 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Below are the instructions on how to install the OpenCL packages on supported Li
.. code-block:: sh
apt-get install -y ocl-icd-libopencl1 intel-opencl-icd intel-level-zero-gpu level-zero
sudo usermod -a -G render $LOGNAME
.. tab-item:: Ubuntu 20.04 LTS
:sync: ubuntu-20
Expand All @@ -57,6 +58,7 @@ Below are the instructions on how to install the OpenCL packages on supported Li
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu focal-legacy main' | tee /etc/apt/sources.list.d/intel.gpu.focal.list && \
apt-get update
apt-get update && apt-get install -y --no-install-recommends intel-opencl-icd intel-level-zero-gpu level-zero
sudo usermod -a -G render $LOGNAME
Alternatively, download older `deb` version from `here <https://github.com/intel/compute-runtime/releases>`__. Note that older driver version might not include some of the bug fixes and might be not supported on some latest platforms. Check the supported hardware for the versions you are installing.

Expand Down Expand Up @@ -135,6 +137,6 @@ Additional Resources
* `Docker CI framework for Intel® Distribution of OpenVINO™ toolkit <https://github.com/openvinotoolkit/docker_ci/blob/master/README.md>`__
* `Get Started with DockerHub CI for Intel® Distribution of OpenVINO™ toolkit <https://github.com/openvinotoolkit/docker_ci/blob/master/get-started.md>`__
* `Dockerfiles with Intel® Distribution of OpenVINO™ toolkit <https://github.com/openvinotoolkit/docker_ci/blob/master/dockerfiles/README.md>`__

* `GPU Driver issue troubleshoot <https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_gpu/docs/gpu_plugin_driver_troubleshooting.md>`


Binary file modified docs/sphinx_setup/_static/download/GenAI_Quick_Start_Guide.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion samples/python/benchmark/bert_benchmark/bert_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import tempfile
from time import perf_counter

import datasets
import openvino as ov
import datasets
from openvino.runtime import get_version
from transformers import AutoTokenizer
from transformers.onnx import export
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/intel_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ ov_add_plugin(NAME ${TARGET_NAME}
DEVICE_NAME "CPU"
AS_EXTENSION
VERSION_DEFINES_FOR src/plugin.cpp
SOURCES ${SOURCES} ${HEADERS})
SOURCES ${SOURCES} ${HEADERS}
ADD_CLANG_FORMAT)

# give a different file name depending on target platform architecture
if(ARM OR AARCH64)
Expand Down
31 changes: 15 additions & 16 deletions src/plugins/intel_cpu/src/cache/cache_entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,34 @@

#pragma once

#include <memory>
#include <functional>
#include <memory>

#include "lru_cache.h"

namespace ov {
namespace intel_cpu {

class CacheEntryBase {
public:
enum class LookUpStatus : int8_t {
Hit,
Miss
};
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 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).
* @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>>
template <typename KeyType, typename ValType, typename ImplType = LruCache<KeyType, ValType>>
class CacheEntry : public CacheEntryBase {
public:
using ResultType = std::pair<ValType, LookUpStatus>;
Expand All @@ -42,11 +40,12 @@ class CacheEntry : public CacheEntryBase {
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.
* @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
* @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) {
Expand All @@ -70,5 +69,5 @@ class CacheEntry : public CacheEntryBase {
ImplType _impl;
};

} // namespace intel_cpu
} // namespace ov
} // namespace intel_cpu
} // namespace ov
21 changes: 11 additions & 10 deletions src/plugins/intel_cpu/src/cache/lru_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

/**
* @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 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!
Expand All @@ -19,7 +20,7 @@
namespace ov {
namespace intel_cpu {

template<typename Key, typename Value>
template <typename Key, typename Value>
class LruCache {
public:
using value_type = std::pair<Key, Value>;
Expand All @@ -33,7 +34,7 @@ class LruCache {
* @param value
*/

void put(const Key &key, const Value &val) {
void put(const Key& key, const Value& val) {
if (0 == _capacity) {
return;
}
Expand All @@ -56,7 +57,7 @@ class LruCache {
* @return Value associated with the key or default constructed instance of the Value type.
*/

Value get(const Key &key) {
Value get(const Key& key) {
auto itr = _cacheMapper.find(key);
if (itr == _cacheMapper.end()) {
return Value();
Expand All @@ -82,13 +83,13 @@ class LruCache {
* @brief Returns the current capacity value
* @return the current capacity value
*/
size_t getCapacity() const noexcept {
return _capacity;
}
size_t getCapacity() const noexcept {
return _capacity;
}

private:
struct key_hasher {
std::size_t operator()(const Key &k) const {
std::size_t operator()(const Key& k) const {
return k.hash();
}
};
Expand All @@ -105,5 +106,5 @@ class LruCache {
size_t _capacity;
};

} // namespace intel_cpu
} // namespace ov
} // namespace intel_cpu
} // namespace ov
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/src/cache/multi_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ namespace intel_cpu {

std::atomic_size_t MultiCache::_typeIdCounter{0};

} // namespace intel_cpu
} // namespace ov
} // namespace intel_cpu
} // namespace ov
40 changes: 21 additions & 19 deletions src/plugins/intel_cpu/src/cache/multi_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

#pragma once

#include <atomic>
#include <functional>
#include <unordered_map>
#include <atomic>

#include "cache_entry.h"

namespace ov {
Expand All @@ -20,27 +21,28 @@ namespace intel_cpu {

class MultiCache {
public:
template<typename KeyType, typename ValueType>
template <typename KeyType, typename ValueType>
using EntryTypeT = CacheEntry<KeyType, ValueType>;
using EntryBasePtr = std::shared_ptr<CacheEntryBase>;
template<typename KeyType, typename ValueType>
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
*/
* @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
*/
* @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,
#if (defined(_MSVC_LANG) && (_MSVC_LANG > 201703L)) || (defined(__cplusplus) && (__cplusplus > 201703L))
Expand All @@ -54,9 +56,9 @@ class MultiCache {
}

private:
template<typename T>
template <typename T>
size_t getTypeId();
template<typename KeyType, typename ValueType>
template <typename KeyType, typename ValueType>
EntryPtr<KeyType, ValueType> getEntry();

private:
Expand All @@ -65,13 +67,13 @@ class MultiCache {
std::unordered_map<size_t, EntryBasePtr> _storage;
};

template<typename T>
template <typename T>
size_t MultiCache::getTypeId() {
static size_t id = _typeIdCounter.fetch_add(1);
return id;
}

template<typename KeyType, typename ValueType>
template <typename KeyType, typename ValueType>
MultiCache::EntryPtr<KeyType, ValueType> MultiCache::getEntry() {
using EntryType = EntryTypeT<KeyType, ValueType>;
size_t id = getTypeId<EntryType>();
Expand All @@ -88,5 +90,5 @@ using MultiCacheWeakCPtr = std::weak_ptr<const MultiCache>;
using MultiCachePtr = std::shared_ptr<MultiCache>;
using MultiCacheCPtr = std::shared_ptr<const MultiCache>;

} // namespace intel_cpu
} // namespace ov
} // namespace intel_cpu
} // namespace ov
24 changes: 12 additions & 12 deletions src/plugins/intel_cpu/src/compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@
//

#include "compiled_model.h"

#include <cstring>
#include <utility>

#include "async_infer_request.h"
#include "cpu/x64/cpu_isa_traits.hpp"
#include "infer_request.h"
#include "itt.h"
#include "low_precision/low_precision.hpp"
#include "memory_state.h"
#include "openvino/core/type/element_type.hpp"
#include "openvino/runtime/intel_cpu/properties.hpp"
#include "openvino/runtime/threading/executor_manager.hpp"
#include "transformations/transformation_pipeline.h"
#include "openvino/runtime/properties.hpp"
#include "openvino/util/common_util.hpp"
#include "openvino/runtime/threading/cpu_message.hpp"
#include "openvino/runtime/threading/cpu_streams_executor.hpp"
#include "transformations/utils/utils.hpp"
#include "openvino/runtime/threading/cpu_streams_info.hpp"
#include "openvino/runtime/threading/cpu_message.hpp"
#include "openvino/runtime/threading/executor_manager.hpp"
#include "openvino/util/common_util.hpp"
#include "transformations/transformation_pipeline.h"
#include "transformations/utils/utils.hpp"
#include "utils/serialize.hpp"

#include "cpu/x64/cpu_isa_traits.hpp"
#include <cstring>
#include <utility>

#if defined(OV_CPU_WITH_ACL)
#include "nodes/executors/acl/acl_ie_scheduler.hpp"
# include "nodes/executors/acl/acl_ie_scheduler.hpp"
#endif

using namespace ov::threading;
Expand Down Expand Up @@ -329,8 +330,7 @@ ov::Any CompiledModel::get_property(const std::string& name) const {
return decltype(ov::intel_cpu::sparse_weights_decompression_rate)::value_type(
config.fcSparseWeiDecompressionRate);
} else if (name == ov::hint::dynamic_quantization_group_size) {
return decltype(ov::hint::dynamic_quantization_group_size)::value_type(
config.fcDynamicQuantizationGroupSize);
return decltype(ov::hint::dynamic_quantization_group_size)::value_type(config.fcDynamicQuantizationGroupSize);
} else if (name == ov::hint::kv_cache_precision) {
return decltype(ov::hint::kv_cache_precision)::value_type(config.kvCachePrecision);
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/src/compiled_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ class CompiledModel : public ov::ICompiledModel {
bool m_has_sub_compiled_models = false;
};

} // namespace intel_cpu
} // namespace ov
} // namespace intel_cpu
} // namespace ov
Loading

0 comments on commit 437efa5

Please sign in to comment.