2 // Copyright (c) 2018 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "auto_tuner.h"
18 #include "auto_tuner_offline.h"
19 namespace kernel_selector
21 std::shared_ptr<auto_tuner_offline> auto_tuner_offline::instance = 0;
22 std::mutex auto_tuner_offline::mutex;
24 auto_tuner_offline::auto_tuner_offline(const std::string& hw_id)
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);
34 std::shared_ptr<auto_tuner_offline> auto_tuner_offline::get_instance(const std::string& hw_id)
36 std::lock_guard<std::mutex> lock(mutex);
37 if (instance == nullptr)
39 instance = std::make_shared<auto_tuner_offline>(auto_tuner_offline(hw_id));