[Mesa-dev] [PATCH 1/2] gm107/ir: adjust jump offsets to avoid sched info

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Nov 2 17:20:49 UTC 2016


This seems like redundant, and because the GM107 emitter already has a 
bunch of emitXXX() helpers, how about adding emitTARG()? Like:

void
CodeEmitterGM107::emitTARG()
{
   int32_t pos = insn->target.bb->binPos;
   if (writeIssueDelays && !(pos & 0x1f))
     pos += 8;
   emitField(0x14, 24, pos - (codeSize + 8));
}

On 11/02/2016 05:38 AM, Ilia Mirkin wrote:
> This doesn't seem to cause real issues, but it makes compiled code
> easier to follow when the jumps go to the right place.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 27 +++++++++++++++++-----
>  1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> index 5ed2ad4..ecd3faa 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> @@ -557,15 +557,18 @@ CodeEmitterGM107::emitCAL()
>     }
>
>     if (!insn->srcExists(0) || insn->src(0).getFile() != FILE_MEMORY_CONST) {
> +      int32_t pos = insn->target.bb->binPos;
> +      if (writeIssueDelays && !(pos & 0x1f))
> +         pos += 8;
>        if (!insn->absolute)
> -         emitField(0x14, 24, insn->target.bb->binPos - (codeSize + 8));
> +         emitField(0x14, 24, pos - (codeSize + 8));
>        else {
>           if (insn->builtin) {
>              int pcAbs = targGM107->getBuiltinOffset(insn->target.builtin);
>              addReloc(RelocEntry::TYPE_BUILTIN, 0, pcAbs, 0xfff00000,  20);
>              addReloc(RelocEntry::TYPE_BUILTIN, 1, pcAbs, 0x000fffff, -12);
>           } else {
> -            emitField(0x14, 32, insn->target.bb->binPos);
> +            emitField(0x14, 32, pos);
>           }
>        }
>     } else {
> @@ -582,7 +585,10 @@ CodeEmitterGM107::emitPCNT()
>     emitInsn(0xe2b00000, 0);
>
>     if (!insn->srcExists(0) || insn->src(0).getFile() != FILE_MEMORY_CONST) {
> -      emitField(0x14, 24, insn->target.bb->binPos - (codeSize + 8));
> +      int32_t pos = insn->target.bb->binPos;
> +      if (writeIssueDelays && !(pos & 0x1f))
> +         pos += 8;
> +      emitField(0x14, 24, pos - (codeSize + 8));
>     } else {
>        emitCBUF (0x24, -1, 20, 16, 0, insn->src(0));
>        emitField(0x05, 1, 1);
> @@ -604,7 +610,10 @@ CodeEmitterGM107::emitPBK()
>     emitInsn(0xe2a00000, 0);
>
>     if (!insn->srcExists(0) || insn->src(0).getFile() != FILE_MEMORY_CONST) {
> -      emitField(0x14, 24, insn->target.bb->binPos - (codeSize + 8));
> +      int32_t pos = insn->target.bb->binPos;
> +      if (writeIssueDelays && !(pos & 0x1f))
> +         pos += 8;
> +      emitField(0x14, 24, pos - (codeSize + 8));
>     } else {
>        emitCBUF (0x24, -1, 20, 16, 0, insn->src(0));
>        emitField(0x05, 1, 1);
> @@ -626,7 +635,10 @@ CodeEmitterGM107::emitPRET()
>     emitInsn(0xe2700000, 0);
>
>     if (!insn->srcExists(0) || insn->src(0).getFile() != FILE_MEMORY_CONST) {
> -      emitField(0x14, 24, insn->target.bb->binPos - (codeSize + 8));
> +      int32_t pos = insn->target.bb->binPos;
> +      if (writeIssueDelays && !(pos & 0x1f))
> +         pos += 8;
> +      emitField(0x14, 24, pos - (codeSize + 8));
>     } else {
>        emitCBUF (0x24, -1, 20, 16, 0, insn->src(0));
>        emitField(0x05, 1, 1);
> @@ -648,7 +660,10 @@ CodeEmitterGM107::emitSSY()
>     emitInsn(0xe2900000, 0);
>
>     if (!insn->srcExists(0) || insn->src(0).getFile() != FILE_MEMORY_CONST) {
> -      emitField(0x14, 24, insn->target.bb->binPos - (codeSize + 8));
> +      int32_t pos = insn->target.bb->binPos;
> +      if (writeIssueDelays && !(pos & 0x1f))
> +         pos += 8;
> +      emitField(0x14, 24, pos - (codeSize + 8));
>     } else {
>        emitCBUF (0x24, -1, 20, 16, 0, insn->src(0));
>        emitField(0x05, 1, 1);
>

-- 
-Samuel


More information about the mesa-dev mailing list