[Mesa-dev] [PATCH 3/3] radeonsi: set unsafe fpmath on FP instructions when allowed by R600_DEBUG

Marek Olšák maraeo at gmail.com
Sun Nov 13 16:13:17 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 624a167..2f38949 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -15,20 +15,21 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "si_shader_internal.h"
+#include "si_pipe.h"
 #include "radeon/radeon_elf_util.h"
 
 #include "gallivm/lp_bld_const.h"
 #include "gallivm/lp_bld_gather.h"
 #include "gallivm/lp_bld_flow.h"
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_intr.h"
 #include "gallivm/lp_bld_misc.h"
 #include "gallivm/lp_bld_swizzle.h"
 #include "tgsi/tgsi_info.h"
@@ -1239,21 +1240,24 @@ void si_llvm_context_init(struct si_shader_context *ctx,
 	memset(ctx, 0, sizeof(*ctx));
 	ctx->shader = shader;
 	ctx->screen = sscreen;
 	ctx->tm = tm;
 	ctx->type = info ? info->processor : -1;
 
 	ctx->gallivm.context = LLVMContextCreate();
 	ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi",
 						ctx->gallivm.context);
 	LLVMSetTarget(ctx->gallivm.module, "amdgcn--");
-	ctx->gallivm.builder = LLVMCreateBuilderInContext(ctx->gallivm.context);
+
+	bool unsafe_fpmath = (sscreen->b.debug_flags & DBG_UNSAFE_MATH) != 0;
+	ctx->gallivm.builder = lp_create_builder(ctx->gallivm.context,
+						 unsafe_fpmath);
 
 	struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
 
 	bld_base->info = info;
 
 	if (info && info->array_max[TGSI_FILE_TEMPORARY] > 0) {
 		int size = info->array_max[TGSI_FILE_TEMPORARY];
 
 		ctx->temp_arrays = CALLOC(size, sizeof(ctx->temp_arrays[0]));
 		ctx->temp_array_allocas = CALLOC(size, sizeof(ctx->temp_array_allocas[0]));
-- 
2.7.4



More information about the mesa-dev mailing list