ONE - On-device Neural Engine
Loading...
Searching...
No Matches
MinMaxMap.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
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#ifndef __ONERT_EXEC_MINMAX_MAP_H__
18#define __ONERT_EXEC_MINMAX_MAP_H__
19
20#include "ir/Index.h"
21#include "util/MinMaxMap.h"
22
23namespace onert
24{
25namespace exec
26{
27
28/*
29 * NOTE: To record MinMax, the key would be better to use Tensor ID in circle.
30 * But in general, onert does not keep track of circle tensor ID to onert tensor ID.
31 * The ordering in tensors in onert may be different from ordering in circle
32 * because onert could try optimization (reusing allocation, removing redundant tensors,
33 * code optimization, ...)
34 * For Linear Executor and CPU backcend, onert keep track of op index in generated Code.
35 * MinMaxMap uses operation index instead.
36 *
37 * TODO: Stop recording in case of onert internal optimization (e.g. code fusion) occcurs.
38 * It rarely happens since most fusioning is done by compiler frontend, not by onert.
39 */
41{
42 size_t operator()(const std::pair<ir::SubgraphIndex, ir::OperationIndex> &k) const noexcept
43 {
44 return std::hash<ir::SubgraphIndex>()(k.first) ^ std::hash<ir::OperationIndex>()(k.second);
45 }
46};
48
50{
51 size_t operator()(const std::pair<ir::SubgraphIndex, ir::IOIndex> &k) const noexcept
52 {
53 return std::hash<ir::SubgraphIndex>()(k.first) ^ std::hash<ir::IOIndex>()(k.second);
54 }
55};
57} // namespace exec
58} // namespace onert
59
60#endif // __ONERT_EXEC_MINMAX_MAP_H__
size_t operator()(const std::pair< ir::SubgraphIndex, ir::IOIndex > &k) const noexcept
Definition MinMaxMap.h:51
size_t operator()(const std::pair< ir::SubgraphIndex, ir::OperationIndex > &k) const noexcept
Definition MinMaxMap.h:42