Request flushing denorms to zero in OpenCL
[alexxy/gromacs.git] / src / gromacs / gpu_utils / ocl_compiler.cpp
index 957c6bc45387d0832fc20d850e6a6addb47cefab..f54a94fa42dca39c6f4e2683933c4da7df178659 100644 (file)
@@ -179,6 +179,11 @@ selectCompilerOptions(ocl_vendor_id_t deviceVendorId)
     if (getenv("GMX_OCL_DISABLE_FASTMATH") == NULL)
     {
         compilerOptions += " -cl-fast-relaxed-math";
+
+        // Hint to the compiler that it can flush denorms to zero.
+        // In CUDA this is triggered by the -use_fast_math flag, equivalent with
+        // -cl-fast-relaxed-math, hence the inclusion on the conditional block.
+        compilerOptions += " -cl-denorms-are-zero";
     }
 
     if ((deviceVendorId == OCL_VENDOR_NVIDIA) && getenv("GMX_OCL_VERBOSE"))