Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit ba24064

Browse files
committed
Update xgl from commit a3c27b8c
Add Navi48 support
1 parent 393503c commit ba24064

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3311
-16
lines changed

cmake/XglCompileDefinitions.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ macro(xgl_set_compile_definitions)
6666
endif()
6767
#endif
6868

69+
#if VKI_BUILD_GFX12
70+
if(VKI_BUILD_GFX12)
71+
target_compile_definitions(xgl PRIVATE VKI_BUILD_GFX12=1)
72+
endif()
73+
#endif
74+
75+
#if VKI_BUILD_NAVI48
76+
if(VKI_BUILD_NAVI48)
77+
target_compile_definitions(xgl PRIVATE VKI_BUILD_NAVI48=1)
78+
endif()
79+
#endif
80+
6981
#if VKI_RAY_TRACING
7082
if (VKI_RAY_TRACING)
7183
target_compile_definitions(xgl PRIVATE VKI_RAY_TRACING=1)

cmake/XglOptions.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ macro(xgl_options)
4747
#if VKI_BUILD_STRIX_HALO
4848
option(VKI_BUILD_STRIX_HALO "Build vulkan for STRIX_HALO" ON)
4949
#endif
50+
#if VKI_BUILD_NAVI48
51+
option(VKI_BUILD_NAVI48 "Build vulkan for Navi48" ON)
52+
#endif
5053

5154
option(VKI_BUILD_TESTS "Build tests?" OFF)
5255

cmake/XglOverrides.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ macro(xgl_overrides_pal)
107107
set(PAL_BUILD_STRIX_HALO ${VKI_BUILD_STRIX_HALO} CACHE BOOL "${PROJECT_NAME} override." FORCE)
108108
#endif
109109

110+
#if VKI_BUILD_GFX12
111+
set(PAL_BUILD_GFX12 ${VKI_BUILD_GFX12} CACHE BOOL "${PROJECT_NAME} override." FORCE)
112+
#endif
113+
114+
#if VKI_BUILD_NAVI48
115+
set(PAL_BUILD_NAVI48 ${VKI_BUILD_NAVI48} CACHE BOOL "${PROJECT_NAME} override." FORCE)
116+
#endif
117+
110118
# Wayland
111119
set(PAL_BUILD_WAYLAND ${VKI_BUILD_WAYLAND} CACHE BOOL "Build PAL with Wayland support" FORCE)
112120

@@ -154,6 +162,16 @@ macro(xgl_overrides_llpc)
154162
set(LLPC_BUILD_STRIX_HALO ${VKI_BUILD_STRIX_HALO} CACHE BOOL "${PROJECT_NAME} override." FORCE)
155163
#endif
156164

165+
#if VKI_BUILD_GFX12
166+
if(VKI_BUILD_GFX12)
167+
set(LLPC_BUILD_GFX12 ${VKI_BUILD_GFX12} CACHE BOOL "${PROJECT_NAME} override." FORCE)
168+
endif()
169+
#endif
170+
171+
#if VKI_BUILD_NAVI48
172+
set(LLPC_BUILD_NAVI48 ${VKI_BUILD_NAVI48} CACHE BOOL "${PROJECT_NAME} override." FORCE)
173+
#endif
174+
157175
set(LLPC_CLIENT_INTERFACE_MAJOR_VERSION ${VKI_LLPC_CLIENT_MAJOR_VERSION} CACHE STRING "${PROJECT_NAME} override." FORCE)
158176

159177
set(LLPC_BUILD_TOOLS ${VKI_BUILD_TOOLS} CACHE BOOL "${PROJECT_NAME} override." FORCE)
@@ -172,6 +190,15 @@ macro(xgl_overrides)
172190

173191
set(GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION ${VKI_GPUOPEN_CLIENT_MAJOR_VERSION})
174192

