radv: remove useless RADV_DEBUG=unsafemath debug option
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 8 Nov 2019 07:22:15 +0000 (08:22 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 15 Nov 2019 08:07:34 +0000 (09:07 +0100)
This option is useless and shouldn't be used at all.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
docs/envvars.html
src/amd/llvm/ac_llvm_helper.cpp
src/amd/llvm/ac_llvm_util.h
src/amd/vulkan/radv_debug.h
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_nir_to_llvm.c
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index ccde327b3c4381011da69d1fa4946930d3647c37..a9c2ddb3ed692272112822d895895c574b380819 100644 (file)
@@ -603,8 +603,6 @@ Mesa EGL supports different sets of environment variables.  See the
    <dd>display info at startup</dd>
    <dt><code>syncshaders</code></dt>
    <dd>synchronize shaders after all draws/dispatches</dd>
-   <dt><code>unsafemath</code></dt>
-   <dd>enable unsafe math operations</dd>
    <dt><code>vmfaults</code></dt>
    <dd>check for VM memory faults via dmesg</dd>
    <dt><code>zerovram</code></dt>
index 5bd7453b5088cb5462260803adf3b052c6680f2a..6b4610597ed7a71e01304a9755f33ffb8122ad42 100644 (file)
@@ -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;
index a864f524fbe43282580a4c1d20fff1f3c978a237..de4ccfb2b9919f114513ac48156a928d8bc9597b 100644 (file)
@@ -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,
 };
 
index 435b0dfaec80425303474f4b044288a0a7bc8167..02691fe4c237848eccec45c6bab0ef7d154ae22e 100644 (file)
@@ -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 {
index a608c39c5e5d76a8944370196914a95cf4f581bd..4775609629f96ebe99c943d251d8dc3c8089fea3 100644 (file)
@@ -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},
index c6fd727b7aaa059ec9b4a506cd7daf3db568894f..37a07bcb339ead134bca28446829dbc84b86de62 100644 (file)
@@ -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;
index c187e3e7d2c81fa549b74956a8797cd7109eb7ba..4579bf10e454131a31ec7c26d224ead05c2b9fc7 100644 (file)
@@ -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)
index c4d9fe5ce3737015ee86d6436ab06e992ce44ab6..4bfcef18589b754fc1c7ee83986a786e76758971 100644 (file)
@@ -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,
index ad022b24ffe0e296db98195c23a236df8c3d8687..c2562c028c4e00ba4b42d32f4c7a6fab2a551f22 100644 (file)
@@ -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;
 
index 0482255bed58726879cf84ef408ffd4724759a58..0dde52e1303a8df08314333a5e67cad0d93a95ab 100644 (file)
@@ -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;