1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef OHOS_HDI_NNRT_V2_0_NNRTDEVICEIMPL_H
16 #define OHOS_HDI_NNRT_V2_0_NNRTDEVICEIMPL_H
17 #include "../../common/log.h"
18 
19 #include "v2_0/innrt_device.h"
20 
21 namespace OHOS {
22 namespace HDI {
23 namespace Nnrt {
24 namespace V2_0 {
25 class NnrtDeviceImpl : public INnrtDevice {
26 public:
27     NnrtDeviceImpl() = default;
28     virtual ~NnrtDeviceImpl() = default;
29 
GetDeviceName(std::string & name)30     int32_t GetDeviceName(std::string& name)
31     {
32         LOGI("Get device name.");
33         return NNRT_ReturnCode::NNRT_FAILED;
34     }
35 
GetVendorName(std::string & name)36     int32_t GetVendorName(std::string& name)
37     {
38         LOGI("Get vendor name.");
39         return NNRT_ReturnCode::NNRT_FAILED;
40     }
41 
GetDeviceType(DeviceType & deviceType)42     int32_t GetDeviceType(DeviceType& deviceType)
43     {
44         LOGI("Get device type.");
45         return NNRT_ReturnCode::NNRT_FAILED;
46     }
47 
GetDeviceStatus(DeviceStatus & status)48     int32_t GetDeviceStatus(DeviceStatus& status)
49     {
50         LOGI("Get device status.");
51         return NNRT_ReturnCode::NNRT_FAILED;
52     }
53 
GetSupportedOperation(const Model & model,std::vector<bool> & ops)54     int32_t GetSupportedOperation(const Model& model, std::vector<bool>& ops)
55     {
56         LOGI("Get supported operation.");
57         return NNRT_ReturnCode::NNRT_FAILED;
58     }
59 
IsFloat16PrecisionSupported(bool & isSupported)60     int32_t IsFloat16PrecisionSupported(bool& isSupported)
61     {
62         LOGI("Is float16 precision support.");
63         return NNRT_ReturnCode::NNRT_FAILED;
64     }
65 
IsPerformanceModeSupported(bool & isSupported)66     int32_t IsPerformanceModeSupported(bool& isSupported)
67     {
68         LOGI("Is performance mode support.");
69         return NNRT_ReturnCode::NNRT_FAILED;
70     }
71 
IsPrioritySupported(bool & isSupported)72     int32_t IsPrioritySupported(bool& isSupported)
73     {
74         LOGI("Is priority support.");
75         return NNRT_ReturnCode::NNRT_FAILED;
76     }
77 
IsDynamicInputSupported(bool & isSupported)78     int32_t IsDynamicInputSupported(bool& isSupported)
79     {
80         LOGI("Is performance mode support.");
81         return NNRT_ReturnCode::NNRT_FAILED;
82     }
83 
PrepareModel(const Model & model,const ModelConfig & config,sptr<IPreparedModel> & preparedModel)84     int32_t PrepareModel(const Model& model, const ModelConfig& config, sptr<IPreparedModel>& preparedModel)
85     {
86         LOGI("Prepare model.");
87         return NNRT_ReturnCode::NNRT_FAILED;
88     }
89 
PrepareOfflineModel(const std::vector<SharedBuffer> & modelBuffer,const ModelConfig & config,sptr<IPreparedModel> & preparedModel)90     int32_t PrepareOfflineModel(const std::vector<SharedBuffer>& modelBuffer, const ModelConfig& config,
91         sptr<IPreparedModel>& preparedModel)
92     {
93         LOGI("Prepare offline model.");
94         return NNRT_ReturnCode::NNRT_FAILED;
95     }
96 
IsModelCacheSupported(bool & isSupported)97     int32_t IsModelCacheSupported(bool& isSupported)
98     {
99         LOGI("Is model cache support.");
100         return NNRT_ReturnCode::NNRT_FAILED;
101     }
102 
PrepareModelFromModelCache(const std::vector<SharedBuffer> & modelCache,const ModelConfig & config,sptr<IPreparedModel> & preparedModel)103     int32_t PrepareModelFromModelCache(const std::vector<SharedBuffer>& modelCache, const ModelConfig& config,
104             sptr<IPreparedModel>& preparedModel)
105     {
106         LOGI("Prepare model from model cache.");
107         return NNRT_ReturnCode::NNRT_FAILED;
108     }
109 
AllocateBuffer(uint32_t length,SharedBuffer & buffer)110     int32_t AllocateBuffer(uint32_t length, SharedBuffer& buffer)
111     {
112         LOGI("Allocate buffer.");
113         return NNRT_ReturnCode::NNRT_FAILED;
114     }
115 
ReleaseBuffer(const SharedBuffer & buffer)116     int32_t ReleaseBuffer(const SharedBuffer& buffer)
117     {
118         LOGI("Release buffer.");
119         return NNRT_ReturnCode::NNRT_FAILED;
120     }
121 };
122 } // V2_0
123 } // Nnrt
124 } // HDI
125 } // OHOS
126 
127 #endif // OHOS_HDI_NNRT_V2_0_NNRTDEVICEIMPL_H