intel/fs: Allow HF const in MAD on Gfx12.5 if all sources are HF
Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23262>
This commit is contained in:
@@ -339,13 +339,23 @@ representable_as_uw(unsigned ud, uint16_t *uw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
supports_src_as_imm(const struct intel_device_info *devinfo, enum opcode op)
|
supports_src_as_imm(const struct intel_device_info *devinfo, const fs_inst *inst)
|
||||||
{
|
{
|
||||||
switch (op) {
|
if (devinfo->ver < 12)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (inst->opcode) {
|
||||||
case BRW_OPCODE_ADD3:
|
case BRW_OPCODE_ADD3:
|
||||||
return devinfo->verx10 >= 125;
|
/* ADD3 only exists on Gfx12.5+. */
|
||||||
|
return true;
|
||||||
|
|
||||||
case BRW_OPCODE_MAD:
|
case BRW_OPCODE_MAD:
|
||||||
return devinfo->ver == 12 && devinfo->verx10 < 125;
|
/* Integer types can always mix sizes. Floating point types can mix
|
||||||
|
* sizes on Gfx12. On Gfx12.5, floating point sources must all be HF or
|
||||||
|
* all be F.
|
||||||
|
*/
|
||||||
|
return devinfo->verx10 < 125 || inst->src[0].type != BRW_REGISTER_TYPE_F;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -357,11 +367,15 @@ can_promote_src_as_imm(const struct intel_device_info *devinfo, fs_inst *inst,
|
|||||||
{
|
{
|
||||||
bool can_promote = false;
|
bool can_promote = false;
|
||||||
|
|
||||||
/* Experiment shows that we can only support src0 as immediate */
|
/* Experiment shows that we can only support src0 as immediate for MAD on
|
||||||
|
* Gfx12. ADD3 can use src0 or src2 in Gfx12.5, but constant propagation
|
||||||
|
* only propagates into src0. It's possible that src2 works for W or UW MAD
|
||||||
|
* on Gfx12.5.
|
||||||
|
*/
|
||||||
if (src_idx != 0)
|
if (src_idx != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!supports_src_as_imm(devinfo, inst->opcode))
|
if (!supports_src_as_imm(devinfo, inst))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* TODO - Fix the codepath below to use a bfloat16 immediate on XeHP,
|
/* TODO - Fix the codepath below to use a bfloat16 immediate on XeHP,
|
||||||
|
Reference in New Issue
Block a user