radeonsi: don't pass si_shader to si_compile_llvm
authorMarek Olšák <marek.olsak@amd.com>
Mon, 28 Dec 2015 00:45:00 +0000 (01:45 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 7 Jan 2016 17:26:06 +0000 (18:26 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h

index aedea8e43ee66676b7280f938c29d8b7bc838cab..3562bd846e7d194d1a4c07f341ecc9703b57c218 100644 (file)
@@ -122,7 +122,8 @@ static void *si_create_compute_state(
                for (i = 0; i < program->num_kernels; i++) {
                        LLVMModuleRef mod = radeon_llvm_get_kernel_module(program->llvm_ctx, i,
                                                         code, header->num_bytes);
-                       si_compile_llvm(sctx->screen, &program->kernels[i], sctx->tm,
+                       si_compile_llvm(sctx->screen, &program->kernels[i].binary,
+                                       &program->kernels[i].config, sctx->tm,
                                        mod, &sctx->b.debug, TGSI_PROCESSOR_COMPUTE);
                        si_shader_binary_upload(sctx->screen, &program->kernels[i]);
                        LLVMDisposeModule(mod);
index 2a206dd62908f03ec07d16d6d3e1dcd4f087d9cb..498822483002f8c49a28164dbb51c0a6b3a78bb1 100644 (file)
@@ -3877,9 +3877,13 @@ void si_shader_binary_read(struct si_screen *sscreen,
                           conf->lds_size, conf->scratch_bytes_per_wave);
 }
 
-int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
-                   LLVMTargetMachineRef tm, LLVMModuleRef mod,
-                   struct pipe_debug_callback *debug, unsigned processor)
+int si_compile_llvm(struct si_screen *sscreen,
+                   struct radeon_shader_binary *binary,
+                   struct si_shader_config *conf,
+                   LLVMTargetMachineRef tm,
+                   LLVMModuleRef mod,
+                   struct pipe_debug_callback *debug,
+                   unsigned processor)
 {
        int r = 0;
        unsigned count = p_atomic_inc_return(&sscreen->b.num_compilations);
@@ -3891,21 +3895,20 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
                        LLVMDumpModule(mod);
        }
 
-       if (!si_replace_shader(count, &shader->binary)) {
-               r = radeon_llvm_compile(mod, &shader->binary,
+       if (!si_replace_shader(count, binary)) {
+               r = radeon_llvm_compile(mod, binary,
                        r600_get_llvm_processor_name(sscreen->b.family), tm,
                        debug);
                if (r)
                        return r;
        }
 
-       si_shader_binary_read(sscreen, &shader->binary, &shader->config,
-                             debug, processor);
+       si_shader_binary_read(sscreen, binary, conf, debug, processor);
 
-       FREE(shader->binary.config);
-       FREE(shader->binary.global_symbol_offsets);
-       shader->binary.config = NULL;
-       shader->binary.global_symbol_offsets = NULL;
+       FREE(binary->config);
+       FREE(binary->global_symbol_offsets);
+       binary->config = NULL;
+       binary->global_symbol_offsets = NULL;
        return r;
 }
 
@@ -3979,8 +3982,9 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
        if (dump)
                fprintf(stderr, "Copy Vertex Shader for Geometry Shader:\n\n");
 
-       r = si_compile_llvm(sscreen, si_shader_ctx->shader,
-                           si_shader_ctx->tm, bld_base->base.gallivm->module,
+       r = si_compile_llvm(sscreen, &si_shader_ctx->shader->binary,
+                           &si_shader_ctx->shader->config, si_shader_ctx->tm,
+                           bld_base->base.gallivm->module,
                            debug, TGSI_PROCESSOR_GEOMETRY);
        if (!r)
                r = si_shader_binary_upload(sscreen, si_shader_ctx->shader);
@@ -4178,7 +4182,8 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
        radeon_llvm_finalize_module(&si_shader_ctx.radeon_bld);
 
        mod = bld_base->base.gallivm->module;
-       r = si_compile_llvm(sscreen, shader, tm, mod, debug, si_shader_ctx.type);
+       r = si_compile_llvm(sscreen, &shader->binary, &shader->config, tm,
+                           mod, debug, si_shader_ctx.type);
        if (r) {
                fprintf(stderr, "LLVM failed to compile shader\n");
                goto out;
index b0abacc15997303f395af2cde559061ef37e3618..2220fc7b91b9bf01ccfe039be59931f5bbb774ff 100644 (file)
@@ -333,9 +333,13 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
                     struct si_shader *shader,
                     struct pipe_debug_callback *debug);
 void si_dump_shader_key(unsigned shader, union si_shader_key *key, FILE *f);
-int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
-                   LLVMTargetMachineRef tm, LLVMModuleRef mod,
-                   struct pipe_debug_callback *debug, unsigned processor);
+int si_compile_llvm(struct si_screen *sscreen,
+                   struct radeon_shader_binary *binary,
+                   struct si_shader_config *conf,
+                   LLVMTargetMachineRef tm,
+                   LLVMModuleRef mod,
+                   struct pipe_debug_callback *debug,
+                   unsigned processor);
 void si_shader_destroy(struct si_shader *shader);
 unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index);
 int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);