Move test parameterization macro from DawnPerfTest to DawnTest
Also add macros to make it easier to generate a params struct. This makes it possible to generate parameterized tests in dawn_end2end_tests Bug: none Change-Id: I009475dcc08a5274f5871237a363489cff7298f1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51000 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
db03566711
commit
56537f8b06
|
@ -183,6 +183,7 @@ if (is_win || is_linux || is_chromeos || is_mac || is_fuchsia || is_android) {
|
||||||
"NonCopyable.h",
|
"NonCopyable.h",
|
||||||
"PlacementAllocated.h",
|
"PlacementAllocated.h",
|
||||||
"Platform.h",
|
"Platform.h",
|
||||||
|
"Preprocessor.h",
|
||||||
"RefBase.h",
|
"RefBase.h",
|
||||||
"RefCounted.cpp",
|
"RefCounted.cpp",
|
||||||
"RefCounted.h",
|
"RefCounted.h",
|
||||||
|
|
|
@ -36,6 +36,7 @@ target_sources(dawn_common PRIVATE
|
||||||
"NonCopyable.h"
|
"NonCopyable.h"
|
||||||
"PlacementAllocated.h"
|
"PlacementAllocated.h"
|
||||||
"Platform.h"
|
"Platform.h"
|
||||||
|
"Preprocessor.h"
|
||||||
"RefBase.h"
|
"RefBase.h"
|
||||||
"RefCounted.cpp"
|
"RefCounted.cpp"
|
||||||
"RefCounted.h"
|
"RefCounted.h"
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
// Copyright 2021 The Dawn Authors
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#ifndef COMMON_PREPROCESSOR_H_
|
||||||
|
#define COMMON_PREPROCESSOR_H_
|
||||||
|
|
||||||
|
// DAWN_PP_GET_HEAD: get the first element of a __VA_ARGS__ without triggering empty
|
||||||
|
// __VA_ARGS__ warnings.
|
||||||
|
#define DAWN_INTERNAL_PP_GET_HEAD(firstParam, ...) firstParam
|
||||||
|
#define DAWN_PP_GET_HEAD(...) DAWN_INTERNAL_PP_GET_HEAD(__VA_ARGS__, dummyArg)
|
||||||
|
|
||||||
|
// DAWN_PP_CONCATENATE: Concatenate tokens, first expanding the arguments passed in.
|
||||||
|
#define DAWN_PP_CONCATENATE(arg1, arg2) DAWN_PP_CONCATENATE_1(arg1, arg2)
|
||||||
|
#define DAWN_PP_CONCATENATE_1(arg1, arg2) DAWN_PP_CONCATENATE_2(arg1, arg2)
|
||||||
|
#define DAWN_PP_CONCATENATE_2(arg1, arg2) arg1##arg2
|
||||||
|
|
||||||
|
// DAWN_PP_EXPAND: Needed to help expand __VA_ARGS__ out on MSVC
|
||||||
|
#define DAWN_PP_EXPAND(...) __VA_ARGS__
|
||||||
|
|
||||||
|
// Implementation of DAWN_PP_FOR_EACH, called by concatenating DAWN_PP_FOR_EACH_ with a number.
|
||||||
|
#define DAWN_PP_FOR_EACH_1(func, x) func(x)
|
||||||
|
#define DAWN_PP_FOR_EACH_2(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_1)(func, __VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_3(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_2)(func, __VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_4(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_3)(func, __VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_5(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_4)(func, __VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_6(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_5)(func, __VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_7(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_6)(func, __VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_8(func, x, ...) \
|
||||||
|
func(x) DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_7)(func, __VA_ARGS__))
|
||||||
|
|
||||||
|
// Implementation for DAWN_PP_FOR_EACH. Get the number of args in __VA_ARGS__ so we can concat
|
||||||
|
// DAWN_PP_FOR_EACH_ and N.
|
||||||
|
// ex.) DAWN_PP_FOR_EACH_NARG(a, b, c) ->
|
||||||
|
// DAWN_PP_FOR_EACH_NARG(a, b, c, DAWN_PP_FOR_EACH_RSEQ()) ->
|
||||||
|
// DAWN_PP_FOR_EACH_NARG_(a, b, c, 8, 7, 6, 5, 4, 3, 2, 1, 0) ->
|
||||||
|
// DAWN_PP_FOR_EACH_ARG_N(a, b, c, 8, 7, 6, 5, 4, 3, 2, 1, 0) ->
|
||||||
|
// DAWN_PP_FOR_EACH_ARG_N( , , , , , , , , N) ->
|
||||||
|
// 3
|
||||||
|
#define DAWN_PP_FOR_EACH_NARG(...) DAWN_PP_FOR_EACH_NARG_(__VA_ARGS__, DAWN_PP_FOR_EACH_RSEQ())
|
||||||
|
#define DAWN_PP_FOR_EACH_NARG_(...) \
|
||||||
|
DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH_ARG_N)(__VA_ARGS__))
|
||||||
|
#define DAWN_PP_FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
|
||||||
|
#define DAWN_PP_FOR_EACH_RSEQ() 8, 7, 6, 5, 4, 3, 2, 1, 0
|
||||||
|
|
||||||
|
// Implementation for DAWN_PP_FOR_EACH.
|
||||||
|
// Creates a call to DAWN_PP_FOR_EACH_X where X is 1, 2, ..., etc.
|
||||||
|
#define DAWN_PP_FOR_EACH_(N, func, x, ...) \
|
||||||
|
DAWN_PP_CONCATENATE(DAWN_PP_FOR_EACH_, N)(func, x, __VA_ARGS__)
|
||||||
|
|
||||||
|
// DAWN_PP_FOR_EACH: Apply |func| to each argument in |x| and __VA_ARGS__
|
||||||
|
#define DAWN_PP_FOR_EACH(func, x, ...) \
|
||||||
|
DAWN_PP_FOR_EACH_(DAWN_PP_FOR_EACH_NARG(x, __VA_ARGS__), func, x, __VA_ARGS__)
|
||||||
|
|
||||||
|
#endif // COMMON_PREPROCESSOR_H_
|
|
@ -284,6 +284,7 @@ source_set("dawn_end2end_tests_sources") {
|
||||||
sources = [
|
sources = [
|
||||||
"DawnTest.h",
|
"DawnTest.h",
|
||||||
"MockCallback.h",
|
"MockCallback.h",
|
||||||
|
"ParamGenerator.h",
|
||||||
"ToggleParser.cpp",
|
"ToggleParser.cpp",
|
||||||
"ToggleParser.h",
|
"ToggleParser.h",
|
||||||
"end2end/BasicTests.cpp",
|
"end2end/BasicTests.cpp",
|
||||||
|
@ -412,6 +413,7 @@ source_set("dawn_white_box_tests_sources") {
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"DawnTest.h",
|
"DawnTest.h",
|
||||||
|
"ParamGenerator.h",
|
||||||
"ToggleParser.h",
|
"ToggleParser.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,11 @@
|
||||||
#define TESTS_DAWNTEST_H_
|
#define TESTS_DAWNTEST_H_
|
||||||
|
|
||||||
#include "common/Log.h"
|
#include "common/Log.h"
|
||||||
|
#include "common/Preprocessor.h"
|
||||||
#include "dawn/dawn_proc_table.h"
|
#include "dawn/dawn_proc_table.h"
|
||||||
#include "dawn/webgpu_cpp.h"
|
#include "dawn/webgpu_cpp.h"
|
||||||
#include "dawn_native/DawnNative.h"
|
#include "dawn_native/DawnNative.h"
|
||||||
|
#include "tests/ParamGenerator.h"
|
||||||
#include "tests/ToggleParser.h"
|
#include "tests/ToggleParser.h"
|
||||||
|
|
||||||
#include <dawn_platform/DawnPlatform.h>
|
#include <dawn_platform/DawnPlatform.h>
|
||||||
|
@ -505,10 +507,6 @@ DawnTestWithParams<Params>::DawnTestWithParams() : DawnTestBase(this->GetParam()
|
||||||
|
|
||||||
using DawnTest = DawnTestWithParams<>;
|
using DawnTest = DawnTestWithParams<>;
|
||||||
|
|
||||||
// Helpers to get the first element of a __VA_ARGS__ without triggering empty __VA_ARGS__ warnings.
|
|
||||||
#define DAWN_INTERNAL_PP_GET_HEAD(firstParam, ...) firstParam
|
|
||||||
#define DAWN_PP_GET_HEAD(...) DAWN_INTERNAL_PP_GET_HEAD(__VA_ARGS__, dummyArg)
|
|
||||||
|
|
||||||
// Instantiate the test once for each backend provided after the first argument. Use it like this:
|
// Instantiate the test once for each backend provided after the first argument. Use it like this:
|
||||||
// DAWN_INSTANTIATE_TEST(MyTestFixture, MetalBackend, OpenGLBackend)
|
// DAWN_INSTANTIATE_TEST(MyTestFixture, MetalBackend, OpenGLBackend)
|
||||||
#define DAWN_INSTANTIATE_TEST(testName, ...) \
|
#define DAWN_INSTANTIATE_TEST(testName, ...) \
|
||||||
|
@ -520,6 +518,61 @@ using DawnTest = DawnTestWithParams<>;
|
||||||
testing::PrintToStringParamName()); \
|
testing::PrintToStringParamName()); \
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(testName)
|
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(testName)
|
||||||
|
|
||||||
|
// Instantiate the test once for each backend provided in the first param list.
|
||||||
|
// The test will be parameterized over the following param lists.
|
||||||
|
// Use it like this:
|
||||||
|
// DAWN_INSTANTIATE_TEST_P(MyTestFixture, {MetalBackend, OpenGLBackend}, {A, B, C}, {1, 2, 3})
|
||||||
|
// MyTestFixture must extend DawnTestWithParam<Param> where Param is a struct that extends
|
||||||
|
// AdapterTestParam, and whose constructor looks like:
|
||||||
|
// Param(AdapterTestParam, ABorC, 12or3, ..., otherParams... )
|
||||||
|
// You must also teach GTest how to print this struct.
|
||||||
|
// https://github.com/google/googletest/blob/master/docs/advanced.md#teaching-googletest-how-to-print-your-values
|
||||||
|
// Macro DAWN_TEST_PARAM_STRUCT can help generate this struct.
|
||||||
|
#define DAWN_INSTANTIATE_TEST_P(testName, ...) \
|
||||||
|
INSTANTIATE_TEST_SUITE_P( \
|
||||||
|
, testName, ::testing::ValuesIn(MakeParamGenerator<testName::ParamType>(__VA_ARGS__)), \
|
||||||
|
testing::PrintToStringParamName()); \
|
||||||
|
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(testName)
|
||||||
|
|
||||||
|
// Implementation for DAWN_TEST_PARAM_STRUCT to declare/print struct fields.
|
||||||
|
#define DAWN_TEST_PARAM_STRUCT_DECL_STRUCT_FIELD(Type) Type DAWN_PP_CONCATENATE(m, Type);
|
||||||
|
#define DAWN_TEST_PARAM_STRUCT_PRINT_STRUCT_FIELD(Type) \
|
||||||
|
o << "__" << #Type << "_" << param.DAWN_PP_CONCATENATE(m, Type);
|
||||||
|
|
||||||
|
// Usage: DAWN_TEST_PARAM_STRUCT(Foo, TypeA, TypeB, ...)
|
||||||
|
// Generate a test param struct called Foo which extends AdapterTestParam and generated
|
||||||
|
// struct _Dawn_Foo. _Dawn_Foo has members of types TypeA, TypeB, etc. which are named mTypeA,
|
||||||
|
// mTypeB, etc. in the order they are placed in the macro argument list. Struct Foo should be
|
||||||
|
// constructed with an AdapterTestParam as the first argument, followed by a list of values
|
||||||
|
// to initialize the base _Dawn_Foo struct.
|
||||||
|
// It is recommended to use alias declarations so that stringified types are more readable.
|
||||||
|
// Example:
|
||||||
|
// using MyParam = unsigned int;
|
||||||
|
// DAWN_TEST_PARAM_STRUCT(FooParams, MyParam)
|
||||||
|
#define DAWN_TEST_PARAM_STRUCT(StructName, ...) \
|
||||||
|
struct DAWN_PP_CONCATENATE(_Dawn_, StructName) { \
|
||||||
|
DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH)(DAWN_TEST_PARAM_STRUCT_DECL_STRUCT_FIELD, \
|
||||||
|
__VA_ARGS__)) \
|
||||||
|
}; \
|
||||||
|
std::ostream& operator<<(std::ostream& o, \
|
||||||
|
const DAWN_PP_CONCATENATE(_Dawn_, StructName) & param) { \
|
||||||
|
DAWN_PP_EXPAND(DAWN_PP_EXPAND(DAWN_PP_FOR_EACH)(DAWN_TEST_PARAM_STRUCT_PRINT_STRUCT_FIELD, \
|
||||||
|
__VA_ARGS__)) \
|
||||||
|
return o; \
|
||||||
|
} \
|
||||||
|
struct StructName : AdapterTestParam, DAWN_PP_CONCATENATE(_Dawn_, StructName) { \
|
||||||
|
template <typename... Args> \
|
||||||
|
StructName(const AdapterTestParam& param, Args&&... args) \
|
||||||
|
: AdapterTestParam(param), \
|
||||||
|
DAWN_PP_CONCATENATE(_Dawn_, StructName){std::forward<Args>(args)...} { \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
std::ostream& operator<<(std::ostream& o, const StructName& param) { \
|
||||||
|
o << static_cast<const AdapterTestParam&>(param); \
|
||||||
|
o << "_" << static_cast<const DAWN_PP_CONCATENATE(_Dawn_, StructName)&>(param); \
|
||||||
|
return o; \
|
||||||
|
}
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
// Helper functions used for DAWN_INSTANTIATE_TEST
|
// Helper functions used for DAWN_INSTANTIATE_TEST
|
||||||
std::vector<AdapterTestParam> GetAvailableAdapterTestParamsForBackends(
|
std::vector<AdapterTestParam> GetAvailableAdapterTestParamsForBackends(
|
||||||
|
|
|
@ -107,6 +107,15 @@ class ParamGenerator {
|
||||||
ParamTuple mParams;
|
ParamTuple mParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BackendTestConfig;
|
||||||
|
struct AdapterTestParam;
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
std::vector<AdapterTestParam> GetAvailableAdapterTestParamsForBackends(
|
||||||
|
const BackendTestConfig* params,
|
||||||
|
size_t numParams);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Param, typename... Params>
|
template <typename Param, typename... Params>
|
||||||
auto MakeParamGenerator(std::vector<BackendTestConfig>&& first,
|
auto MakeParamGenerator(std::vector<BackendTestConfig>&& first,
|
||||||
std::initializer_list<Params>&&... params) {
|
std::initializer_list<Params>&&... params) {
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include "tests/perf_tests/DawnPerfTest.h"
|
#include "tests/perf_tests/DawnPerfTest.h"
|
||||||
|
|
||||||
#include "tests/ParamGenerator.h"
|
|
||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -148,9 +147,8 @@ TEST_P(BufferUploadPerf, Run) {
|
||||||
RunTest();
|
RunTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_PERF_TEST_SUITE_P(BufferUploadPerf,
|
DAWN_INSTANTIATE_TEST_P(BufferUploadPerf,
|
||||||
{D3D12Backend(), MetalBackend(), OpenGLBackend(),
|
{D3D12Backend(), MetalBackend(), OpenGLBackend(), VulkanBackend()},
|
||||||
VulkanBackend()},
|
|
||||||
{UploadMethod::WriteBuffer, UploadMethod::MappedAtCreation},
|
{UploadMethod::WriteBuffer, UploadMethod::MappedAtCreation},
|
||||||
{UploadSize::BufferSize_1KB, UploadSize::BufferSize_64KB,
|
{UploadSize::BufferSize_1KB, UploadSize::BufferSize_64KB,
|
||||||
UploadSize::BufferSize_1MB, UploadSize::BufferSize_4MB,
|
UploadSize::BufferSize_1MB, UploadSize::BufferSize_4MB,
|
||||||
|
|
|
@ -120,10 +120,4 @@ class DawnPerfTestWithParams : public DawnTestWithParams<Params>, public DawnPer
|
||||||
|
|
||||||
using DawnPerfTest = DawnPerfTestWithParams<>;
|
using DawnPerfTest = DawnPerfTestWithParams<>;
|
||||||
|
|
||||||
#define DAWN_INSTANTIATE_PERF_TEST_SUITE_P(testName, ...) \
|
|
||||||
INSTANTIATE_TEST_SUITE_P( \
|
|
||||||
, testName, ::testing::ValuesIn(MakeParamGenerator<testName::ParamType>(__VA_ARGS__)), \
|
|
||||||
testing::PrintToStringParamName()); \
|
|
||||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(testName)
|
|
||||||
|
|
||||||
#endif // TESTS_PERFTESTS_DAWNPERFTEST_H_
|
#endif // TESTS_PERFTESTS_DAWNPERFTEST_H_
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "common/Assert.h"
|
#include "common/Assert.h"
|
||||||
#include "common/Constants.h"
|
#include "common/Constants.h"
|
||||||
#include "common/Math.h"
|
#include "common/Math.h"
|
||||||
#include "tests/ParamGenerator.h"
|
|
||||||
#include "utils/ComboRenderPipelineDescriptor.h"
|
#include "utils/ComboRenderPipelineDescriptor.h"
|
||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
|
@ -607,7 +606,7 @@ TEST_P(DrawCallPerf, Run) {
|
||||||
RunTest();
|
RunTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_PERF_TEST_SUITE_P(
|
DAWN_INSTANTIATE_TEST_P(
|
||||||
DrawCallPerf,
|
DrawCallPerf,
|
||||||
{D3D12Backend(), MetalBackend(), OpenGLBackend(), VulkanBackend(),
|
{D3D12Backend(), MetalBackend(), OpenGLBackend(), VulkanBackend(),
|
||||||
VulkanBackend({"skip_validation"})},
|
VulkanBackend({"skip_validation"})},
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include "tests/perf_tests/DawnPerfTest.h"
|
#include "tests/perf_tests/DawnPerfTest.h"
|
||||||
|
|
||||||
#include "tests/ParamGenerator.h"
|
|
||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -355,47 +354,29 @@ namespace {
|
||||||
MatMulVec4TwoDimSharedArray
|
MatMulVec4TwoDimSharedArray
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ShaderRobustnessParams : AdapterTestParam {
|
std::ostream& operator<<(std::ostream& ostream, const MatMulMethod& matMulMethod) {
|
||||||
ShaderRobustnessParams(const AdapterTestParam& param,
|
switch (matMulMethod) {
|
||||||
MatMulMethod matmulMethod,
|
|
||||||
uint32_t dimAOuter,
|
|
||||||
uint32_t dimInner,
|
|
||||||
uint32_t dimBOuter)
|
|
||||||
: AdapterTestParam(param),
|
|
||||||
matmulMethod(matmulMethod),
|
|
||||||
dimAOuter(dimAOuter),
|
|
||||||
dimInner(dimInner),
|
|
||||||
dimBOuter(dimBOuter) {
|
|
||||||
}
|
|
||||||
|
|
||||||
MatMulMethod matmulMethod;
|
|
||||||
uint32_t dimAOuter;
|
|
||||||
uint32_t dimInner;
|
|
||||||
uint32_t dimBOuter;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ostream, const ShaderRobustnessParams& param) {
|
|
||||||
ostream << static_cast<const AdapterTestParam&>(param);
|
|
||||||
switch (param.matmulMethod) {
|
|
||||||
case MatMulMethod::MatMulFloatOneDimSharedArray:
|
case MatMulMethod::MatMulFloatOneDimSharedArray:
|
||||||
ostream << "_MatMulFloatOneDimSharedArray";
|
ostream << "MatMulFloatOneDimSharedArray";
|
||||||
break;
|
break;
|
||||||
case MatMulMethod::MatMulFloatTwoDimSharedArray:
|
case MatMulMethod::MatMulFloatTwoDimSharedArray:
|
||||||
ostream << "_MatMulFloatTwoDimSharedArray";
|
ostream << "MatMulFloatTwoDimSharedArray";
|
||||||
break;
|
break;
|
||||||
case MatMulMethod::MatMulVec4OneDimSharedArray:
|
case MatMulMethod::MatMulVec4OneDimSharedArray:
|
||||||
ostream << "_MatMulVec4OneDimSharedArray";
|
ostream << "MatMulVec4OneDimSharedArray";
|
||||||
break;
|
break;
|
||||||
case MatMulMethod::MatMulVec4TwoDimSharedArray:
|
case MatMulMethod::MatMulVec4TwoDimSharedArray:
|
||||||
ostream << "_MatMulVec4TwoDimSharedArray";
|
ostream << "MatMulVec4TwoDimSharedArray";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream << "_" << param.dimAOuter << "_" << param.dimInner << "_" << param.dimBOuter;
|
|
||||||
|
|
||||||
return ostream;
|
return ostream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using DimAOuter = uint32_t;
|
||||||
|
using DimInner = uint32_t;
|
||||||
|
using DimBOuter = uint32_t;
|
||||||
|
DAWN_TEST_PARAM_STRUCT(ShaderRobustnessParams, MatMulMethod, DimAOuter, DimInner, DimBOuter)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Test the execution time of matrix multiplication (A [dimAOuter, dimInner] * B [dimInner,
|
// Test the execution time of matrix multiplication (A [dimAOuter, dimInner] * B [dimInner,
|
||||||
|
@ -404,9 +385,9 @@ class ShaderRobustnessPerf : public DawnPerfTestWithParams<ShaderRobustnessParam
|
||||||
public:
|
public:
|
||||||
ShaderRobustnessPerf()
|
ShaderRobustnessPerf()
|
||||||
: DawnPerfTestWithParams(kNumIterations, 1),
|
: DawnPerfTestWithParams(kNumIterations, 1),
|
||||||
mDimAOuter(GetParam().dimAOuter),
|
mDimAOuter(GetParam().mDimAOuter),
|
||||||
mDimInner(GetParam().dimInner),
|
mDimInner(GetParam().mDimInner),
|
||||||
mDimBOuter(GetParam().dimBOuter) {
|
mDimBOuter(GetParam().mDimBOuter) {
|
||||||
}
|
}
|
||||||
~ShaderRobustnessPerf() override = default;
|
~ShaderRobustnessPerf() override = default;
|
||||||
|
|
||||||
|
@ -452,7 +433,7 @@ void ShaderRobustnessPerf::SetUp() {
|
||||||
device, uniformData, sizeof(uniformData), wgpu::BufferUsage::Uniform);
|
device, uniformData, sizeof(uniformData), wgpu::BufferUsage::Uniform);
|
||||||
|
|
||||||
wgpu::ShaderModule module;
|
wgpu::ShaderModule module;
|
||||||
switch (GetParam().matmulMethod) {
|
switch (GetParam().mMatMulMethod) {
|
||||||
case MatMulMethod::MatMulFloatOneDimSharedArray: {
|
case MatMulMethod::MatMulFloatOneDimSharedArray: {
|
||||||
module =
|
module =
|
||||||
utils::CreateShaderModule(device, kMatMulFloatOneDimensionalSharedArray.c_str());
|
utils::CreateShaderModule(device, kMatMulFloatOneDimensionalSharedArray.c_str());
|
||||||
|
@ -515,18 +496,18 @@ TEST_P(ShaderRobustnessPerf, Run) {
|
||||||
RunTest();
|
RunTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_PERF_TEST_SUITE_P(ShaderRobustnessPerf,
|
DAWN_INSTANTIATE_TEST_P(ShaderRobustnessPerf,
|
||||||
// TODO: Remove "use_tint_generator" once the following bug is
|
// TODO: Remove "use_tint_generator" once the following bug is
|
||||||
// fixed https://bugs.chromium.org/p/tint/issues/detail?id=744.
|
// fixed https://bugs.chromium.org/p/tint/issues/detail?id=744.
|
||||||
{D3D12Backend({}, {"use_tint_generator"}),
|
{D3D12Backend({}, {"use_tint_generator"}),
|
||||||
D3D12Backend({"disable_robustness"}, {"use_tint_generator"}),
|
D3D12Backend({"disable_robustness"}, {"use_tint_generator"}),
|
||||||
MetalBackend(), MetalBackend({"disable_robustness"}, {}),
|
MetalBackend(), MetalBackend({"disable_robustness"}, {}), OpenGLBackend(),
|
||||||
OpenGLBackend(), OpenGLBackend({"disable_robustness"}, {}),
|
OpenGLBackend({"disable_robustness"}, {}), VulkanBackend(),
|
||||||
VulkanBackend(), VulkanBackend({"disable_robustness"}, {})},
|
VulkanBackend({"disable_robustness"}, {})},
|
||||||
{MatMulMethod::MatMulFloatOneDimSharedArray,
|
{MatMulMethod::MatMulFloatOneDimSharedArray,
|
||||||
MatMulMethod::MatMulFloatTwoDimSharedArray,
|
MatMulMethod::MatMulFloatTwoDimSharedArray,
|
||||||
MatMulMethod::MatMulVec4OneDimSharedArray,
|
MatMulMethod::MatMulVec4OneDimSharedArray,
|
||||||
MatMulMethod::MatMulVec4TwoDimSharedArray},
|
MatMulMethod::MatMulVec4TwoDimSharedArray},
|
||||||
{512},
|
{512u},
|
||||||
{512},
|
{512u},
|
||||||
{512});
|
{512u});
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include "tests/perf_tests/DawnPerfTest.h"
|
#include "tests/perf_tests/DawnPerfTest.h"
|
||||||
|
|
||||||
#include "tests/ParamGenerator.h"
|
|
||||||
#include "utils/ComboRenderPipelineDescriptor.h"
|
#include "utils/ComboRenderPipelineDescriptor.h"
|
||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
|
@ -146,8 +145,7 @@ TEST_P(SubresourceTrackingPerf, Run) {
|
||||||
RunTest();
|
RunTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_PERF_TEST_SUITE_P(SubresourceTrackingPerf,
|
DAWN_INSTANTIATE_TEST_P(SubresourceTrackingPerf,
|
||||||
{D3D12Backend(), MetalBackend(), OpenGLBackend(),
|
{D3D12Backend(), MetalBackend(), OpenGLBackend(), VulkanBackend()},
|
||||||
VulkanBackend()},
|
|
||||||
{1, 4, 16, 256},
|
{1, 4, 16, 256},
|
||||||
{2, 3, 8});
|
{2, 3, 8});
|
||||||
|
|
Loading…
Reference in New Issue