-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathMiopenUtils.hpp
More file actions
58 lines (44 loc) · 2.6 KB
/
Copy pathMiopenUtils.hpp
File metadata and controls
58 lines (44 loc) · 2.6 KB
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
// Copyright © Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT
#pragma once
#include <hipdnn_sdk/data_objects/tensor_attributes_generated.h>
#include <hipdnn_sdk/plugin/PluginException.hpp>
#include <hipdnn_sdk/plugin/PluginFlatbufferTypeHelpers.hpp>
#include <miopen/miopen.h>
#include <unordered_map>
#include "MiopenTensor.hpp"
#define LOG_ON_MIOPEN_FAILURE(status) \
do \
{ \
if(status != miopenStatusSuccess) \
{ \
HIPDNN_LOG_ERROR("MIOpen error occurred: {}", miopenGetErrorString(status)); \
} \
} while(0)
#define THROW_ON_MIOPEN_FAILURE(status) \
do \
{ \
if(status != miopenStatusSuccess) \
{ \
throw hipdnn_plugin::HipdnnPluginException( \
HIPDNN_PLUGIN_STATUS_INTERNAL_ERROR, \
"MIOpen error occurred: " + std::string(miopenGetErrorString(status))); \
} \
} while(0)
namespace miopen_legacy_plugin
{
namespace miopen_utils
{
hipdnnPluginDeviceBuffer_t findDeviceBuffer(int64_t uid,
const hipdnnPluginDeviceBuffer_t* deviceBuffers,
uint32_t numDeviceBuffers);
miopenDataType_t tensorDataTypeToMiopenDataType(const hipdnn_sdk::data_objects::DataType& dataType);
const hipdnn_sdk::data_objects::TensorAttributes& findTensorAttributes(
const std::unordered_map<int64_t, const hipdnn_sdk::data_objects::TensorAttributes*>& tensorMap,
int64_t uid);
MiopenTensor createTensor(
const std::unordered_map<int64_t, const hipdnn_sdk::data_objects::TensorAttributes*>& tensorMap,
int64_t uid);
size_t getSpatialDimCount(const hipdnn_sdk::data_objects::TensorAttributes& attr);
}
}