end2end tests: add --enable-implicit-device-sync option.

This option will allow tests to be run with
ImplicitiDeviceSynchronization feature.

Bug: dawn:1662
Change-Id: Ic001b2fa175f63e8d77eeb3b23d4d2cf52bb224e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
This commit is contained in:
Le Hoang Quyen 2023-04-06 16:03:13 +00:00 committed by Dawn LUCI CQ
parent 8bfdb661f8
commit b7a3cbe8ca
2 changed files with 31 additions and 0 deletions

View File

@ -201,6 +201,11 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) {
continue;
}
if (strcmp("-s", argv[i]) == 0 || strcmp("--enable-implicit-device-sync", argv[i]) == 0) {
mEnableImplicitDeviceSync = true;
continue;
}
if (strcmp("--run-suppressed-tests", argv[i]) == 0) {
mRunSuppressedTests = true;
continue;
@ -327,6 +332,8 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) {
"[--enable-backend-validation[=full,partial,disabled]]\n"
" [--exclusive-device-type-preference=integrated,cpu,discrete]\n\n"
" -w, --use-wire: Run the tests through the wire (defaults to no wire)\n"
" -s, --enable-implicit-device-sync: Run the tests with implicit device "
"synchronization feature (defaults to false)\n"
" -c, --begin-capture-on-startup: Begin debug capture on startup "
"(defaults to no capture)\n"
" --enable-backend-validation: Enables backend validation. Defaults to \n"
@ -356,6 +363,13 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) {
dawn::WarningLog() << " Unused argument: " << argv[i];
}
// TODO(crbug.com/dawn/1678): DawnWire doesn't support thread safe API yet.
if (mUseWire && mEnableImplicitDeviceSync) {
dawn::ErrorLog()
<< "--use-wire and --enable-implicit-device-sync cannot be used at the same time";
UNREACHABLE();
}
}
std::unique_ptr<dawn::native::Instance> DawnTestEnvironment::CreateInstanceAndDiscoverAdapters() {
@ -507,6 +521,9 @@ void DawnTestEnvironment::PrintTestConfigurationAndAdapterInfo(
"---------------------\n"
"UseWire: "
<< (mUseWire ? "true" : "false")
<< "\n"
"Implicit device synchronization: "
<< (mEnableImplicitDeviceSync ? "enabled" : "disabled")
<< "\n"
"Run suppressed tests: "
<< (mRunSuppressedTests ? "true" : "false")
@ -592,6 +609,10 @@ bool DawnTestEnvironment::UsesWire() const {
return mUseWire;
}
bool DawnTestEnvironment::IsImplicitDeviceSyncEnabled() const {
return mEnableImplicitDeviceSync;
}
bool DawnTestEnvironment::RunSuppressedTests() const {
return mRunSuppressedTests;
}
@ -838,6 +859,10 @@ bool DawnTestBase::UsesWire() const {
return gTestEnv->UsesWire();
}
bool DawnTestBase::IsImplicitDeviceSyncEnabled() const {
return gTestEnv->IsImplicitDeviceSyncEnabled();
}
bool DawnTestBase::IsBackendValidationEnabled() const {
return gTestEnv->GetBackendValidationLevel() != dawn::native::BackendValidationLevel::Disabled;
}
@ -942,6 +967,9 @@ bool DawnTestBase::SupportsFeatures(const std::vector<wgpu::FeatureName>& featur
WGPUDevice DawnTestBase::CreateDeviceImpl(std::string isolationKey) {
// Create the device from the adapter
std::vector<wgpu::FeatureName> requiredFeatures = GetRequiredFeatures();
if (IsImplicitDeviceSyncEnabled()) {
requiredFeatures.push_back(wgpu::FeatureName::ImplicitDeviceSynchronization);
}
wgpu::SupportedLimits supportedLimits;
mBackendAdapter.GetLimits(reinterpret_cast<WGPUSupportedLimits*>(&supportedLimits));

View File

@ -166,6 +166,7 @@ class DawnTestEnvironment : public testing::Environment {
void TearDown() override;
bool UsesWire() const;
bool IsImplicitDeviceSyncEnabled() const;
dawn::native::BackendValidationLevel GetBackendValidationLevel() const;
dawn::native::Instance* GetInstance() const;
bool HasVendorIdFilter() const;
@ -193,6 +194,7 @@ class DawnTestEnvironment : public testing::Environment {
bool ValidateToggles(dawn::native::Instance* instance) const;
bool mUseWire = false;
bool mEnableImplicitDeviceSync = false;
dawn::native::BackendValidationLevel mBackendValidationLevel =
dawn::native::BackendValidationLevel::Disabled;
std::string mANGLEBackend;
@ -250,6 +252,7 @@ class DawnTestBase {
bool IsAndroid() const;
bool UsesWire() const;
bool IsImplicitDeviceSyncEnabled() const;
bool IsBackendValidationEnabled() const;
bool IsFullBackendValidationEnabled() const;
bool RunSuppressedTests() const;