<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 26, 2015 at 5:45 PM, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, May 27, 2015 at 12:39 AM, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu">jan.vesely@rutgers.edu</a>> wrote:<br>
> On Wed, 2015-05-27 at 00:36 +0200, Marek Olšák wrote:<br>
>> On Tue, May 26, 2015 at 10:19 PM, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>> wrote:<br>
>> > On 26/05/15 14:04, Marek Olšák wrote:<br>
>> >> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
>> >><br>
>> >> ---<br>
>> >> src/gallium/drivers/radeon/radeon_llvm.h | 5 ++---<br>
>> >> src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 15 +++++++++++----<br>
>> >> 2 files changed, 13 insertions(+), 7 deletions(-)<br>
>> >><br>
>> >> diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h<br>
>> >> index 8612ef8..ec4c343 100644<br>
>> >> --- a/src/gallium/drivers/radeon/radeon_llvm.h<br>
>> >> +++ b/src/gallium/drivers/radeon/radeon_llvm.h<br>
>> >> @@ -33,7 +33,6 @@<br>
>> >><br>
>> >> #define RADEON_LLVM_MAX_INPUTS 32 * 4<br>
>> >> #define RADEON_LLVM_MAX_OUTPUTS 32 * 4<br>
>> >> -#define RADEON_LLVM_MAX_ARRAYS 16<br>
>> >><br>
>> >> #define RADEON_LLVM_INITIAL_CF_DEPTH 4<br>
>> >><br>
>> >> @@ -130,8 +129,8 @@ struct radeon_llvm_context {<br>
>> >> unsigned loop_depth;<br>
>> >> unsigned loop_depth_max;<br>
>> >><br>
>> >> - struct tgsi_declaration_range arrays[RADEON_LLVM_MAX_ARRAYS];<br>
>> >> - unsigned num_arrays;<br>
>> >> + struct tgsi_declaration_range *arrays;<br>
>> >> + unsigned max_num_arrays;<br>
>> >><br>
>> >> LLVMValueRef main_fn;<br>
>> >><br>
>> >> diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c<br>
>> >> index 8638537..af5eb88 100644<br>
>> >> --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c<br>
>> >> +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c<br>
>> >> @@ -85,8 +85,9 @@ get_array_range(struct lp_build_tgsi_context *bld_base,<br>
>> >> unsigned File, const struct tgsi_ind_register *reg)<br>
>> >> {<br>
>> >> struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);<br>
>> >> +<br>
>> >> if (File != TGSI_FILE_TEMPORARY || reg->ArrayID == 0 ||<br>
>> >> - reg->ArrayID > RADEON_LLVM_MAX_ARRAYS) {<br>
>> >> + reg->ArrayID-1 >= ctx->max_num_arrays) {<br>
>> >> struct tgsi_declaration_range range;<br>
>> >> range.First = 0;<br>
>> >> range.Last = bld_base->info->file_max[File];<br>
>> >> @@ -252,8 +253,14 @@ static void emit_declaration(<br>
>> >> }<br>
>> >><br>
>> >> case TGSI_FILE_TEMPORARY:<br>
>> >> - if (decl->Declaration.Array && decl->Array.ArrayID <= RADEON_LLVM_MAX_ARRAYS)<br>
>> >> + if (decl->Declaration.Array) {<br>
>> >> + if (decl->Array.ArrayID-1 >= ctx->max_num_arrays) {<br>
>> >> + ctx->max_num_arrays += 32;<br>
>> >> + ctx->arrays = realloc(ctx->arrays,<br>
>> > You should use the REALLOC wrapper, considering the FREE below.<br>
>> ><br>
>> >> + sizeof(ctx->arrays[0]) * ctx->max_num_arrays);<br>
>> >> + }<br>
>> >> ctx->arrays[decl->Array.ArrayID - 1] = decl->Range;<br>
>> >> + }<br>
>> >> if (uses_temp_indirect_addressing(bld_base)) {<br>
>> >> lp_emit_declaration_soa(bld_base, decl);<br>
>> >> break;<br>
>> >> @@ -1432,8 +1439,6 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)<br>
>> >> /* Allocate outputs */<br>
>> >> ctx->soa.outputs = ctx->outputs;<br>
>> >><br>
>> >> - ctx->num_arrays = 0;<br>
>> >> -<br>
>> >> /* XXX: Is there a better way to initialize all this ? */<br>
>> >><br>
>> >> lp_set_default_actions(bld_base);<br>
>> >> @@ -1622,6 +1627,8 @@ void radeon_llvm_dispose(struct radeon_llvm_context * ctx)<br>
>> >> {<br>
>> >> LLVMDisposeModule(ctx->soa.bld_base.base.gallivm->module);<br>
>> >> LLVMContextDispose(ctx->soa.bld_base.base.gallivm->context);<br>
>> >> + FREE(ctx->arrays);<br>
>> >> + ctx->arrays = NULL;<br>
>> > Not particularly familiar with the radeon driver(s) so this might come a<br>
>> > bit silly - shouldn't one zero max_num_arrays at this stage ?<br>
>><br>
>> Yes, I've sent a new patch for that.<br>
>> ><br>
>> > Similar counters (temps_count, output_reg_count) seems to be left<br>
>> > unchanged, while others (branch_depth_max, loop_depth_max) are reset.<br>
>><br>
>> I've sent a patch for temps_count. I'm not touching output_reg_count,<br>
>> because it's only used by the dying r600g LLVM backend.<br>
><br>
> just out of curiosity, why is it dying?<br>
<br>
</div></div>The OpenGL shader support is dying because the LLVM backend is not<br>
used by default, it lacks some features, and SB should perform<br>
equally, if not better.<br>
<br>
The LLVM backend is still important for OpenCL though.<br></blockquote><div><br></div><div>wouldn't a functioning llvm-r600 backend for OCL, and the fact that SI uses llvm for graphics mean that GL-llvm-r600 is lower maintenance solution?</div><div>I'm not familiar with GL codepaths, is the GL(tgsi)-llvm conversion so complex (and different from SI) that it's better to use SB?</div><div><br></div><div>jan</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Marek<br>
</font></span></blockquote></div><br></div></div>