Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f750943 authored by Michael Butler's avatar Michael Butler Committed by Android (Google) Code Review
Browse files

Merge "Neuralnetworks HAL cleanup -- hardware/interfaces" into oc-mr1-dev

parents 2de5e5d0 61ae6edb
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -22,11 +22,13 @@ import IEvent;
import IPreparedModel;
import IPreparedModel;


interface IDevice {
interface IDevice {
    initialize() generates(Capabilities capabilities);
    getCapabilities() generates (ErrorStatus status, Capabilities capabilities);


    getSupportedSubgraph(Model model) generates(vec<bool> supported);
    getSupportedOperations(Model model)
            generates (ErrorStatus status, vec<bool> supportedOperations);


    prepareModel(Model model, IEvent event) generates(IPreparedModel preparedModel);
    prepareModel(Model model, IEvent event)
            generates (ErrorStatus status, IPreparedModel preparedModel);


    getStatus() generates (DeviceStatus status);
    getStatus() generates (DeviceStatus status);
};
};
+1 −1
Original line number Original line Diff line number Diff line
@@ -44,6 +44,6 @@ interface IEvent {
     * @param status Status of the execution associated with the Event.
     * @param status Status of the execution associated with the Event.
     *               Should be SUCCESS or ERROR.
     *               Should be SUCCESS or ERROR.
     */
     */
    oneway notify(Status status);
    oneway notify(ErrorStatus status);


};
};
+1 −1
Original line number Original line Diff line number Diff line
@@ -22,5 +22,5 @@ import IEvent;


interface IPreparedModel {
interface IPreparedModel {
    // Multiple threads can call this execute function concurrently.
    // Multiple threads can call this execute function concurrently.
    execute(Request request, IEvent event) generates(bool success);
    execute(Request request, IEvent event) generates (ErrorStatus status);
};
};
+13 −14
Original line number Original line Diff line number Diff line
@@ -22,18 +22,14 @@ package android.hardware.neuralnetworks@1.0;
// These values are the same as found in the NeuralNetworks.h file.
// These values are the same as found in the NeuralNetworks.h file.
// When modifying, be sure to update HAL_NUM_OPERAND_TYPES in HalIntefaces.h.
// When modifying, be sure to update HAL_NUM_OPERAND_TYPES in HalIntefaces.h.
enum OperandType : uint32_t {
enum OperandType : uint32_t {
    FLOAT16                   = 0,
    OEM                       = 0,
    FLOAT32                   = 1,
    FLOAT32                   = 1,
    INT8                      = 2,
    INT32                     = 2, // TODO: is this needed?
    UINT8                     = 3,
    UINT32                    = 3,
    INT16                     = 4,
    TENSOR_OEM_BYTE           = 4,
    UINT16                    = 5,
    TENSOR_FLOAT32            = 5,
    INT32                     = 6,
    TENSOR_INT32              = 6,
    UINT32                    = 7,
    TENSOR_QUANT8_ASYMM       = 7,
    TENSOR_FLOAT16            = 8,
    TENSOR_FLOAT32            = 9,
    TENSOR_INT32              = 10,
    TENSOR_QUANT8_ASYMM       = 11,
};
};


// The type of operations.  Unlike the operation types found in
// The type of operations.  Unlike the operation types found in
@@ -210,7 +206,10 @@ struct Request {
    vec<memory> pools;
    vec<memory> pools;
};
};


enum Status : uint32_t {
enum ErrorStatus : uint32_t {
    SUCCESS,
    NONE,
    ERROR,
    DEVICE_UNAVAILABLE,
    GENERAL_FAILURE,
    OUTPUT_INSUFFICIENT_SIZE,
    INVALID_ARGUMENT,
};
};
+2 −2
Original line number Original line Diff line number Diff line
@@ -21,10 +21,10 @@ Event::~Event() {
    //     thread::join failed: Resource deadlock would occur
    //     thread::join failed: Resource deadlock would occur
}
}


Return<void> Event::notify(ReturnedStatus status) {
Return<void> Event::notify(ErrorStatus status) {
    {
    {
        std::lock_guard<std::mutex> lock(mMutex);
        std::lock_guard<std::mutex> lock(mMutex);
        mStatus = status == ReturnedStatus::SUCCESS ? Status::SUCCESS : Status::ERROR;
        mStatus = status == ErrorStatus::NONE ? Status::SUCCESS : Status::ERROR;
        if (mStatus == Status::SUCCESS && mCallback != nullptr) {
        if (mStatus == Status::SUCCESS && mCallback != nullptr) {
            bool success = mCallback();
            bool success = mCallback();
            if (!success) {
            if (!success) {
Loading