tools/run-cts: Add --unroll-const-eval-loops flag

Change-Id: I82152615a068bbabfbfa3dcc7d68025d6383684e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116291
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2023-01-10 16:21:26 +00:00 committed by Dawn LUCI CQ
parent ce42cf1b4c
commit c6236de7c2
1 changed files with 41 additions and 30 deletions

View File

@ -90,7 +90,7 @@ const (
type dawnNodeFlags []string type dawnNodeFlags []string
func (f *dawnNodeFlags) String() string { func (f *dawnNodeFlags) String() string {
return fmt.Sprint(strings.Join(*f, "")) return strings.Join(*f, "")
} }
func (f *dawnNodeFlags) Set(value string) error { func (f *dawnNodeFlags) Set(value string) error {
@ -129,8 +129,10 @@ func run() error {
backendDefault = "vulkan" backendDefault = "vulkan"
} }
unrollConstEvalLoopsDefault := runtime.GOOS != "windows"
var dawnNode, cts, node, npx, resultsPath, expectationsPath, logFilename, backend, coverageFile string var dawnNode, cts, node, npx, resultsPath, expectationsPath, logFilename, backend, coverageFile string
var printStdout, verbose, isolated, build, dumpShaders, genCoverage bool var printStdout, verbose, isolated, build, dumpShaders, unrollConstEvalLoops, genCoverage bool
var numRunners int var numRunners int
var flags dawnNodeFlags var flags dawnNodeFlags
flag.StringVar(&dawnNode, "dawn-node", "", "path to dawn.node module") flag.StringVar(&dawnNode, "dawn-node", "", "path to dawn.node module")
@ -150,6 +152,7 @@ func run() error {
flag.StringVar(&backend, "backend", backendDefault, "backend to use: default|null|webgpu|d3d11|d3d12|metal|vulkan|opengl|opengles."+ flag.StringVar(&backend, "backend", backendDefault, "backend to use: default|null|webgpu|d3d11|d3d12|metal|vulkan|opengl|opengles."+
" set to 'vulkan' if VK_ICD_FILENAMES environment variable is set, 'default' otherwise") " set to 'vulkan' if VK_ICD_FILENAMES environment variable is set, 'default' otherwise")
flag.BoolVar(&dumpShaders, "dump-shaders", false, "dump WGSL shaders. Enables --verbose") flag.BoolVar(&dumpShaders, "dump-shaders", false, "dump WGSL shaders. Enables --verbose")
flag.BoolVar(&unrollConstEvalLoops, "unroll-const-eval-loops", unrollConstEvalLoopsDefault, "unroll loops in const-eval tests")
flag.BoolVar(&genCoverage, "coverage", false, "displays coverage data. Enables --isolated") flag.BoolVar(&genCoverage, "coverage", false, "displays coverage data. Enables --isolated")
flag.StringVar(&coverageFile, "export-coverage", "", "write coverage data to the given path") flag.StringVar(&coverageFile, "export-coverage", "", "write coverage data to the given path")
flag.Parse() flag.Parse()
@ -229,16 +232,17 @@ func run() error {
} }
r := runner{ r := runner{
numRunners: numRunners, numRunners: numRunners,
printStdout: printStdout, printStdout: printStdout,
verbose: verbose, verbose: verbose,
node: node, node: node,
npx: npx, npx: npx,
dawnNode: dawnNode, dawnNode: dawnNode,
cts: cts, cts: cts,
tmpDir: filepath.Join(os.TempDir(), "dawn-cts"), tmpDir: filepath.Join(os.TempDir(), "dawn-cts"),
flags: flags, unrollConstEvalLoops: unrollConstEvalLoops,
results: testcaseStatuses{}, flags: flags,
results: testcaseStatuses{},
evalScript: func(main string) string { evalScript: func(main string) string {
return fmt.Sprintf(`require('./src/common/tools/setup-ts-in-node.js');require('./src/common/runtime/%v.ts');`, main) return fmt.Sprintf(`require('./src/common/tools/setup-ts-in-node.js');require('./src/common/runtime/%v.ts');`, main)
}, },
@ -411,24 +415,25 @@ func (c *cache) save(path string) error {
} }
type runner struct { type runner struct {
numRunners int numRunners int
printStdout bool printStdout bool
verbose bool verbose bool
node string node string
npx string npx string
dawnNode string dawnNode string
cts string cts string
tmpDir string tmpDir string
flags dawnNodeFlags unrollConstEvalLoops bool
covEnv *cov.Env flags dawnNodeFlags
coverageFile string covEnv *cov.Env
evalScript func(string) string coverageFile string
testcases []string evalScript func(string) string
expectations testcaseStatuses testcases []string
results testcaseStatuses expectations testcaseStatuses
log logger results testcaseStatuses
stdout io.WriteCloser log logger
colors bool // Colors enabled? stdout io.WriteCloser
colors bool // Colors enabled?
} }
// scanSourceTimestamps scans all the .js and .ts files in all subdirectories of // scanSourceTimestamps scans all the .js and .ts files in all subdirectories of
@ -654,6 +659,9 @@ func (r *runner) runServer(ctx context.Context, id int, caseIndices <-chan int,
if r.verbose { if r.verbose {
args = append(args, "--verbose") args = append(args, "--verbose")
} }
if r.unrollConstEvalLoops {
args = append(args, "--unroll-const-eval-loops")
}
for _, f := range r.flags { for _, f := range r.flags {
args = append(args, "--gpu-provider-flag", f) args = append(args, "--gpu-provider-flag", f)
} }
@ -1063,6 +1071,9 @@ func (r *runner) runTestcase(ctx context.Context, query string, profraw string)
if r.colors { if r.colors {
args = append(args, "--colors") args = append(args, "--colors")
} }
if r.unrollConstEvalLoops {
args = append(args, "--unroll-const-eval-loops")
}
for _, f := range r.flags { for _, f := range r.flags {
args = append(args, "--gpu-provider-flag", f) args = append(args, "--gpu-provider-flag", f)
} }