Commit graph

1 commit

Author SHA1 Message Date
Michael Butler
a06e261af9 NNAPI Burst -- HAL interface
FastMessageQueue is a Treble-compliant data structure that enables fast
communication between two processes. The FMQ object itself is an atomic
circular buffer that is optionally synchronized with a futex. However,
FMQ has no notion of ownership or lifetime across processes, so it must
be paired with higher-level constructs to manage the lifetime and
ownership.

The NNAPI is introducing the notion of an "Execution Burst" object (or
more simply a "Burst" object), which is similar to an
ANeuralNetworksExecution, but is intended to be reused across multiple
executions and has lower IPC overheads. It achieves this low IPC
overhead by replacing HIDL HwBinder calls with FMQ messages.
Specifically, it replaces IPreparedModel::executeSynchronously's call
from the client into the service with fmq_sync<FmqRequestDatum> (an FMQ
channel used to pass a serialized Request object) and it replaces
the return from the service into the client with
fmq_sync<FmqResultDatum> (an FMQ channel used to return serialized
result status and OutputShapes information).

Each channel is a unidirectional flow of information with exactly one
producer and exactly one consumer. The channels are created by the NN
runtime and passed to the service via
IPreparedModel::configureExecutionBurst.

This CL defines the FmqRequestDatum and FmqResultDatum types in
types.hal. IBurstContext.hal defines IBurstContext, a HIDL object used
by the service to manage the resources of a Burst. IBurstCallback.hal
defines IBurstCallback, a HIDL callback object that can be used to
retrieve the handle to a resource the service has either not yet seen or
has evicted from its cache. Finally, IPreparedModel.hal is extended with
IPreparedModel::configureExecutionBurst to create the burst object.

Bug: 119570067
Test: mma
Change-Id: I333da70201531b1396efc714d096c277e8e1d47b
Merged-In: I333da70201531b1396efc714d096c277e8e1d47b
(cherry picked from commit 7e91e24fe1)
2019-01-24 14:04:35 -08:00