hip_profile_common.h 1.71 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
 *  @file:   hip_profile_common.h
 *  @brief:  common define for hip_prof and profile。
 *  @author: lizhigong
 *  @data:   2021/05/11
 */
#ifndef HIP_HIP_PROFILE_COMMON_H
#define HIP_HIP_PROFILE_COMMON_H

#include <cstdint>
#include <map>
#include <bitset>
#include <cstring>

typedef uint32_t activity_kind_t;
typedef uint64_t activity_correlation_id_t;

struct hip_prof_rccl_entry {
    activity_kind_t kind;
    uint32_t cid;
    // NCCL Coll Args
    const void* sendbuff;
    void* recvbuff;
    size_t count;
    uint32_t datatype;
    uint32_t op;
    int rid; // peer for p2p operations
    // Computed later
    int algorithm;
    int protocol;
    uint8_t pattern;
    int nChannels;
    int nThreads;
    size_t nBytes;
    int chunkSize;
    int channelId;
    uint64_t elapsed;
    struct {
        activity_correlation_id_t correlation_id; /* activity ID uint64_t */
        uint64_t begin_ns; /* host begin timestamp uint64_t*/
        uint64_t end_ns; /* host end timestamp uint64_t */
    };
    union {
        struct {
            int device_id; /* device id */
            uint64_t queue_id; /* queue id */
        };
        struct {
            uint32_t process_id; /* device id */
            uint32_t thread_id; /* thread id */
        };
    };
    uint32_t ret_stat;
    const char* kernel_name;
    double BW_GBps; //(nBytes/1.0E9)/[(end_ns-begin_ns)/1.0E9]
};

typedef enum {
    STATUS_SUCCESS = 0,
    STATUS_ERROR = -1,
    GET_TIMESTAMP_FAILED = -2,
    INVALID_KIND = -3,
    INVALID_OP = -4,
    API_RETURN_ERROR = -5,
} prof_error_t;

/* rccl entry kinds */
typedef enum {
    RCCL_KIND_ID_KERNEL = 0,
    RCCL_KIND_ID_API = 1,
    RCCL_KIND_ID_NUMBER =2
} entry_kind_t;

#endif // HIP_HIP_PROFILE_COMMON_H