[Mesa-dev] [PATCH 08/17] i965/fs: Make better use of the builder in shader_time

Jason Ekstrand jason at jlekstrand.net
Thu Jun 25 13:12:56 PDT 2015


On Tue, Jun 23, 2015 at 2:09 AM, Pohjolainen, Topi
<topi.pohjolainen at intel.com> wrote:
> On Thu, Jun 18, 2015 at 05:51:37PM -0700, Jason Ekstrand wrote:
>> Previously, we were just depending on register widths to ensure that
>> various things were exec_size of 1 etc.  Now, we do so explicitly using the
>> builder.
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++------
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index c13ac7d..740b51d 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -557,7 +557,7 @@ fs_visitor::get_timestamp(const fs_builder &bld)
>>     /* We want to read the 3 fields we care about even if it's not enabled in
>>      * the dispatch.
>>      */
>> -   bld.exec_all().MOV(dst, ts);
>> +   bld.group(4, 0).exec_all().MOV(dst, ts);
>
> Just to make sure I understand correctly, we want SIMD4 in order to read wide
> enough to get all the mentioned 3 fields?

I believe so, yes.

>>
>>     /* The caller wants the low 32 bits of the timestamp.  Since it's running
>>      * at the GPU clock rate of ~1.2ghz, it will roll over every ~3 seconds,
>> @@ -637,17 +637,19 @@ fs_visitor::emit_shader_time_end()
>>     start.negate = true;
>>     fs_reg diff = fs_reg(GRF, alloc.allocate(1), BRW_REGISTER_TYPE_UD, 1);
>>     diff.set_smear(0);
>> -   ibld.ADD(diff, start, shader_end_time);
>> +
>> +   const fs_builder cbld = ibld.group(1, 0);
>> +   cbld.group(1, 0).ADD(diff, start, shader_end_time);
>>
>>     /* If there were no instructions between the two timestamp gets, the diff
>>      * is 2 cycles.  Remove that overhead, so I can forget about that when
>>      * trying to determine the time taken for single instructions.
>>      */
>> -   ibld.ADD(diff, diff, fs_reg(-2u));
>> -   SHADER_TIME_ADD(ibld, type, diff);
>> -   SHADER_TIME_ADD(ibld, written_type, fs_reg(1u));
>> +   cbld.ADD(diff, diff, fs_reg(-2u));
>> +   SHADER_TIME_ADD(cbld, type, diff);
>> +   SHADER_TIME_ADD(cbld, written_type, fs_reg(1u));
>>     ibld.emit(BRW_OPCODE_ELSE);
>> -   SHADER_TIME_ADD(ibld, reset_type, fs_reg(1u));
>> +   SHADER_TIME_ADD(cbld, reset_type, fs_reg(1u));
>>     ibld.emit(BRW_OPCODE_ENDIF);
>>  }
>>
>> --
>> 2.4.3
>>
>> _______________________________________________
>> 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