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

Commit cf7d9988 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7205268 from 273ffe6b to sc-v2-release

Change-Id: I26684f108dcc6528df69ff61b1264cb87c9d47d4
parents abc631e4 273ffe6b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,4 +36,5 @@ parcelable DataLocation {
  int poolIndex;
  long offset;
  long length;
  long padding;
}
+21 −0
Original line number Diff line number Diff line
@@ -18,6 +18,23 @@ package android.hardware.neuralnetworks;

/**
 * Describes the location of a data object.
 *
 * If the data object is an omitted operand, all of the fields must be 0. If the poolIndex refers to
 * a driver-managed buffer allocated from IDevice::allocate, or an AHardwareBuffer of a format other
 * than AHARDWAREBUFFER_FORMAT_BLOB, the offset, length, and padding must be set to 0 indicating
 * the entire pool is used.
 *
 * Otherwise, the offset, length, and padding specify a sub-region of a memory pool. The sum of
 * offset, length, and padding must not exceed the total size of the specified memory pool. If the
 * data object is a scalar operand or a tensor operand with fully specified dimensions, the value of
 * length must be equal to the raw size of the operand (i.e. the size of an element multiplied
 * by the number of elements). When used in Operand, the value of padding must be 0. When used in
 * RequestArgument, the value of padding specifies the extra bytes at the end of the memory region
 * that may be used by the device to access memory in chunks, for efficiency. If the data object is
 * a Request output whose dimensions are not fully specified, the value of length specifies the
 * total size of the writable region of the output data, and padding specifies the extra bytes at
 * the end of the memory region that may be used by the device to access memory in chunks, for
 * efficiency, but must not be used to hold any output data.
 */
