[Mesa-dev] [PATCH] llvmpipe: Implement TXQ.

Roland Scheidegger sroland at vmware.com
Thu May 17 12:11:41 PDT 2012


Am 17.05.2012 16:41, schrieb Olivier Galibert:
> On Thu, May 17, 2012 at 04:34:31PM +0200, Roland Scheidegger wrote:
>>> +   bld_int_vec.zero = lp_build_zero(gallivm, bld_int_vec.type);
>>> +   bld_int_vec.one  = lp_build_one (gallivm, bld_int_vec.type);
>> This is unnecessary. build_context_init() will take care of initializing
>> the zero/one values.
> 
> Missed that, cool.
> 
>> Though this always will use a vector, even for 1d case. I guess though
>> this is ok, if llvm is smart enough it could make it scalar itself.
> 
> The shl in minify blows up in your face if you don't have a
> full-length vector anyway.
Hmm it shouldn't. The sample code uses that too. You need to be careful
though since a llvm vector with length one isn't the same as a scalar,
but just using a scalar build context should work (you cannot use
LLVMBuildInsertElement though in this case leading to slightly different
code).
But the scalar code might not be faster anyway, so using always a vector
is fine by me (the only thing you'd generally want to avoid is using
vector sizes not matching hw vector size not least because the
intrinsics won't get used).

Roland



> 
>>> +      sizes_out[i] = lp_build_broadcast_scalar(&bld_int_vec,
>>> +                                               LLVMBuildExtractElement(gallivm->builder, slot,
>>> +                                                                       lp_build_const_int32(gallivm, i), ""));
>> I think you could use the lp_build_extract_broadcast() helper instead
>> for even better readability.
> 
> Nice helper, lemme try it.
> 
> Best,
> 
>   OG.



More information about the mesa-dev mailing list