[Mesa-dev] [PATCH] r600/llvm: use killgt info from llvm
Vincent Lejeune
vljn at ovi.com
Mon Apr 29 07:44:15 PDT 2013
---
src/gallium/drivers/r600/r600_llvm.c | 2 ++
src/gallium/drivers/r600/r600_llvm.h | 1 +
src/gallium/drivers/r600/r600_shader.c | 8 ++++++--
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 2050be2..83d7340 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -556,6 +556,7 @@ unsigned r600_llvm_compile(
unsigned * inst_byte_count,
enum radeon_family family,
struct r600_bytecode *bc,
+ boolean *use_kill,
unsigned dump)
{
unsigned r;
@@ -566,6 +567,7 @@ unsigned r600_llvm_compile(
*inst_byte_count = binary.code_size;
bc->ngpr = util_le32_to_cpu(*(uint32_t*)binary.config);
bc->nstack = util_le32_to_cpu(*(uint32_t*)(binary.config + 4));
+ *use_kill = util_le32_to_cpu(*(uint32_t*)(binary.config + 8));
return r;
}
diff --git a/src/gallium/drivers/r600/r600_llvm.h b/src/gallium/drivers/r600/r600_llvm.h
index 919dd24..50bbca6 100644
--- a/src/gallium/drivers/r600/r600_llvm.h
+++ b/src/gallium/drivers/r600/r600_llvm.h
@@ -22,6 +22,7 @@ unsigned r600_llvm_compile(
unsigned * inst_byte_count,
enum radeon_family family,
struct r600_bytecode *bc,
+ boolean *use_kill,
unsigned dump);
#endif /* defined R600_USE_LLVM || defined HAVE_OPENCL */
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 0204f80..25f900f 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -272,6 +272,7 @@ int r600_compute_shader_create(struct pipe_context * ctx,
unsigned byte_count;
struct r600_shader_ctx shader_ctx;
bool dump = (r600_ctx->screen->debug_flags & DBG_CS) != 0;
+ boolean use_kill;
shader_ctx.bc = bytecode;
r600_bytecode_init(shader_ctx.bc, r600_ctx->chip_class, r600_ctx->family,
@@ -279,7 +280,7 @@ int r600_compute_shader_create(struct pipe_context * ctx,
shader_ctx.bc->type = TGSI_PROCESSOR_COMPUTE;
shader_ctx.bc->isa = r600_ctx->isa;
r600_llvm_compile(mod, &bytes, &byte_count, r600_ctx->family,
- shader_ctx.bc, dump);
+ shader_ctx.bc, &use_kill, dump);
r600_bytecode_from_byte_stream(&shader_ctx, bytes, byte_count);
if (shader_ctx.bc->chip_class == CAYMAN) {
cm_bytecode_add_cf_end(shader_ctx.bc);
@@ -1444,6 +1445,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
if (use_llvm) {
struct radeon_llvm_context radeon_llvm_ctx;
LLVMModuleRef mod;
+ boolean use_kill;
bool dump = r600_can_dump_shader(rscreen, ctx.type);
memset(&radeon_llvm_ctx, 0, sizeof(radeon_llvm_ctx));
@@ -1461,13 +1463,15 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
mod = r600_tgsi_llvm(&radeon_llvm_ctx, tokens);
if (r600_llvm_compile(mod, &inst_bytes, &inst_byte_count,
- rscreen->family, ctx.bc, dump)) {
+ rscreen->family, ctx.bc, &use_kill, dump)) {
FREE(inst_bytes);
radeon_llvm_dispose(&radeon_llvm_ctx);
use_llvm = 0;
fprintf(stderr, "R600 LLVM backend failed to compile "
"shader. Falling back to TGSI\n");
} else {
+ if (use_kill)
+ ctx.shader->uses_kill = use_kill;
ctx.file_offset[TGSI_FILE_OUTPUT] =
ctx.file_offset[TGSI_FILE_INPUT];
}
--
1.8.1.4
More information about the mesa-dev
mailing list