"PTDN/configs/ppocr_det_server_params.txt" did not exist on "faa88edd8d6a9315e3376a658a7c10d6f68f1cd1"
instruction_ref.hpp 2.31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
Paul's avatar
Paul committed
24
25
#ifndef MIGRAPHX_GUARD_INSTRUCTION_REF_HPP
#define MIGRAPHX_GUARD_INSTRUCTION_REF_HPP
Paul's avatar
Paul committed
26
27

#include <list>
28
#include <functional>
Paul's avatar
Paul committed
29
#include <migraphx/config.hpp>
Paul's avatar
Paul committed
30

Paul's avatar
Paul committed
31
namespace migraphx {
Paul's avatar
Paul committed
32
inline namespace MIGRAPHX_INLINE_NS {
Paul's avatar
Paul committed
33
34
35
36

struct instruction;
using instruction_ref = std::list<instruction>::iterator;

37
38
migraphx::instruction* as_address(const instruction_ref& ins) noexcept;

Paul's avatar
Paul committed
39
} // namespace MIGRAPHX_INLINE_NS
Paul's avatar
Paul committed
40
} // namespace migraphx
Paul's avatar
Paul committed
41

42
43
namespace std {
template <>
44
struct hash<migraphx::instruction_ref> // NOLINT
45
46
47
48
49
50
51
52
53
54
{
    using argument_type = migraphx::instruction_ref;
    using result_type   = std::size_t;
    result_type operator()(const migraphx::instruction_ref& x) const noexcept
    {
        return std::hash<migraphx::instruction*>{}(migraphx::as_address(x));
    }
};

template <>
55
struct equal_to<migraphx::instruction_ref> // NOLINT
56
57
58
59
60
61
62
63
64
65
66
67
{
    using argument_type = migraphx::instruction_ref;
    using result_type   = bool;
    result_type operator()(const migraphx::instruction_ref& x,
                           const migraphx::instruction_ref& y) const noexcept
    {
        return migraphx::as_address(x) == migraphx::as_address(y);
    }
};

} // namespace std

Paul's avatar
Paul committed
68
#endif