Refactor MatrixVectorMultiplyPref tests The test required a buffer larger than some devices support. In that case device creation fails in DawnTest and the test fails. Change-Id: Ic0f1a76e4a331cf605c5a12ba99b456a6a6a6964 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/278257 Commit-Queue: Gregg Tavares <gman@chromium.org> Reviewed-by: Shrek Shao <shrekshao@google.com>
diff --git a/src/dawn/tests/perf_tests/MatrixVectorMultiplyPerf.cpp b/src/dawn/tests/perf_tests/MatrixVectorMultiplyPerf.cpp index 460fdfb13..9f60174 100644 --- a/src/dawn/tests/perf_tests/MatrixVectorMultiplyPerf.cpp +++ b/src/dawn/tests/perf_tests/MatrixVectorMultiplyPerf.cpp
@@ -25,6 +25,7 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include <algorithm> #include <sstream> #include <string> #include <vector> @@ -93,6 +94,7 @@ : DawnPerfTestWithParams(kNumDisptaches, /* allow many steps in flight */ 100) {} ~MatrixVectorMultiplyPerf() override = default; + protected: void SetUp() override; std::vector<wgpu::FeatureName> GetRequiredFeatures() override { mUsingF16 = false; @@ -119,10 +121,17 @@ return requirements; } + uint64_t GetMaxStorageBufferBindingSizeNeeded() { + return BytesPerElement() * GetParam().mRows * GetParam().mCols; + } + void GetRequiredLimits(const dawn::utils::ComboLimits& supported, dawn::utils::ComboLimits& required) override { + // Tests fail if the device can not be created so don't ask for more than the device + // supports. + uint64_t needed = GetMaxStorageBufferBindingSizeNeeded(); required.maxStorageBufferBindingSize = - BytesPerElement() * GetParam().mRows * GetParam().mCols; + std::min(supported.maxStorageBufferBindingSize, needed); } private: @@ -157,6 +166,9 @@ DawnPerfTestWithParams<MatrixVectorMultiplyParams>::SetUp(); + DAWN_TEST_UNSUPPORTED_IF(deviceLimits.maxStorageBufferBindingSize < + GetMaxStorageBufferBindingSizeNeeded()); + // Unoptimized variant too slow for bots. // Unskip locally with flag --run-suppressed-tests. DAWN_SUPPRESS_TEST_IF(IsMacOS() && IsAMD() && !GetParam().mSwizzle);