Vulkan: Feature to make async queue slow for testing

Bug: angleproject:6746
Change-Id: I2573cae2dcf42d177168c55bc2a6d8bb012dde18
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4227986
Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Charlie Lao <cclao@google.com>
This commit is contained in:
Shahbaz Youssefi
2022-11-28 11:05:05 -05:00
committed by Angle LUCI CQ
parent 28da0a3e98
commit b38467147b
8 changed files with 61 additions and 19 deletions

View File

@@ -320,6 +320,11 @@ struct FeaturesVk : FeatureSetBase
"Use CommandQueue worker thread to dispatch work to GPU.",
&members, "http://anglebug.com/4324"};
FeatureInfo slowAsyncCommandQueueForTesting = {
"slowAsyncCommandQueueForTesting", FeatureCategory::VulkanWorkarounds,
"Artificially slow down async command queue for threading testing", &members,
"https://anglebug.com/6574"};
FeatureInfo supportsShaderFloat16 = {
"supportsShaderFloat16", FeatureCategory::VulkanFeatures,
"VkDevice supports the VK_KHR_shader_float16_int8 extension "

View File

@@ -406,6 +406,14 @@
],
"issue": "http://anglebug.com/4324"
},
{
"name": "slow_async_command_queue_for_testing",
"category": "Workarounds",
"description": [
"Artificially slow down async command queue for threading testing"
],
"issue": "https://anglebug.com/6574"
},
{
"name": "supports_shader_float16",
"category": "Features",
@@ -1091,7 +1099,7 @@
"VkDevice supports the VK_EXT_pipeline_protected_access extension"
],
"issue": "https://anglebug.com/7714"
},
},
{
"name": "supports_mixed_read_write_depth_stencil_layouts",
"category": "Features",
@@ -1099,7 +1107,7 @@
"VkDevice supports the mixed read and write depth/stencil layouts introduced by VK_KHR_maintenance2"
],
"issue": "https://anglebug.com/7899"
},
},
{
"name": "supports_swapchain_maintenance1",
"category": "Features",
@@ -1107,14 +1115,14 @@
"VkDevice supports the VK_EXT_surface_maintenance1 and VK_EXT_swapchain_maintenance1 extensions"
],
"issue": "https://anglebug.com/7847"
},
{
},
{
"name": "prefer_submit_on_any_samples_passed_query_end",
"category": "Workarounds",
"description":["Submit commands to driver when last GL_ANY_SAMPLES_PASSED query is made for performance improvements."],
"issue": "https://issuetracker.google.com/250706693"
},
{
{
"name": "force_wait_for_submission_to_complete_for_query_result",
"category": "Workarounds",
"description":["Force wait for submission to complete before calling getQueryResult(wait)."],

View File

@@ -6,7 +6,7 @@
"include/platform/FeaturesMtl_autogen.h":
"6fe5588c37d4e177fe6009efac2425b8",
"include/platform/FeaturesVk_autogen.h":
"4481f1e1198695596fceeb8152022529",
"da481ae62f74e9e46ae5d8c79d058006",
"include/platform/FrontendFeatures_autogen.h":
"be41034e621326dd51e86b139705ea39",
"include/platform/d3d_features.json":
@@ -20,9 +20,9 @@
"include/platform/mtl_features.json":
"0734ff4029e1db1a0c242666bd88653a",
"include/platform/vk_features.json":
"5266e522142d92061527d3d1ff2ecc09",
"08d68ffafdb43e2e44f0d0d012683a3d",
"util/angle_features_autogen.cpp":
"569685ec9c1b11dc004219eccffa75a4",
"f6b64b287ab8fc5684da509c65121e28",
"util/angle_features_autogen.h":
"08370288b8d692fcfa3b24b8bae2bfde"
"576663d918a9ce1cdb29756768bcd5e5"
}

View File

@@ -8,6 +8,7 @@
//
#include "libANGLE/renderer/vulkan/CommandProcessor.h"
#include "common/system_utils.h"
#include "libANGLE/renderer/vulkan/RendererVk.h"
namespace rx
@@ -657,6 +658,19 @@ angle::Result CommandProcessor::processTasksImpl(bool *exitThread)
{
CommandProcessorTask task(std::move(mTasks.front()));
mTasks.pop();
// Artificially make the task take longer to catch threading issues.
if (getFeatures().slowAsyncCommandQueueForTesting.enabled)
{
constexpr double kSlowdownTime = 0.005;
double startTime = angle::GetCurrentSystemTime();
while (angle::GetCurrentSystemTime() - startTime < kSlowdownTime)
{
// Busy waiting
}
}
ANGLE_TRY(processTask(&task));
}
}

View File

