From f99bffd08a3e4f212a306a67b97509a2335f6b87 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Mon, 24 Jun 2019 10:57:02 -0700 Subject: [PATCH] Specify NNAPI Burst FMQ read/write requirements This CL additionally adds missing documentation for timing information when returning results on the resultChannel. Bug: 133773876 Test: mma Change-Id: I1eb1affbb4a912d5fdeab012e2be7e7005deb04d --- current.txt | 2 +- neuralnetworks/1.2/IPreparedModel.hal | 52 +++++++++++++++++++-------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/current.txt b/current.txt index 44eebf8a88..83657b2d47 100644 --- a/current.txt +++ b/current.txt @@ -576,6 +576,6 @@ cfa81f229b69f9011c58f48264fcb552447430fe68610eac514e811e65bc306a android.hardwar b69a7615c508acf5c5201efd1bfa3262167874fc3594e2db5a3ff93addd8ac75 android.hardware.keymaster@4.0::IKeymasterDevice eb2fa0c883c2185d514be0b84c179b283753ef0c1b77b45b4f359bd23bba8b75 android.hardware.neuralnetworks@1.0::IPreparedModel fb382e986c10b8fbb797a8546e8f9ea6d1107bfe6f3fb7e57f6bbbf1f807a906 android.hardware.neuralnetworks@1.2::IDevice -6c5081dd131eeb7eb02efece2187cd4d7d554197800bb520c92ff874cc238fa6 android.hardware.neuralnetworks@1.2::IPreparedModel +40e71cd693de5b832325c5d8f081f2ff20a7ba2b89d401cee5b4b3eb0e241681 android.hardware.neuralnetworks@1.2::IPreparedModel 1a6e2bd289f22931c526b21916910f1d4c436b7acb9556e4243de4ce8e6cc2e4 android.hardware.soundtrigger@2.0::ISoundTriggerHwCallback fd65298e1e09e0e3c781ab18305920d757dbe55a3b459ce17814ec5cf6dfee99 android.hardware.wifi@1.0::IWifiP2pIface diff --git a/neuralnetworks/1.2/IPreparedModel.hal b/neuralnetworks/1.2/IPreparedModel.hal index f3508fede7..1445f18e4d 100644 --- a/neuralnetworks/1.2/IPreparedModel.hal +++ b/neuralnetworks/1.2/IPreparedModel.hal @@ -157,22 +157,44 @@ interface IPreparedModel extends @1.0::IPreparedModel { * unless the device itself is in a bad state. * * @param callback A callback object used to retrieve memory resources - * corresponding to a unique identifiers ("slots"). - * @param requestChannel Used by the client to send a serialized Request to - * the Burst for execution. The client must not change - * the content of any data object referenced by the - * Request (described by the {@link @1.0::DataLocation} - * of an {@link OperandInformation}) until a result - * has been received from resultChannel. Execution - * must not change the content of any of the data - * objects corresponding to Request inputs. requestChannel + * corresponding to unique identifiers ("slots"). + * @param requestChannel FMQ used by the client to send a serialized Request + * to the Burst for execution. The client must not + * change the content of any data object referenced by + * the Request (described by the + * {@link @1.0::DataLocation} of an + * {@link OperandInformation}) until a result has been + * received from resultChannel. Execution must not + * change the content of any of the data objects + * corresponding to Request inputs. requestChannel * must not be used to pass a second Request object - * until a result has been received from resultChannel. - * @param resultChannel Used by the service to return the results of an - * execution to the client: the status of the execution - * and OutputShape of all output tensors. resultChannel - * must be used to return the results if a Request was - * sent through the requestChannel. + * until a result has been received from + * resultChannel. The client must send the request + * messages to the consumer atomically by using + * MessageQueue::writeBlocking if the queue is + * blocking, or by using MessageQueue::write if the + * queue is non-blocking. When the service receives a + * packet, it must dequeue the entire packet from the + * requestChannel. The client must not send a request + * packet that exceeds the length of the FMQ. + * @param resultChannel FMQ used by the service to return the results of an + * execution to the client: the status of the + * execution, OutputShape of all output tensors, and + * timing information. resultChannel must be used to + * return the results if a Request was sent through the + * requestChannel. The service must send the result + * messages to the consumer atomically by using + * MessageQueue::writeBlocking if the queue is + * blocking, or by using MessageQueue::write if the + * queue is non-blocking. When the client receives a + * packet, it must dequeue the entire packet from the + * resultChannel. If the packet's length exceeds the + * size of the FMQ, the service must not send this + * result packet; instead, the service must send a + * packet consisting of the error code + * ErrorStatus::GENERAL_FAILURE, no information for the + * outputShapes, and an indication that timing + * information is unavailable. * @return status Error status of configuring the execution burst, must be: * - NONE if the burst is successfully configured * - DEVICE_UNAVAILABLE if driver is offline or busy