mesa/1003-gallivm-add-more-optlevel-for-debug-purpose-on-loong.patch
2024-01-08 14:34:51 +08:00

67 lines
2.5 KiB
Diff

From 1043c69f60f9042d770bb92627a6f7736637d739 Mon Sep 17 00:00:00 2001
From: suijingfeng <suijingfeng@loongson.cn>
Date: Fri, 9 Jul 2021 15:25:06 +0800
Subject: [PATCH 4/4] gallivm: add more optlevel for debug purpose on
loongarch64
Signed-off-by: suijingfeng <suijingfeng@loongson.cn>
---
src/gallium/auxiliary/gallivm/lp_bld_debug.h | 6 ++++++
src/gallium/auxiliary/gallivm/lp_bld_init.c | 16 ++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
index a5dd7b8..86604e0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
@@ -49,6 +49,12 @@
#define GALLIVM_PERF_NO_OPT (1 << 3)
#define GALLIVM_PERF_NO_AOS_SAMPLING (1 << 4)
+#if defined(PIPE_ARCH_LOONGARCH64)
+#define GALLIVM_PERF_OPT_O1 (1 << 5)
+#define GALLIVM_PERF_OPT_O2 (1 << 6)
+#define GALLIVM_PERF_OPT_O3 (1 << 7)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 9c251d8..4a9ee17 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -60,6 +60,11 @@ static const struct debug_named_value lp_bld_perf_flags[] = {
{ "no_quad_lod", GALLIVM_PERF_NO_QUAD_LOD, "disable quad_lod optimization" },
{ "no_aos_sampling", GALLIVM_PERF_NO_AOS_SAMPLING, "disable aos sampling optimization" },
{ "nopt", GALLIVM_PERF_NO_OPT, "disable optimization passes to speed up shader compilation" },
+#if defined(PIPE_ARCH_LOONGARCH64)
+ { "o3", GALLIVM_PERF_OPT_O3, "enable aggressive optimization passes" },
+ { "o2", GALLIVM_PERF_OPT_O2, "enable medium optimization passes" },
+ { "o1", GALLIVM_PERF_OPT_O1, "enable less optimization passes" },
+#endif
DEBUG_NAMED_VALUE_END
};
@@ -270,6 +275,17 @@ init_gallivm_engine(struct gallivm_state *gallivm)
optlevel = Default;
}
+#if defined(PIPE_ARCH_LOONGARCH64)
+ if (gallivm_perf & GALLIVM_PERF_OPT_O3)
+ optlevel = Aggressive;
+ else if (gallivm_perf & GALLIVM_PERF_OPT_O2)
+ optlevel = Default;
+ else if (gallivm_perf & GALLIVM_PERF_OPT_O1)
+ optlevel = Less;
+ else
+ optlevel = Default;
+#endif
+
ret = lp_build_create_jit_compiler_for_module(&gallivm->engine,
&gallivm->code,
gallivm->cache,
--
2.20.1