1 /*
2  * Copyright (C) 2020-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #include "shared/source/aub_mem_dump/definitions/aub_services.h"
9 #include "shared/source/debug_settings/debug_settings_manager.h"
10 #include "shared/source/gen12lp/hw_cmds_dg1.h"
11 #include "shared/source/helpers/constants.h"
12 
13 #include "engine_node.h"
14 
15 namespace NEO {
16 
17 const char *HwMapper<IGFX_DG1>::abbreviation = "dg1";
18 
isSimulationDG1(unsigned short deviceId)19 bool isSimulationDG1(unsigned short deviceId) {
20     switch (deviceId) {
21     case 0x4905:
22     case 0x4906:
23     case 0x4907:
24         return true;
25     }
26 
27     return false;
28 };
29 
30 const PLATFORM DG1::platform = {
31     IGFX_DG1,
32     PCH_UNKNOWN,
33     IGFX_GEN12LP_CORE,
34     IGFX_GEN12LP_CORE,
35     PLATFORM_NONE, // default init
36     0,             // usDeviceID
37     0,             // usRevId. 0 sets the stepping to A0
38     0,             // usDeviceID_PCH
39     0,             // usRevId_PCH
40     GTTYPE_UNDEFINED};
41 
42 const RuntimeCapabilityTable DG1::capabilityTable{
43     EngineDirectSubmissionInitVec{
44         {aub_stream::ENGINE_RCS, {true, true}},
45         {aub_stream::ENGINE_CCS, {true, true}}},   // directSubmissionEngines
46     {0, 0, 0, 0, false, false, false, false},      // kmdNotifyProperties
47     MemoryConstants::max64BitAppAddress,           // gpuAddressSpace
48     0,                                             // sharedSystemMemCapabilities
49     83.333,                                        // defaultProfilingTimerResolution
50     MemoryConstants::pageSize,                     // requiredPreemptionSurfaceSize
51     &isSimulationDG1,                              // isSimulation
52     "lp",                                          // platformType
53     "",                                            // deviceName
54     PreemptionMode::MidThread,                     // defaultPreemptionMode
55     aub_stream::ENGINE_RCS,                        // defaultEngineType
56     0,                                             // maxRenderFrequency
57     30,                                            // clVersionSupport
58     CmdServicesMemTraceVersion::DeviceValues::Dg1, // aubDeviceId
59     1,                                             // extraQuantityThreadsPerEU
60     64,                                            // slmSize
61     sizeof(DG1::GRF),                              // grfSize
62     36u,                                           // timestampValidBits
63     32u,                                           // kernelTimestampValidBits
64     false,                                         // blitterOperationsSupported
65     true,                                          // ftrSupportsInteger64BitAtomics
66     false,                                         // ftrSupportsFP64
67     false,                                         // ftrSupports64BitMath
68     true,                                          // ftrSvm
69     false,                                         // ftrSupportsCoherency
70     false,                                         // ftrSupportsVmeAvcTextureSampler
71     false,                                         // ftrSupportsVmeAvcPreemption
72     false,                                         // ftrRenderCompressedBuffers
73     false,                                         // ftrRenderCompressedImages
74     true,                                          // ftr64KBpages
75     true,                                          // instrumentationEnabled
76     true,                                          // sourceLevelDebuggerSupported
77     false,                                         // supportsVme
78     true,                                          // supportCacheFlushAfterWalker
79     true,                                          // supportsImages,
80     false,                                         // supportsDeviceEnqueue
81     false,                                         // supportsPipes
82     true,                                          // supportsOcl21Features
83     false,                                         // supportsOnDemandPageFaults
84     false,                                         // supportsIndependentForwardProgress
85     false,                                         // hostPtrTrackingEnabled
86     true,                                          // levelZeroSupported
87     false,                                         // isIntegratedDevice
88     true,                                          // supportsMediaBlock
89     true                                           // fusedEuEnabled
90 };
91 
92 WorkaroundTable DG1::workaroundTable = {};
93 FeatureTable DG1::featureTable = {};
94 
setupFeatureAndWorkaroundTable(HardwareInfo * hwInfo)95 void DG1::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) {
96     FeatureTable *featureTable = &hwInfo->featureTable;
97     WorkaroundTable *workaroundTable = &hwInfo->workaroundTable;
98 
99     featureTable->flags.ftrL3IACoherency = true;
100     featureTable->flags.ftrPPGTT = true;
101     featureTable->flags.ftrSVM = true;
102     featureTable->flags.ftrIA32eGfxPTEs = true;
103     featureTable->flags.ftrStandardMipTailFormat = true;
104     featureTable->flags.ftrLocalMemory = true;
105 
106     featureTable->flags.ftrTranslationTable = true;
107     featureTable->flags.ftrUserModeTranslationTable = true;
108     featureTable->flags.ftrTileMappedResource = true;
109     featureTable->flags.ftrEnableGuC = true;
110 
111     featureTable->flags.ftrFbc = true;
112     featureTable->flags.ftrFbc2AddressTranslation = true;
113     featureTable->flags.ftrFbcBlitterTracking = true;
114     featureTable->flags.ftrFbcCpuTracking = true;
115     featureTable->flags.ftrTileY = true;
116 
117     featureTable->flags.ftrAstcHdr2D = true;
118     featureTable->flags.ftrAstcLdr2D = true;
119 
120     featureTable->flags.ftr3dMidBatchPreempt = true;
121     featureTable->flags.ftrGpGpuMidBatchPreempt = true;
122     featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = true;
123     featureTable->flags.ftrPerCtxtPreemptionGranularityControl = true;
124     featureTable->ftrBcsInfo = maxNBitValue(1);
125 
126     workaroundTable->flags.wa4kAlignUVOffsetNV12LinearSurface = true;
127     workaroundTable->flags.waEnablePreemptionGranularityControlByUMD = true;
128 };
129 
130 const HardwareInfo DG1_CONFIG::hwInfo = {
131     &DG1::platform,
132     &DG1::featureTable,
133     &DG1::workaroundTable,
134     &DG1_CONFIG::gtSystemInfo,
135     DG1::capabilityTable,
136 };
137 GT_SYSTEM_INFO DG1_CONFIG::gtSystemInfo = {0};
setupHardwareInfo(HardwareInfo * hwInfo,bool setupFeatureTableAndWorkaroundTable)138 void DG1_CONFIG::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) {
139     GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo;
140     gtSysInfo->ThreadCount = gtSysInfo->EUCount * DG1::threadsPerEu;
141     gtSysInfo->SliceCount = 1;
142     gtSysInfo->DualSubSliceCount = 6;
143     gtSysInfo->L3CacheSizeInKb = 16384;
144     gtSysInfo->L3BankCount = 8;
145     gtSysInfo->MaxFillRate = 16;
146     gtSysInfo->TotalVsThreads = 672;
147     gtSysInfo->TotalHsThreads = 672;
148     gtSysInfo->TotalDsThreads = 672;
149     gtSysInfo->TotalGsThreads = 672;
150     gtSysInfo->TotalPsThreadsWindowerRange = 64;
151     gtSysInfo->CsrSizeInMb = 8;
152     gtSysInfo->MaxEuPerSubSlice = DG1::maxEuPerSubslice;
153     gtSysInfo->MaxSlicesSupported = DG1::maxSlicesSupported;
154     gtSysInfo->MaxSubSlicesSupported = DG1::maxSubslicesSupported;
155     gtSysInfo->MaxDualSubSlicesSupported = DG1::maxDualSubslicesSupported;
156     gtSysInfo->IsL3HashModeEnabled = false;
157     gtSysInfo->IsDynamicallyPopulated = false;
158 
159     gtSysInfo->CCSInfo.IsValid = true;
160     gtSysInfo->CCSInfo.NumberOfCCSEnabled = 1;
161     gtSysInfo->CCSInfo.Instances.CCSEnableMask = 0b1;
162 
163     if (setupFeatureTableAndWorkaroundTable) {
164         DG1::setupFeatureAndWorkaroundTable(hwInfo);
165     }
166 };
167 
168 const HardwareInfo DG1::hwInfo = DG1_CONFIG::hwInfo;
169 const uint64_t DG1::defaultHardwareInfoConfig = 0x100060010;
170 
setupDG1HardwareInfoImpl(HardwareInfo * hwInfo,bool setupFeatureTableAndWorkaroundTable,uint64_t hwInfoConfig)171 void setupDG1HardwareInfoImpl(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig) {
172     if (hwInfoConfig == 0x100060010) {
173         DG1_CONFIG::setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
174     } else if (hwInfoConfig == 0x0) {
175         // Default config
176         DG1_CONFIG::setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
177     } else {
178         UNRECOVERABLE_IF(true);
179     }
180 }
181 
182 void (*DG1::setupHardwareInfo)(HardwareInfo *, bool, const uint64_t) = setupDG1HardwareInfoImpl;
183 } // namespace NEO
184