migraphx.h 1.82 KB
Newer Older
Paul Fultz II's avatar
Paul Fultz II committed
1
2
3
4
5
6
7
8
#ifndef MIGRAPHX_GUARD_C_API_MIGRAPHX_H
#define MIGRAPHX_GUARD_C_API_MIGRAPHX_H

#include <stdlib.h>

// Add new types here
// clang-format off
#define MIGRAPHX_SHAPE_VISIT_TYPES(m) \
9
    m(bool_type, bool) \
Paul Fultz II's avatar
Paul Fultz II committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    m(half_type, half) \
    m(float_type, float) \
    m(double_type, double) \
    m(uint8_type, uint8_t) \
    m(int8_type, int8_t) \
    m(uint16_type, uint16_t) \
    m(int16_type, int16_t) \
    m(int32_type, int32_t) \
    m(int64_type, int64_t) \
    m(uint32_type, uint32_t) \
    m(uint64_type, uint64_t)
// clang-format on

#ifdef __cplusplus
extern "C" {
#endif

// return code, more to be added later
typedef enum {
    migraphx_status_success        = 0,
    migraphx_status_bad_param      = 1,
    migraphx_status_unknown_target = 3,
    migraphx_status_unknown_error  = 4,

} migraphx_status;

#define MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES(x, t) migraphx_shape_##x,
37
/// An enum to represent the different data type inputs
Paul Fultz II's avatar
Paul Fultz II committed
38
39
40
41
42
typedef enum {
    MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES)
} migraphx_shape_datatype_t;
#undef MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES

43
/// Options to be passed when compiling
Paul Fultz II's avatar
Paul Fultz II committed
44
45
typedef struct
{
46
47
48
49
    /// For targets with offloaded memory(such as the gpu), this will insert
    /// instructions during compilation to copy the input parameters to the
    /// offloaded memory and to copy the final result from the offloaded
    /// memory back to main memory.
Paul Fultz II's avatar
Paul Fultz II committed
50
    bool offload_copy;
51
52
    /// Optimize math functions to use faster approximate versions. There may
    /// be slight accuracy degredation when enabled.
kahmed10's avatar
kahmed10 committed
53
    bool fast_math;
Paul Fultz II's avatar
Paul Fultz II committed
54
55
} migraphx_compile_options;

56
/// Options for saving and loading files
57
58
typedef struct
{
59
    /// Format to be used for file. It can either be json or msgpack
60
61
62
    const char* format;
} migraphx_file_options;

Paul Fultz II's avatar
Paul Fultz II committed
63
64
65
66
67
68
69
<% generate_c_header() %>

#ifdef __cplusplus
}
#endif

#endif