ac: update and document fast math flags used by radeonsi

This should have no effect, because we never use FP division, but
it's safer for the future.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4696>
This commit is contained in:
Marek Olšák 2020-04-22 22:38:14 -04:00 committed by Marge Bot
parent 3bb65c0670
commit f2c2a28073
3 changed files with 14 additions and 4 deletions

View file

@ -84,8 +84,18 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx,
case AC_FLOAT_MODE_DEFAULT:
case AC_FLOAT_MODE_DENORM_FLUSH_TO_ZERO:
break;
case AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH:
flags.setNoSignedZeros();
case AC_FLOAT_MODE_DEFAULT_OPENGL:
/* Allow optimizations to treat the sign of a zero argument or
* result as insignificant.
*/
flags.setNoSignedZeros(); /* nsz */
/* Allow optimizations to use the reciprocal of an argument
* rather than perform division.
*/
flags.setAllowReciprocal(); /* arcp */
llvm::unwrap(builder)->setFastMathFlags(flags);
break;
}

View file

@ -70,7 +70,7 @@ enum ac_target_machine_options {
enum ac_float_mode {
AC_FLOAT_MODE_DEFAULT,
AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH,
AC_FLOAT_MODE_DEFAULT_OPENGL,
AC_FLOAT_MODE_DENORM_FLUSH_TO_ZERO,
};

View file

@ -134,7 +134,7 @@ void si_llvm_context_init(struct si_shader_context *ctx, struct si_screen *sscre
ctx->compiler = compiler;
ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class, sscreen->info.family,
AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH, wave_size, 64);
AC_FLOAT_MODE_DEFAULT_OPENGL, wave_size, 64);
}
void si_llvm_create_func(struct si_shader_context *ctx, const char *name, LLVMTypeRef *return_types,