Add a section of how to link IE with CMake project (#99)
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / kernel_selector / core / auto_tuner_offline.cpp
1 /*
2 // Copyright (c) 2018 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #include "auto_tuner.h"
18 #include "auto_tuner_offline.h"
19 namespace kernel_selector 
20 {
21     std::shared_ptr<auto_tuner_offline> auto_tuner_offline::instance = 0;
22     std::mutex auto_tuner_offline::mutex;
23
24     auto_tuner_offline::auto_tuner_offline(const std::string& hw_id)
25     {
26         std::string temp_hw_id = hw_id;
27         // TODO: this is temporary solution of cases where user has non-tuned configuration. needs to implement better logic
28         // i.e. create table with number of eu's configuration that will point to common cache.
29         if (sku_cache_fillers.count(hw_id) == 0)
30             temp_hw_id = "0x1912";
31         sku_cache_fillers.at(temp_hw_id)(t_data);
32     }
33
34     std::shared_ptr<auto_tuner_offline> auto_tuner_offline::get_instance(const std::string& hw_id)
35     {
36         std::lock_guard<std::mutex> lock(mutex);
37         if (instance == nullptr)
38         {
39             instance = std::make_shared<auto_tuner_offline>(auto_tuner_offline(hw_id));
40         }
41         return instance;
42     }
43 }