From eb5cabf3ae6e7a127876f1e66a86809b9441ef4a Mon Sep 17 00:00:00 2001 From: George Ouzounoudis Date: Tue, 15 Aug 2023 19:40:26 +0300 Subject: [PATCH] nouveau/codegen: Add a 4th optimization level for MemoryOpts MemoryOpt optimization pass makes some tests in NVK fail. Until its fixed in codegen or implemented on NIR instead, move it to a 4th level. This affects the GL driver as well, but less often. Fixes dEQP-VK.pipeline.monolithic.dynamic_control_points.change_output* Part-of: --- src/gallium/drivers/nouveau/nv50/nv50_program.c | 4 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 4 ++-- src/nouveau/codegen/nv50_ir_driver.h | 3 ++- src/nouveau/codegen/nv50_ir_peephole.cpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c index f38b98d6905..331a75baa8c 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c @@ -375,11 +375,11 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset, info_out.driverPriv = prog; #ifndef NDEBUG - info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3); + info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 4); info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0); info->omitLineNum = debug_get_num_option("NV50_PROG_DEBUG_OMIT_LINENUM", 0); #else - info->optLevel = 3; + info->optLevel = 4; #endif ret = nv50_ir_generate_code(info, &info_out); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index b8c9278fb80..e806977af73 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -594,11 +594,11 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset, #ifndef NDEBUG info->target = debug_get_num_option("NV50_PROG_CHIPSET", chipset); - info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3); + info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 4); info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0); info->omitLineNum = debug_get_num_option("NV50_PROG_DEBUG_OMIT_LINENUM", 0); #else - info->optLevel = 3; + info->optLevel = 4; #endif info->bin.smemSize = prog->cp.smem_size; diff --git a/src/nouveau/codegen/nv50_ir_driver.h b/src/nouveau/codegen/nv50_ir_driver.h index ab13e603a26..712e56676d3 100644 --- a/src/nouveau/codegen/nv50_ir_driver.h +++ b/src/nouveau/codegen/nv50_ir_driver.h @@ -95,7 +95,8 @@ struct nv50_ir_prog_info uint8_t type; /* PIPE_SHADER */ - uint8_t optLevel; /* optimization level (0 to 3) */ + uint8_t optLevel; /* optimization level (0 to 4). Level 4 enables MemoryOpt + * which does not work well with NVK */ uint8_t dbgFlags; bool omitLineNum; /* only used for printing the prog when dbgFlags is set */ diff --git a/src/nouveau/codegen/nv50_ir_peephole.cpp b/src/nouveau/codegen/nv50_ir_peephole.cpp index 9088e614f7e..53f4b106157 100644 --- a/src/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/nouveau/codegen/nv50_ir_peephole.cpp @@ -4092,7 +4092,7 @@ Program::optimizeSSA(int level) RUN_PASS(2, LateAlgebraicOpt, run); RUN_PASS(1, LoadPropagation, run); RUN_PASS(1, IndirectPropagation, run); - RUN_PASS(2, MemoryOpt, run); + RUN_PASS(4, MemoryOpt, run); RUN_PASS(2, LocalCSE, run); RUN_PASS(0, DeadCodeElim, buryAll);