File: Platform.hpp

package info (click to toggle)
intel-graphics-compiler 1.0.17791.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,312 kB
  • sloc: cpp: 935,343; lisp: 286,143; ansic: 16,196; python: 3,279; yacc: 2,487; lex: 1,642; pascal: 300; sh: 174; makefile: 27
file content (1802 lines) | stat: -rw-r--r-- 55,127 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
/*========================== begin_copyright_notice ============================

Copyright (C) 2017-2023 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#pragma once
#include "inc/common/igfxfmid.h"
#include "Compiler/compiler_caps.h"
#include "Compiler/igc_workaround.h"
#include "Compiler/API/ShaderTypesEnum.h"
#include "common/Types.hpp"
#include "Probe/Assertion.h"
#include "common/igc_regkeys.hpp"

#include "skuwa/iacm_g10_rev_id.h"
#include "skuwa/iacm_g11_rev_id.h"
#include "skuwa/iacm_g12_rev_id.h"

#include "iStdLib/utility.h"
#include "visa_igc_common_header.h"

namespace IGC
{

class CPlatform
{
    PLATFORM m_platformInfo = {};
    SCompilerHwCaps m_caps = {};
    WA_TABLE m_WaTable = {};
    SKU_FEATURE_TABLE m_SkuTable = {};
    GT_SYSTEM_INFO m_GTSystemInfo = {};
    OCLCaps m_OCLCaps = {};

public:
    CPlatform() {}

    CPlatform(const PLATFORM& platform)
    {
        m_platformInfo = platform;
    }

private:
bool hasQWAddSupport() const
{
    return (m_platformInfo.eProductFamily == IGFX_PVC &&
        m_platformInfo.usRevId >= REVISION_D)  // true from PVC XT B0 RevID==0x5==REVISION_D
        || isCoreChildOf(IGFX_XE2_HPG_CORE);
}

//all the platforms which DONOT support 64 bit int operations
bool hasNoInt64Inst() const {
    return m_platformInfo.eProductFamily == IGFX_ICELAKE_LP ||
        m_platformInfo.eProductFamily == IGFX_LAKEFIELD ||
        m_platformInfo.eProductFamily == IGFX_ELKHARTLAKE ||
        m_platformInfo.eProductFamily == IGFX_JASPERLAKE ||
        m_platformInfo.eProductFamily == IGFX_TIGERLAKE_LP ||
        m_platformInfo.eProductFamily == IGFX_ROCKETLAKE ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_S ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_P ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_N ||
        m_platformInfo.eProductFamily == IGFX_DG1 ||
        m_platformInfo.eProductFamily == IGFX_DG2 ||
        m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE;
}

public:
void setOclCaps(OCLCaps& caps) { m_OCLCaps = caps; }
uint32_t getMaxOCLParameteSize() const {
    uint32_t limitFromFlag = IGC_GET_FLAG_VALUE(OverrideOCLMaxParamSize);
    return limitFromFlag ? limitFromFlag : m_OCLCaps.MaxParameterSize;
}
void OverrideRevId(unsigned short newRevId)
{
    m_platformInfo.usRevId = newRevId;
}

void OverrideDeviceId(unsigned short newDeviceID)
{
    m_platformInfo.usDeviceID = newDeviceID;
}


void OverrideProductFamily(unsigned int productID)
{
    PRODUCT_FAMILY eProd = static_cast<PRODUCT_FAMILY>(productID);
    if(eProd > IGFX_UNKNOWN && eProd < IGFX_MAX_PRODUCT)
        m_platformInfo.eProductFamily = (PRODUCT_FAMILY)productID;
}

    WA_TABLE const& getWATable() const { return m_WaTable; }
SKU_FEATURE_TABLE const& getSkuTable() const { return m_SkuTable; }

bool hasPackedVertexAttr() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool hasScaledMessage() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool has8ByteA64ByteScatteredMessage() const { return m_platformInfo.eRenderCoreFamily == IGFX_GEN8_CORE; }
bool hasQWGatherScatterBTSMessage() const { return m_platformInfo.eRenderCoreFamily >= IGFX_XE_HP_SDV; }

bool hasPredicatedBarriers() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool hasIEEEMinmaxBit() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool hasL1ReadOnlyCache() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }
// Gen10+ HW supports adding vertex start to vertex ID
bool hasVertexOffsetEnable() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }

// Gen10+ HW supports sending base instance, base vertex and draw index with
// VF, this is programmed using 3DSTATE_VF_SGVS2 command.
bool hasSGVS2Command() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }

// Sampler supports normalization of coordinates during sampling from
// rectangle textures.
bool supportsCoordinateNormalizationForRectangleTextures() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }

/// On some platforms ld sources order is: u lod v r
bool hasOldLdOrder() const { return m_platformInfo.eRenderCoreFamily <= IGFX_GEN8_CORE; }
bool supportSampleAndLd_lz() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool supportSamplerToRT() const {
        return (m_platformInfo.eProductFamily == IGFX_CHERRYVIEW) || (m_platformInfo.eRenderCoreFamily == IGFX_GEN9_CORE);
    }
    bool supportFP16() const {
        return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE) ||
            ((m_platformInfo.eRenderCoreFamily == IGFX_GEN8_CORE) && (m_platformInfo.eProductFamily == IGFX_CHERRYVIEW));
    }
bool supportFP16Rounding() const { return false; }
bool supportSamplerFp16Input() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }
bool supportPooledEU() const { return m_SkuTable.FtrPooledEuEnabled != 0; }
bool supportSplitSend() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool supportSendInstShootdown() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }
bool supportHSEightPatchDispatch() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool supportSingleInstanceVertexShader() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }
bool supportDSDualPatchDispatch() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool needsHSBarrierIDWorkaround() const { return m_platformInfo.eRenderCoreFamily <= IGFX_GEN10_CORE; }
bool supportBindless() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool supportsBindlessSamplers() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }
bool supportsHDCLegacyDCROMessage() const { return m_platformInfo.eRenderCoreFamily <= IGFX_XE_HPC_CORE; }


bool SupportSurfaceInfoMessage() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }
bool SupportHDCUnormFormats() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }
    bool localMemFenceSupress() const {
        return m_platformInfo.eRenderCoreFamily <= IGFX_GEN9_CORE ||
            IGC_IS_FLAG_ENABLED(DisbleLocalFences);
    }
bool psSimd32SkipStallHeuristic() const { return m_caps.KernelHwCaps.EUThreadsPerEU == 6; }
bool enablePSsimd32() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE; }

bool supportSimd32PerPixelPSWithNumSamples16() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool canSupportWMTPWithoutBTD() const {
    // Returns true if the platform has the capability of supporting
    // WMTP but WMTP isn't supported for all shader types
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}


bool canSupportWMTP() const
{
    // Returns true if the platform has the capability of supporting
    // WMTP but WMTP isn't supported for all shader types
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool supportsWMTPForShaderType(ShaderType type) const {

    if (isCoreChildOf(IGFX_XE2_HPG_CORE)) {
        switch(type) {
        case ShaderType::COMPUTE_SHADER:
        case ShaderType::OPENCL_SHADER:
            return true;
        default:
            return false;
        }
    }

    return false;
}

bool supportDisableMidThreadPreemptionSwitch() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE; }

bool needSWStencil() const
{
        return (m_platformInfo.eRenderCoreFamily == IGFX_GEN9_CORE && IGC_IS_FLAG_ENABLED(EnableSoftwareStencil));
}
bool supportMSAARateInPayload() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE;
}

bool support16BitImmSrcForMad() const {
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE);
}

// This function checks if product is child of another product
bool isProductChildOf(PRODUCT_FAMILY product) const
{
    if (product == IGFX_PVC)
        return isCoreChildOf(IGFX_XE_HPC_CORE);
    return m_platformInfo.eProductFamily >= product;
}

// This function checks if core is child of another core
bool isCoreChildOf(GFXCORE_FAMILY core) const
{
    return m_platformInfo.eRenderCoreFamily >= core;
}

bool supports8DWLSCMessage() const {
    return (SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0) && m_platformInfo.eProductFamily == IGFX_DG2)
            || GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID)
            || GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID)
            || isCoreChildOf(IGFX_XE_HPC_CORE);
}

PRODUCT_FAMILY GetProductFamily() const { return m_platformInfo.eProductFamily; }
unsigned short GetDeviceId() const { return m_platformInfo.usDeviceID; }
unsigned short GetRevId() const { return m_platformInfo.usRevId; }
GFXCORE_FAMILY GetPlatformFamily() const { return m_platformInfo.eRenderCoreFamily; }
const PLATFORM& getPlatformInfo() const { return m_platformInfo; }
void SetCaps(const SCompilerHwCaps& caps) { m_caps = caps; }
void SetWATable(const WA_TABLE& waTable) { m_WaTable = waTable; }
void SetSkuTable(const SKU_FEATURE_TABLE& skuTable) { m_SkuTable = skuTable; }
void SetGTSystemInfo(const SUscGTSystemInfo gtSystemInfo) {
    m_GTSystemInfo.EUCount = gtSystemInfo.EUCount;
    m_GTSystemInfo.ThreadCount = gtSystemInfo.ThreadCount;
    m_GTSystemInfo.SliceCount = gtSystemInfo.SliceCount;
    m_GTSystemInfo.SubSliceCount = gtSystemInfo.SubSliceCount;
    m_GTSystemInfo.SLMSizeInKb = gtSystemInfo.SLMSizeInKb;
    m_GTSystemInfo.TotalPsThreadsWindowerRange = gtSystemInfo.TotalPsThreadsWindowerRange;
    m_GTSystemInfo.TotalVsThreads = gtSystemInfo.TotalVsThreads;
    m_GTSystemInfo.TotalVsThreads_Pocs = gtSystemInfo.TotalVsThreads_Pocs;
    m_GTSystemInfo.TotalDsThreads = gtSystemInfo.TotalDsThreads;
    m_GTSystemInfo.TotalGsThreads = gtSystemInfo.TotalGsThreads;
    m_GTSystemInfo.TotalHsThreads = gtSystemInfo.TotalHsThreads;
    m_GTSystemInfo.MaxEuPerSubSlice = gtSystemInfo.MaxEuPerSubSlice;
    m_GTSystemInfo.EuCountPerPoolMax = gtSystemInfo.EuCountPerPoolMax;
    m_GTSystemInfo.EuCountPerPoolMin = gtSystemInfo.EuCountPerPoolMin;
    m_GTSystemInfo.MaxSlicesSupported = gtSystemInfo.MaxSlicesSupported;
    m_GTSystemInfo.MaxSubSlicesSupported = gtSystemInfo.MaxSubSlicesSupported;
    m_GTSystemInfo.IsDynamicallyPopulated = gtSystemInfo.IsDynamicallyPopulated;
    m_GTSystemInfo.CsrSizeInMb = gtSystemInfo.CsrSizeInMb;
}

    void SetGTSystemInfo(const GT_SYSTEM_INFO& gtSystemInfo) {
    m_GTSystemInfo = gtSystemInfo;
}

GT_SYSTEM_INFO GetGTSystemInfo() const { return m_GTSystemInfo; }

    unsigned int getMaxPixelShaderThreads() const {
        return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE ?
            m_caps.PixelShaderThreadsWindowerRange - 1 : m_caps.PixelShaderThreadsWindowerRange - 2;
    }
bool supportGPGPUMidThreadPreemption() const {
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE &&
        m_platformInfo.eRenderCoreFamily <= IGFX_GEN11LP_CORE;
}
bool supportFtrWddm2Svm() const { return m_SkuTable.FtrWddm2Svm != 0; }
bool supportStructuredAsRaw() const {
        return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE;
    }
bool supportSamplerCacheResinfo() const { return m_platformInfo.eRenderCoreFamily == IGFX_GEN8_CORE; }

unsigned int getMaxVertexShaderThreads(const bool isPositionOnlyShader) const
{
    const unsigned int maxVertexShaderThreads = isPositionOnlyShader ? m_caps.VertexShaderThreadsPosh : m_caps.VertexShaderThreads;
    return maxVertexShaderThreads - 1;
}
unsigned int getMaxGeometryShaderThreads() const { return m_caps.GeometryShaderThreads - 1; }
unsigned int getMaxHullShaderThreads() const { return m_caps.HullShaderThreads - 1; }
unsigned int getMaxDomainShaderThreads() const { return m_caps.DomainShaderThreads - 1; }
unsigned int getMaxGPGPUShaderThreads() const { return m_caps.MediaShaderThreads - 1; }
unsigned int getKernelPointerAlignSize() const { return m_caps.KernelHwCaps.KernelPointerAlignSize; }
unsigned int getSharedLocalMemoryBlockSize() const { return m_caps.SharedLocalMemoryBlockSize; }
unsigned int getMaxNumberThreadPerSubslice() const
{
    //total number of threads per subslice
        if (m_caps.KernelHwCaps.SubSliceCount != 0)
        return m_caps.KernelHwCaps.ThreadCount / m_caps.KernelHwCaps.SubSliceCount;
    return 0;
}
unsigned int getMaxNumberThreadPerWorkgroupPooledMax() const
{
    return m_caps.KernelHwCaps.EUCountPerPoolMax * m_caps.KernelHwCaps.EUThreadsPerEU;
}
unsigned int getBarrierCountBits(unsigned int count) const
{
    // Returns barrier count field + enable for barrier message
    if (m_platformInfo.eRenderCoreFamily <= IGFX_GEN10_CORE)
    {
        // up to Gen9 barrier count is in bits 14:9, enable is bit 15
        return (count << 9) | (1 << 15);
    }
    else
    {
        // for Gen10+ barrier count is in bits 14:8, enable is bit 15
        return (count << 8) | (1 << 15);
    }
}

bool supportsDrawParametersSGVs() const
{
    // Gen10+, 3DSTATE_VF_SGVS_2
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE;
}

bool hasPSDBottleneck() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; }

bool supportsHardwareResourceStreamer() const
{
    return m_platformInfo.eRenderCoreFamily < IGFX_GEN11_CORE;
}
bool AOComputeShadersSIMD32Mode() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE);
}
unsigned int getHullShaderThreadInstanceIdBitFieldPosition() const
{
    // HS thread receives instance ID in R0.2 bits 22:16 for Gen10+ and bits 23:17 for older Gens
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE) ? 16 : 17;
}
bool supportsBinaryAtomicCounterMessage() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE;
}
bool supportSLMBlockMessage() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE);
}

bool hasSLMFence() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE);
}

bool hasIndependentSharedMemoryFenceFunctionality() const
{
    return (m_platformInfo.eProductFamily != IGFX_DG2);
}

bool supportRotateInstruction() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; }
bool supportLRPInstruction() const { return m_platformInfo.eRenderCoreFamily < IGFX_GEN11_CORE; }
bool support16bitMSAAPayload() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE; }
bool supportTwoStackTSG() const
{
    //Will need check for specific skus where TwoStackTSG is enabled
    //Not all skus have it enabled
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE);
}
bool enableBlendToDiscardAndFill() const
{
    return (m_platformInfo.eRenderCoreFamily < IGFX_GEN11_CORE);
}
bool HSUsesHWBarriers() const
{
    // HS HW barriers work correctly since ICL platform.
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE);
}

bool NeedResetA0forVxHA0() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE);
}

unsigned int GetLogBindlessSamplerSize() const
{
    // Samplers are 16 bytes
    return 4;
}

bool SupportCPS() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE);
}
bool supportsSIMD32forCPS() const
{
    return (m_platformInfo.eProductFamily >= IGFX_METEORLAKE);
}

bool supportsThreadCombining() const
{
    return (!(!m_WaTable.WaEnablePooledEuFor2x6 &&
        m_platformInfo.eProductFamily == IGFX_BROXTON &&
        m_GTSystemInfo.SubSliceCount == 2))
        && (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE);
}

bool enableMaxWorkGroupSizeCalculation() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE) &&
        IGC_IS_FLAG_ENABLED(EnableMaxWGSizeCalculation);
}

bool has8DWA64ScatteredMessage() const { return m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE; }

bool flushL3ForTypedMemory() const
{
    return m_platformInfo.eRenderCoreFamily <= IGFX_GEN11_CORE;
}

bool supportsStencil(SIMDMode simdMode) const
{
    return getMinDispatchMode() == SIMDMode::SIMD16 ? true : simdMode == SIMDMode::SIMD8;
}

bool hasFDIV() const {
    if (IGC_IS_FLAG_ENABLED(DisableFDIV))
        return false;
    return (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE);
}

bool doIntegerMad() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN11_CORE && m_platformInfo.eProductFamily != IGFX_DG1 &&
        IGC_IS_FLAG_ENABLED(EnableIntegerMad);
}

bool isDG1() const
{
    return m_platformInfo.eProductFamily == IGFX_DG1;
}

bool simplePushIsFasterThanGather() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE;
}

bool singleThreadBasedInstScheduling() const
{
    return m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE;
}

//all the platforms which do not support 64 bit operations and
//needs int64 emulation support. Except also for BXT where
//64-bit inst has much lower throughput compared to SKL.
//Emulating it improves performance on some benchmarks and
//won't have impact on the overall performance.
bool need64BitEmulation() const {
    return m_platformInfo.eProductFamily == IGFX_GEMINILAKE ||
        m_platformInfo.eProductFamily == IGFX_BROXTON ||
        hasNoInt64Inst();
}

bool HDCCoalesceSLMAtomicINCWithNoReturn() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE;
}


int LSCCachelineSize() const
{
    return 64;
}


bool HDCCoalesceAtomicCounterAccess() const
{
    return (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE) && IGC_IS_FLAG_DISABLED(ForceSWCoalescingOfAtomicCounter);
}

bool supportsMCSNonCompressedFix() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; }

bool hasHWDp4AddSupport() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; }

bool useOnlyEightPatchDispatchHS() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE);
}

bool supportsPrimitiveReplication() const
{
    return ((m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE) ||
            (m_platformInfo.eRenderCoreFamily == IGFX_GEN11_CORE && m_platformInfo.eProductFamily == IGFX_ICELAKE));
}

// If true then screen space coordinates for upper-left vertex of a triangle
// being rasterized are delivered together with source depth or W deltas.
bool hasStartCoordinatesDeliveredWithDeltas() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE;
}

bool disableStaticVertexCount() const
{
    return m_WaTable.Wa_14012504847 != 0 || IGC_IS_FLAG_ENABLED(ForceStaticToDynamic);
}

bool hasSamplerSupport() const
{
    return (m_platformInfo.eRenderCoreFamily != IGFX_XE_HPC_CORE) ||
        (IGC_IS_FLAG_ENABLED(EnableSamplerSupport)); // flag for IGFX_PVC
}

bool hasSamplerFeedbackSurface() const
{
    return m_platformInfo.eProductFamily >= IGFX_BMG;
}

// logical subslice id
bool hasLogicalSSID() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

uint32_t getMinPushConstantBufferAlignment() const
{
    return 8; // DWORDs
}

// Returns the default limit of pushed constant data in 32-byte units. This value limits
// the amount of constant buffer data promoted to registers.
uint32_t getBlockPushConstantThreshold() const
{
    constexpr uint32_t defaultThreshold = 31;
    constexpr uint32_t gen9GT2Threshold = 15;

    const GTTYPE gt = m_platformInfo.eGTType;
    switch (m_platformInfo.eProductFamily)
    {
    case IGFX_COFFEELAKE:
    case IGFX_SKYLAKE:
    case IGFX_KABYLAKE:
        return (gt == GTTYPE_GT2) ? gen9GT2Threshold : defaultThreshold;
    default:
        return defaultThreshold;
    }
}

bool hasDualSubSlices() const
{
    bool hasDualSS = m_platformInfo.eRenderCoreFamily == IGFX_GEN12_CORE ||
        m_platformInfo.eRenderCoreFamily == IGFX_GEN12LP_CORE;
    if (m_platformInfo.eRenderCoreFamily == IGFX_XE_HPG_CORE)
    {
        hasDualSS = true;
    }
    return hasDualSS;
}

unsigned getSlmSizePerSsOrDss() const
{
    // GTSysInfo sets SLMSize only for gen12+
    unsigned slmSizePerSsOrDss = 65536;
    if (hasDualSubSlices())
    {
        if (GetGTSystemInfo().DualSubSliceCount)
        {
            slmSizePerSsOrDss = GetGTSystemInfo().SLMSizeInKb / GetGTSystemInfo().DualSubSliceCount * 1024;
        }
        else
        {
            slmSizePerSsOrDss = 131072;
        }
    }
    else if (isProductChildOf(IGFX_BMG))
    {
        // SLMSizeInKb is reported per SS for BMG+
        slmSizePerSsOrDss = GetGTSystemInfo().SLMSizeInKb * 1024;
    }
    else if (isProductChildOf(IGFX_PVC))
    {
        slmSizePerSsOrDss = GetGTSystemInfo().SLMSizeInKb / GetGTSystemInfo().SubSliceCount * 1024;
    }
    return slmSizePerSsOrDss;
}

bool canForcePrivateToGlobal() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN9_CORE && IGC_IS_FLAG_ENABLED(ForcePrivateMemoryToGlobalOnGeneric);
}

bool getHWTIDFromSR0() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool supportAdd3Instruction() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool supportBfnInstruction() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool supportDpasInstruction() const
{
    return isProductChildOf(IGFX_XE_HP_SDV) && m_platformInfo.eProductFamily != IGFX_METEORLAKE &&
        !(m_platformInfo.eProductFamily == IGFX_PVC && GFX_IS_VG_CONFIG(m_platformInfo.usDeviceID));
}

bool supportJointMatrixOCLExtension() const
{
    return supportDpasInstruction() ||
        // SPV_INTEL_joint_matrix extension is partially supported on PVC-VG. Only OpJointMatrixMadINTEL
        // opcodes are not supported and proper error is emitted in case any of them is used in a kernel.
        (m_platformInfo.eProductFamily == IGFX_PVC && GFX_IS_VG_CONFIG(m_platformInfo.usDeviceID));
}

bool hasPackedRestrictedFloatVector() const
{
    return !isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool supportLoadThreadPayloadForCompute() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool support16BitAtomics() const
{
    return m_platformInfo.eProductFamily >= IGFX_GEN12_CORE;
}

bool Enable32BitIntDivRemEmu() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool support16DWURBWrite() const
{
    return IGC_IS_FLAG_ENABLED(Enable16DWURBWrite) && isProductChildOf(IGFX_XE_HP_SDV);
}

bool hasScratchSurface() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}


bool hasAtomicPreDec() const
{
    return !isProductChildOf(IGFX_XE_HP_SDV);
}

bool support26BitBSOFormat() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool needsHeaderForAtomicCounter() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool doScalar64bScan() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool hasHWLocalThreadID() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

unsigned int getOfflineCompilerMaxWorkGroupSize() const
{
    if (isProductChildOf(IGFX_XE_HP_SDV))
        return 1024;
    return 448;
}

bool hasFP16AtomicMinMax() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool hasFP32GlobalAtomicAdd() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool has16OWSLMBlockRW() const
{
    return IGC_IS_FLAG_ENABLED(Enable16OWSLMBlockRW) && isProductChildOf(IGFX_XE_HP_SDV);
}

bool hasLargeMaxConstantBufferSize() const
{
    return IGC_IS_FLAG_DISABLED(Force32bitConstantGEPLowering) &&
        m_platformInfo.eProductFamily == IGFX_PVC;
}

bool supportInlineData() const
{
    return isProductChildOf(IGFX_XE_HP_SDV);
}

// TODO: temporary solution, remove this once it's not needed
bool supportInlineDataOCL() const
{
    if (m_platformInfo.eRenderCoreFamily == IGFX_XE_HPC_CORE && IGC_IS_FLAG_DISABLED(ForceInlineDataForXeHPC))
    {
        return false;
    }
    return isProductChildOf(IGFX_XE_HP_SDV);
}

bool supportsAutoGRFSelection() const
{
    return isProductChildOf(IGFX_PVC) || m_platformInfo.eProductFamily == IGFX_XE_HP_SDV || (m_platformInfo.eProductFamily == IGFX_DG2 && IGC_IS_FLAG_ENABLED(ForceSupportsAutoGRFSelection));
}

bool hasLSC() const
{
    return IGC_IS_FLAG_DISABLED(ForceNoLSC) && !WaEnableLSCBackupMode() && isProductChildOf(IGFX_DG2);
}

bool WaEnableLSCBackupMode() const
{
    return (m_WaTable.Wa_14010198302 != 0);
}

bool supportQWRotateInstructions() const
{
    return m_platformInfo.eRenderCoreFamily == IGFX_XE_HPC_CORE && IGC_IS_FLAG_ENABLED(EnableQWRotateInstructions);
}

// Some workloads use handcrafted ISA kernels and generate patch tokens for them by compiling a
// dummy kernel. They depend on static BTIs allocation in IGC, that's why dynamic allocation
// can't be enabled by default for all platforms. That is not an issue when ZEBin is enabled by
// default since a workload can generate ZEBin sections by itself, without depending on a dummy kernel
// compilation by IGC.
bool supportDynamicBTIsAllocation() const
{
    return supportsZEBin();
}

bool supportsZEBin() const
{
    switch (m_platformInfo.eProductFamily)
    {
    default:
        return true;
    case IGFX_BROADWELL:
    case IGFX_BROXTON:
    case IGFX_GEMINILAKE:
    case IGFX_LAKEFIELD:
    case IGFX_ELKHARTLAKE:
        return false;
    }
}

bool loosenSimd32occu() const
{
    if (IGC_GET_FLAG_VALUE(ForceLoosenSimd32Occu) == 2)
        return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE && m_platformInfo.eProductFamily != IGFX_DG2);
    else
        return IGC_GET_FLAG_VALUE(ForceLoosenSimd32Occu);
}

// Local memory here refers to memory on the device- e.g. HBM for PVC.
bool hasLocalMemory() const
{
    return m_SkuTable.FtrLocalMemory != 0;
}

bool supportsTier2VRS() const
{
    return m_platformInfo.eProductFamily >= IGFX_DG2;
}

bool supportsSIMD16TypedRW() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE);
}

bool supportHWGenerateTID() const
{
    return IGC_IS_FLAG_ENABLED(EnableHWGenerateThreadID) && isProductChildOf(IGFX_DG2);
}

bool supportHWDispatchWalkOrder() const
{
    const bool hasHWDispatchWalkOrder =
        (m_platformInfo.eProductFamily == IGFX_ARROWLAKE && !(GFX_IS_ARL_S(m_platformInfo.usDeviceID)))
        || isCoreChildOf(IGFX_XE2_HPG_CORE);
    return hasHWDispatchWalkOrder;
}

bool hasHalfSIMDLSC() const
{
    return (m_platformInfo.eProductFamily == IGFX_DG2 && SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0)) ||
        GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID) ||
        GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID) ||
        // false for PVC XL A0 RevID==0x0, true from PVC XT A0 RevID==0x3==REVISION_B
        (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId >= REVISION_B) ||
        m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE ||
        isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool NeedsLSCFenceUGMBeforeEOT() const
{
    return getWATable().Wa_22013689345 != 0;
}

bool hasPartialInt64Support() const
{
    // false for PVC XL A0 RevID==0x0, true from PVC XT A0 RevID==0x3==REVISION_B
    return (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId >= REVISION_B) ||
        isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasInt64Add() const
{
    return !hasNoFullI64Support() || hasQWAddSupport();
}

bool hasFullInt64() const
{
    // We don't support int64 adder in PVC-XT-A0, please see more info in hasQWAddSupport
    if (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId < REVISION_D)
    {
        return false;
    }
    else
    {
        return !hasNoInt64Inst();
    }
}

bool hasInt64DstMul() const
{

    return (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId < REVISION_B)
            || isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasExecSize16DPAS() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE);
}

bool LSCSimd1NeedFullPayload() const
{
    // in PVC XL A0 RevID=0x0, SIMD1 reads/writes need full payloads
    // this causes chaos for vISA (would need 4REG alignment)
    // and to make extra moves to enable the payload
    // PVC XT A0 RevID==0x3==REVISION_B gets this feature
    return (m_platformInfo.eProductFamily == IGFX_PVC &&
        m_platformInfo.usRevId < REVISION_B);
}

bool hasNoFullI64Support() const
{
    return (hasNoInt64Inst() || hasPartialInt64Support());
}

bool hasBFTFDenormMode() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool WaPredicatedStackIDRelease() const
{
    return m_WaTable.Wa_22014559856 &&
           IGC_IS_FLAG_DISABLED(DisablePredicatedStackIDRelease);
}

// This returns the current maximum size that we recommend for performance.
// SIMD32 is still allowed and we may relax this in the future.
SIMDMode getMaxRayQuerySIMDSize() const
{
    if (isCoreChildOf(IGFX_XE_HPG_CORE))
    {
        return SIMDMode::SIMD16;
    }
    else
    {
        IGC_ASSERT_MESSAGE(0, "Unsupported platform!");
        return SIMDMode::UNKNOWN;
    }
}

SIMDMode getPreferredRayQuerySIMDSize() const
{
    SIMDMode ret = isCoreChildOf(IGFX_XE_HPC_CORE) ? SIMDMode::SIMD16 : SIMDMode::SIMD8;

    IGC_ASSERT_MESSAGE(ret <= getMaxRayQuerySIMDSize(), "Preferred SIMD size for RayQuery must not be greater than MaxRayQuerySIMDSize!");

    return ret;
}

SIMDMode getPreferredRayTracingSIMDSize() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE) ? SIMDMode::SIMD16 : SIMDMode::SIMD8;
}

bool supportRayTracing() const
{
    return isProductChildOf(IGFX_DG2);
}

bool isValidNumThreads(int32_t numThreadsPerEU) const
{
    return numThreadsPerEU == 0 // "auto" mode - use compiler heuristic
        || numThreadsPerEU == 4
        || numThreadsPerEU == 8;
}

bool supports3DAndCubeSampleD() const
{
    // Make sure to match hasSupportForSampleDOnCubeTextures LLVM3DBuilder\BuiltinsFrontend.hpp
    return (
        m_platformInfo.eProductFamily != IGFX_XE_HP_SDV &&
        m_platformInfo.eProductFamily != IGFX_DG2 &&
        m_platformInfo.eProductFamily != IGFX_METEORLAKE &&
        m_platformInfo.eProductFamily != IGFX_ARROWLAKE &&
        m_platformInfo.eProductFamily != IGFX_BMG &&
        m_platformInfo.eProductFamily != IGFX_LUNARLAKE
        );
}

bool LSCEnabled(SIMDMode m = SIMDMode::UNKNOWN) const
{
    if (IGC_IS_FLAG_ENABLED(EnableLSC))
        return true;
    if (hasLSC())
    {
        switch (m_platformInfo.eProductFamily)
        {
        case IGFX_PVC:
            if (m == SIMDMode::UNKNOWN)
            {
                // Must generate LSC from PVC XT A0 RevID==0x3==REVISION_B (not include XL A0)
                return m_platformInfo.usRevId >= REVISION_B;
            }
            return (m == SIMDMode::SIMD16 && m_platformInfo.usRevId > REVISION_A0)
                || m == SIMDMode::SIMD32;
        case IGFX_DG2:
            if (m == SIMDMode::UNKNOWN)
            {
                // Must generate LSC after A0 (not include A0)
                return (SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0) ||
                        GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID) ||
                        GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID)
                        );
            }
            return ((SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0) ||
                     GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID) ||
                     GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID)
                ) && m == SIMDMode::SIMD8) ||
                m == SIMDMode::SIMD16;
        case IGFX_METEORLAKE:
        case IGFX_ARROWLAKE:
            return m == SIMDMode::UNKNOWN || m == SIMDMode::SIMD8 || m == SIMDMode::SIMD16;
        default:
            return true;
        }
    }
    return false;
}

// Max LSC message block size is 8GRF
uint32_t getMaxLSCBlockMsgSize(bool isD64 = true) const
{
    return (isD64 ? 8 : 4) * getGRFSize();
}

bool hasURBFence() const
{
    return (m_platformInfo.eProductFamily == IGFX_DG2 ||
        m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE ||
        isCoreChildOf(IGFX_XE2_HPG_CORE));
}

bool hasMultiTile() const
{
    //FIXME: what to do for AOT compile?
    return m_GTSystemInfo.MultiTileArchInfo.TileCount > 1;
}

// UGM LSC fence with GPU scope triggers L3 flush
bool hasL3FlushOnGPUScopeInvalidate() const
{
    return
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE ||
        m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_DG2;
}

bool L3CacheCoherentCrossTiles() const {
    return isCoreChildOf(IGFX_XE_HPC_CORE);
}

//if RayTracing fence WA for LSCBackupMode (DG2.A0 only actually) is enabled.
//In case of RayQuery of DG2.A0, we have to flush L1 after RTWrite and before shader read.
//The reason is, for RT writes, write - completion must guarantee that
//subsequent read with LSC bypass can read.This issue can be present
//even in async mode too but in sync mode read happens rather quickly
//compared to BTD dispatched thread.
bool RTFenceWAforBkModeEnabled() const
{
    return WaEnableLSCBackupMode();
}

SIMDMode getMinDispatchMode() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE) ? SIMDMode::SIMD16 : SIMDMode::SIMD8;
}

bool hasLSCTypedMessage() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE);
}

bool LSC2DSupportImmXY() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

SIMDMode getMaxLSCTypedMessageSize() const
{
    switch (m_platformInfo.eRenderCoreFamily)
    {
    case IGFX_XE_HPG_CORE:
        return SIMDMode::SIMD8;
    case IGFX_XE_HPC_CORE:
        return SIMDMode::SIMD16;
    default:
        if (IGC_IS_FLAG_ENABLED(DisableLSCSIMD32TGMMessages))
        {
            return SIMDMode::SIMD16;
        }
        else
        {
            return SIMDMode::SIMD32;
        }
    }
}

unsigned getAccChNumUD() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE) ? 16 : 8;
}

bool hasInt64SLMAtomicCAS() const
{
    // false for PVC XL A0 RevID==0x0, true from PVC XT A0 RevID==0x3==REVISION_B
    return (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId >= REVISION_B)
            || isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasFP64GlobalAtomicAdd() const
{
    return (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId > REVISION_A0)
            || isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool supports16BitLdMcs() const
{
    return isProductChildOf(IGFX_XE_HP_SDV) && IGC_IS_FLAG_ENABLED(Enable16BitLDMCS);
}

bool supportsGather4PO() const
{
    return !isProductChildOf(IGFX_XE_HP_SDV);
}

// Typed read supports all renderable image formats, no image data conversion is
// required.
bool typedReadSupportsAllRenderableFormats() const
{
    bool isChildOfDG2B0 = SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0);
    bool isChildOfDG2C0 = SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_C0);
    bool isDG2G11Config = GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID);
    bool isDG2G12Config = GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID);

    if ((m_platformInfo.eProductFamily == IGFX_DG2 && isChildOfDG2C0) ||
        (m_platformInfo.eProductFamily == IGFX_DG2 && isDG2G11Config && isChildOfDG2B0) ||
        (m_platformInfo.eProductFamily == IGFX_DG2 && isDG2G12Config) ||
        (m_platformInfo.eProductFamily == IGFX_METEORLAKE) ||
        (m_platformInfo.eProductFamily == IGFX_ARROWLAKE) ||
        (m_platformInfo.eRenderCoreFamily == IGFX_XE_HPC_CORE) ||
        isCoreChildOf(IGFX_XE2_HPG_CORE))
    {
        return IGC_IS_FLAG_DISABLED(ForceFormatConversionDG2Plus);
    }

    return false;
}

bool EnableNewTileYCheckDefault() const
{
    return true;
}

bool EnableKeepTileYForFlattenedDefault() const
{
    return false;
}

bool needsWAForThreadsUtilization() const
{
    return (m_platformInfo.eProductFamily == IGFX_DG2 ||
        m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE);
}

bool supportDualSimd8PS() const
{
    return IGC_IS_FLAG_ENABLED(EnableDualSIMD8) && (m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE) &&
        !isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasDualSimd8Payload() const
{
    return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE) && !isCoreChildOf(IGFX_XE2_HPG_CORE);
}

unsigned int getMaxMeshShaderThreads() const {
    return m_caps.MediaShaderThreads - 1;
}

bool supportDpaswInstruction() const
{
    return hasFusedEU() && supportDpasInstruction();
}

// This represents the max number of logical lanes available for RT,
// so it is not dependent on compiled SIMD size or "PreferredRayTracingSIMDSize".
unsigned getRTStackDSSMultiplier() const
{
    IGC_ASSERT(supportRayTracing());
    return 2048;
}

// Max number of hw threads for each workgroup
unsigned int getMaxNumberHWThreadForEachWG() const
{
    if (m_platformInfo.eRenderCoreFamily < IGFX_GEN12_CORE) {
        // Each WG is dispatched into one subslice for GEN11 and before
        return getMaxNumberThreadPerSubslice();
    }
    else if (m_platformInfo.eRenderCoreFamily <= IGFX_XE_HPC_CORE)
    {
        // Each WG is dispatched into one DSS which has 2 Subslices for Gen12 and above
        if (getWATable().Wa_1609337546 || getWATable().Wa_1609337769) {
            return 64;
        }
        else {
            return getMaxNumberThreadPerSubslice() * 2;
        }
    }
    else if (m_platformInfo.eRenderCoreFamily == IGFX_XE2_HPG_CORE)
    {
        // Each WG is dispatched into one subslice
        return getMaxNumberThreadPerSubslice();
    }
    else {
        IGC_ASSERT_MESSAGE(0, "Unsupported platform!");
    }
    return 0;
}

uint32_t getGRFSize() const
{
    return isCoreChildOf(IGFX_XE_HPC_CORE) ? 64 : 32;
}

uint32_t getInlineDataSize() const
{
    if (!supportInlineData()) return 0;
    return 32;
}

bool hasFusedEU() const
{
    return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE &&
        !isCoreChildOf(IGFX_XE_HPC_CORE);
}

bool requireCallWA() const
{
    return IGC_IS_FLAG_ENABLED(EnableCallWA) && hasFusedEU() && (getWATable().Wa_14016243945 == false);
}

bool hasPartialEmuI64Enabled() const
{
    return hasPartialInt64Support() && IGC_IS_FLAG_ENABLED(EnablePartialEmuI64);
}


bool matchImmOffsetsLSC() const
{
    enum LscMatchImmMode {
        OFF = 0,
        IF_HW_SUPPORTED = 1,
        ON = 2,
    };
    auto immOffsetMode = (LscMatchImmMode)IGC_GET_FLAG_VALUE(LscImmOffsMatch);
    return hasLSC() &&
        (immOffsetMode >= ON || (immOffsetMode == IF_HW_SUPPORTED && isCoreChildOf(IGFX_XE2_HPG_CORE)));
}

bool WaCubeHFPrecisionBug() const
{
    return m_WaTable.Wa_18012201914 != 0;
}

//The max size in bytes of the scratch space per thread.
//  XeHP_SDV and above are for each physical thread: 256k.
//  TGLLP and below are for each FFTID: 2M.
uint32_t maxPerThreadScratchSpace(
) const
{

    return hasScratchSurface() ? 0x40000 : 0x200000;
}

bool enableSpillCompressionCheckDefault() const
{
    bool bEnabled = false;
    return bEnabled;
}

bool supportAIParameterCombiningWithLODBiasEnabled() const
{
    return IGC_IS_FLAG_ENABLED(EnableAIParameterCombiningWithLODBias) &&
           ((m_platformInfo.eProductFamily == IGFX_DG2 && SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0)) ||
           GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID) ||
           GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID) ||
           m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
           m_platformInfo.eProductFamily == IGFX_ARROWLAKE ||
           isCoreChildOf(IGFX_XE2_HPG_CORE));
}

bool useScratchSpaceForOCL() const
{
    // Disable using scratch surface for private memory on XeHP_SDV
    // because it does not support byte-aligned (byte-scattered) messages.
    if (hasScratchSurface()) {
        return LSCEnabled() &&
               IGC_IS_FLAG_ENABLED(EnableOCLScratchPrivateMemory) &&
               isCoreChildOf(IGFX_XE_HPC_CORE);
    }
    else {
        return IGC_IS_FLAG_ENABLED(EnableOCLScratchPrivateMemory);
    }
}


// Check if byte ALU operations are well supported. If not, promote byte to i16/i32.
bool supportByteALUOperation() const
{
    return !isCoreChildOf(IGFX_XE_HPC_CORE);
}

//all the platforms which DONOT support 64 bit float operations
bool hasNoFP64Inst() const {
    return m_platformInfo.eProductFamily == IGFX_ICELAKE_LP ||
        m_platformInfo.eProductFamily == IGFX_LAKEFIELD ||
        m_platformInfo.eProductFamily == IGFX_ELKHARTLAKE ||
        m_platformInfo.eProductFamily == IGFX_JASPERLAKE ||
        m_platformInfo.eProductFamily == IGFX_TIGERLAKE_LP ||
        m_platformInfo.eProductFamily == IGFX_ROCKETLAKE ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_S ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_P ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_N ||
        m_platformInfo.eProductFamily == IGFX_DG1 ||
        m_platformInfo.eProductFamily == IGFX_DG2;
}

//all the platforms which have correctly rounded macros (INVM, RSQRTM, MADM)
bool hasCorrectlyRoundedMacros() const {
    if (isCoreChildOf(IGFX_XE2_HPG_CORE) && IGC_IS_FLAG_DISABLED(DisableCorrectlyRoundedMacros))
        return true;
    return (m_platformInfo.eProductFamily != IGFX_ICELAKE_LP &&
        m_platformInfo.eProductFamily != IGFX_LAKEFIELD &&
        m_platformInfo.eProductFamily != IGFX_JASPERLAKE &&
        m_platformInfo.eProductFamily != IGFX_TIGERLAKE_LP &&
        m_platformInfo.eProductFamily != IGFX_ROCKETLAKE &&
        m_platformInfo.eProductFamily != IGFX_DG1 &&
        m_platformInfo.eProductFamily != IGFX_ALDERLAKE_S &&
        m_platformInfo.eProductFamily != IGFX_ALDERLAKE_P &&
        m_platformInfo.eProductFamily != IGFX_ALDERLAKE_N &&
        m_platformInfo.eProductFamily != IGFX_DG2 &&
        m_platformInfo.eProductFamily != IGFX_METEORLAKE) &&
        m_platformInfo.eProductFamily != IGFX_ARROWLAKE &&
        m_platformInfo.eProductFamily != IGFX_BMG &&
        m_platformInfo.eProductFamily != IGFX_LUNARLAKE;
}

// Has 64bit support but use 32bit for perf reasons
bool preferFP32IntDivRemEmu() const {
    return (m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE ||
        isCoreChildOf(IGFX_XE2_HPG_CORE));
}

// Platforms that haven't HW support for FP64 operations
// and can emulate double operations
bool emulateFP64ForPlatformsWithoutHWSupport() const {
    return m_platformInfo.eProductFamily == IGFX_DG2;
}

bool supportMixMode() const {
    return IGC_IS_FLAG_ENABLED(ForceMixMode) ||
        (IGC_IS_FLAG_DISABLED(DisableMixMode) &&
            (m_platformInfo.eProductFamily == IGFX_CHERRYVIEW ||
                m_platformInfo.eProductFamily == IGFX_DG1 ||
                m_platformInfo.eProductFamily == IGFX_TIGERLAKE_LP ||
                m_platformInfo.eProductFamily == IGFX_ROCKETLAKE ||
                m_platformInfo.eRenderCoreFamily == IGFX_GEN12LP_CORE ||
                m_platformInfo.eProductFamily == IGFX_ALDERLAKE_S ||
                m_platformInfo.eProductFamily == IGFX_ALDERLAKE_P ||
                m_platformInfo.eProductFamily == IGFX_ALDERLAKE_N ||
                m_platformInfo.eRenderCoreFamily == IGFX_GEN9_CORE ||
                m_platformInfo.eRenderCoreFamily == IGFX_GEN10_CORE));
}

bool supportsStaticRegSharing() const
{
    // Static register sharing with multiple number of threads per EU supported on:
    return ((isProductChildOf(IGFX_XE_HP_SDV) && !WaDisableStaticRegSharing())
        || IGC_IS_FLAG_ENABLED(ForceSupportsStaticRegSharing));
}

bool DSPrimitiveIDPayloadPhaseCanBeSkipped() const
{
    bool isFromFamilyWhereSkippable = m_platformInfo.eProductFamily == IGFX_ALDERLAKE_S ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_P ||
        m_platformInfo.eProductFamily == IGFX_ALDERLAKE_N ||
        m_platformInfo.eProductFamily == IGFX_TIGERLAKE_LP ||
        m_platformInfo.eProductFamily == IGFX_ROCKETLAKE ||
        m_platformInfo.eProductFamily == IGFX_DG1;
    return (IGC_IS_FLAG_ENABLED(EnablePostCullPatchFIFOLP) &&
        m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE &&
        isFromFamilyWhereSkippable) ||
        (IGC_IS_FLAG_ENABLED(EnablePostCullPatchFIFOHP) && isProductChildOf(IGFX_XE_HP_SDV));
}

bool emulateByteScraterMsgForSS() const
{
    return IGC_IS_FLAG_ENABLED(EnableUntypedSurfRWofSS) &&
        isProductChildOf(IGFX_XE_HP_SDV) &&
        !hasLSC();
}

bool has64BMediaBlockRW() const
{
    bool hasBlockRW = (IGC_IS_FLAG_ENABLED(Enable64BMediaBlockRW) && isProductChildOf(IGFX_XE_HP_SDV));
    hasBlockRW = hasBlockRW || isCoreChildOf(IGFX_XE2_HPG_CORE);
    return hasBlockRW;
}

int getBSOLocInExtDescriptor() const
{
    return support26BitBSOFormat() ? 6 : 12;
}

bool NeedsHDCFenceBeforeEOTInPixelShader() const
{
    return m_WaTable.Wa_1807084924 != 0;
}

bool canFuseTypedWrite() const
{
    bool isChildOfDG2B0 = SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_B0);
    bool isChildOfDG2C0 = SI_WA_FROM(m_platformInfo.usRevId, ACM_G10_GT_REV_ID_C0);
    bool isDG2G11Config = GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID);
    bool isDG2G12Config = GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID);
    bool canFuse = (m_platformInfo.eProductFamily == IGFX_METEORLAKE) ||
        (m_platformInfo.eProductFamily == IGFX_ARROWLAKE) ||
        (m_platformInfo.eProductFamily == IGFX_DG2 && isChildOfDG2C0) ||
        (m_platformInfo.eProductFamily == IGFX_DG2 && isDG2G11Config && isChildOfDG2B0) ||
        (m_platformInfo.eProductFamily == IGFX_DG2 && isDG2G12Config);
    return (IGC_IS_FLAG_ENABLED(FuseTypedWrite) && canFuse);
}

bool enableSetDefaultTileYWalk() const
{
    if (IGC_IS_FLAG_ENABLED(EnableTileYForExperiments))
        return true;

    // disable it on DG2 G11
    if (GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID))
        return false;

    return (supportHWGenerateTID());
}

// max block size for legacy OWord block messages
uint32_t getMaxBlockMsgSize(bool isSLM) const
{
    if (isSLM)
    {
        if (m_WaTable.Wa_14010875903)
        {
            return 64;
        }
        if (has16OWSLMBlockRW())
        {
            return 256;
        }
    }
    return 128;
}

bool hasLSCUrbMessage() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasSampleMlodMessage() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool forceSamplerHeader() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasDualKSPPS() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasLSCSamplerRouting() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool hasBarrierControlFlowOpt() const
{
    bool enabled =
        hasLSC() && IGC_IS_FLAG_ENABLED(EnableLSCFence) &&
        isCoreChildOf(IGFX_XE2_HPG_CORE);

    return enabled;
}

bool canDoMultipleLineMOVOpt() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool supportStochasticLod() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool supportsProgrammableOffsets() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool isDynamicRayQueryDynamicRayManagementMechanismEnabled() const
{
    return (isCoreChildOf(IGFX_XE2_HPG_CORE) &&
        IGC_IS_FLAG_DISABLED(DisableRayQueryDynamicRayManagementMechanism));
}

// ***** Below go accessor methods for testing WA data from WA_TABLE *****

bool WaDoNotPushConstantsForAllPulledGSTopologies() const
{
    return (m_platformInfo.eProductFamily == IGFX_BROADWELL) ||
        m_WaTable.WaDoNotPushConstantsForAllPulledGSTopologies != 0;
}

bool WaForceMinMaxGSThreadCount() const
{
    return m_WaTable.WaForceMinMaxGSThreadCount != 0;
}

bool WaOCLEnableFMaxFMinPlusZero() const
{
    return m_WaTable.WaOCLEnableFMaxFMinPlusZero != 0;
}

bool WaDisableSendsSrc0DstOverlap() const
{
    return m_WaTable.WaDisableSendsSrc0DstOverlap != 0;
}

bool WaDisableEuBypass() const
{
        return (m_WaTable.WaDisableEuBypassOnSimd16Float32 != 0);
}

bool WaDisableDSDualPatchMode() const
{
    return m_WaTable.WaDisableDSDualPatchMode == 0;
}

bool WaDispatchGRFHWIssueInGSAndHSUnit() const
{
    return m_WaTable.WaDispatchGRFHWIssueInGSAndHSUnit != 0;
}

bool WaSamplerResponseLengthMustBeGreaterThan1() const
{
    return m_WaTable.WaSamplerResponseLengthMustBeGreaterThan1 != 0;
}

bool WaDisableDSPushConstantsInFusedDownModeWithOnlyTwoSubslices() const
{
    return ((m_WaTable.WaDisableDSPushConstantsInFusedDownModeWithOnlyTwoSubslices) &&
            (m_GTSystemInfo.IsDynamicallyPopulated && m_GTSystemInfo.SubSliceCount == 2));
}

bool WaDisableVSPushConstantsInFusedDownModeWithOnlyTwoSubslices() const
{
    return ((m_WaTable.WaDisableVSPushConstantsInFusedDownModeWithOnlyTwoSubslices) &&
            (m_GTSystemInfo.IsDynamicallyPopulated && m_GTSystemInfo.SubSliceCount == 2));
}

bool WaForceCB0ToBeZeroWhenSendingPC() const
{
    return m_WaTable.WaForceCB0ToBeZeroWhenSendingPC != 0;
}

bool WaConservativeRasterization() const
{
    return (m_WaTable.WaConservativeRasterization != 0 &&
        IGC_IS_FLAG_ENABLED(ApplyConservativeRastWAHeader));
}

bool WaReturnZeroforRTReadOutsidePrimitive() const
{
    return m_WaTable.WaReturnZeroforRTReadOutsidePrimitive != 0;
}

bool WaFixInnerCoverageWithSampleMask() const
{
    return m_WaTable.Wa_220856683 != 0;
}

bool WaOverwriteFFID() const
{
    return m_WaTable.Wa_1409460247 != 0;
}

bool WaDisableStaticRegSharing() const
{
    return m_WaTable.Wa_14012688715 != 0;
}

bool WaDisablePrimitiveReplicationWithCPS() const
{
    return m_WaTable.Wa_18013852970 != 0;
}

bool supportSystemFence() const
{
    return hasLSC()
        && m_platformInfo.eProductFamily != IGFX_DG2
        && m_platformInfo.eProductFamily != IGFX_METEORLAKE
        && m_platformInfo.eProductFamily != IGFX_ARROWLAKE;
}


bool WaGeoShaderURBAllocReduction() const
{
    return m_WaTable.Wa_18012660806 != 0;
}

bool WaDisableSendSrcDstOverlap() const
{
  return (!IGC_IS_FLAG_ENABLED(DisableSendSrcDstOverlapWA)) &&
         (m_SkuTable.FtrWddm2Svm != 0 ||
          m_platformInfo.eRenderCoreFamily == IGFX_GEN10_CORE ||
          m_platformInfo.eRenderCoreFamily == IGFX_GEN11_CORE ||
          (m_platformInfo.eProductFamily >= IGFX_PVC &&
           m_platformInfo.eProductFamily <= IGFX_ARROWLAKE));
}

bool WaInsertHDCFenceBeforeEOTWhenSparseAliasedResources() const
{
    return m_WaTable.Wa_1807084924 != 0;
}

bool WaDisableSampleLz() const
{
    return (IGC_IS_FLAG_DISABLED(DisableWaSampleLZ) && m_WaTable.Wa_14013297064);
}

bool WaEnableA64WA() const
{
    if (IGC_IS_FLAG_ENABLED(EnableA64WA) && m_WaTable.Wa_14010595310) {
        return true;
    }
    return false;
}

//Only enable this WA for TGLLP+ because, in pre TGLLP projects, smov was replaced with two instructions which caused performance penalty.
bool enableMultiGRFAccessWA() const
{
    return (m_platformInfo.eProductFamily >= IGFX_TIGERLAKE_LP);
}

// Return true if platform has structured control-flow instructions and IGC wants to use them.
bool hasSCF() const
{
    bool doscf = true;
    // DG2 and PVC still has SCF, but igc will stop using them.
    doscf = !isProductChildOf(IGFX_DG2);
    return doscf;
}

const SCompilerHwCaps& GetCaps() { return m_caps; }

bool supportHeaderRTW() const
{
    return (!isCoreChildOf(IGFX_XE2_HPG_CORE));
}

bool preemptionSupported() const
{
    if (isCoreChildOf(IGFX_XE_HPC_CORE) && !isCoreChildOf(IGFX_XE2_HPG_CORE))
        return false;

    return GetPlatformFamily() >= IGFX_GEN9_CORE;
}

// platform natively not support DW-DW multiply
bool noNativeDwordMulSupport() const
{
    return m_platformInfo.eProductFamily == IGFX_BROXTON ||
        m_platformInfo.eProductFamily == IGFX_GEMINILAKE ||
        m_platformInfo.eProductFamily == IGFX_DG2 ||
        m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
        m_platformInfo.eProductFamily == IGFX_ARROWLAKE ||
        GetPlatformFamily() == IGFX_GEN11_CORE ||
        GetPlatformFamily() == IGFX_GEN12LP_CORE;
}

unsigned getURBFullWriteMinGranularity() const
{
    unsigned overrideValue = IGC_GET_FLAG_VALUE(SetURBFullWriteGranularity);
    if (overrideValue == 16 || overrideValue == 32)
    {
        return overrideValue;
    }
    return isProductChildOf(IGFX_XE_HP_SDV) ? 16 : 32; // in bytes
}

unsigned forceQwAtSrc0ForQwShlWA() const
{
    // PVC XT A0: RevID==0X3==REVISION_B
    return (m_platformInfo.eProductFamily == IGFX_PVC && m_platformInfo.usRevId == REVISION_B);
}


bool hasSIMD8Support() const
{
    if (isCoreChildOf(IGFX_XE2_HPG_CORE))
        return false;
    return !(m_platformInfo.eRenderCoreFamily == IGFX_XE_HPC_CORE);
}

bool hasThreadPauseSupport() const
{
    if (isCoreChildOf(IGFX_XE_HPC_CORE))
        return false;
    return true;
}

bool WaDisableD64ScratchMessage() const
{
    return getWATable().Wa_15010203763 != 0;
}

bool supportLargeGRF() const
{
    return isCoreChildOf(IGFX_XE_HPG_CORE);
}

bool supportCheckCSThreadsLimit() const
{
    return (m_platformInfo.eRenderCoreFamily == IGFX_XE2_HPG_CORE);
}
bool supportTriggerLargeGRFRetry() const
{
    return (m_platformInfo.eRenderCoreFamily == IGFX_XE2_HPG_CORE);
}



bool EnableCSWalkerPass() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool limitedBCR() const
{
    return m_platformInfo.eProductFamily == IGFX_DG2 &&
         (GFX_IS_DG2_G11_CONFIG(m_platformInfo.usDeviceID) ||
          GFX_IS_DG2_G12_CONFIG(m_platformInfo.usDeviceID));
}

uint32_t getMaxAddressedHWThreads() const
{
    // TODO Calculate the value
    if (isCoreChildOf(IGFX_XE2_HPG_CORE))
        return 8192;
    return 4096;
}

bool supportsNumberOfBariers() const
{
    return isProductChildOf(IGFX_DG2);
}

uint32_t getVISAABIVersion() const {
  return 2;
}

bool supportsNonDefaultLSCCacheSetting() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}

bool isSupportedLSCCacheControlsEnum(LSC_L1_L3_CC l1l3cc, bool isLoad) const
{
    if (isLoad)
    {
        switch (l1l3cc)
        {
        default: break;
        case LSC_L1UC_L3CC:
        case LSC_L1C_L3CC:
        case LSC_L1IAR_L3IAR:
            return isCoreChildOf(IGFX_XE2_HPG_CORE);
        }
    }
    return true;
}

unsigned int roundUpTgsmSize(DWORD size) const
{
    const DWORD blockSize = getSharedLocalMemoryBlockSize() ? getSharedLocalMemoryBlockSize() : sizeof(KILOBYTE);
    size = iSTD::Round(size, blockSize) / blockSize;
    if (size > 16)
    {
        if (isCoreChildOf(IGFX_XE2_HPG_CORE))
        {
            const DWORD roundSize = iSTD::RoundPower2(size) / 4;
            return iSTD::Round(size, roundSize) * blockSize;
        }
    }
    return iSTD::RoundPower2(size) * blockSize;
}

unsigned getRayTracingTileXDim1D() const
{
    if (isCoreChildOf(IGFX_XE2_HPG_CORE))
    {
        return 512;
    }
    return 256;
}

unsigned getRayTracingTileYDim1D() const
{
    return 1;
}

unsigned getRayTracingTileXDim2D() const
{
    if (isCoreChildOf(IGFX_XE2_HPG_CORE))
        return 8;
    else
        return 32;
}

unsigned getRayTracingTileYDim2D() const
{
    if (isCoreChildOf(IGFX_XE2_HPG_CORE))
        return 128;
    else
        return 4;
}

bool preferLSCCache() const
{
    return isCoreChildOf(IGFX_XE2_HPG_CORE);
}


bool allowDivergentControlFlowRayQueryCheckRelease() const
{
    return m_WaTable.Wa_22019804511 != 0;
}

bool allowProceedBasedApproachForRayQueryDynamicRayManagementMechanism() const
{

    return IGC_IS_FLAG_DISABLED(DisableProceedBasedApproachForRayQueryDynamicRayManagementMechanism);
}

};
}//namespace IGC