mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "Add Capabilities::relaxedFloat32toFloat16Performance for 1.1."
This commit is contained in:
@@ -24,6 +24,20 @@ import @1.0::IPreparedModelCallback;
|
||||
* This interface represents a device driver.
|
||||
*/
|
||||
interface IDevice extends @1.0::IDevice {
|
||||
/**
|
||||
* Gets the capabilities of a driver.
|
||||
*
|
||||
* Note that @1.1::Capabilities provides performance information
|
||||
* on relaxed calculations, whereas @1.0::Capabilities does not.
|
||||
*
|
||||
* @return status Error status of the call, must be:
|
||||
* - NONE if successful
|
||||
* - DEVICE_UNAVAILABLE if driver is offline or busy
|
||||
* - GENERAL_FAILURE if there is an unspecified error
|
||||
* @return capabilities Capabilities of the driver.
|
||||
*/
|
||||
getCapabilities_1_1() generates (ErrorStatus status, Capabilities capabilities);
|
||||
|
||||
/**
|
||||
* Gets the supported operations in a model.
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.hardware.neuralnetworks@1.1;
|
||||
|
||||
import @1.0::Operand;
|
||||
import @1.0::OperationType;
|
||||
import @1.0::PerformanceInfo;
|
||||
|
||||
/**
|
||||
* Operation types.
|
||||
@@ -258,6 +259,28 @@ enum OperationType : @1.0::OperationType {
|
||||
TRANSPOSE = 37,
|
||||
};
|
||||
|
||||
/**
|
||||
* The capabilities of a driver.
|
||||
*/
|
||||
struct Capabilities {
|
||||
/**
|
||||
* Driver performance when operating on float32 data.
|
||||
*/
|
||||
PerformanceInfo float32Performance;
|
||||
|
||||
/**
|
||||
* Driver performance when operating on asymmetric 8-bit quantized data.
|
||||
*/
|
||||
PerformanceInfo quantized8Performance;
|
||||
|
||||
/**
|
||||
* Driver performance when operating on float32 data but performing
|
||||
* calculations with range and/or precision as low as that of the IEEE
|
||||
* 754 16-bit floating-point format.
|
||||
*/
|
||||
PerformanceInfo relaxedFloat32toFloat16Performance;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes one operation of the model's graph.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <hidlmemory/mapping.h>
|
||||
|
||||
using ::android::hardware::neuralnetworks::V1_0::IPreparedModel;
|
||||
using ::android::hardware::neuralnetworks::V1_0::Capabilities;
|
||||
using ::android::hardware::neuralnetworks::V1_0::DeviceStatus;
|
||||
using ::android::hardware::neuralnetworks::V1_0::ErrorStatus;
|
||||
using ::android::hardware::neuralnetworks::V1_0::FusedActivationFunc;
|
||||
@@ -37,6 +36,7 @@ using ::android::hardware::neuralnetworks::V1_0::Operand;
|
||||
using ::android::hardware::neuralnetworks::V1_0::OperandLifeTime;
|
||||
using ::android::hardware::neuralnetworks::V1_0::OperandType;
|
||||
using ::android::hardware::neuralnetworks::V1_0::Request;
|
||||
using ::android::hardware::neuralnetworks::V1_1::Capabilities;
|
||||
using ::android::hardware::neuralnetworks::V1_1::IDevice;
|
||||
using ::android::hardware::neuralnetworks::V1_1::Model;
|
||||
using ::android::hardware::neuralnetworks::V1_1::Operation;
|
||||
@@ -95,12 +95,14 @@ TEST_F(NeuralnetworksHidlTest, StatusTest) {
|
||||
// initialization
|
||||
TEST_F(NeuralnetworksHidlTest, GetCapabilitiesTest) {
|
||||
Return<void> ret =
|
||||
device->getCapabilities([](ErrorStatus status, const Capabilities& capabilities) {
|
||||
device->getCapabilities_1_1([](ErrorStatus status, const Capabilities& capabilities) {
|
||||
EXPECT_EQ(ErrorStatus::NONE, status);
|
||||
EXPECT_LT(0.0f, capabilities.float32Performance.execTime);
|
||||
EXPECT_LT(0.0f, capabilities.float32Performance.powerUsage);
|
||||
EXPECT_LT(0.0f, capabilities.quantized8Performance.execTime);
|
||||
EXPECT_LT(0.0f, capabilities.quantized8Performance.powerUsage);
|
||||
EXPECT_LT(0.0f, capabilities.relaxedFloat32toFloat16Performance.execTime);
|
||||
EXPECT_LT(0.0f, capabilities.relaxedFloat32toFloat16Performance.powerUsage);
|
||||
});
|
||||
EXPECT_TRUE(ret.isOk());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user