Snap for 5180536 from 412352b37accb6e8f3684aae162b82e1a6a2d528 to pi-platform-release
Change-Id: I378cf141149edc38d0e65749085821427b973578
diff --git a/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index bb1d26f..a08a2d6 100644
--- a/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -661,8 +661,8 @@
code; \
}
-TEST_IO_STREAM(GetFrameCount, "Check that the stream frame count == the one it was opened with",
- ASSERT_EQ(audioConfig.frameCount, extract(stream->getFrameCount())))
+TEST_IO_STREAM(GetFrameCount, "Check that getting stream frame count does not crash the HAL.",
+ ASSERT_TRUE(stream->getFrameCount().isOk()))
TEST_IO_STREAM(GetSampleRate, "Check that the stream sample rate == the one it was opened with",
ASSERT_EQ(audioConfig.sampleRateHz, extract(stream->getSampleRate())))
diff --git a/audio/core/4.0/vts/functional/Android.bp b/audio/core/4.0/vts/functional/Android.bp
index 22c5493..e3b376c 100644
--- a/audio/core/4.0/vts/functional/Android.bp
+++ b/audio/core/4.0/vts/functional/Android.bp
@@ -29,6 +29,9 @@
"libicuuc_stubdata",
"libxml2",
],
+ shared_libs: [
+ "libfmq",
+ ],
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
index 0f8996f..46c228a 100644
--- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
@@ -29,6 +29,8 @@
#include <fcntl.h>
#include <unistd.h>
+#include <hwbinder/IPCThreadState.h>
+
#include <VtsHalHidlTargetTestBase.h>
#include <android-base/logging.h>
@@ -38,6 +40,8 @@
#include <android/hardware/audio/4.0/IPrimaryDevice.h>
#include <android/hardware/audio/4.0/types.h>
#include <android/hardware/audio/common/4.0/types.h>
+#include <fmq/EventFlag.h>
+#include <fmq/MessageQueue.h>
#include <common/all-versions/VersionUtils.h>
@@ -55,13 +59,17 @@
using std::list;
using ::android::sp;
-using ::android::hardware::Return;
+using ::android::hardware::EventFlag;
using ::android::hardware::hidl_bitfield;
using ::android::hardware::hidl_enum_iterator;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
+using ::android::hardware::kSynchronizedReadWrite;
+using ::android::hardware::IPCThreadState;
+using ::android::hardware::MessageQueue;
using ::android::hardware::MQDescriptorSync;
+using ::android::hardware::Return;
using ::android::hardware::audio::V4_0::AudioDrain;
using ::android::hardware::audio::V4_0::DeviceAddress;
using ::android::hardware::audio::V4_0::IDevice;
@@ -71,6 +79,7 @@
using ::android::hardware::audio::V4_0::IDevicesFactory;
using ::android::hardware::audio::V4_0::IStream;
using ::android::hardware::audio::V4_0::IStreamIn;
+using ::android::hardware::audio::V4_0::MessageQueueFlagBits;
using ::android::hardware::audio::V4_0::TimeSpec;
using ReadParameters = ::android::hardware::audio::V4_0::IStreamIn::ReadParameters;
using ReadStatus = ::android::hardware::audio::V4_0::IStreamIn::ReadStatus;
@@ -164,15 +173,25 @@
TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) {
doc::test("Calling openDevice(\"primary\") should return the primary device.");
- Result result;
- sp<IDevice> baseDevice;
- ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
- ASSERT_OK(result);
- ASSERT_TRUE(baseDevice != nullptr);
+ {
+ Result result;
+ sp<IDevice> baseDevice;
+ ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
+ ASSERT_OK(result);
+ ASSERT_TRUE(baseDevice != nullptr);
- Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice);
- ASSERT_TRUE(primaryDevice.isOk());
- ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr);
+ Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice);
+ ASSERT_TRUE(primaryDevice.isOk());
+ ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr);
+ } // Destroy local IDevice proxy
+ // FIXME: there is no way to know when the remote IDevice is being destroyed
+ // Binder does not support testing if an object is alive, thus
+ // wait for 100ms to let the binder destruction propagates and
+ // the remote device has the time to be destroyed.
+ // flushCommand makes sure all local command are sent, thus should reduce
+ // the latency between local and remote destruction.
+ IPCThreadState::self()->flushCommands();
+ usleep(100);
}
//////////////////////////////////////////////////////////////////////////////
@@ -489,7 +508,7 @@
}
//////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// getMicrophones ///////////////////////////////
+/////////////////////////// get(Active)Microphones ///////////////////////////
//////////////////////////////////////////////////////////////////////////////
TEST_F(AudioPrimaryHidlTest, GetMicrophonesTest) {
@@ -497,6 +516,76 @@
hidl_vec<MicrophoneInfo> microphones;
ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
ASSERT_OK(res);
+ if (microphones.size() > 0) {
+ // When there is microphone on the phone, try to open an input stream
+ // and query for the active microphones.
+ doc::test(
+ "Make sure getMicrophones always succeeds"
+ "and getActiveMicrophones always succeeds when recording from these microphones.");
+ AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE;
+ AudioConfig config{};
+ config.channelMask = mkBitfield(AudioChannelMask::IN_MONO);
+ config.sampleRateHz = 8000;
+ config.format = AudioFormat::PCM_16_BIT;
+ auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
+ const SinkMetadata initialMetadata = {{{AudioSource::MIC, 1 /* gain */}}};
+ EventFlag* efGroup;
+ for (auto microphone : microphones) {
+ if (microphone.deviceAddress.device != AudioDevice::IN_BUILTIN_MIC) {
+ continue;
+ }
+ sp<IStreamIn> stream;
+ AudioConfig suggestedConfig{};
+ ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress, config, flags,
+ initialMetadata,
+ returnIn(res, stream, suggestedConfig)));
+ if (res != Result::OK) {
+ ASSERT_TRUE(stream == nullptr);
+ AudioConfig suggestedConfigRetry{};
+ ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress,
+ suggestedConfig, flags, initialMetadata,
+ returnIn(res, stream, suggestedConfigRetry)));
+ }
+ ASSERT_OK(res);
+ hidl_vec<MicrophoneInfo> activeMicrophones;
+ Result readRes;
+ typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
+ typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
+ std::unique_ptr<CommandMQ> commandMQ;
+ std::unique_ptr<DataMQ> dataMQ;
+ size_t frameSize = stream->getFrameSize();
+ size_t frameCount = stream->getBufferSize() / frameSize;
+ ASSERT_OK(stream->prepareForReading(
+ frameSize, frameCount, [&](auto r, auto& c, auto& d, auto&, auto&) {
+ readRes = r;
+ if (readRes == Result::OK) {
+ commandMQ.reset(new CommandMQ(c));
+ dataMQ.reset(new DataMQ(d));
+ if (dataMQ->isValid() && dataMQ->getEventFlagWord()) {
+ EventFlag::createEventFlag(dataMQ->getEventFlagWord(), &efGroup);
+ }
+ }
+ }));
+ ASSERT_OK(readRes);
+ ReadParameters params;
+ params.command = IStreamIn::ReadCommand::READ;
+ ASSERT_TRUE(commandMQ != nullptr);
+ ASSERT_TRUE(commandMQ->isValid());
+ ASSERT_TRUE(commandMQ->write(¶ms));
+ efGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL));
+ uint32_t efState = 0;
+ efGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
+ if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)) {
+ ASSERT_OK(stream->getActiveMicrophones(returnIn(res, activeMicrophones)));
+ ASSERT_OK(res);
+ ASSERT_NE(0U, activeMicrophones.size());
+ }
+ stream->close();
+ if (efGroup) {
+ EventFlag::deleteEventFlag(&efGroup);
+ }
+ }
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -734,8 +823,8 @@
code; \
}
-TEST_IO_STREAM(GetFrameCount, "Check that the stream frame count == the one it was opened with",
- ASSERT_EQ(audioConfig.frameCount, extract(stream->getFrameCount())))
+TEST_IO_STREAM(GetFrameCount, "Check that getting stream frame count does not crash the HAL.",
+ ASSERT_TRUE(stream->getFrameCount().isOk()))
TEST_IO_STREAM(GetSampleRate, "Check that the stream sample rate == the one it was opened with",
ASSERT_EQ(audioConfig.sampleRateHz, extract(stream->getSampleRate())))
@@ -1104,14 +1193,6 @@
ASSERT_OK(stream->updateSinkMetadata(initialMetadata));
}
-TEST_P(InputStreamTest, getActiveMicrophones) {
- doc::test("Getting active microphones should always succeed");
- hidl_vec<MicrophoneInfo> microphones;
- ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
- ASSERT_OK(res);
- ASSERT_TRUE(microphones.size() > 0);
-}
-
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////// StreamOut //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -1402,6 +1483,7 @@
"Make sure setBtHfpVolume is either not supported or "
"only succeed if volume is in [0,1]");
auto ret = device->setBtHfpVolume(0.0);
+ ASSERT_TRUE(ret.isOk());
if (ret == Result::NOT_SUPPORTED) {
doc::partialTest("setBtHfpVolume is not supported");
return;
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 439333d..71b78f4 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -1172,6 +1172,14 @@
}
ASSERT_GT(firstApiLevel, 0); // first_api_level must exist
+ // all devices with first API level == 28 and <= 1GB of RAM must set low_ram
+ // and thus be allowed to continue using HAL1
+ if ((firstApiLevel == HAL1_PHASE_OUT_API_LEVEL) &&
+ (property_get_bool("ro.config.low_ram", /*default*/ false))) {
+ ALOGI("Hal1 allowed for low ram device");
+ return;
+ }
+
if (firstApiLevel >= HAL1_PHASE_OUT_API_LEVEL) {
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
for (const auto& name : cameraDeviceNames) {
diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
index c9f840e..2d901f3 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
@@ -119,6 +119,11 @@
struct ComparableBlacklistedSource {
IGnssConfiguration::BlacklistedSource id;
+ ComparableBlacklistedSource() {
+ id.constellation = GnssConstellationType::UNKNOWN;
+ id.svid = 0;
+ }
+
bool operator<(const ComparableBlacklistedSource& compare) const {
return ((id.svid < compare.id.svid) || ((id.svid == compare.id.svid) &&
(id.constellation < compare.id.constellation)));
@@ -191,18 +196,21 @@
* 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does not use those satellites.
* 4a & b) Turns off location, and send in empty blacklist.
- * 5) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
+ * 5a) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does re-use at least the previously strongest satellite
+ * 5b) Retry a few times, in case GNSS search strategy takes a while to reacquire even the
+ * formerly strongest satellite
*/
TEST_F(GnssHalTest, BlacklistIndividualSatellites) {
const int kLocationsToAwait = 3;
+ const int kRetriesToUnBlacklist = 10;
StartAndCheckLocations(kLocationsToAwait);
// Tolerate 1 less sv status to handle edge cases in reporting.
EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
+ ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations (%d received)",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, location_called_count_);
/*
* Identify strongest SV seen at least kLocationsToAwait -1 times
@@ -237,13 +245,18 @@
// retry and ensure satellite not used
list_gnss_sv_status_.clear();
- location_called_count_ = 0;
StartAndCheckLocations(kLocationsToAwait);
+ // early exit if test is being run with insufficient signal
+ if (location_called_count_ == 0) {
+ ALOGE("0 Gnss locations received - ensure sufficient signal and retry");
+ }
+ ASSERT_TRUE(location_called_count_ > 0);
+
// Tolerate 1 less sv status to handle edge cases in reporting.
EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
+ ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations (%d received)",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, location_called_count_);
for (const auto& gnss_sv_status : list_gnss_sv_status_) {
for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
@@ -260,28 +273,40 @@
ASSERT_TRUE(result.isOk());
EXPECT_TRUE(result);
- StopAndClearLocations();
- list_gnss_sv_status_.clear();
-
- StartAndCheckLocations(kLocationsToAwait);
-
- // Tolerate 1 less sv status to handle edge cases in reporting.
- EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
-
bool strongest_sv_is_reobserved = false;
- for (const auto& gnss_sv_status : list_gnss_sv_status_) {
- for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
- const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
- if ((gnss_sv.svid == source_to_blacklist.svid) &&
- (gnss_sv.constellation == source_to_blacklist.constellation) &&
- (gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
- strongest_sv_is_reobserved = true;
- break;
- }
+ // do several loops awaiting a few locations, allowing non-immediate reacquisition strategies
+ int unblacklist_loops_remaining = kRetriesToUnBlacklist;
+ while (!strongest_sv_is_reobserved && (unblacklist_loops_remaining-- > 0)) {
+ StopAndClearLocations();
+ list_gnss_sv_status_.clear();
+
+ StartAndCheckLocations(kLocationsToAwait);
+
+ // early exit loop if test is being run with insufficient signal
+ if (location_called_count_ == 0) {
+ ALOGE("0 Gnss locations received - ensure sufficient signal and retry");
}
- if (strongest_sv_is_reobserved) break;
+ ASSERT_TRUE(location_called_count_ > 0);
+
+ // Tolerate 1 less sv status to handle edge cases in reporting.
+ EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
+ ALOGD(
+ "Clear blacklist, observed %d GnssSvStatus, while awaiting %d Locations"
+ ", tries remaining %d",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, unblacklist_loops_remaining);
+
+ for (const auto& gnss_sv_status : list_gnss_sv_status_) {
+ for (uint32_t iSv = 0; iSv < gnss_sv_status.numSvs; iSv++) {
+ const auto& gnss_sv = gnss_sv_status.gnssSvList[iSv];
+ if ((gnss_sv.svid == source_to_blacklist.svid) &&
+ (gnss_sv.constellation == source_to_blacklist.constellation) &&
+ (gnss_sv.svFlag & IGnssCallback::GnssSvFlags::USED_IN_FIX)) {
+ strongest_sv_is_reobserved = true;
+ break;
+ }
+ }
+ if (strongest_sv_is_reobserved) break;
+ }
}
EXPECT_TRUE(strongest_sv_is_reobserved);
StopAndClearLocations();
@@ -304,8 +329,8 @@
// Tolerate 1 less sv status to handle edge cases in reporting.
EXPECT_GE((int)list_gnss_sv_status_.size() + 1, kLocationsToAwait);
- ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations", (int)list_gnss_sv_status_.size(),
- kLocationsToAwait);
+ ALOGD("Observed %d GnssSvStatus, while awaiting %d Locations (%d received)",
+ (int)list_gnss_sv_status_.size(), kLocationsToAwait, location_called_count_);
// Find first non-GPS constellation to blacklist
GnssConstellationType constellation_to_blacklist = GnssConstellationType::UNKNOWN;
diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
index 23bf558..951e874 100644
--- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
+++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp
@@ -18,11 +18,11 @@
#include <VtsHalHidlTargetTestBase.h>
#include <android-base/logging.h>
-#include <android/hardware/graphics/mapper/2.1/IMapper.h>
+#include <android/hardware/graphics/mapper/2.0/IMapper.h>
#include <composer-vts/2.1/GraphicsComposerCallback.h>
#include <composer-vts/2.1/TestCommandReader.h>
#include <composer-vts/2.2/ComposerVts.h>
-#include <mapper-vts/2.1/MapperVts.h>
+#include <mapper-vts/2.0/MapperVts.h>
namespace android {
namespace hardware {
@@ -40,8 +40,8 @@
using android::hardware::graphics::common::V1_1::PixelFormat;
using android::hardware::graphics::common::V1_1::RenderIntent;
using android::hardware::graphics::composer::V2_2::IComposerClient;
-using android::hardware::graphics::mapper::V2_1::IMapper;
-using android::hardware::graphics::mapper::V2_1::vts::Gralloc;
+using android::hardware::graphics::mapper::V2_0::IMapper;
+using android::hardware::graphics::mapper::V2_0::vts::Gralloc;
using GrallocError = android::hardware::graphics::mapper::V2_0::Error;
// Test environment for graphics.composer
@@ -136,7 +136,7 @@
info.width = 64;
info.height = 64;
info.layerCount = 1;
- info.format = PixelFormat::RGBA_8888;
+ info.format = static_cast<common::V1_0::PixelFormat>(PixelFormat::RGBA_8888);
info.usage =
static_cast<uint64_t>(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN);
@@ -280,7 +280,7 @@
info.height = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config,
IComposerClient::Attribute::HEIGHT);
info.layerCount = 1;
- info.format = pixelFormat;
+ info.format = static_cast<common::V1_0::PixelFormat>(pixelFormat);
// BufferUsage::COMPOSER_OUTPUT is missing
info.usage = static_cast<uint64_t>(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN);
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index 0682ab9..64495cf 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -66,8 +66,8 @@
// Top level driver for models and examples generated by test_generator.py
// Test driver for those generated from ml/nn/runtime/test/spec
void EvaluatePreparedModel(sp<IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored,
- const std::vector<MixedTypedExampleType>& examples,
- float fpRange = 1e-5f) {
+ const std::vector<MixedTypedExampleType>& examples, float fpAtol = 1e-5f,
+ float fpRtol = 1e-5f) {
const uint32_t INPUT = 0;
const uint32_t OUTPUT = 1;
@@ -175,7 +175,7 @@
MixedTyped filtered_test = filter(test, is_ignored);
// We want "close-enough" results for float
- compare(filtered_golden, filtered_test, fpRange);
+ compare(filtered_golden, filtered_test, fpAtol, fpRtol);
}
}
@@ -220,7 +220,8 @@
EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus);
ASSERT_NE(nullptr, preparedModel.get());
- EvaluatePreparedModel(preparedModel, is_ignored, examples);
+ float fpAtol = 1e-5f, fpRtol = 5.0f * 1.1920928955078125e-7f;
+ EvaluatePreparedModel(preparedModel, is_ignored, examples, fpAtol, fpRtol);
}
void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> create_model,
@@ -265,9 +266,13 @@
EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus);
ASSERT_NE(nullptr, preparedModel.get());
- // If in relaxed mode, set the error range to be 5ULP of FP16.
- float fpRange = !model.relaxComputationFloat32toFloat16 ? 1e-5f : 5.0f * 0.0009765625f;
- EvaluatePreparedModel(preparedModel, is_ignored, examples, fpRange);
+ // TODO: Adjust the error limit based on testing.
+ // If in relaxed mode, set the absolute tolerance to be 5ULP of FP16.
+ float fpAtol = !model.relaxComputationFloat32toFloat16 ? 1e-5f : 5.0f * 0.0009765625f;
+ // Set the relative tolerance to be 5ULP of the corresponding FP precision.
+ float fpRtol = !model.relaxComputationFloat32toFloat16 ? 5.0f * 1.1920928955078125e-7f
+ : 5.0f * 0.0009765625f;
+ EvaluatePreparedModel(preparedModel, is_ignored, examples, fpAtol, fpRtol);
}
} // namespace generated_tests