@@ -1073,13 +1073,6 @@
5458 ASAN VULKAN SWIFTSHADER : ClipCullDistanceTest.SizeCheckCombined/* = SKIP
7922 TSAN VULKAN SWIFTSHADER : ClipCullDistanceTest.SizeCheckCombined/* = SKIP
// Slow tests, should appear last in this file
5076 : GLSLTest.VerifyMaxVertexUniformVectors* = TIMEOUT
5076 : GLSLTest.VerifyMaxFragmentUniformVectors* = TIMEOUT
6261 : MultithreadingTest* = TIMEOUT
// Please do not add expectations below this line,
// so that TIMEOUT expectations above don't override more precise SKIP expectations
7629 VULKAN : EGLRobustnessTestES3.Context*ResetOnInvalidLocalShaderVariableAccess_ShareGroupAfterProgramCreation/* = SKIP
// EXT_multisample_compatibility exposed for the sake of GLES1, but not implemented on Vulkan
@@ -1102,3 +1095,9 @@
// GL program cache failure with shader images.
7797 WIN OPENGL : PixelLocalStorageTest.ProgramCache/* = SKIP
// Slow tests, should appear last in this file
5076 : GLSLTest.VerifyMaxVertexUniformVectors* = TIMEOUT
5076 : GLSLTest.VerifyMaxFragmentUniformVectors* = TIMEOUT
6261 : MultithreadingTest* = TIMEOUT
// Please do not add expectations below this line,
// so that TIMEOUT expectations above don't override more precise SKIP expectations

View File

@@ -248,7 +248,9 @@ TEST_P(MultithreadingTest, MultiContextClear)
EXPECT_PIXEL_COLOR_EQ(0, 0, color);
}
};
runMultithreadedGLTest(testBody, 72);
runMultithreadedGLTest(
testBody,
getEGLWindow()->isFeatureEnabled(Feature::SlowAsyncCommandQueueForTesting) ? 4 : 72);
}
// Verify that threads can interleave eglDestroyContext and draw calls without
@@ -422,7 +424,9 @@ TEST_P(MultithreadingTest, MultiContextDrawWithSwapBuffers)
EXPECT_PIXEL_COLOR_EQ(0, 0, color);
}
};
runMultithreadedGLTest(testBody, 32);
runMultithreadedGLTest(
testBody,
getEGLWindow()->isFeatureEnabled(Feature::SlowAsyncCommandQueueForTesting) ? 4 : 32);
}
// Test that ANGLE handles multiple threads creating and destroying resources (vertex buffer in this
@@ -476,7 +480,9 @@ TEST_P(MultithreadingTest, MultiContextCreateAndDeleteResources)
}
glFinish();
};
runMultithreadedGLTest(testBody, 32);
runMultithreadedGLTest(
testBody,
getEGLWindow()->isFeatureEnabled(Feature::SlowAsyncCommandQueueForTesting) ? 4 : 32);
}
TEST_P(MultithreadingTest, MultiCreateContext)
@@ -1937,6 +1943,10 @@ ANGLE_INSTANTIATE_TEST(
ES2_OPENGLES(),
ES3_OPENGLES(),
ES3_VULKAN(),
ES3_VULKAN_SWIFTSHADER().enable(Feature::AsyncCommandQueue),
ES3_VULKAN_SWIFTSHADER()
.enable(Feature::AsyncCommandQueue)
.enable(Feature::SlowAsyncCommandQueueForTesting),
ES3_VULKAN_SWIFTSHADER().disable(Feature::PreferMonolithicPipelinesOverLibraries),
ES3_VULKAN_SWIFTSHADER().enable(Feature::PreferMonolithicPipelinesOverLibraries),
ES3_VULKAN_SWIFTSHADER()
@@ -1962,6 +1972,10 @@ ANGLE_INSTANTIATE_TEST(
ES3_OPENGL(),
ES3_OPENGLES(),
ES3_VULKAN(),
ES3_VULKAN_SWIFTSHADER().enable(Feature::AsyncCommandQueue),
ES3_VULKAN_SWIFTSHADER()
.enable(Feature::AsyncCommandQueue)
.enable(Feature::SlowAsyncCommandQueueForTesting),
ES3_VULKAN_SWIFTSHADER().disable(Feature::PreferMonolithicPipelinesOverLibraries),
ES3_VULKAN_SWIFTSHADER().enable(Feature::PreferMonolithicPipelinesOverLibraries),
ES3_VULKAN_SWIFTSHADER()

View File

@@ -237,6 +237,7 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::ShiftInstancedArrayDataWithOffset, "shiftInstancedArrayDataWithOffset"},
{Feature::SingleThreadedTextureDecompression, "singleThreadedTextureDecompression"},
{Feature::SkipVSConstantRegisterZero, "skipVSConstantRegisterZero"},
{Feature::SlowAsyncCommandQueueForTesting, "slowAsyncCommandQueueForTesting"},
{Feature::SlowDownMonolithicPipelineCreationForTesting,
"slowDownMonolithicPipelineCreationForTesting"},
{Feature::SupportsAndroidHardwareBuffer, "supportsAndroidHardwareBuffer"},

View File

@@ -223,6 +223,7 @@ enum class Feature
ShiftInstancedArrayDataWithOffset,
SingleThreadedTextureDecompression,
SkipVSConstantRegisterZero,
SlowAsyncCommandQueueForTesting,
SlowDownMonolithicPipelineCreationForTesting,
SupportsAndroidHardwareBuffer,
SupportsAndroidNativeFenceSync,