@VintfStability
parcelable DataLocation {
@@ -33,4 +50,8 @@ parcelable DataLocation {
     * The length of the data in bytes.
     */
    long length;
    /**
     * The end padding of the specified memory region in bytes.
     */
    long padding;
}
+6 −0
Original line number Diff line number Diff line
@@ -254,16 +254,22 @@ GeneralResult<DataLocation> unvalidatedConvert(const aidl_hal::DataLocation& loc
    VERIFY_NON_NEGATIVE(location.poolIndex) << "DataLocation: pool index must not be negative";
    VERIFY_NON_NEGATIVE(location.offset) << "DataLocation: offset must not be negative";
    VERIFY_NON_NEGATIVE(location.length) << "DataLocation: length must not be negative";
    VERIFY_NON_NEGATIVE(location.padding) << "DataLocation: padding must not be negative";
    if (location.offset > std::numeric_limits<uint32_t>::max()) {
        return NN_ERROR() << "DataLocation: offset must be <= std::numeric_limits<uint32_t>::max()";
    }
    if (location.length > std::numeric_limits<uint32_t>::max()) {
        return NN_ERROR() << "DataLocation: length must be <= std::numeric_limits<uint32_t>::max()";
    }
    if (location.padding > std::numeric_limits<uint32_t>::max()) {
        return NN_ERROR()
               << "DataLocation: padding must be <= std::numeric_limits<uint32_t>::max()";
    }
    return DataLocation{
            .poolIndex = static_cast<uint32_t>(location.poolIndex),
            .offset = static_cast<uint32_t>(location.offset),
            .length = static_cast<uint32_t>(location.length),
            .padding = static_cast<uint32_t>(location.padding),
    };
}

+6 −3
Original line number Diff line number Diff line
@@ -1125,12 +1125,15 @@ TEST_P(MemoryDomainExecutionTest, InvalidDimensions) {
                                       utils::toSigned(kTestOperand.dimensions).value());
    if (deviceBuffer.buffer == nullptr) return;

    RequestMemoryPool sharedMemory = createSharedMemoryPool(kTestOperandDataSize);
    RequestMemoryPool deviceMemory = createDeviceMemoryPool(deviceBuffer.token);
    // Use an incompatible dimension and make sure the length matches with the bad dimension.
    auto badDimensions = utils::toSigned(kTestOperand.dimensions).value();
    badDimensions[0] = 2;
    const uint32_t badTestOperandDataSize = kTestOperandDataSize * 2;

    RequestMemoryPool sharedMemory = createSharedMemoryPool(badTestOperandDataSize);
    RequestMemoryPool deviceMemory = createDeviceMemoryPool(deviceBuffer.token);
    RequestArgument sharedMemoryArg = {
            .location = {.poolIndex = 0, .offset = 0, .length = kTestOperandDataSize},
            .location = {.poolIndex = 0, .offset = 0, .length = badTestOperandDataSize},
            .dimensions = badDimensions};
    RequestArgument deviceMemoryArg = {.location = {.poolIndex = 1}};
    RequestArgument deviceMemoryArgWithBadDimensions = {.location = {.poolIndex = 1},
+21 −18
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ interface IPowerStats {
     * A PowerEntity is defined as a platform subsystem, peripheral, or power domain that impacts
     * the total device power consumption.
     *
     * @return List of information on each PowerEntity
     * @return List of information on each PowerEntity for which state residency can be requested.
     */
    PowerEntity[] getPowerEntityInfo();

@@ -52,11 +52,12 @@ interface IPowerStats {
     *     Passing an empty list will return state residency for all available PowerEntitys.
     *     ID of each PowerEntity is contained in PowerEntityInfo.
     *
     * @return StateResidency since boot for each requested PowerEntity
     * @return StateResidencyResults since boot for each requested and available PowerEntity. Note
     * that StateResidencyResult for a given PowerEntity may not always be available. Clients shall
     * not rely on StateResidencyResult always being returned for every request.
     *
     * Returns the following service-specific exceptions in order of highest priority:
     *  - STATUS_BAD_VALUE if an invalid powerEntityId is provided
     *  - STATUS_FAILED_TRANSACTION if any StateResidencyResult fails to be returned
     * Returns the following exception codes:
     *  - EX_ILLEGAL_ARGUMENT if an invalid powerEntityId is provided
     */
    StateResidencyResult[] getStateResidency(in int[] powerEntityIds);

@@ -66,7 +67,7 @@ interface IPowerStats {
     * An EnergyConsumer is a device subsystem or peripheral that consumes energy. Energy
     * consumption data may be used by framework for the purpose of power attribution.
     *
     * @return List of EnergyConsumers that are available.
     * @return List of EnergyConsumers for which energy consumption can be requested.
     */
    EnergyConsumer[] getEnergyConsumerInfo();

@@ -74,38 +75,40 @@ interface IPowerStats {
     * Reports the energy consumed since boot by each requested EnergyConsumer.
     *
     * @param energyConsumerIds List of IDs of EnergyConsumers for which data is requested.
     *     Passing an empty list will return state residency for all available EnergyConsumers.
     *     Passing an empty list will return results for all available EnergyConsumers.
     *
     * @return Energy consumed since boot for each requested EnergyConsumer
     * @return Energy consumed since boot for each requested and available EnergyConsumer. Note
     * that EnergyConsumerResult for a given EnergyConsumer may not always be available. Clients
     * shall not rely on EnergyConsumerResult always being returned for every request.
     *
     * Returns the following service-specific exceptions in order of highest priority:
     *  - STATUS_BAD_VALUE if an invalid energyConsumerId is provided
     *  - STATUS_FAILED_TRANSACTION if any EnergyConsumerResult fails to be returned
     * Returns the following exception codes:
     *  - EX_ILLEGAL_ARGUMENT if an invalid energyConsumerId is provided
     */
    EnergyConsumerResult[] getEnergyConsumed(in int[] energyConsumerIds);

    /**
     * Return information related to all channels monitored by Energy Meters.
     * Return information related to all Channels monitored by Energy Meters.
     *
     * An Energy Meter is a device that monitors energy and may support monitoring multiple
     * channels simultaneously. A channel may correspond a bus, sense resistor, or power rail.
     *
     * @return Channels monitored by Energy Meters.
     * @return All Channels for which energy measurements can be requested.
     */
    Channel[] getEnergyMeterInfo();

    /**
     * Reports accumulated energy for each specified channel.
     * Reports accumulated energy for each specified Channel.
     *
     * @param channelIds IDs of channels for which data is requested.
     *     Passing an empty list will return energy measurements for all available channels.
     *     ID of each channel is contained in ChannelInfo.
     *
     * @return Energy measured since boot for each requested channel
     * @return Energy measured since boot for each requested and available Channel. Note
     * that EnergyMeasurement for a given Channel may not always be available. Clients
     * shall not rely on EnergyMeasurement always being returned for every request.
     *
     * Returns the following service-specific exceptions in order of highest priority:
     *  - STATUS_BAD_VALUE if an invalid channelId is provided
     *  - STATUS_FAILED_TRANSACTION if any EnergyMeasurement fails to be returned
     * Returns the following exception codes:
     *  - EX_ILLEGAL_ARGUMENT if an invalid channelId is provided
     */
    EnergyMeasurement[] readEnergyMeter(in int[] channelIds);
}
Loading