mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Introduce canonical IBurst object in NNAPI -- hal
A sibling change to this change introduces a canonical IBurst object and
a new method IPreparedModel::configureExecutionBurst. This CL performs
minimal changes to the NN hal utility code to make the code still
compile.
Bug: 177267324
Test: mma
Change-Id: I076067289dde7def5622a6cb25233619f80efa41
Merged-In: I076067289dde7def5622a6cb25233619f80efa41
(cherry picked from commit b6a7ed5d5f)
This commit is contained in:
committed by
Lev Proleev
parent
9adab0cf49
commit
2a8b679bba
@@ -56,6 +56,8 @@ class PreparedModel final : public nn::IPreparedModel {
|
||||
const nn::OptionalDuration& loopTimeoutDuration,
|
||||
const nn::OptionalDuration& timeoutDurationAfterFence) const override;
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> configureExecutionBurst() const override;
|
||||
|
||||
std::any getUnderlyingResource() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -90,6 +90,10 @@ PreparedModel::executeFenced(const nn::Request& /*request*/,
|
||||
<< "IPreparedModel::executeFenced is not supported on 1.0 HAL service";
|
||||
}
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> PreparedModel::configureExecutionBurst() const {
|
||||
return NN_ERROR(nn::ErrorStatus::GENERAL_FAILURE) << "Not yet implemented";
|
||||
}
|
||||
|
||||
std::any PreparedModel::getUnderlyingResource() const {
|
||||
sp<V1_0::IPreparedModel> resource = kPreparedModel;
|
||||
return resource;
|
||||
|
||||
@@ -57,6 +57,8 @@ class PreparedModel final : public nn::IPreparedModel {
|
||||
const nn::OptionalDuration& loopTimeoutDuration,
|
||||
const nn::OptionalDuration& timeoutDurationAfterFence) const override;
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> configureExecutionBurst() const override;
|
||||
|
||||
std::any getUnderlyingResource() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -117,6 +117,10 @@ PreparedModel::executeFenced(const nn::Request& /*request*/,
|
||||
<< "IPreparedModel::executeFenced is not supported on 1.2 HAL service";
|
||||
}
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> PreparedModel::configureExecutionBurst() const {
|
||||
return NN_ERROR(nn::ErrorStatus::GENERAL_FAILURE) << "Not yet implemented";
|
||||
}
|
||||
|
||||
std::any PreparedModel::getUnderlyingResource() const {
|
||||
sp<V1_2::IPreparedModel> resource = kPreparedModel;
|
||||
return resource;
|
||||
|
||||
@@ -56,6 +56,8 @@ class PreparedModel final : public nn::IPreparedModel {
|
||||
const nn::OptionalDuration& loopTimeoutDuration,
|
||||
const nn::OptionalDuration& timeoutDurationAfterFence) const override;
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> configureExecutionBurst() const override;
|
||||
|
||||
std::any getUnderlyingResource() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -197,6 +197,10 @@ PreparedModel::executeFenced(const nn::Request& request, const std::vector<nn::S
|
||||
return std::make_pair(std::move(syncFence), std::move(callback));
|
||||
}
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> PreparedModel::configureExecutionBurst() const {
|
||||
return NN_ERROR(nn::ErrorStatus::GENERAL_FAILURE) << "Not yet implemented";
|
||||
}
|
||||
|
||||
std::any PreparedModel::getUnderlyingResource() const {
|
||||
sp<V1_3::IPreparedModel> resource = kPreparedModel;
|
||||
return resource;
|
||||
|
||||
@@ -40,6 +40,8 @@ class InvalidPreparedModel final : public nn::IPreparedModel {
|
||||
const nn::OptionalDuration& loopTimeoutDuration,
|
||||
const nn::OptionalDuration& timeoutDurationAfterFence) const override;
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> configureExecutionBurst() const override;
|
||||
|
||||
std::any getUnderlyingResource() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ class ResilientPreparedModel final : public nn::IPreparedModel {
|
||||
const nn::OptionalDuration& loopTimeoutDuration,
|
||||
const nn::OptionalDuration& timeoutDurationAfterFence) const override;
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> configureExecutionBurst() const override;
|
||||
|
||||
std::any getUnderlyingResource() const override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -42,6 +42,10 @@ InvalidPreparedModel::executeFenced(
|
||||
return NN_ERROR() << "InvalidPreparedModel";
|
||||
}
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> InvalidPreparedModel::configureExecutionBurst() const {
|
||||
return NN_ERROR() << "InvalidPreparedModel";
|
||||
}
|
||||
|
||||
std::any InvalidPreparedModel::getUnderlyingResource() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -124,6 +124,13 @@ ResilientPreparedModel::executeFenced(const nn::Request& request,
|
||||
return protect(*this, fn);
|
||||
}
|
||||
|
||||
nn::GeneralResult<nn::SharedBurst> ResilientPreparedModel::configureExecutionBurst() const {
|
||||
const auto fn = [](const nn::IPreparedModel& preparedModel) {
|
||||
return preparedModel.configureExecutionBurst();
|
||||
};
|
||||
return protect(*this, fn);
|
||||
}
|
||||
|
||||
std::any ResilientPreparedModel::getUnderlyingResource() const {
|
||||
return getPreparedModel()->getUnderlyingResource();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class MockPreparedModel final : public IPreparedModel {
|
||||
const OptionalDuration& loopTimeoutDuration,
|
||||
const OptionalDuration& timeoutDurationAfterFence),
|
||||
(const, override));
|
||||
MOCK_METHOD(GeneralResult<SharedBurst>, configureExecutionBurst, (), (const, override));
|
||||
MOCK_METHOD(std::any, getUnderlyingResource, (), (const, override));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user