summaryrefslogtreecommitdiff
path: root/neuralnetworks/aidl/utils/src
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2021-02-16 10:40:32 -0800
committerPrzemysław Szczepaniak <pszczepaniak@google.com>2021-03-17 11:39:20 +0000
commit5e36ca05e729bfd2a04cf2024e174c4c9b74b751 (patch)
treebeab2ed408e743828f0a9346e16a4d19edabe6a7 /neuralnetworks/aidl/utils/src
parentdf3a0dcaebc0bd7d0d987ab65b217ef838ce240b (diff)
Passing padding information to the driver -- hal.
This CL changes the sAIDL interface to enable passing padding information of the shared memory pool to the driver. The sAIDL interface defines the padding field explicitly in DataLocation to make it easy to convert to/from the canonical request. Bug: 179691454 Test: NNT_static Test: VtsHalNeuralnetworksTargetTest Change-Id: Ie13b421531ee4df48822086b027d94a622a3518c Merged-In: Ie13b421531ee4df48822086b027d94a622a3518c (cherry picked from commit 6365ea1dbba94da8a0f2fb63d00283109ee47f9b)
Diffstat (limited to 'neuralnetworks/aidl/utils/src')
-rw-r--r--neuralnetworks/aidl/utils/src/Conversions.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/neuralnetworks/aidl/utils/src/Conversions.cpp b/neuralnetworks/aidl/utils/src/Conversions.cpp
index db3504bb74..9a06d475f8 100644
--- a/neuralnetworks/aidl/utils/src/Conversions.cpp
+++ b/neuralnetworks/aidl/utils/src/Conversions.cpp
@@ -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),
};
}