Hash :
e495e7fd
Author :
Date :
2022-10-14T13:52:47
Redo perf and trace test parameters. - Moves common argument parsing code into test_util. - Changes the perf test arg parsing to use the common functions. - Adds new --use-angle and --use-gl parameters to the trace tests. - Also adds new --offscreen and --vsync parameters to the traces. - Removes the now unneeded --enable-all-trace-tests argument. - Both --arg=value and --arg value work in test suites now. Now, instead of using --enable-all-trace-tests you can specify the backend with --use-angle=swiftshader, --offscreen, or combinations of those parameters. The test names are the same as they were before, but only the configured tests will run in a session. We could opt to simplify the test names in later CLs if we want to simplify the test running. Ideally we'd keep the perf reporting the same because then we'd keep the time series the same on the test infra. This also allows us to split up the trace tests into separate targets on the bots, which will better allow us to control the workloads and sampling of the tests. For example: - angle_perftests becomes - angle_perftests (microbenchmarks) - angle_trace_perf_vulkan_tests (traces with vulkan back-end) - angle_trace_perf_native_tests (traces with system GL) Bug: angleproject:7755 Change-Id: I537168f3a6de96425dfda05ed98220eff9b19b76 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3956937 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ANGLEPerfTestArgs.cpp:
// Parse command line arguments for angle_perftests.
//
#include "ANGLEPerfTestArgs.h"
#include <string.h>
#include <sstream>
#include "util/test_utils.h"
namespace angle
{
bool gCalibration = false;
int gStepsPerTrial = std::numeric_limits<int>::max();
int gMaxStepsPerformed = 0;
bool gEnableTrace = false;
const char *gTraceFile = "ANGLETrace.json";
const char *gScreenshotDir = nullptr;
const char *gRenderTestOutputDir = nullptr;
bool gSaveScreenshots = false;
int gScreenshotFrame = 1;
bool gVerboseLogging = false;
int gCalibrationTimeSeconds = 1;
int gMaxTrialTimeSeconds = 0;
int gTestTrials = 3;
bool gNoFinish = false;
bool gRetraceMode = false;
bool gMinimizeGPUWork = false;
bool gTraceTestValidation = false;
const char *gPerfCounters = nullptr;
const char *gUseANGLE = nullptr;
const char *gUseGL = nullptr;
bool gOffscreen = false;
bool gVsync = false;
bool gOneFrameOnly = false;
bool gNoWarmup = false;
int gFixedTestTime = 0;
// Default to three warmup trials. There's no science to this. More than two was experimentally
// helpful on a Windows NVIDIA setup when testing with Vulkan and native trace tests.
int gWarmupTrials = 3;
int gWarmupSteps = std::numeric_limits<int>::max();
namespace
{
bool PerfTestArg(int *argc, char **argv, int argIndex)
{
return ParseFlag("--one-frame-only", argc, argv, argIndex, &gOneFrameOnly) ||
ParseFlag("--enable-trace", argc, argv, argIndex, &gEnableTrace) ||
ParseFlag("--calibration", argc, argv, argIndex, &gCalibration) ||
ParseFlag("-v", argc, argv, argIndex, &gVerboseLogging) ||
ParseFlag("--verbose", argc, argv, argIndex, &gVerboseLogging) ||
ParseFlag("--verbose-logging", argc, argv, argIndex, &gVerboseLogging) ||
ParseFlag("--no-warmup", argc, argv, argIndex, &gNoWarmup) ||
ParseFlag("--no-finish", argc, argv, argIndex, &gNoFinish) ||
ParseFlag("--minimize-gpu-work", argc, argv, argIndex, &gMinimizeGPUWork) ||
ParseCStringArg("--trace-file", argc, argv, argIndex, &gTraceFile) ||
ParseCStringArg("--perf-counters", argc, argv, argIndex, &gPerfCounters) ||
ParseIntArg("--steps-per-trial", argc, argv, argIndex, &gStepsPerTrial) ||
ParseIntArg("--max-steps-performed", argc, argv, argIndex, &gMaxStepsPerformed) ||
ParseIntArg("--fixed-test-time", argc, argv, argIndex, &gFixedTestTime) ||
ParseIntArg("--warmup-trials", argc, argv, argIndex, &gWarmupTrials) ||
ParseIntArg("--warmup-steps", argc, argv, argIndex, &gWarmupSteps) ||
ParseIntArg("--calibration-time", argc, argv, argIndex, &gCalibrationTimeSeconds) ||
ParseIntArg("--trial-time", argc, argv, argIndex, &gMaxTrialTimeSeconds) ||
ParseIntArg("--max-trial-time", argc, argv, argIndex, &gMaxTrialTimeSeconds) ||
ParseIntArg("--trials", argc, argv, argIndex, &gTestTrials);
}
bool TraceTestArg(int *argc, char **argv, int argIndex)
{
return ParseFlag("--retrace-mode", argc, argv, argIndex, &gRetraceMode) ||
ParseFlag("--validation", argc, argv, argIndex, &gTraceTestValidation) ||
ParseFlag("--save-screenshots", argc, argv, argIndex, &gSaveScreenshots) ||
ParseFlag("--offscreen", argc, argv, argIndex, &gOffscreen) ||
ParseFlag("--vsync", argc, argv, argIndex, &gVsync) ||
ParseIntArg("--screenshot-frame", argc, argv, argIndex, &gScreenshotFrame) ||
ParseCStringArg("--render-test-output-dir", argc, argv, argIndex,
&gRenderTestOutputDir) ||
ParseCStringArg("--screenshot-dir", argc, argv, argIndex, &gScreenshotDir) ||
ParseCStringArg("--use-angle", argc, argv, argIndex, &gUseANGLE) ||
ParseCStringArg("--use-gl", argc, argv, argIndex, &gUseGL);
}
} // namespace
} // namespace angle
using namespace angle;
void ANGLEProcessPerfTestArgs(int *argc, char **argv)
{
for (int argIndex = 1; argIndex < *argc;)
{
if (!PerfTestArg(argc, argv, argIndex))
{
argIndex++;
}
}
if (gOneFrameOnly)
{
gStepsPerTrial = 1;
gWarmupTrials = 0;
}
if (gCalibration)
{
gTestTrials = 0;
}
if (gMaxStepsPerformed > 0)
{
gWarmupTrials = 0;
gTestTrials = 1;
gMaxTrialTimeSeconds = 36000;
}
if (gFixedTestTime != 0)
{
gMaxTrialTimeSeconds = gFixedTestTime;
gStepsPerTrial = std::numeric_limits<int>::max();
gTestTrials = 1;
gWarmupTrials = 0;
}
if (gNoWarmup)
{
gWarmupTrials = 0;
}
if (gMaxTrialTimeSeconds == 0)
{
gMaxTrialTimeSeconds = 10;
}
else
{
gCalibrationTimeSeconds = gMaxTrialTimeSeconds;
}
}
void ANGLEProcessTraceTestArgs(int *argc, char **argv)
{
ANGLEProcessPerfTestArgs(argc, argv);
for (int argIndex = 1; argIndex < *argc;)
{
if (!TraceTestArg(argc, argv, argIndex))
{
argIndex++;
}
}
if (gScreenshotDir)
{
// implicitly set here but not when using kRenderTestOutputDir
gSaveScreenshots = true;
}
if (gRenderTestOutputDir)
{
gScreenshotDir = gRenderTestOutputDir;
}
if (gTraceTestValidation)
{
gWarmupTrials = 0;
gTestTrials = 1;
gMaxTrialTimeSeconds = 600;
}
}