context.hpp 1.06 KB
Newer Older
Paul's avatar
Paul committed
1
2
#ifndef MIGRAPHX_GUARD_CONTEXT_HPP
#define MIGRAPHX_GUARD_CONTEXT_HPP
Paul's avatar
Paul committed
3

Paul's avatar
Paul committed
4
#include <cassert>
Paul's avatar
Paul committed
5
6
7
8
9
#include <string>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
Paul's avatar
Paul committed
10
#include <migraphx/config.hpp>
Paul's avatar
Paul committed
11

Paul's avatar
Paul committed
12
namespace migraphx {
Paul's avatar
Paul committed
13
inline namespace MIGRAPHX_INLINE_NS {
Paul's avatar
Paul committed
14

Paul's avatar
Paul committed
15
16
17
18
19
20
#ifdef DOXYGEN

/// A context is used to store internal data for a `target`. A context is
/// constructed by a target during compilation and passed to the operations
/// during `eval`.
struct context
Paul's avatar
Paul committed
21
{
Paul's avatar
Paul committed
22
    /// Wait for any tasks in the context to complete
mei-ye's avatar
mei-ye committed
23
24
25
26
27
    void finish();
    void set_stream(int ndx);
    void create_events(int num_of_events);
    void record_event(int event);
    void wait_event(int event);
Paul's avatar
Paul committed
28
};
Paul's avatar
Paul committed
29
30
31

#else

Paul's avatar
Paul committed
32
<%
Paul's avatar
Paul committed
33
interface('context',
mei-ye's avatar
mei-ye committed
34
35
36
37
38
    virtual('finish', returns='void'),
    virtual('set_stream', returns='void', input = 'int'),
    virtual('create_events', returns='void', input = 'int'),
    virtual('record_event', returns='void', input = 'int'),
    virtual('wait_event', returns='void', input = 'int'),
Paul's avatar
Paul committed
39
)
Paul's avatar
Paul committed
40
41
%>

Paul's avatar
Paul committed
42
#endif
Paul's avatar
Paul committed
43
} // namespace MIGRAPHX_INLINE_NS
Paul's avatar
Paul committed
44
} // namespace migraphx
Paul's avatar
Paul committed
45
46

#endif