summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_debug.h16
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c25
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c6
4 files changed, 32 insertions, 21 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
index f96a1afa7aa..eeef0d6ba61 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
@@ -39,20 +39,22 @@
#define GALLIVM_DEBUG_TGSI (1 << 0)
#define GALLIVM_DEBUG_IR (1 << 1)
#define GALLIVM_DEBUG_ASM (1 << 2)
-#define GALLIVM_DEBUG_NO_OPT (1 << 3)
-#define GALLIVM_DEBUG_PERF (1 << 4)
-#define GALLIVM_DEBUG_NO_BRILINEAR (1 << 5)
-#define GALLIVM_DEBUG_NO_RHO_APPROX (1 << 6)
-#define GALLIVM_DEBUG_NO_QUAD_LOD (1 << 7)
-#define GALLIVM_DEBUG_GC (1 << 8)
-#define GALLIVM_DEBUG_DUMP_BC (1 << 9)
+#define GALLIVM_DEBUG_PERF (1 << 3)
+#define GALLIVM_DEBUG_GC (1 << 4)
+#define GALLIVM_DEBUG_DUMP_BC (1 << 5)
+#define GALLIVM_PERF_NO_BRILINEAR (1 << 0)
+#define GALLIVM_PERF_NO_RHO_APPROX (1 << 1)
+#define GALLIVM_PERF_NO_QUAD_LOD (1 << 2)
+#define GALLIVM_PERF_NO_OPT (1 << 3)
#ifdef __cplusplus
extern "C" {
#endif
+extern unsigned gallivm_perf;
+
#ifdef DEBUG
extern unsigned gallivm_debug;
#else
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 1f0a01cde67..e8bca5bc3af 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -59,6 +59,17 @@ static const bool use_mcjit = USE_MCJIT;
static bool use_mcjit = FALSE;
#endif
+unsigned gallivm_perf = 0;
+
+static const struct debug_named_value lp_bld_perf_flags[] = {
+ { "no_brilinear", GALLIVM_PERF_NO_BRILINEAR, "disable brilinear optimization" },
+ { "no_rho_approx", GALLIVM_PERF_NO_RHO_APPROX, "disable rho_approx optimization" },
+ { "no_quad_lod", GALLIVM_PERF_NO_QUAD_LOD, "disable quad_lod optimization" },
+ { "nopt", GALLIVM_PERF_NO_OPT, "disable optimization passes to speed up shader compilation" },
+ { "no_filter_hacks", GALLIVM_PERF_NO_BRILINEAR | GALLIVM_PERF_NO_RHO_APPROX |
+ GALLIVM_PERF_NO_QUAD_LOD, "disable filter optimization hacks" },
+ DEBUG_NAMED_VALUE_END
+};
#ifdef DEBUG
unsigned gallivm_debug = 0;
@@ -67,11 +78,7 @@ static const struct debug_named_value lp_bld_debug_flags[] = {
{ "tgsi", GALLIVM_DEBUG_TGSI, NULL },
{ "ir", GALLIVM_DEBUG_IR, NULL },
{ "asm", GALLIVM_DEBUG_ASM, NULL },
- { "nopt", GALLIVM_DEBUG_NO_OPT, NULL },
{ "perf", GALLIVM_DEBUG_PERF, NULL },
- { "no_brilinear", GALLIVM_DEBUG_NO_BRILINEAR, NULL },
- { "no_rho_approx", GALLIVM_DEBUG_NO_RHO_APPROX, NULL },
- { "no_quad_lod", GALLIVM_DEBUG_NO_QUAD_LOD, NULL },
{ "gc", GALLIVM_DEBUG_GC, NULL },
{ "dumpbc", GALLIVM_DEBUG_DUMP_BC, NULL },
DEBUG_NAMED_VALUE_END
@@ -136,7 +143,7 @@ create_pass_manager(struct gallivm_state *gallivm)
free(td_str);
}
- if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
+ if ((gallivm_perf & GALLIVM_PERF_NO_OPT) == 0) {
/*
* TODO: Evaluate passes some more - keeping in mind
* both quality of generated code and compile times.
@@ -240,7 +247,7 @@ init_gallivm_engine(struct gallivm_state *gallivm)
char *error = NULL;
int ret;
- if (gallivm_debug & GALLIVM_DEBUG_NO_OPT) {
+ if (gallivm_perf & GALLIVM_PERF_NO_OPT) {
optlevel = None;
}
else {
@@ -420,6 +427,8 @@ lp_build_init(void)
gallivm_debug = debug_get_option_gallivm_debug();
#endif
+ gallivm_perf = debug_get_flags_option("GALLIVM_PERF", lp_bld_perf_flags, 0 );
+
lp_set_target_options();
util_cpu_detect();
@@ -589,10 +598,10 @@ gallivm_compile_module(struct gallivm_state *gallivm)
LLVMWriteBitcodeToFile(gallivm->module, filename);
debug_printf("%s written\n", filename);
debug_printf("Invoke as \"opt %s %s | llc -O%d %s%s\"\n",
- gallivm_debug & GALLIVM_DEBUG_NO_OPT ? "-mem2reg" :
+ gallivm_debug & GALLIVM_PERF_NO_OPT ? "-mem2reg" :
"-sroa -early-cse -simplifycfg -reassociate "
"-mem2reg -constprop -instcombine -gvn",
- filename, gallivm_debug & GALLIVM_DEBUG_NO_OPT ? 0 : 2,
+ filename, gallivm_debug & GALLIVM_PERF_NO_OPT ? 0 : 2,
(HAVE_LLVM >= 0x0305) ? "[-mcpu=<-mcpu option>] " : "",
"[-mattr=<-mattr option(s)>]");
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 8f760f59fed..018cca8f9df 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -2825,13 +2825,13 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
bld.format_desc = util_format_description(static_texture_state->format);
bld.dims = dims;
- if (gallivm_debug & GALLIVM_DEBUG_NO_QUAD_LOD || op_is_lodq) {
+ if (gallivm_perf & GALLIVM_PERF_NO_QUAD_LOD || op_is_lodq) {
bld.no_quad_lod = TRUE;
}
- if (gallivm_debug & GALLIVM_DEBUG_NO_RHO_APPROX || op_is_lodq) {
+ if (gallivm_perf & GALLIVM_PERF_NO_RHO_APPROX || op_is_lodq) {
bld.no_rho_approx = TRUE;
}
- if (gallivm_debug & GALLIVM_DEBUG_NO_BRILINEAR || op_is_lodq) {
+ if (gallivm_perf & GALLIVM_PERF_NO_BRILINEAR || op_is_lodq) {
bld.no_brilinear = TRUE;
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 79ece639e35..5fecad4ea67 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2037,7 +2037,7 @@ lp_build_lod_property(
lod_property = LP_SAMPLER_LOD_SCALAR;
}
else if (bld_base->info->processor == PIPE_SHADER_FRAGMENT) {
- if (gallivm_debug & GALLIVM_DEBUG_NO_QUAD_LOD) {
+ if (gallivm_perf & GALLIVM_PERF_NO_QUAD_LOD) {
lod_property = LP_SAMPLER_LOD_PER_ELEMENT;
}
else {
@@ -2225,7 +2225,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
* cases exist in practice.
*/
if (bld->bld_base.info->processor == PIPE_SHADER_FRAGMENT) {
- if (gallivm_debug & GALLIVM_DEBUG_NO_QUAD_LOD) {
+ if (gallivm_perf & GALLIVM_PERF_NO_QUAD_LOD) {
lod_property = LP_SAMPLER_LOD_PER_ELEMENT;
}
else {
@@ -2394,7 +2394,7 @@ emit_sample(struct lp_build_tgsi_soa_context *bld,
* cases exist in practice.
*/
if (bld->bld_base.info->processor == PIPE_SHADER_FRAGMENT) {
- if (gallivm_debug & GALLIVM_DEBUG_NO_QUAD_LOD) {
+ if (gallivm_perf & GALLIVM_PERF_NO_QUAD_LOD) {
lod_property = LP_SAMPLER_LOD_PER_ELEMENT;
}
else {