16 #ifndef CAFFE2_CORE_COMMON_MIOPEN_H_ 17 #define CAFFE2_CORE_COMMON_MIOPEN_H_ 21 #include "miopen/miopen.h" 22 #include "caffe2/core/common.h" 23 #include "caffe2/core/context.h" 24 #include "caffe2/core/logging.h" 25 #include "caffe2/core/types.h" 26 #include "caffe2/proto/caffe2_pb.h" 28 #define MIOPEN_VERSION 1399 36 inline const char* miopenGetErrorString(miopenStatus_t status)
40 case miopenStatusSuccess:
return "MIOPEN_STATUS_SUCCESS";
41 case miopenStatusNotInitialized:
return "MIOPEN_STATUS_NOT_INITIALIZED";
42 case miopenStatusAllocFailed:
return "MIOPEN_STATUS_ALLOC_FAILED";
43 case miopenStatusBadParm:
return "MIOPEN_STATUS_BAD_PARAM";
44 case miopenStatusInternalError:
return "MIOPEN_STATUS_INTERNAL_ERROR";
45 case miopenStatusInvalidValue:
return "MIOPEN_STATUS_INVALID_VALUE";
46 case miopenStatusNotImplemented:
return "MIOPEN_STATUS_NOT_SUPPORTED";
47 case miopenStatusUnknownError:
return "MIOPEN_STATUS_UNKNOWN_ERROR";
48 default:
return "MIOPEN_STATUS_UNKNOWN_ERROR";
55 #define MIOPEN_ENFORCE(condition) \ 58 miopenStatus_t status = condition; \ 59 CAFFE_ENFORCE_EQ(status, \ 60 miopenStatusSuccess, \ 66 ::caffe2::internal::miopenGetErrorString(status)); \ 68 #define MIOPEN_CHECK(condition) \ 71 miopenStatus_t status = condition; \ 72 CHECK(status == miopenStatusSuccess) << ::caffe2::internal::miopenGetErrorString(status); \ 76 inline size_t miopenCompiledVersion() {
return MIOPEN_VERSION; }
79 inline size_t miopenRuntimeVersion() {
return MIOPEN_VERSION; }
82 inline void CheckMIOPENVersions() {}
96 static const miopenDataType_t type = miopenFloat;
97 typedef const float ScalingParamType;
98 typedef float BNParamType;
99 static ScalingParamType* kOne()
101 static ScalingParamType v = 1.0;
104 static const ScalingParamType* kZero()
106 static ScalingParamType v = 0.0;
115 static const miopenDataType_t type = miopenHalf;
116 typedef const float ScalingParamType;
117 typedef float BNParamType;
118 static ScalingParamType* kOne()
120 static ScalingParamType v = 1.0;
123 static ScalingParamType* kZero()
125 static ScalingParamType v = 0.0;
141 inline miopenTensorDescriptor_t
142 Descriptor(
const miopenDataType_t type,
const vector<int>& dims,
bool* changed)
144 if(type_ == type && dims_ == dims)
152 dims.size(), 4,
"MIOPEN currently only support 4-dimensional tensor descriptor");
157 miopenSet4dTensorDescriptor(desc_, type, dims_[0], dims_[1], dims_[2], dims_[3]));
163 template <
typename T>
164 inline miopenTensorDescriptor_t Descriptor(
const StorageOrder& order,
const vector<int>& dims)
170 miopenTensorDescriptor_t desc_;
171 miopenDataType_t type_;
178 #endif // CAFFE2_CORE_COMMON_MIOPEN_H_ miopenTypeWrapper is a wrapper class that allows us to refer to the miopen type in a template functio...
miopenTensorDescWrapper is the placeholder that wraps around a miopenTensorDescriptor_t, allowing us to do descriptor change as-needed during runtime.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Flush-To-Zero and Denormals-Are-Zero mode.