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

2017-05-19 Thread Nicolai Hähnle

On 18.05.2017 22:46, Marek Olšák wrote:

From: Marek Olšák 

so that LLVM doesn't allocate SGPRs where XNACK is.


Reviewed-by: Nicolai Hähnle 



Cc: 17.1 
---
 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.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-05-18 Thread Marek Olšák
On Thu, May 18, 2017 at 11:23 PM, Matt Arsenault  wrote:
>
>> On May 18, 2017, at 22:46, Marek Olšák  wrote:
>>
>> From: Marek Olšák 
>>
>> so that LLVM doesn't allocate SGPRs where XNACK is.
>>
>> Cc: 17.1 
>
> You shouldn’t be explicitly enabling xnack. This sounds like a workaround for 
> a backend bug, and this has other consequences than changing the reserved 
> registers. Do you have an example of where this is a problem?

What are the other consequences?

We don't want XNACK on Carrizo/Stoney, because XNACK is always
disabled on the graphics ring. It's only enabled on compute rings,
which we don't use. GFX9 enables XNACK on all rings at the moment.

XNACK AKA instruction replay is a per-VMID setting in the kernel
driver and it might change in the future. It's not a fixed property of
the GPU architecture.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-05-18 Thread Matt Arsenault

> On May 18, 2017, at 22:46, Marek Olšák  wrote:
> 
> From: Marek Olšák 
> 
> so that LLVM doesn't allocate SGPRs where XNACK is.
> 
> Cc: 17.1 

You shouldn’t be explicitly enabling xnack. This sounds like a workaround for a 
backend bug, and this has other consequences than changing the reserved 
registers. Do you have an example of where this is a problem?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev