mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 13:00:09 +01:00
intel/compiler: Remove is_tex()
The current name doesn't cover all the tex related instructions and in all usages, we already have a switch statement to dispatch per instruction type, so is more natural to list the instructions we care there. In fs::is_send_from_grf() we can simply ignore them since the instructions are either lowered directly to SEND (Gfx7+) or use MRF (Gfx6-). With this change, the fs_inst::size_read() generated code gets simplified (the "tex" entries get added to the switch jump table in gcc) and the default case loses the conditional handling tex. This reduces shader compilation time, as illustrated by replaying fossils (tested on my TGL laptop): ``` // Rise of the Tomb Raider (N=13) Difference at 95.0% confidence -1.32231 +/- 0.0170138 -4.37605% +/- 0.0563054% (Student's t, pooled s = 0.0210159) // Cyberpunk 2077 (N=7) Difference at 95.0% confidence -3.64 +/- 0.114993 -2.95188% +/- 0.0932544% (Student's t, pooled s = 0.09873) ``` Suggested-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25721>
This commit is contained in:
parent
424df6a68d
commit
fcd025c1ce
4 changed files with 53 additions and 34 deletions
|
|
@ -243,9 +243,6 @@ fs_inst::is_send_from_grf() const
|
|||
case FS_OPCODE_FB_READ:
|
||||
return src[0].file == VGRF;
|
||||
default:
|
||||
if (is_tex())
|
||||
return src[0].file == VGRF;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -309,16 +306,29 @@ fs_inst::is_payload(unsigned arg) const
|
|||
case SHADER_OPCODE_INTERLOCK:
|
||||
case SHADER_OPCODE_MEMORY_FENCE:
|
||||
case SHADER_OPCODE_BARRIER:
|
||||
case SHADER_OPCODE_TEX:
|
||||
case FS_OPCODE_TXB:
|
||||
case SHADER_OPCODE_TXD:
|
||||
case SHADER_OPCODE_TXF:
|
||||
case SHADER_OPCODE_TXF_LZ:
|
||||
case SHADER_OPCODE_TXF_CMS:
|
||||
case SHADER_OPCODE_TXF_CMS_W:
|
||||
case SHADER_OPCODE_TXF_UMS:
|
||||
case SHADER_OPCODE_TXF_MCS:
|
||||
case SHADER_OPCODE_TXL:
|
||||
case SHADER_OPCODE_TXL_LZ:
|
||||
case SHADER_OPCODE_TXS:
|
||||
case SHADER_OPCODE_LOD:
|
||||
case SHADER_OPCODE_TG4:
|
||||
case SHADER_OPCODE_TG4_OFFSET:
|
||||
case SHADER_OPCODE_SAMPLEINFO:
|
||||
return arg == 0;
|
||||
|
||||
case SHADER_OPCODE_SEND:
|
||||
return arg == 2 || arg == 3;
|
||||
|
||||
default:
|
||||
if (is_tex())
|
||||
return arg == 0;
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -910,10 +920,28 @@ fs_inst::size_read(int arg) const
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (arg == 0 && src[0].file == VGRF && is_tex())
|
||||
case SHADER_OPCODE_TEX:
|
||||
case FS_OPCODE_TXB:
|
||||
case SHADER_OPCODE_TXD:
|
||||
case SHADER_OPCODE_TXF:
|
||||
case SHADER_OPCODE_TXF_LZ:
|
||||
case SHADER_OPCODE_TXF_CMS:
|
||||
case SHADER_OPCODE_TXF_CMS_W:
|
||||
case SHADER_OPCODE_TXF_UMS:
|
||||
case SHADER_OPCODE_TXF_MCS:
|
||||
case SHADER_OPCODE_TXL:
|
||||
case SHADER_OPCODE_TXL_LZ:
|
||||
case SHADER_OPCODE_TXS:
|
||||
case SHADER_OPCODE_LOD:
|
||||
case SHADER_OPCODE_TG4:
|
||||
case SHADER_OPCODE_TG4_OFFSET:
|
||||
case SHADER_OPCODE_SAMPLEINFO:
|
||||
if (arg == 0 && src[0].file == VGRF)
|
||||
return mlen * REG_SIZE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (src[arg].file) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ struct bblock_t;
|
|||
|
||||
struct backend_instruction : public exec_node {
|
||||
bool is_3src(const struct brw_compiler *compiler) const;
|
||||
bool is_tex() const;
|
||||
bool is_math() const;
|
||||
bool is_control_flow_begin() const;
|
||||
bool is_control_flow_end() const;
|
||||
|
|
|
|||
|
|
@ -849,27 +849,6 @@ backend_instruction::is_3src(const struct brw_compiler *compiler) const
|
|||
return ::is_3src(&compiler->isa, opcode);
|
||||
}
|
||||
|
||||
bool
|
||||
backend_instruction::is_tex() const
|
||||
{
|
||||
return (opcode == SHADER_OPCODE_TEX ||
|
||||
opcode == FS_OPCODE_TXB ||
|
||||
opcode == SHADER_OPCODE_TXD ||
|
||||
opcode == SHADER_OPCODE_TXF ||
|
||||
opcode == SHADER_OPCODE_TXF_LZ ||
|
||||
opcode == SHADER_OPCODE_TXF_CMS ||
|
||||
opcode == SHADER_OPCODE_TXF_CMS_W ||
|
||||
opcode == SHADER_OPCODE_TXF_UMS ||
|
||||
opcode == SHADER_OPCODE_TXF_MCS ||
|
||||
opcode == SHADER_OPCODE_TXL ||
|
||||
opcode == SHADER_OPCODE_TXL_LZ ||
|
||||
opcode == SHADER_OPCODE_TXS ||
|
||||
opcode == SHADER_OPCODE_LOD ||
|
||||
opcode == SHADER_OPCODE_TG4 ||
|
||||
opcode == SHADER_OPCODE_TG4_OFFSET ||
|
||||
opcode == SHADER_OPCODE_SAMPLEINFO);
|
||||
}
|
||||
|
||||
bool
|
||||
backend_instruction::is_math() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -290,6 +290,22 @@ vec4_instruction::can_do_writemask(const struct intel_device_info *devinfo)
|
|||
case TES_OPCODE_ADD_INDIRECT_URB_OFFSET:
|
||||
case VEC4_OPCODE_URB_READ:
|
||||
case SHADER_OPCODE_MOV_INDIRECT:
|
||||
case SHADER_OPCODE_TEX:
|
||||
case FS_OPCODE_TXB:
|
||||
case SHADER_OPCODE_TXD:
|
||||
case SHADER_OPCODE_TXF:
|
||||
case SHADER_OPCODE_TXF_LZ:
|
||||
case SHADER_OPCODE_TXF_CMS:
|
||||
case SHADER_OPCODE_TXF_CMS_W:
|
||||
case SHADER_OPCODE_TXF_UMS:
|
||||
case SHADER_OPCODE_TXF_MCS:
|
||||
case SHADER_OPCODE_TXL:
|
||||
case SHADER_OPCODE_TXL_LZ:
|
||||
case SHADER_OPCODE_TXS:
|
||||
case SHADER_OPCODE_LOD:
|
||||
case SHADER_OPCODE_TG4:
|
||||
case SHADER_OPCODE_TG4_OFFSET:
|
||||
case SHADER_OPCODE_SAMPLEINFO:
|
||||
return false;
|
||||
default:
|
||||
/* The MATH instruction on Gfx6 only executes in align1 mode, which does
|
||||
|
|
@ -298,9 +314,6 @@ vec4_instruction::can_do_writemask(const struct intel_device_info *devinfo)
|
|||
if (devinfo->ver == 6 && is_math())
|
||||
return false;
|
||||
|
||||
if (is_tex())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue