[Mesa-dev] [PATCH] radeonsi/gfx9: compile shaders with +xnack

Nicolai Hähnle nhaehnle at gmail.com
Fri May 19 09:31:11 UTC 2017


On 18.05.2017 22:46, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> so that LLVM doesn't allocate SGPRs where XNACK is.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

>
> Cc: 17.1 <mesa-stable at lists.freedesktop.org>
> ---
>  src/gallium/drivers/radeonsi/si_pipe.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index eaa3348..6f82e29 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -26,23 +26,20 @@
>  #include "si_shader_internal.h"
>  #include "sid.h"
>
>  #include "radeon/radeon_uvd.h"
>  #include "util/u_memory.h"
>  #include "util/u_suballoc.h"
>  #include "util/u_tests.h"
>  #include "vl/vl_decoder.h"
>  #include "../ddebug/dd_util.h"
>
> -#define SI_LLVM_DEFAULT_FEATURES \
> -	"+DumpCode,+vgpr-spilling,-fp32-denormals,-xnack"
> -
>  /*
>   * pipe_context
>   */
>  static void si_destroy_context(struct pipe_context *context)
>  {
>  	struct si_context *sctx = (struct si_context *)context;
>  	int i;
>
>  	/* Unreference the framebuffer normally to disable related logic
>  	 * properly.
> @@ -120,26 +117,30 @@ static void si_emit_string_marker(struct pipe_context *ctx,
>  {
>  	struct si_context *sctx = (struct si_context *)ctx;
>
>  	dd_parse_apitrace_marker(string, len, &sctx->apitrace_call_number);
>  }
>
>  static LLVMTargetMachineRef
>  si_create_llvm_target_machine(struct si_screen *sscreen)
>  {
>  	const char *triple = "amdgcn--";
> +	char features[256];
> +
> +	snprintf(features, sizeof(features),
> +		 "+DumpCode,+vgpr-spilling,-fp32-denormals,+fp64-denormals%s%s",
> +		 sscreen->b.chip_class >= GFX9 ? ",+xnack" : ",-xnack",
> +		 sscreen->b.debug_flags & DBG_SI_SCHED ? ",+si-scheduler" : "");
>
>  	return LLVMCreateTargetMachine(si_llvm_get_amdgpu_target(triple), triple,
>  				       r600_get_llvm_processor_name(sscreen->b.family),
> -				       sscreen->b.debug_flags & DBG_SI_SCHED ?
> -					       SI_LLVM_DEFAULT_FEATURES ",+si-scheduler" :
> -					       SI_LLVM_DEFAULT_FEATURES,
> +				       features,
>  				       LLVMCodeGenLevelDefault,
>  				       LLVMRelocDefault,
>  				       LLVMCodeModelDefault);
>  }
>
>  static struct pipe_context *si_create_context(struct pipe_screen *screen,
>                                                unsigned flags)
>  {
>  	struct si_context *sctx = CALLOC_STRUCT(si_context);
>  	struct si_screen* sscreen = (struct si_screen *)screen;
>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list