Re: [Mesa-dev] [PATCH 5/9] gallium/radeon: always add +DumpCode to the LLVM target machine for LLVM <= 3.5
On Sat, Jan 2, 2016 at 11:01 PM, Nicolai Hähnlewrote: > What's the reason for always having +DumpCode? Generating the assembly is > some overhead that's usually unnecessary. Even if it's a small part of the > profiles I've seen, it still seems like a natural thing to just skip. From > what I can tell it should be dependent on any of the shader dumping flags + > DBG_CHECK_VM being set. In any case, I suppose that would be for a separate > commit. Yeah, I agree that we shouldn't always generate the assembly string. However, there is one case where we probably want to dump it always: when a shader cache is used. We'll have only one chance to compile a shader with a shader cache. If we decide not to generate the assembly, we won't have it for all subsequent uses of the shader (even in other processes). Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/9] gallium/radeon: always add +DumpCode to the LLVM target machine for LLVM <= 3.5
What's the reason for always having +DumpCode? Generating the assembly is some overhead that's usually unnecessary. Even if it's a small part of the profiles I've seen, it still seems like a natural thing to just skip. From what I can tell it should be dependent on any of the shader dumping flags + DBG_CHECK_VM being set. In any case, I suppose that would be for a separate commit. Cheers, Nicolai On 01.01.2016 09:13, Marek Olšák wrote: From: Marek OlšákIt's the same behavior that we use for later LLVM. --- src/gallium/drivers/r600/r600_llvm.c | 2 +- src/gallium/drivers/radeon/radeon_llvm_emit.c | 5 ++--- src/gallium/drivers/radeon/radeon_llvm_emit.h | 2 +- src/gallium/drivers/radeonsi/si_shader.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 1cc3031..7d93658 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -922,7 +922,7 @@ unsigned r600_llvm_compile( const char * gpu_family = r600_get_llvm_processor_name(family); memset(, 0, sizeof(struct radeon_shader_binary)); - r = radeon_llvm_compile(mod, , gpu_family, dump, dump, NULL); + r = radeon_llvm_compile(mod, , gpu_family, dump, NULL); r = r600_create_shader(bc, , use_kill); diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index 61ed940..f8c7f54 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -141,7 +141,7 @@ static void radeonDiagnosticHandler(LLVMDiagnosticInfoRef di, void *context) * @returns 0 for success, 1 for failure */ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary, -const char *gpu_family, bool dump_ir, bool dump_asm, +const char *gpu_family, bool dump_ir, LLVMTargetMachineRef tm) { @@ -165,8 +165,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binar } strncpy(cpu, gpu_family, CPU_STRING_LEN); memset(fs, 0, sizeof(fs)); - if (dump_asm) - strncpy(fs, "+DumpCode", FS_STRING_LEN); + strncpy(fs, "+DumpCode", FS_STRING_LEN); tm = LLVMCreateTargetMachine(target, triple, cpu, fs, LLVMCodeGenLevelDefault, LLVMRelocDefault, LLVMCodeModelDefault); diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h index e20aed9..5f956dd 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.h +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h @@ -38,7 +38,7 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type); LLVMTargetRef radeon_llvm_get_r600_target(const char *triple); unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary, -const char *gpu_family, bool dump_ir, bool dump_asm, +const char *gpu_family, bool dump_ir, LLVMTargetMachineRef tm); #endif /* RADEON_LLVM_EMIT_H */ diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index a9297a5..4044961 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -3884,7 +3884,7 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader, bool dump_ir = dump_asm && !(sscreen->b.debug_flags & DBG_NO_IR); r = radeon_llvm_compile(mod, >binary, - r600_get_llvm_processor_name(sscreen->b.family), dump_ir, dump_asm, tm); + r600_get_llvm_processor_name(sscreen->b.family), dump_ir, tm); if (r) return r; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/9] gallium/radeon: always add +DumpCode to the LLVM target machine for LLVM <= 3.5
From: Marek OlšákIt's the same behavior that we use for later LLVM. --- src/gallium/drivers/r600/r600_llvm.c | 2 +- src/gallium/drivers/radeon/radeon_llvm_emit.c | 5 ++--- src/gallium/drivers/radeon/radeon_llvm_emit.h | 2 +- src/gallium/drivers/radeonsi/si_shader.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 1cc3031..7d93658 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -922,7 +922,7 @@ unsigned r600_llvm_compile( const char * gpu_family = r600_get_llvm_processor_name(family); memset(, 0, sizeof(struct radeon_shader_binary)); - r = radeon_llvm_compile(mod, , gpu_family, dump, dump, NULL); + r = radeon_llvm_compile(mod, , gpu_family, dump, NULL); r = r600_create_shader(bc, , use_kill); diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index 61ed940..f8c7f54 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -141,7 +141,7 @@ static void radeonDiagnosticHandler(LLVMDiagnosticInfoRef di, void *context) * @returns 0 for success, 1 for failure */ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary, -const char *gpu_family, bool dump_ir, bool dump_asm, +const char *gpu_family, bool dump_ir, LLVMTargetMachineRef tm) { @@ -165,8 +165,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binar } strncpy(cpu, gpu_family, CPU_STRING_LEN); memset(fs, 0, sizeof(fs)); - if (dump_asm) - strncpy(fs, "+DumpCode", FS_STRING_LEN); + strncpy(fs, "+DumpCode", FS_STRING_LEN); tm = LLVMCreateTargetMachine(target, triple, cpu, fs, LLVMCodeGenLevelDefault, LLVMRelocDefault, LLVMCodeModelDefault); diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h index e20aed9..5f956dd 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.h +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h @@ -38,7 +38,7 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type); LLVMTargetRef radeon_llvm_get_r600_target(const char *triple); unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary, -const char *gpu_family, bool dump_ir, bool dump_asm, +const char *gpu_family, bool dump_ir, LLVMTargetMachineRef tm); #endif /* RADEON_LLVM_EMIT_H */ diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index a9297a5..4044961 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -3884,7 +3884,7 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader, bool dump_ir = dump_asm && !(sscreen->b.debug_flags & DBG_NO_IR); r = radeon_llvm_compile(mod, >binary, - r600_get_llvm_processor_name(sscreen->b.family), dump_ir, dump_asm, tm); + r600_get_llvm_processor_name(sscreen->b.family), dump_ir, tm); if (r) return r; -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev