[Mesa-dev] [PATCH] r600g/llvm: Read stack size from .AMDGPU.config ELF section
Tom Stellard
tom at stellard.net
Tue Apr 23 20:57:25 PDT 2013
Hi Vincent,
I didn't see your Mesa commits from earlier today, so I wrote this patch.
You can ignore it, but in your patch you forgot to update the compute
shader path, which I think breaks the build with --enable-opencl.
-Tom
On Tue, Apr 23, 2013 at 08:49:43PM -0700, Tom Stellard wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
>
> ---
> src/gallium/drivers/r600/r600_llvm.c | 5 +++--
> src/gallium/drivers/r600/r600_llvm.h | 3 ++-
> src/gallium/drivers/r600/r600_shader.c | 5 ++---
> src/gallium/drivers/radeon/LLVM_REVISION.txt | 2 +-
> 4 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
> index 35d6c90..2050be2 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -555,7 +555,7 @@ unsigned r600_llvm_compile(
> unsigned char ** inst_bytes,
> unsigned * inst_byte_count,
> enum radeon_family family,
> - unsigned *ngpr,
> + struct r600_bytecode *bc,
> unsigned dump)
> {
> unsigned r;
> @@ -564,7 +564,8 @@ unsigned r600_llvm_compile(
> r = radeon_llvm_compile(mod, &binary, gpu_family, dump);
> *inst_bytes = binary.code;
> *inst_byte_count = binary.code_size;
> - *ngpr = util_le32_to_cpu(*(uint32_t*)binary.config);
> + bc->ngpr = util_le32_to_cpu(*(uint32_t*)binary.config);
> + bc->nstack = util_le32_to_cpu(*(uint32_t*)(binary.config + 4));
> return r;
> }
>
> diff --git a/src/gallium/drivers/r600/r600_llvm.h b/src/gallium/drivers/r600/r600_llvm.h
> index afc6881..919dd24 100644
> --- a/src/gallium/drivers/r600/r600_llvm.h
> +++ b/src/gallium/drivers/r600/r600_llvm.h
> @@ -7,6 +7,7 @@
> #include "radeon_llvm.h"
> #include <llvm-c/Core.h>
>
> +struct r600_bytecode;
> struct r600_shader_ctx;
> struct radeon_llvm_context;
> enum radeon_family;
> @@ -20,7 +21,7 @@ unsigned r600_llvm_compile(
> unsigned char ** inst_bytes,
> unsigned * inst_byte_count,
> enum radeon_family family,
> - unsigned *ngpr,
> + struct r600_bytecode *bc,
> 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 2907c7c..4607dc7 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -279,7 +279,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->ngpr, dump);
> + shader_ctx.bc, 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);
> @@ -591,7 +591,6 @@ static void r600_bytecode_from_byte_stream(struct r600_shader_ctx *ctx,
> unsigned char * bytes, unsigned num_bytes)
> {
> unsigned bytes_read = 0;
> - ctx->bc->nstack = bytes[bytes_read++];
> unsigned i, byte;
> while (bytes_read < num_bytes) {
> char inst_type = bytes[bytes_read++];
> @@ -1462,7 +1461,7 @@ 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->ngpr, dump)) {
> + rscreen->family, ctx.bc, dump)) {
> FREE(inst_bytes);
> radeon_llvm_dispose(&radeon_llvm_ctx);
> use_llvm = 0;
> diff --git a/src/gallium/drivers/radeon/LLVM_REVISION.txt b/src/gallium/drivers/radeon/LLVM_REVISION.txt
> index b633ea6..f003aab 100644
> --- a/src/gallium/drivers/radeon/LLVM_REVISION.txt
> +++ b/src/gallium/drivers/radeon/LLVM_REVISION.txt
> @@ -1 +1 @@
> - at 179684
> + at 180124
> --
> 1.7.11.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list