From b28acfe0a878da0399830a856d05738fbf83c4b6 Mon Sep 17 00:00:00 2001 From: liufang Date: Fri, 18 Feb 2022 08:36:29 +0000 Subject: [PATCH] [vISA] Add W/A for mov instruction with conditional modifier when converting from df source data type. w/a detai: Compiler must not use conditional modifier with mov instruction when converting from double precision. Instead convert from DP to dst data type and then compare with zero with conditional modifiers in another mov instruction. For example: From mov (16|M0) (eq)f0.0 r10.0<1>:q r20.0<1;1,0>:df To mov (16|M0) r10.0<1>:q r20.0<1;1,0>:df mov (16|M0) (eq)f0.0 null.0<1>:q r10.0<1;1,0>:q --- inc/common/sku_wa_defs.h | 6 ++++++ skuwa/ipvc_hw_wa.c | 7 +++++++ visa/HWConformity.cpp | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/inc/common/sku_wa_defs.h b/inc/common/sku_wa_defs.h index 9dc08ebac..a778208ee 100644 --- a/inc/common/sku_wa_defs.h +++ b/inc/common/sku_wa_defs.h @@ -8345,3 +8345,9 @@ SPDX-License-Identifier: MIT "Workaround", WA_BUG_TYPE_UNKNOWN, WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN) + + WA_DECLARE( + Wa_16011698357, + "Workaround", + WA_BUG_TYPE_UNKNOWN, + WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN) diff --git a/skuwa/ipvc_hw_wa.c b/skuwa/ipvc_hw_wa.c index 2c04edfd3..61ed7c531 100644 --- a/skuwa/ipvc_hw_wa.c +++ b/skuwa/ipvc_hw_wa.c @@ -87,4 +87,11 @@ void InitPvcHwWaTable(PWA_TABLE pWaTable, PSKU_FEATURE_TABLE pSkuTable, PWA_INIT PLATFORM_ALL, SI_WA_BETWEEN(iStepId_PVC_ComputeTile, PVC_GT_REV_ID_COMPUTETILE_A0P, PVC_GT_REV_ID_COMPUTETILE_XTB0)); + SI_WA_ENABLE( + Wa_16011698357, + "No Link Provided", + "No HWSightingLink provided", + PLATFORM_ALL, + SI_WA_BETWEEN(iStepId_PVC_ComputeTile, PVC_GT_REV_ID_COMPUTETILE_XTA0, PVC_GT_REV_ID_COMPUTETILE_XTB0)); + } diff --git a/visa/HWConformity.cpp b/visa/HWConformity.cpp index 88967a3f8..03d7464b7 100644 --- a/visa/HWConformity.cpp +++ b/visa/HWConformity.cpp @@ -1512,6 +1512,8 @@ static bool canReplaceMovSrcType(IR_Builder& builder, G4_INST* inst, uint32_t ex // Use two instructions and a WORD or DWORD intermediate type respectively. // -- There is no direct conversion from HF to Integer (DWORD or WORD). // Use two instructions and F (Float) as an intermediate type. +// -- There is no direct conversion from DF with conditional modifier. +// Instead convert from DF to dst type and then compare with zero with conditional modifier in another mov instruction. // returns true if a move is inserted bool HWConformity::fixMov(INST_LIST_ITER i, G4_BB* bb) { @@ -1564,6 +1566,25 @@ bool HWConformity::fixMov(INST_LIST_ITER i, G4_BB* bb) replaceDst(i, Type_F); return true; } + + // mov (16|M0) (eq)f0.0 r10.0<1>:q r20.0<1;1,0>:df + // => + // mov (16|M0) r10.0<1>:q r20.0<1;1,0>:df + // mov (16|M0) (eq)f0.0 null.0<1>:q r10.0<1;1,0>:q + if (VISA_WA_CHECK(builder.getPWaTable(), Wa_16011698357) && srcType == Type_DF && inst->getCondMod()) + { + auto newMovSrc = builder.createSrc(inst->getDst()->getBase(), + inst->getDst()->getRegOff(), inst->getDst()->getSubRegOff(), + inst->getExecSize() == g4::SIMD1 ? builder.getRegionScalar() : builder.createRegionDesc(inst->getDst()->getHorzStride(),1,0), + dstType); + G4_INST* newMov = builder.createMov(inst->getExecSize(), builder.createNullDst(dstType), + newMovSrc, inst->getOption(), false); + newMov->setPredicate(inst->getPredicate()); + newMov->setCondMod(inst->getCondMod()); + inst->setCondMod(nullptr); + bb->insertAfter(i, newMov); + return true; + } return false; }