From 519d9b30de96759369109e0653222f36381100e6 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 8 Nov 2019 08:22:15 +0100 Subject: [PATCH] radv: remove useless RADV_DEBUG=unsafemath debug option This option is useless and shouldn't be used at all. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- docs/envvars.html | 2 -- src/amd/llvm/ac_llvm_helper.cpp | 4 --- src/amd/llvm/ac_llvm_util.h | 1 - src/amd/vulkan/radv_debug.h | 45 +++++++++++++++---------------- src/amd/vulkan/radv_device.c | 4 +-- src/amd/vulkan/radv_nir_to_llvm.c | 26 +----------------- src/amd/vulkan/radv_pipeline.c | 2 -- src/amd/vulkan/radv_private.h | 11 ++++---- src/amd/vulkan/radv_shader.c | 1 - src/amd/vulkan/radv_shader.h | 1 - 10 files changed, 29 insertions(+), 68 deletions(-) diff --git a/docs/envvars.html b/docs/envvars.html index ccde327b3c4..a9c2ddb3ed6 100644 --- a/docs/envvars.html +++ b/docs/envvars.html @@ -603,8 +603,6 @@ Mesa EGL supports different sets of environment variables. See the
display info at startup
syncshaders
synchronize shaders after all draws/dispatches
-
unsafemath
-
enable unsafe math operations
vmfaults
check for VM memory faults via dmesg
zerovram
diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp index 5bd7453b508..6b4610597ed 100644 --- a/src/amd/llvm/ac_llvm_helper.cpp +++ b/src/amd/llvm/ac_llvm_helper.cpp @@ -88,10 +88,6 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx, flags.setNoSignedZeros(); llvm::unwrap(builder)->setFastMathFlags(flags); break; - case AC_FLOAT_MODE_UNSAFE_FP_MATH: - flags.setFast(); - llvm::unwrap(builder)->setFastMathFlags(flags); - break; } return builder; diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h index a864f524fbe..de4ccfb2b99 100644 --- a/src/amd/llvm/ac_llvm_util.h +++ b/src/amd/llvm/ac_llvm_util.h @@ -72,7 +72,6 @@ enum ac_target_machine_options { enum ac_float_mode { AC_FLOAT_MODE_DEFAULT, AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH, - AC_FLOAT_MODE_UNSAFE_FP_MATH, AC_FLOAT_MODE_DENORM_FLUSH_TO_ZERO, }; diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h index 435b0dfaec8..02691fe4c23 100644 --- a/src/amd/vulkan/radv_debug.h +++ b/src/amd/vulkan/radv_debug.h @@ -35,29 +35,28 @@ enum { RADV_DEBUG_DUMP_SHADER_STATS = 0x10, RADV_DEBUG_NO_HIZ = 0x20, RADV_DEBUG_NO_COMPUTE_QUEUE = 0x40, - RADV_DEBUG_UNSAFE_MATH = 0x80, - RADV_DEBUG_ALL_BOS = 0x100, - RADV_DEBUG_NO_IBS = 0x200, - RADV_DEBUG_DUMP_SPIRV = 0x400, - RADV_DEBUG_VM_FAULTS = 0x800, - RADV_DEBUG_ZERO_VRAM = 0x1000, - RADV_DEBUG_SYNC_SHADERS = 0x2000, - RADV_DEBUG_NO_SISCHED = 0x4000, - RADV_DEBUG_PREOPTIR = 0x8000, - RADV_DEBUG_NO_DYNAMIC_BOUNDS = 0x10000, - RADV_DEBUG_NO_OUT_OF_ORDER = 0x20000, - RADV_DEBUG_INFO = 0x40000, - RADV_DEBUG_ERRORS = 0x80000, - RADV_DEBUG_STARTUP = 0x100000, - RADV_DEBUG_CHECKIR = 0x200000, - RADV_DEBUG_NOTHREADLLVM = 0x400000, - RADV_DEBUG_NOBINNING = 0x800000, - RADV_DEBUG_NO_LOAD_STORE_OPT = 0x1000000, - RADV_DEBUG_NO_NGG = 0x2000000, - RADV_DEBUG_NO_SHADER_BALLOT = 0x4000000, - RADV_DEBUG_ALL_ENTRYPOINTS = 0x8000000, - RADV_DEBUG_DUMP_META_SHADERS = 0x10000000, - RADV_DEBUG_NO_MEMORY_CACHE = 0x20000000, + RADV_DEBUG_ALL_BOS = 0x80, + RADV_DEBUG_NO_IBS = 0x100, + RADV_DEBUG_DUMP_SPIRV = 0x200, + RADV_DEBUG_VM_FAULTS = 0x400, + RADV_DEBUG_ZERO_VRAM = 0x800, + RADV_DEBUG_SYNC_SHADERS = 0x1000, + RADV_DEBUG_NO_SISCHED = 0x2000, + RADV_DEBUG_PREOPTIR = 0x4000, + RADV_DEBUG_NO_DYNAMIC_BOUNDS = 0x8000, + RADV_DEBUG_NO_OUT_OF_ORDER = 0x10000, + RADV_DEBUG_INFO = 0x20000, + RADV_DEBUG_ERRORS = 0x40000, + RADV_DEBUG_STARTUP = 0x80000, + RADV_DEBUG_CHECKIR = 0x100000, + RADV_DEBUG_NOTHREADLLVM = 0x200000, + RADV_DEBUG_NOBINNING = 0x400000, + RADV_DEBUG_NO_LOAD_STORE_OPT = 0x800000, + RADV_DEBUG_NO_NGG = 0x1000000, + RADV_DEBUG_NO_SHADER_BALLOT = 0x2000000, + RADV_DEBUG_ALL_ENTRYPOINTS = 0x4000000, + RADV_DEBUG_DUMP_META_SHADERS = 0x8000000, + RADV_DEBUG_NO_MEMORY_CACHE = 0x10000000, }; enum { diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index a608c39c5e5..4775609629f 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -341,8 +341,7 @@ radv_physical_device_init(struct radv_physical_device *device, /* These flags affect shader compilation. */ uint64_t shader_env_flags = (device->instance->perftest_flags & RADV_PERFTEST_SISCHED ? 0x1 : 0) | - (device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH ? 0x2 : 0) | - (device->use_aco ? 0x4 : 0); + (device->use_aco ? 0x2 : 0); /* The gpu id is already embedded in the uuid so we just pass "radv" * when creating the cache. @@ -468,7 +467,6 @@ static const struct debug_control radv_debug_options[] = { {"shaderstats", RADV_DEBUG_DUMP_SHADER_STATS}, {"nohiz", RADV_DEBUG_NO_HIZ}, {"nocompute", RADV_DEBUG_NO_COMPUTE_QUEUE}, - {"unsafemath", RADV_DEBUG_UNSAFE_MATH}, {"allbos", RADV_DEBUG_ALL_BOS}, {"noibs", RADV_DEBUG_NO_IBS}, {"spirv", RADV_DEBUG_DUMP_SPIRV}, diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index c6fd727b7aa..37a07bcb339 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -435,24 +435,6 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef module, ac_llvm_set_workgroup_size(main_function, max_workgroup_size); - if (options->unsafe_math) { - /* These were copied from some LLVM test. */ - LLVMAddTargetDependentFunctionAttr(main_function, - "less-precise-fpmad", - "true"); - LLVMAddTargetDependentFunctionAttr(main_function, - "no-infs-fp-math", - "true"); - LLVMAddTargetDependentFunctionAttr(main_function, - "no-nans-fp-math", - "true"); - LLVMAddTargetDependentFunctionAttr(main_function, - "unsafe-fp-math", - "true"); - LLVMAddTargetDependentFunctionAttr(main_function, - "no-signed-zeros-fp-math", - "true"); - } return main_function; } @@ -4814,8 +4796,6 @@ LLVMModuleRef ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, if (shader_info->float_controls_mode & FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP32) { float_mode = AC_FLOAT_MODE_DENORM_FLUSH_TO_ZERO; - } else if (options->unsafe_math) { - float_mode = AC_FLOAT_MODE_UNSAFE_FP_MATH; } ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, @@ -5275,12 +5255,8 @@ radv_compile_gs_copy_shader(struct ac_llvm_compiler *ac_llvm, ctx.options = options; ctx.shader_info = shader_info; - enum ac_float_mode float_mode = - options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH : - AC_FLOAT_MODE_DEFAULT; - ac_llvm_context_init(&ctx.ac, ac_llvm, options->chip_class, - options->family, float_mode, 64, 64); + options->family, AC_FLOAT_MODE_DEFAULT, 64, 64); ctx.context = ctx.ac.context; ctx.is_gs_copy_shader = true; diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index c187e3e7d2c..4579bf10e45 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -156,8 +156,6 @@ static uint32_t get_hash_flags(struct radv_device *device) { uint32_t hash_flags = 0; - if (device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH) - hash_flags |= RADV_HASH_SHADER_UNSAFE_MATH; if (device->instance->debug_flags & RADV_DEBUG_NO_NGG) hash_flags |= RADV_HASH_SHADER_NO_NGG; if (device->instance->perftest_flags & RADV_PERFTEST_SISCHED) diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index c4d9fe5ce37..4bfcef18589 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1500,12 +1500,11 @@ struct radv_shader_module; #define RADV_HASH_SHADER_IS_GEOM_COPY_SHADER (1 << 0) #define RADV_HASH_SHADER_SISCHED (1 << 1) -#define RADV_HASH_SHADER_UNSAFE_MATH (1 << 2) -#define RADV_HASH_SHADER_NO_NGG (1 << 3) -#define RADV_HASH_SHADER_CS_WAVE32 (1 << 4) -#define RADV_HASH_SHADER_PS_WAVE32 (1 << 5) -#define RADV_HASH_SHADER_GE_WAVE32 (1 << 6) -#define RADV_HASH_SHADER_ACO (1 << 7) +#define RADV_HASH_SHADER_NO_NGG (1 << 2) +#define RADV_HASH_SHADER_CS_WAVE32 (1 << 3) +#define RADV_HASH_SHADER_PS_WAVE32 (1 << 4) +#define RADV_HASH_SHADER_GE_WAVE32 (1 << 5) +#define RADV_HASH_SHADER_ACO (1 << 6) void radv_hash_shaders(unsigned char *hash, diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index ad022b24ffe..c2562c028c4 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1188,7 +1188,6 @@ radv_shader_variant_compile(struct radv_device *device, if (key) options.key = *key; - options.unsafe_math = !!(device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH); options.supports_spill = true; options.robust_buffer_access = device->robust_buffer_access; diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 0482255bed5..0dde52e1303 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -125,7 +125,6 @@ struct radv_shader_variant_key { struct radv_nir_compiler_options { struct radv_pipeline_layout *layout; struct radv_shader_variant_key key; - bool unsafe_math; bool supports_spill; bool clamp_shadow_reference; bool robust_buffer_access; -- 2.30.2