1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2017-2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 #pragma once 10 #include "inc/common/igfxfmid.h" 11 #include "Compiler/compiler_caps.h" 12 #include "Compiler/igc_workaround.h" 13 #include "common/Types.hpp" 14 #include "Probe/Assertion.h" 15 #include "common/igc_regkeys.hpp" 16 17 18 namespace IGC 19 { 20 21 class CPlatform 22 { 23 PLATFORM m_platformInfo = {}; 24 SCompilerHwCaps m_caps = {}; 25 WA_TABLE m_WaTable = {}; 26 SKU_FEATURE_TABLE m_SkuTable = {}; 27 GT_SYSTEM_INFO m_GTSystemInfo = {}; 28 OCLCaps m_OCLCaps = {}; 29 30 public: CPlatform()31 CPlatform() {} 32 CPlatform(const PLATFORM & platform)33 CPlatform(const PLATFORM& platform) 34 { 35 m_platformInfo = platform; 36 } 37 38 public: setOclCaps(OCLCaps & caps)39void setOclCaps(OCLCaps& caps) { m_OCLCaps = caps; } getMaxOCLParameteSize() const40uint32_t getMaxOCLParameteSize() const { 41 uint32_t limitFromFlag = IGC_GET_FLAG_VALUE(OverrideOCLMaxParamSize); 42 return limitFromFlag ? limitFromFlag : m_OCLCaps.MaxParameterSize; 43 } OverrideRevId(unsigned short newRevId)44void OverrideRevId(unsigned short newRevId) 45 { 46 m_platformInfo.usRevId = newRevId; 47 } 48 OverrideDeviceId(unsigned short newDeviceID)49void OverrideDeviceId(unsigned short newDeviceID) 50 { 51 m_platformInfo.usDeviceID = newDeviceID; 52 } 53 54 OverrideProductFamily(unsigned int productID)55void OverrideProductFamily(unsigned int productID) 56 { 57 PRODUCT_FAMILY eProd = static_cast<PRODUCT_FAMILY>(productID); 58 if(eProd > IGFX_UNKNOWN && eProd < IGFX_MAX_PRODUCT) 59 m_platformInfo.eProductFamily = (PRODUCT_FAMILY)productID; 60 } 61 getWATable() const62 WA_TABLE const& getWATable() const { return m_WaTable; } getSkuTable() const63SKU_FEATURE_TABLE const& getSkuTable() const { return m_SkuTable; } 64 hasPackedVertexAttr() const65bool hasPackedVertexAttr() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } hasScaledMessage() const66bool hasScaledMessage() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } has8ByteA64ByteScatteredMessage() const67bool has8ByteA64ByteScatteredMessage() const { return m_platformInfo.eRenderCoreFamily == IGFX_GEN8_CORE; } 68 hasPredicatedBarriers() const69bool hasPredicatedBarriers() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } hasIEEEMinmaxBit() const70bool hasIEEEMinmaxBit() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } hasL1ReadOnlyCache() const71bool hasL1ReadOnlyCache() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } 72 // Gen10+ HW supports adding vertex start to vertex ID hasVertexOffsetEnable() const73bool hasVertexOffsetEnable() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } 74 75 // Gen10+ HW supports sending base instance, base vertex and draw index with 76 // VF, this is programmed using 3DSTATE_VF_SGVS2 command. hasSGVS2Command() const77bool hasSGVS2Command() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } 78 79 // Sampler supports normalization of coordinates during sampling from 80 // rectangle textures. supportsCoordinateNormalizationForRectangleTextures() const81bool supportsCoordinateNormalizationForRectangleTextures() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } 82 83 /// On some platforms ld sources order is: u lod v r hasOldLdOrder() const84bool hasOldLdOrder() const { return m_platformInfo.eRenderCoreFamily <= IGFX_GEN8_CORE; } supportSampleAndLd_lz() const85bool supportSampleAndLd_lz() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } supportSamplerToRT() const86bool supportSamplerToRT() const { 87 return (m_platformInfo.eProductFamily == IGFX_CHERRYVIEW) || (m_platformInfo.eRenderCoreFamily == IGFX_GEN9_CORE); 88 } supportFP16() const89 bool supportFP16() const { 90 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE) || 91 ((m_platformInfo.eRenderCoreFamily == IGFX_GEN8_CORE) && (m_platformInfo.eProductFamily == IGFX_CHERRYVIEW)); 92 } supportFP16Rounding() const93bool supportFP16Rounding() const { return false; } supportSamplerFp16Input() const94bool supportSamplerFp16Input() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } supportPooledEU() const95bool supportPooledEU() const { return m_SkuTable.FtrPooledEuEnabled != 0; } supportSplitSend() const96bool supportSplitSend() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } supportSendInstShootdown() const97bool supportSendInstShootdown() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } supportHSEightPatchDispatch() const98bool supportHSEightPatchDispatch() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } supportSingleInstanceVertexShader() const99bool supportSingleInstanceVertexShader() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } supportDSDualPatchDispatch() const100bool supportDSDualPatchDispatch() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } needsHSBarrierIDWorkaround() const101bool needsHSBarrierIDWorkaround() const { return m_platformInfo.eRenderCoreFamily <= IGFX_GEN10_CORE; } supportBindless() const102bool supportBindless() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } supportsBindlessSamplers() const103bool supportsBindlessSamplers() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } 104 SupportSurfaceInfoMessage() const105bool SupportSurfaceInfoMessage() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } SupportHDCUnormFormats() const106bool SupportHDCUnormFormats() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } localMemFenceSupress() const107 bool localMemFenceSupress() const { 108 return m_platformInfo.eRenderCoreFamily <= IGFX_GEN9_CORE || 109 IGC_IS_FLAG_ENABLED(DisbleLocalFences); 110 } psSimd32SkipStallHeuristic() const111bool psSimd32SkipStallHeuristic() const { return m_caps.KernelHwCaps.EUThreadsPerEU == 6; } enablePSsimd32() const112bool enablePSsimd32() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; } 113 supportSimd32PerPixelPSWithNumSamples16() const114bool supportSimd32PerPixelPSWithNumSamples16() const 115 { 116 return false; 117 } 118 119 supportDisableMidThreadPreemptionSwitch() const120bool supportDisableMidThreadPreemptionSwitch() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; } 121 needSWStencil() const122bool needSWStencil() const 123 { 124 return (m_platformInfo.eRenderCoreFamily == IGFX_GEN9_CORE && IGC_IS_FLAG_ENABLED(EnableSoftwareStencil)); 125 } supportMSAARateInPayload() const126bool supportMSAARateInPayload() const 127 { 128 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; 129 } 130 support16BitImmSrcForMad() const131bool support16BitImmSrcForMad() const { 132 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE); 133 } GetProductFamily() const134PRODUCT_FAMILY GetProductFamily() const { return m_platformInfo.eProductFamily; } GetDeviceId() const135unsigned short GetDeviceId() const { return m_platformInfo.usDeviceID; } GetRevId() const136unsigned short GetRevId() const { return m_platformInfo.usRevId; } GetPlatformFamily() const137GFXCORE_FAMILY GetPlatformFamily() const { return m_platformInfo.eRenderCoreFamily; } getPlatformInfo() const138const PLATFORM& getPlatformInfo() const { return m_platformInfo; } SetCaps(const SCompilerHwCaps & caps)139void SetCaps(const SCompilerHwCaps& caps) { m_caps = caps; } SetWATable(const WA_TABLE & waTable)140void SetWATable(const WA_TABLE& waTable) { m_WaTable = waTable; } SetSkuTable(const SKU_FEATURE_TABLE & skuTable)141void SetSkuTable(const SKU_FEATURE_TABLE& skuTable) { m_SkuTable = skuTable; } SetGTSystemInfo(const SUscGTSystemInfo gtSystemInfo)142void SetGTSystemInfo(const SUscGTSystemInfo gtSystemInfo) { 143 m_GTSystemInfo.EUCount = gtSystemInfo.EUCount; 144 m_GTSystemInfo.ThreadCount = gtSystemInfo.ThreadCount; 145 m_GTSystemInfo.SliceCount = gtSystemInfo.SliceCount; 146 m_GTSystemInfo.SubSliceCount = gtSystemInfo.SubSliceCount; 147 m_GTSystemInfo.SLMSizeInKb = gtSystemInfo.SLMSizeInKb; 148 m_GTSystemInfo.TotalPsThreadsWindowerRange = gtSystemInfo.TotalPsThreadsWindowerRange; 149 m_GTSystemInfo.TotalVsThreads = gtSystemInfo.TotalVsThreads; 150 m_GTSystemInfo.TotalVsThreads_Pocs = gtSystemInfo.TotalVsThreads_Pocs; 151 m_GTSystemInfo.TotalDsThreads = gtSystemInfo.TotalDsThreads; 152 m_GTSystemInfo.TotalGsThreads = gtSystemInfo.TotalGsThreads; 153 m_GTSystemInfo.TotalHsThreads = gtSystemInfo.TotalHsThreads; 154 m_GTSystemInfo.MaxEuPerSubSlice = gtSystemInfo.MaxEuPerSubSlice; 155 m_GTSystemInfo.EuCountPerPoolMax = gtSystemInfo.EuCountPerPoolMax; 156 m_GTSystemInfo.EuCountPerPoolMin = gtSystemInfo.EuCountPerPoolMin; 157 m_GTSystemInfo.MaxSlicesSupported = gtSystemInfo.MaxSlicesSupported; 158 m_GTSystemInfo.MaxSubSlicesSupported = gtSystemInfo.MaxSubSlicesSupported; 159 m_GTSystemInfo.IsDynamicallyPopulated = gtSystemInfo.IsDynamicallyPopulated; 160 m_GTSystemInfo.CsrSizeInMb = gtSystemInfo.CsrSizeInMb; 161 } 162 SetGTSystemInfo(const GT_SYSTEM_INFO & gtSystemInfo)163 void SetGTSystemInfo(const GT_SYSTEM_INFO& gtSystemInfo) { 164 m_GTSystemInfo = gtSystemInfo; 165 } 166 GetGTSystemInfo() const167GT_SYSTEM_INFO GetGTSystemInfo() const { return m_GTSystemInfo; } 168 getMaxPixelShaderThreads() const169 unsigned int getMaxPixelShaderThreads() const { 170 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE ? 171 m_caps.PixelShaderThreadsWindowerRange - 1 : m_caps.PixelShaderThreadsWindowerRange - 2; 172 } supportGPGPUMidThreadPreemption() const173bool supportGPGPUMidThreadPreemption() const { 174 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE && 175 m_platformInfo.eRenderCoreFamily <= IGFX_GEN11LP_CORE; 176 } supportFtrWddm2Svm() const177bool supportFtrWddm2Svm() const { return m_SkuTable.FtrWddm2Svm != 0; } supportStructuredAsRaw() const178bool supportStructuredAsRaw() const { 179 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; 180 } supportSamplerCacheResinfo() const181bool supportSamplerCacheResinfo() const { return m_platformInfo.eRenderCoreFamily == IGFX_GEN8_CORE; } 182 getMaxVertexShaderThreads(const bool isPositionOnlyShader) const183unsigned int getMaxVertexShaderThreads(const bool isPositionOnlyShader) const 184 { 185 const unsigned int maxVertexShaderThreads = isPositionOnlyShader ? m_caps.VertexShaderThreadsPosh : m_caps.VertexShaderThreads; 186 return maxVertexShaderThreads - 1; 187 } getMaxGeometryShaderThreads() const188unsigned int getMaxGeometryShaderThreads() const { return m_caps.GeometryShaderThreads - 1; } getMaxHullShaderThreads() const189unsigned int getMaxHullShaderThreads() const { return m_caps.HullShaderThreads - 1; } getMaxDomainShaderThreads() const190unsigned int getMaxDomainShaderThreads() const { return m_caps.DomainShaderThreads - 1; } getMaxGPGPUShaderThreads() const191unsigned int getMaxGPGPUShaderThreads() const { return m_caps.MediaShaderThreads - 1; } getKernelPointerAlignSize() const192unsigned int getKernelPointerAlignSize() const { return m_caps.KernelHwCaps.KernelPointerAlignSize; } getSharedLocalMemoryBlockSize() const193unsigned int getSharedLocalMemoryBlockSize() const { return m_caps.SharedLocalMemoryBlockSize; } getMaxNumberThreadPerSubslice() const194unsigned int getMaxNumberThreadPerSubslice() const 195 { 196 //total number of threads per subslice 197 if (m_caps.KernelHwCaps.SubSliceCount != 0) 198 return m_caps.KernelHwCaps.ThreadCount / m_caps.KernelHwCaps.SubSliceCount; 199 return 0; 200 } getMaxNumberThreadPerWorkgroupPooledMax() const201unsigned int getMaxNumberThreadPerWorkgroupPooledMax() const 202 { 203 return m_caps.KernelHwCaps.EUCountPerPoolMax * m_caps.KernelHwCaps.EUThreadsPerEU; 204 } getFFTIDBitMask() const205unsigned int getFFTIDBitMask() const { 206 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE) ? 0x3FF : 0x1FF; 207 } getBarrierCountBits(unsigned int count) const208unsigned int getBarrierCountBits(unsigned int count) const 209 { 210 // Returns barrier count field + enable for barrier message 211 if (m_platformInfo.eRenderCoreFamily <= IGFX_GEN10_CORE) 212 { 213 // up to Gen9 barrier count is in bits 14:9, enable is bit 15 214 return (count << 9) | (1 << 15); 215 } 216 else 217 { 218 // for Gen10+ barrier count is in bits 14:8, enable is bit 15 219 return (count << 8) | (1 << 15); 220 } 221 } 222 supportsDrawParametersSGVs() const223bool supportsDrawParametersSGVs() const 224 { 225 // Gen10+, 3DSTATE_VF_SGVS_2 226 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; 227 } 228 hasPSDBottleneck() const229bool hasPSDBottleneck() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; } 230 supportsHardwareResourceStreamer() const231bool supportsHardwareResourceStreamer() const 232 { 233 return m_platformInfo.eRenderCoreFamily < IGFX_GEN11_CORE; 234 } AOComputeShadersSIMD32Mode() const235bool AOComputeShadersSIMD32Mode() const 236 { 237 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE); 238 } getHullShaderThreadInstanceIdBitFieldPosition() const239unsigned int getHullShaderThreadInstanceIdBitFieldPosition() const 240 { 241 // HS thread receives instance ID in R0.2 bits 22:16 for Gen10+ and bits 23:17 for older Gens 242 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE) ? 16 : 17; 243 } supportsBinaryAtomicCounterMessage() const244bool supportsBinaryAtomicCounterMessage() const 245 { 246 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; 247 } supportSLMBlockMessage() const248bool supportSLMBlockMessage() const 249 { 250 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE); 251 } 252 hasSLMFence() const253bool hasSLMFence() const 254 { 255 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE); 256 } 257 supportRotateInstruction() const258bool supportRotateInstruction() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; } supportLRPInstruction() const259bool supportLRPInstruction() const { return m_platformInfo.eRenderCoreFamily < IGFX_GEN11_CORE; } support16bitMSAAPayload() const260bool support16bitMSAAPayload() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; } supportTwoStackTSG() const261bool supportTwoStackTSG() const 262 { 263 //Will need check for specific skus where TwoStackTSG is enabled 264 //Not all skus have it enabled 265 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE); 266 } enableBlendToDiscardAndFill() const267bool enableBlendToDiscardAndFill() const 268 { 269 return (m_platformInfo.eRenderCoreFamily < IGFX_GEN11_CORE); 270 } HSUsesHWBarriers() const271bool HSUsesHWBarriers() const 272 { 273 // HS HW barriers work correctly since ICL platform. 274 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE); 275 } 276 NeedResetA0forVxHA0() const277bool NeedResetA0forVxHA0() const 278 { 279 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE); 280 } 281 GetLogBindlessSamplerSize() const282unsigned int GetLogBindlessSamplerSize() const 283 { 284 // Samplers are 16 bytes 285 return 4; 286 } 287 SupportCPS() const288bool SupportCPS() const 289 { 290 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE); 291 } 292 supportsThreadCombining() const293bool supportsThreadCombining() const 294 { 295 return (!(!m_WaTable.WaEnablePooledEuFor2x6 && 296 m_platformInfo.eProductFamily == IGFX_BROXTON && 297 m_GTSystemInfo.SubSliceCount == 2)) 298 && (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE); 299 } 300 enableMaxWorkGroupSizeCalculation() const301bool enableMaxWorkGroupSizeCalculation() const 302 { 303 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE) && 304 IGC_IS_FLAG_ENABLED(EnableMaxWGSizeCalculation); 305 } 306 has8DWA64ScatteredMessage() const307bool has8DWA64ScatteredMessage() const { return m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE; } 308 flushL3ForTypedMemory() const309bool flushL3ForTypedMemory() const 310 { 311 return m_platformInfo.eRenderCoreFamily <= IGFX_GEN11_CORE; 312 } 313 supportsStencil(SIMDMode simdMode) const314bool supportsStencil(SIMDMode simdMode) const 315 { 316 return getMinDispatchMode() == SIMDMode::SIMD16 ? true : simdMode == SIMDMode::SIMD8; 317 } 318 hasFDIV() const319bool hasFDIV() const { 320 if (IGC_IS_FLAG_ENABLED(DisableFDIV)) 321 return false; 322 return (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE); 323 } 324 doIntegerMad() const325bool doIntegerMad() const 326 { 327 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE && m_platformInfo.eProductFamily != IGFX_DG1 && 328 IGC_IS_FLAG_ENABLED(EnableIntegerMad); 329 } 330 isDG1() const331bool isDG1() const 332 { 333 return m_platformInfo.eProductFamily == IGFX_DG1; 334 } 335 simplePushIsFasterThanGather() const336bool simplePushIsFasterThanGather() const 337 { 338 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; 339 } 340 singleThreadBasedInstScheduling() const341bool singleThreadBasedInstScheduling() const 342 { 343 return m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE; 344 } 345 346 //all the platforms which do not support 64 bit operations and 347 //needs int64 emulation support. Except also for BXT where 348 //64-bit inst has much lower throughput compared to SKL. 349 //Emulating it improves performance on some benchmarks and 350 //won't have impact on the overall performance. need64BitEmulation() const351bool need64BitEmulation() const { 352 return m_platformInfo.eProductFamily == IGFX_GEMINILAKE || 353 m_platformInfo.eProductFamily == IGFX_BROXTON || 354 hasNoInt64Inst(); 355 } 356 HDCCoalesceSLMAtomicINCWithNoReturn() const357bool HDCCoalesceSLMAtomicINCWithNoReturn() const 358 { 359 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; 360 } 361 HDCCoalesceAtomicCounterAccess() const362bool HDCCoalesceAtomicCounterAccess() const 363 { 364 return (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE) && IGC_IS_FLAG_DISABLED(ForceSWCoalescingOfAtomicCounter); 365 } 366 supportsMCSNonCompressedFix() const367bool supportsMCSNonCompressedFix() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; } 368 hasHWDp4AddSupport() const369bool hasHWDp4AddSupport() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; } 370 useOnlyEightPatchDispatchHS() const371bool useOnlyEightPatchDispatchHS() const 372 { 373 return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE); 374 } 375 supportsPrimitiveReplication() const376bool supportsPrimitiveReplication() const 377 { 378 return ((m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE) || 379 (m_platformInfo.eRenderCoreFamily == IGFX_GEN11_CORE && m_platformInfo.eProductFamily == IGFX_ICELAKE)); 380 } 381 382 // If true then screen space coordinates for upper-left vertex of a triangle 383 // being rasterized are delivered together with source depth or W deltas. hasStartCoordinatesDeliveredWithDeltas() const384bool hasStartCoordinatesDeliveredWithDeltas() const 385 { 386 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; 387 } 388 disableStaticVertexCount() const389bool disableStaticVertexCount() const 390 { 391 return m_WaTable.Wa_14012504847 != 0 || IGC_IS_FLAG_ENABLED(ForceStaticToDynamic); 392 } 393 hasSamplerSupport() const394bool hasSamplerSupport() const 395 { 396 return true; 397 } 398 getMinPushConstantBufferAlignment() const399uint32_t getMinPushConstantBufferAlignment() const 400 { 401 return 8; // DWORDs 402 } 403 404 // Returns the default limit of pushed constant data in GRFs. This value limits 405 // the amount of constant buffer data promoted to registers. getBlockPushConstantGRFThreshold() const406uint32_t getBlockPushConstantGRFThreshold() const 407 { 408 constexpr uint32_t defaultThreshold = 31; 409 constexpr uint32_t gen9GT2Threshold = 15; 410 411 const GTTYPE gt = m_platformInfo.eGTType; 412 switch (m_platformInfo.eProductFamily) 413 { 414 case IGFX_COFFEELAKE: 415 case IGFX_SKYLAKE: 416 case IGFX_KABYLAKE: 417 return (gt == GTTYPE_GT2) ? gen9GT2Threshold : defaultThreshold; 418 default: 419 return defaultThreshold; 420 } 421 } 422 hasDualSubSlices() const423bool hasDualSubSlices() const 424 { 425 bool hasDualSS = m_platformInfo.eRenderCoreFamily == IGFX_GEN12_CORE || 426 m_platformInfo.eRenderCoreFamily == IGFX_GEN12LP_CORE; 427 return hasDualSS; 428 } 429 getSlmSizePerSsOrDss() const430unsigned getSlmSizePerSsOrDss() const 431 { 432 // GTSysInfo sets SLMSize only for gen12+ 433 unsigned slmSizePerSsOrDss = 65536; 434 if (hasDualSubSlices()) 435 { 436 if (GetGTSystemInfo().DualSubSliceCount) 437 { 438 slmSizePerSsOrDss = GetGTSystemInfo().SLMSizeInKb / GetGTSystemInfo().DualSubSliceCount * 1024; 439 } 440 else 441 { 442 slmSizePerSsOrDss = 131072; 443 } 444 } 445 return slmSizePerSsOrDss; 446 } 447 canForcePrivateToGlobal() const448bool canForcePrivateToGlobal() const 449 { 450 return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE && IGC_IS_FLAG_ENABLED(ForcePrivateMemoryToGlobalOnGeneric); 451 } 452 getHWTIDFromSR0() const453bool getHWTIDFromSR0() const 454 { 455 return isXeHPSDVPlus(); 456 } 457 supportAdd3Instruction() const458bool supportAdd3Instruction() const 459 { 460 return isXeHPSDVPlus(); 461 } 462 supportBfnInstruction() const463bool supportBfnInstruction() const 464 { 465 return isXeHPSDVPlus(); 466 } 467 supportDpasInstruction() const468bool supportDpasInstruction() const 469 { 470 return isXeHPSDVPlus(); 471 } 472 hasPackedRestrictedFloatVector() const473bool hasPackedRestrictedFloatVector() const 474 { 475 return true; 476 } 477 supportLoadThreadPayloadForCompute() const478bool supportLoadThreadPayloadForCompute() const 479 { 480 return isXeHPSDVPlus(); 481 } 482 Enable32BitIntDivRemEmu() const483bool Enable32BitIntDivRemEmu() const 484 { 485 return isXeHPSDVPlus(); 486 } 487 support16DWURBWrite() const488bool support16DWURBWrite() const 489 { 490 return IGC_IS_FLAG_ENABLED(Enable16DWURBWrite) && isXeHPSDVPlus(); 491 } 492 hasScratchSurface() const493bool hasScratchSurface() const 494 { 495 return isXeHPSDVPlus(); 496 } 497 hasAtomicPreDec() const498bool hasAtomicPreDec() const 499 { 500 return !isXeHPSDVPlus(); 501 } 502 support26BitBSOFormat() const503bool support26BitBSOFormat() const 504 { 505 return isXeHPSDVPlus(); 506 } 507 needsHeaderForAtomicCounter() const508bool needsHeaderForAtomicCounter() const 509 { 510 return isXeHPSDVPlus(); 511 } 512 doScalar64bScan() const513bool doScalar64bScan() const 514 { 515 return isXeHPSDVPlus(); 516 } 517 hasHWLocalThreadID() const518bool hasHWLocalThreadID() const 519 { 520 return isXeHPSDVPlus(); 521 } 522 getOfflineCompilerMaxWorkGroupSize() const523unsigned int getOfflineCompilerMaxWorkGroupSize() const 524 { 525 if (isXeHPSDVPlus()) 526 return 1024; 527 return 448; 528 } 529 hasFP16AtomicMinMax() const530bool hasFP16AtomicMinMax() const 531 { 532 return isXeHPSDVPlus(); 533 } 534 hasFP32GlobalAtomicAdd() const535bool hasFP32GlobalAtomicAdd() const 536 { 537 return isXeHPSDVPlus(); 538 } 539 has16OWSLMBlockRW() const540bool has16OWSLMBlockRW() const 541 { 542 return IGC_IS_FLAG_ENABLED(Enable16OWSLMBlockRW) && isXeHPSDVPlus(); 543 } 544 supportInlineData() const545bool supportInlineData() const 546 { 547 return isXeHPSDVPlus(); 548 } 549 supportsAutoGRFSelection() const550bool supportsAutoGRFSelection() const 551 { 552 return m_platformInfo.eProductFamily == IGFX_XE_HP_SDV; 553 } 554 adjustedSpillThreshold() const555float adjustedSpillThreshold() const 556 { 557 return 12.0f; 558 } 559 isXeHPSDVPlus() const560bool isXeHPSDVPlus() const 561 { 562 return m_platformInfo.eProductFamily >= IGFX_XE_HP_SDV; 563 } 564 supportInlineDataOCL() const565bool supportInlineDataOCL() const 566 { 567 return isXeHPSDVPlus(); 568 } 569 has64BMediaBlockRW() const570bool has64BMediaBlockRW() const 571 { 572 return IGC_IS_FLAG_ENABLED(Enable64BMediaBlockRW) && isXeHPSDVPlus(); 573 } 574 hasNoFullI64Support() const575bool hasNoFullI64Support() const 576 { 577 return hasNoInt64Inst(); 578 } 579 hasNoInt64AddInst() const580bool hasNoInt64AddInst() const 581 { 582 return hasNoFullI64Support(); 583 } 584 supportsSIMD16TypedRW() const585bool supportsSIMD16TypedRW() const 586 { 587 return false; 588 } 589 supportsStaticRegSharing() const590bool supportsStaticRegSharing() const 591 { 592 return isXeHPSDVPlus(); 593 } emulateByteScraterMsgForSS() const594bool emulateByteScraterMsgForSS() const 595 { 596 return isXeHPSDVPlus() && (m_platformInfo.usRevId == 0 || IGC_IS_FLAG_ENABLED(EnableUntypedSurfRWofSS)); 597 } 598 599 //all the platforms which DONOT support 64 bit int operations hasNoInt64Inst() const600bool hasNoInt64Inst() const { 601 return m_platformInfo.eProductFamily == IGFX_ICELAKE_LP || 602 m_platformInfo.eProductFamily == IGFX_LAKEFIELD || 603 m_platformInfo.eProductFamily == IGFX_ELKHARTLAKE || 604 m_platformInfo.eProductFamily == IGFX_JASPERLAKE || 605 m_platformInfo.eProductFamily == IGFX_TIGERLAKE_LP || 606 m_platformInfo.eProductFamily == IGFX_ROCKETLAKE || 607 m_platformInfo.eProductFamily == IGFX_ALDERLAKE_S || 608 m_platformInfo.eProductFamily == IGFX_ALDERLAKE_P || 609 m_platformInfo.eProductFamily == IGFX_DG1; 610 } 611 612 //all the platforms which DONOT support 64 bit float operations hasNoFP64Inst() const613bool hasNoFP64Inst() const { 614 return m_platformInfo.eProductFamily == IGFX_ICELAKE_LP || 615 m_platformInfo.eProductFamily == IGFX_LAKEFIELD || 616 m_platformInfo.eProductFamily == IGFX_ELKHARTLAKE || 617 m_platformInfo.eProductFamily == IGFX_JASPERLAKE || 618 m_platformInfo.eProductFamily == IGFX_TIGERLAKE_LP || 619 m_platformInfo.eProductFamily == IGFX_ROCKETLAKE || 620 m_platformInfo.eProductFamily == IGFX_ALDERLAKE_S || 621 m_platformInfo.eProductFamily == IGFX_ALDERLAKE_P || 622 m_platformInfo.eProductFamily == IGFX_DG1; 623 } 624 625 //all the platforms which have correctly rounded macros (INVM, RSQRTM, MADM) hasCorrectlyRoundedMacros() const626bool hasCorrectlyRoundedMacros() const { 627 return m_platformInfo.eProductFamily != IGFX_ICELAKE_LP && 628 m_platformInfo.eProductFamily != IGFX_LAKEFIELD && 629 m_platformInfo.eProductFamily != IGFX_JASPERLAKE && 630 m_platformInfo.eProductFamily != IGFX_TIGERLAKE_LP && 631 m_platformInfo.eProductFamily != IGFX_ROCKETLAKE && 632 m_platformInfo.eProductFamily != IGFX_DG1 && 633 m_platformInfo.eProductFamily != IGFX_ALDERLAKE_S && 634 m_platformInfo.eProductFamily != IGFX_ALDERLAKE_P; 635 } 636 hasFusedEU() const637bool hasFusedEU() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; } supportMixMode() const638bool supportMixMode() const { 639 return IGC_IS_FLAG_ENABLED(ForceMixMode) || 640 (IGC_IS_FLAG_DISABLED(DisableMixMode) && 641 (m_platformInfo.eProductFamily == IGFX_CHERRYVIEW || 642 m_platformInfo.eRenderCoreFamily == IGFX_GEN9_CORE || 643 m_platformInfo.eRenderCoreFamily == IGFX_GEN10_CORE)); 644 } DSPrimitiveIDPayloadPhaseCanBeSkipped() const645bool DSPrimitiveIDPayloadPhaseCanBeSkipped() const { return false; } useScratchSpaceForOCL() const646bool useScratchSpaceForOCL() const 647 { 648 return IGC_IS_FLAG_ENABLED(EnableOCLScratchPrivateMemory); 649 } 650 getGRFSize() const651uint32_t getGRFSize() const 652 { 653 return 32; 654 } 655 maxPerThreadScratchSpace() const656uint32_t maxPerThreadScratchSpace() const 657 { 658 return 0x200000; 659 } 660 supportByteALUOperation() const661bool supportByteALUOperation() const 662 { 663 return true; 664 } 665 NeedsHDCFenceBeforeEOTInPixelShader() const666bool NeedsHDCFenceBeforeEOTInPixelShader() const 667 { 668 return m_WaTable.Wa_1807084924 != 0; 669 } 670 canFuseTypedWrite() const671bool canFuseTypedWrite() const 672 { 673 return false; 674 } 675 getMaxNumberHWThreadForEachWG() const676unsigned int getMaxNumberHWThreadForEachWG() const 677 { 678 if (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE) 679 { 680 //each WG is dispatched into one subslice for GEN11 and before 681 return getMaxNumberThreadPerSubslice(); 682 } 683 else 684 { 685 return getMaxNumberThreadPerSubslice() * 2; 686 } 687 } 688 689 // max block size for legacy OWord block messages getMaxBlockMsgSize(bool isSLM) const690uint32_t getMaxBlockMsgSize(bool isSLM) const 691 { 692 return 128; 693 } 694 getMinDispatchMode() const695SIMDMode getMinDispatchMode() const 696 { 697 return SIMDMode::SIMD8; 698 } 699 getAccChNumUD() const700unsigned getAccChNumUD() const 701 { 702 return 8; 703 } 704 getBSOLocInExtDescriptor() const705int getBSOLocInExtDescriptor() const 706 { 707 return 12; 708 } 709 710 // ***** Below go accessor methods for testing WA data from WA_TABLE ***** 711 WaDoNotPushConstantsForAllPulledGSTopologies() const712bool WaDoNotPushConstantsForAllPulledGSTopologies() const 713 { 714 return (m_platformInfo.eProductFamily == IGFX_BROADWELL) || 715 m_WaTable.WaDoNotPushConstantsForAllPulledGSTopologies != 0; 716 } 717 WaForceMinMaxGSThreadCount() const718bool WaForceMinMaxGSThreadCount() const 719 { 720 return m_WaTable.WaForceMinMaxGSThreadCount != 0; 721 } 722 WaOCLEnableFMaxFMinPlusZero() const723bool WaOCLEnableFMaxFMinPlusZero() const 724 { 725 return m_WaTable.WaOCLEnableFMaxFMinPlusZero != 0; 726 } 727 WaDisableSendsSrc0DstOverlap() const728bool WaDisableSendsSrc0DstOverlap() const 729 { 730 return m_WaTable.WaDisableSendsSrc0DstOverlap != 0; 731 } 732 WaDisableEuBypass() const733bool WaDisableEuBypass() const 734 { 735 return (m_WaTable.WaDisableEuBypassOnSimd16Float32 != 0); 736 } 737 WaDisableDSDualPatchMode() const738bool WaDisableDSDualPatchMode() const 739 { 740 return m_WaTable.WaDisableDSDualPatchMode == 0; 741 } 742 WaDispatchGRFHWIssueInGSAndHSUnit() const743bool WaDispatchGRFHWIssueInGSAndHSUnit() const 744 { 745 return m_WaTable.WaDispatchGRFHWIssueInGSAndHSUnit != 0; 746 } 747 WaSamplerResponseLengthMustBeGreaterThan1() const748bool WaSamplerResponseLengthMustBeGreaterThan1() const 749 { 750 return m_WaTable.WaSamplerResponseLengthMustBeGreaterThan1 != 0; 751 } 752 WaDisableDSPushConstantsInFusedDownModeWithOnlyTwoSubslices() const753bool WaDisableDSPushConstantsInFusedDownModeWithOnlyTwoSubslices() const 754 { 755 return ((m_WaTable.WaDisableDSPushConstantsInFusedDownModeWithOnlyTwoSubslices) && 756 (m_GTSystemInfo.IsDynamicallyPopulated && m_GTSystemInfo.SubSliceCount == 2)); 757 } 758 WaDisableVSPushConstantsInFusedDownModeWithOnlyTwoSubslices() const759bool WaDisableVSPushConstantsInFusedDownModeWithOnlyTwoSubslices() const 760 { 761 return ((m_WaTable.WaDisableVSPushConstantsInFusedDownModeWithOnlyTwoSubslices) && 762 (m_GTSystemInfo.IsDynamicallyPopulated && m_GTSystemInfo.SubSliceCount == 2)); 763 } 764 WaForceCB0ToBeZeroWhenSendingPC() const765bool WaForceCB0ToBeZeroWhenSendingPC() const 766 { 767 return m_WaTable.WaForceCB0ToBeZeroWhenSendingPC != 0; 768 } 769 WaConservativeRasterization() const770bool WaConservativeRasterization() const 771 { 772 return (m_WaTable.WaConservativeRasterization != 0 && 773 IGC_IS_FLAG_ENABLED(ApplyConservativeRastWAHeader)); 774 } 775 WaReturnZeroforRTReadOutsidePrimitive() const776bool WaReturnZeroforRTReadOutsidePrimitive() const 777 { 778 return m_WaTable.WaReturnZeroforRTReadOutsidePrimitive != 0; 779 } 780 WaFixInnerCoverageWithSampleMask() const781bool WaFixInnerCoverageWithSampleMask() const 782 { 783 return m_WaTable.Wa_220856683 != 0; 784 } 785 WaForceDSToWriteURB() const786bool WaForceDSToWriteURB() const 787 { 788 return m_WaTable.Wa_1805992985 != 0; 789 } 790 WaOverwriteFFID() const791bool WaOverwriteFFID() const 792 { 793 return m_WaTable.Wa_1409460247 != 0; 794 } 795 796 WaDisableSendSrcDstOverlap() const797bool WaDisableSendSrcDstOverlap() const 798 { 799 return (!IGC_IS_FLAG_ENABLED(DisableSendSrcDstOverlapWA)) && 800 (m_SkuTable.FtrWddm2Svm != 0 || m_platformInfo.eRenderCoreFamily == IGFX_GEN10_CORE || 801 m_platformInfo.eRenderCoreFamily == IGFX_GEN11_CORE); 802 803 } 804 WaInsertHDCFenceBeforeEOTWhenSparseAliasedResources() const805bool WaInsertHDCFenceBeforeEOTWhenSparseAliasedResources() const 806 { 807 return m_WaTable.Wa_1807084924 != 0; 808 } 809 WaDisableSampleLz() const810bool WaDisableSampleLz() const 811 { 812 return (IGC_IS_FLAG_DISABLED(DisableWaSampleLZ) && m_WaTable.Wa_14013297064); 813 } 814 WaEnableA64WA() const815bool WaEnableA64WA() const 816 { 817 if (IGC_IS_FLAG_ENABLED(EnableA64WA) && m_WaTable.Wa_14010595310) { 818 return true; 819 } 820 return false; 821 } 822 823 //Only enable this WA for TGLLP+ because, in pre TGLLP projects, smov was replaced with two instructions which caused performance penalty. enableMultiGRFAccessWA() const824bool enableMultiGRFAccessWA() const 825 { 826 return (m_platformInfo.eProductFamily >= IGFX_TIGERLAKE_LP); 827 } 828 829 // Return true if platform has structured control-flow instructions and IGC wants to use them. hasSCF() const830bool hasSCF() const 831 { 832 bool doscf = true; 833 return doscf; 834 } 835 GetCaps()836const SCompilerHwCaps& GetCaps() { return m_caps; } 837 supportHeaderRTW() const838bool supportHeaderRTW() const 839 { 840 return true; 841 } 842 preemptionSupported() const843bool preemptionSupported() const 844 { 845 846 return GetPlatformFamily() >= IGFX_GEN9_CORE; 847 } 848 849 // platform natively not support DW-DW multiply noNativeDwordMulSupport() const850bool noNativeDwordMulSupport() const 851 { 852 return m_platformInfo.eProductFamily == IGFX_BROXTON || 853 m_platformInfo.eProductFamily == IGFX_GEMINILAKE || 854 GetPlatformFamily() == IGFX_GEN11_CORE || 855 GetPlatformFamily() == IGFX_GEN12LP_CORE; 856 } 857 getURBFullWriteMinGranularity() const858unsigned getURBFullWriteMinGranularity() const 859 { 860 unsigned overrideValue = IGC_GET_FLAG_VALUE(SetURBFullWriteGranularity); 861 if (overrideValue == 16 || overrideValue == 32) 862 { 863 return overrideValue; 864 } 865 return isXeHPSDVPlus() ? 16 : 32; // in bytes 866 } 867 868 }; 869 870 }//namespace IGC 871