[Mesa-dev] [PATCH 1/6] r600g: Add no_merge_inst_groups flag

Christian König deathsimple at vodafone.de
Thu Apr 26 07:53:58 PDT 2012


On 26.04.2012 16:40, Tom Stellard wrote:
> On Thu, Apr 26, 2012 at 08:46:52AM -0400, Tom Stellard wrote:
>> Setting this flag will skip the merge_inst_groups() function.
>> ---
>>   src/gallium/drivers/r600/r600_asm.c |    3 ++-
>>   src/gallium/drivers/r600/r600_asm.h |   10 ++++++++++
>>   2 files changed, 12 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
>> index 0ecca36..5f83879 100644
>> --- a/src/gallium/drivers/r600/r600_asm.c
>> +++ b/src/gallium/drivers/r600/r600_asm.c
>> @@ -1034,6 +1034,7 @@ static int merge_inst_groups(struct r600_bytecode *bc, struct r600_bytecode_alu
>>   	int have_mova = 0, have_rel = 0;
>>   	int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
>>
>> +	assert(!bc->no_merge_inst_groups);
>>   	r = assign_alu_units(bc, alu_prev, prev);
>>   	if (r)
>>   		return r;
>> @@ -1481,7 +1482,7 @@ int r600_bytecode_add_alu_type(struct r600_bytecode *bc, const struct r600_bytec
>>   		if (r)
>>   			return r;
>>
>> -		if (bc->cf_last->prev_bs_head) {
>> +		if (!bc->no_merge_inst_groups&&  bc->cf_last->prev_bs_head) {
>>   			r = merge_inst_groups(bc, slots, bc->cf_last->prev_bs_head);
>>   			if (r)
>>   				return r;
>> diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h
>> index 5790ead..86d44d3 100644
>> --- a/src/gallium/drivers/r600/r600_asm.h
>> +++ b/src/gallium/drivers/r600/r600_asm.h
>> @@ -205,6 +205,16 @@ struct r600_bytecode {
>>   	unsigned	ar_reg;
>>   	unsigned        ar_handling;
>>   	unsigned        r6xx_nop_after_rel_dst;
>> +
>> +	/* Setting this bit will prevent the r600 assembler from trying to
>> +	 * merge instruction groups.  This is necessary for compute shaders,
>> +	 * because the CF_ALLOC_EXPORT_WORD0_RAT instructions expects the index
>> +	 * values to be in the X, Y, and Z channels depending on the
>> +	 * dimension of the surface.  The merge_inst_groups function will move
>> +	 * these values around to the wrong channels and the RAT read or write
>> +	 * will fail.
>> +	 */
> vadimg has pointed out on IRC that this comment is wrong, and the
> merge_inst_groups function won't rewrite the destination channels.
>
> I think this patch might still be useful, so I'll just drop this comment
> from the final version.
I would rather prefer to not do workarounds like this, but rather teach 
merge_instruction groups the reason why something can't be merged.

Christian.

>
> -Tom
>
>> +	unsigned			no_merge_inst_groups;
>>   };
>>
>>   /* eg_asm.c */
>> -- 
>> 1.7.7.6
>>
>>
> _______________________________________________
> 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