migraphx.h 1.67 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
typedef enum {
Paul Fultz II's avatar
Paul Fultz II committed
39
    migraphx_shape_tuple_type,
Paul Fultz II's avatar
Paul Fultz II committed
40
41
42
43
    MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES)
} migraphx_shape_datatype_t;
#undef MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES

44
/// Options to be passed when compiling
Paul Fultz II's avatar
Paul Fultz II committed
45
46
typedef struct
{
47
48
49
50
    /// 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
51
    bool offload_copy;
52
53
    /// Optimize math functions to use faster approximate versions. There may
    /// be slight accuracy degredation when enabled.
kahmed10's avatar
kahmed10 committed
54
    bool fast_math;
Paul Fultz II's avatar
Paul Fultz II committed
55
56
57
58
59
60
61
62
63
} migraphx_compile_options;

<% generate_c_header() %>

#ifdef __cplusplus
}
#endif

#endif