项目文件夹

文件

项目文件夹

0
T

54 行
1.2 KiB
C++

2022-11-07 08:16:41 +08:00
/**
2018-09-05 10:51:31 -04:00
* Copyright (c) 2017 by Contributors
* @file dgl/runtime/util.h
* @brief Useful runtime util.
2018-09-05 10:51:31 -04:00
*/
2018-10-18 22:44:29 -04:00
#ifndef DGL_RUNTIME_UTIL_H_
#define DGL_RUNTIME_UTIL_H_
2018-09-05 10:51:31 -04:00
#include "c_runtime_api.h"
2018-12-05 16:45:36 -05:00
namespace dgl {
2018-09-05 10:51:31 -04:00
namespace runtime {
2022-11-07 08:16:41 +08:00
/**
* @brief Check whether type matches the given spec.
* @param t The type
* @param code The type code.
* @param bits The number of bits to be matched.
* @param lanes The number of lanes sin the type.
2018-09-05 10:51:31 -04:00
*/
inline bool TypeMatch(DGLDataType t, int code, int bits, int lanes = 1) {
2018-09-05 10:51:31 -04:00
return t.code == code && t.bits == bits && t.lanes == lanes;
}
} // namespace runtime
2018-12-05 16:45:36 -05:00
} // namespace dgl
2018-09-05 10:51:31 -04:00
// Forward declare the intrinsic id we need
// in structure fetch to enable stackvm in runtime
2018-12-05 16:45:36 -05:00
namespace dgl {
2018-09-05 10:51:31 -04:00
namespace ir {
namespace intrinsic {
2022-11-07 08:16:41 +08:00
/** @brief The kind of structure field info used in intrinsic */
2018-12-05 16:45:36 -05:00
enum DGLStructFieldKind : int {
2018-09-05 10:51:31 -04:00
// array head address
kArrAddr,
kArrData,
kArrShape,
kArrStrides,
kArrNDim,
kArrTypeCode,
kArrTypeBits,
kArrTypeLanes,
kArrByteOffset,
kArrDeviceId,
kArrDeviceType,
kArrKindBound_,
2018-12-05 16:45:36 -05:00
// DGLValue field
kDGLValueContent,
kDGLValueKindBound_
2018-09-05 10:51:31 -04:00
};
} // namespace intrinsic
} // namespace ir
2018-12-05 16:45:36 -05:00
} // namespace dgl
2018-10-18 22:44:29 -04:00
#endif // DGL_RUNTIME_UTIL_H_