193+
#if VKI_BUILD_GFX12
194+
set(VKI_BUILD_GFX12 OFF)
195+
#if VKI_BUILD_NAVI48
196+
if(VKI_BUILD_NAVI48)
197+
set(VKI_BUILD_GFX12 ON)
198+
endif()
199+
#endif
200+
#endif
201+
175202
xgl_get_path()
176203

177204
set(VKI_MEMTRACK ${CMAKE_BUILD_TYPE_DEBUG})

icd/api/app_resource_optimizer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
***********************************************************************************************************************
33
*
4-
* Copyright (c) 2019-2024 Advanced Micro Devices, Inc. All Rights Reserved.
4+
* Copyright (c) 2019-2025 Advanced Micro Devices, Inc. All Rights Reserved.
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -116,6 +116,8 @@ void ResourceOptimizer::ApplyProfileToImageViewCreateInfo(
116116
pViewInfo->flags.bypassMallWrite = 1;
117117
}
118118

119+
#if VKI_BUILD_GFX12
120+
#endif
119121
}
120122
}
121123
}

icd/api/app_shader_optimizer.cpp

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,46 @@ void ShaderOptimizer::ApplyProfileToShaderCreateInfo(
251251
{
252252
options.pOptions->disableFMA = shaderCreate.tuningOptions.disableFMA;
253253
}
254+
#if VKI_BUILD_GFX12
255+
if (shaderCreate.apply.workgroupRoundRobin)
256+
{
257+
options.pOptions->workgroupRoundRobin = shaderCreate.tuningOptions.workgroupRoundRobin;
258+
}
259+
260+
if (shaderCreate.apply.mallPolicy)
261+
{
262+
options.pOptions->cachePolicyLlc.resourceCount = shaderCreate.tuningOptions.mallResourceCount;
263+
options.pOptions->cachePolicyLlc.noAllocs = shaderCreate.tuningOptions.noAllocs;
264+
}
265+
266+
if (shaderCreate.apply.temporalHintBufferRead)
267+
{
268+
options.pOptions->temporalHintShaderControl |=
269+
(shaderCreate.tuningOptions.temporalHintBufferRead + CompilerTemporalHintOffset)
270+
<< Vkgc::TemporalHintBufferRead;
271+
}
272+
273+
if (shaderCreate.apply.temporalHintBufferWrite)
274+
{
275+
options.pOptions->temporalHintShaderControl |=
276+
(shaderCreate.tuningOptions.temporalHintBufferWrite + CompilerTemporalHintOffset)
277+
<< Vkgc::TemporalHintBufferWrite;
278+
}
279+
280+
if (shaderCreate.apply.temporalHintImageRead)
281+
{
282+
options.pOptions->temporalHintShaderControl |=
283+
(shaderCreate.tuningOptions.temporalHintImageRead + CompilerTemporalHintOffset)
284+
<< Vkgc::TemporalHintImageRead;
285+
}
286+
287+
if (shaderCreate.apply.temporalHintImageWrite)
288+
{
289+
options.pOptions->temporalHintShaderControl |=
290+
(shaderCreate.tuningOptions.temporalHintImageWrite + CompilerTemporalHintOffset)
291+
<< Vkgc::TemporalHintImageWrite;
292+
}
293+
#endif
254294
if (shaderCreate.apply.workaroundStorageImageFormats)
255295
{
256296
options.pOptions->workaroundStorageImageFormats = true;
@@ -536,6 +576,49 @@ void ShaderOptimizer::OverrideShaderThreadGroupSize(
536576
}
537577
}
538578

579+
#if VKI_BUILD_GFX12
580+
// =====================================================================================================================
581+
bool ShaderOptimizer::OverrideReverseWorkgroupOrder(
582+
ShaderStage shaderStage,
583+
const PipelineOptimizerKey& pipelineKey
584+
) const
585+
{
586+
bool overrideReverseWorkgroupOrderHw = false;
587+
588+
for (uint32_t entry = 0; entry < m_appProfile.entryCount; ++entry)
589+
{
590+
const PipelineProfileEntry& profileEntry = m_appProfile.pEntries[entry];
591+
592+
if (GetFirstMatchingShader(profileEntry.pattern, InvalidShaderIndex, pipelineKey) != InvalidShaderIndex)
593+
{
594+
const auto& shaders = profileEntry.action.shaders;
595+
596+
if (shaders[shaderStage].shaderCreate.apply.reverseWorkgroupOrderHw)
597+
{
598+
overrideReverseWorkgroupOrderHw = shaders[shaderStage].shaderCreate.tuningOptions.reverseWorkgroupOrderHw;
599+
}
600+
}
601+
}
602+
603+
for (uint32_t entry = 0; entry < m_tuningProfile.entryCount; ++entry)
604+
{
605+
const PipelineProfileEntry& profileEntry = m_tuningProfile.pEntries[entry];
606+
607+
if (GetFirstMatchingShader(profileEntry.pattern, InvalidShaderIndex, pipelineKey) != InvalidShaderIndex)
608+
{
609+
const auto& shaders = profileEntry.action.shaders;
610+
611+
if (shaders[shaderStage].shaderCreate.apply.reverseWorkgroupOrderHw)
612+
{
613+
overrideReverseWorkgroupOrderHw = shaders[shaderStage].shaderCreate.tuningOptions.reverseWorkgroupOrderHw;
614+
}
615+
}
616+
}
617+
618+
return overrideReverseWorkgroupOrderHw;
619+
}
620+
#endif
621+
539622
// =====================================================================================================================
540623
void ShaderOptimizer::OverrideGraphicsPipelineCreateInfo(
541624
const PipelineOptimizerKey& pipelineKey,
@@ -1014,6 +1097,13 @@ void ShaderOptimizer::BuildTuningProfile()
10141097
pAction->shaderCreate.apply.allowReZ = m_settings.overrideAllowReZ;
10151098
pAction->shaderCreate.apply.disableLoopUnrolls = m_settings.overrideDisableLoopUnrolls;
10161099

1100+
#if VKI_BUILD_GFX12
1101+
if (m_settings.overrideWorkgroupRoundRobin)
1102+
{
1103+
pAction->shaderCreate.apply.workgroupRoundRobin = true;
1104+
pAction->shaderCreate.tuningOptions.workgroupRoundRobin = m_settings.overrideWorkgroupRoundRobin;
1105+
}
1106+
#endif
10171107
if (m_settings.overrideUseSiScheduler)
10181108
{
10191109
pAction->shaderCreate.apply.useSiScheduler = true;
@@ -1171,6 +1261,60 @@ void ShaderOptimizer::BuildTuningProfile()
11711261
break;
11721262
}
11731263
}
1264+
#if VKI_BUILD_GFX12
1265+
if (m_settings.overrideTemporalHintBufferRead != TemporalHints::TH_Default)
1266+
{
1267+
pAction->shaderCreate.apply.temporalHintBufferRead = true;
1268+
pAction->shaderCreate.tuningOptions.temporalHintBufferRead =
1269+
m_settings.overrideTemporalHintBufferRead;
1270+
}
1271+
1272+
if (m_settings.overrideTemporalHintBufferWrite != TemporalHints::TH_Default)
1273+
{
1274+
pAction->shaderCreate.apply.temporalHintBufferWrite = true;
1275+
pAction->shaderCreate.tuningOptions.temporalHintBufferWrite =
1276+
m_settings.overrideTemporalHintBufferWrite;
1277+
}
1278+
1279+
if (m_settings.overrideTemporalHintImageRead != TemporalHints::TH_Default)
1280+
{
1281+
pAction->shaderCreate.apply.temporalHintImageRead = true;
1282+
pAction->shaderCreate.tuningOptions.temporalHintImageRead =
1283+
m_settings.overrideTemporalHintImageRead;
1284+
}
1285+
1286+
if (m_settings.overrideTemporalHintImageWrite != TemporalHints::TH_Default)
1287+
{
1288+
pAction->shaderCreate.apply.temporalHintImageWrite = true;
1289+
pAction->shaderCreate.tuningOptions.temporalHintImageWrite =
1290+
m_settings.overrideTemporalHintImageWrite;
1291+
}
1292+
1293+
Util::File hashListFile;
1294+
if (hashListFile.Open(m_settings.overrideCachePolicyLlc, Util::FileAccessRead) == Util::Result::Success)
1295+
{
1296+
// Each line of the file is a hex string which start with "0x", like this
1297+
// 0x000000 - set=0, binding=0, NOALLOC=0
1298+
// 0x200020 - set=0, binding=1, NOALLOC=1
1299+
// 0x200001 - set=1, binding=0, NOALLOC=1
1300+
pAction->shaderCreate.tuningOptions.mallResourceCount = 0;
1301+
char hash[256] = {};
1302+
while ((hashListFile.ReadLine(hash, sizeof(hash), nullptr) == Util::Result::Success))
1303+
{
1304+
// Only read hex string
1305+
if ((hash[0] == '0') && (hash[1] == 'x'))
1306+
{
1307+
uint32_t llcResource = strtoul(hash, nullptr, 16);
1308+
pAction->shaderCreate.tuningOptions.
1309+
noAllocs[pAction->shaderCreate.tuningOptions.mallResourceCount++] = llcResource;
1310+
}
1311+
}
1312+
if (pAction->shaderCreate.tuningOptions.mallResourceCount > 0)
1313+
{
1314+
pAction->shaderCreate.apply.mallPolicy = 1;
1315+
}
1316+
}
1317+
#endif
11741318
}
11751319
}
11761320
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"entries": [
3+
{
4+
"pattern": {
5+
"shaderOnly": true,
6+
"cs": {
7+
"codeHash": "0x6cf7d4214c1e20c7 2409528a8878cc85"
8+
}
9+
},
10+
"action": {
11+
"cs": {
12+
"disableLicm": true
13+
}
14+
}
15+
},
16+
{
17+
"pattern": {
18+
"shaderOnly": true,
19+
"cs": {
20+
"codeHash": "0xeeeeec1163c65c16 ef312b9b872cc8d1"
21+
}
22+
},
23+
"action": {
24+
"cs": {
25+
"waveSize": 32
26+
}
27+
}
28+
},
29+
{
30+
"pattern": {
31+
"ps": {
32+
"codeHash": "0xdf6ce21168ed9fec b8b6c1aeba350d99"
33+
}
34+
},
35+
"action": {
36+
"ps": {
37+
"disableCodeSinking": true
38+
}
39+
}
40+
},
41+
{
42+
"pattern": {
43+
"shaderOnly": true,
44+
"cs": {
45+
"codeHash": "0x7d9d32b38971e698 ecc36f044017b015"
46+
}
47+
},
48+
"action": {
49+
"cs": {
50+
"waveSize": 32
51+
}
52+
}
53+
},
54+
{
55+
"pattern": {
56+
"shaderOnly": true,
57+
"cs": {
58+
"codeHash": "0x5c91656901ce58aa 958181a34ce2de28"
59+
}
60+
},
61+
"action": {
62+
"cs": {
63+
"enableLoadScalarizer": true
64+
}
65+
}
66+
}
67+
]
68+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"entries": [
3+
{
4+
"pattern": {
5+
"ps": {
6+
"codeHash": "0xb770b01a43d1e0cb ba5d9eea178f98f0"
7+
}
8+
},
9+
"action": {
10+
"ps": {
11+
"disableCodeSinking": true,
12+
"vgprLimit": 72
13+
}
14+
}
15+
},
16+
{
17+
"pattern": {
18+
"vs": {
19+
"codeHash": "0x6f736139163a06f6 cc5207924ce81d88"
20+
}
21+
},
22+
"action": {
23+
"vs": {
24+
"dontUnrollHintThreshold": 100,
25+
"useSiScheduler": true
26+
}
27+
}
28+
}
29+
]
30+
}

0 commit comments

Comments
 (0)