Skip to content

Commit

Permalink
Merge branch 'master_prm' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
WenqingLiAMD committed Apr 2, 2022
2 parents 36c5637 + 25569e8 commit 685edbe
Show file tree
Hide file tree
Showing 143 changed files with 2,803 additions and 19,250 deletions.
6 changes: 0 additions & 6 deletions cmake/XglCompileDefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ macro(xgl_set_compile_definitions)
target_compile_definitions(xgl PRIVATE ICD_BUILD_LLPC)
endif()

#if VKI_SDK_NEXT
if(VKI_SDK_NEXT)
target_compile_definitions(xgl PRIVATE VKI_SDK_NEXT=1)
endif()
#endif

target_compile_definitions(xgl PRIVATE PAL_BUILD_GFX9=1)

target_compile_definitions(xgl PRIVATE PAL_BUILD_RAVEN2)
Expand Down
16 changes: 6 additions & 10 deletions cmake/XglOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,23 @@ macro(xgl_options)

### Cached Project Options #############################################################################################

#if VKI_SDK_NEXT
option(VKI_SDK_NEXT "Build with Vulkan 1.3 support" ON)
#endif

option(XGL_ENABLE_PRINTS_ASSERTS "Build with debug print enabled?" OFF)

option(XGL_ENABLE_LTO "Build with LTO enabled?" ON)

option(XGL_ENABLE_GCOV "Build with gcov source code coverage?" OFF)

option(XGL_BUILD_VEGA20 "Build open source vulkan for Vega20?" ON)
option(XGL_BUILD_VEGA20 "Build vulkan for Vega20?" ON)

option(XGL_BUILD_GFX103 "Build open source vulkan for GFX103" ON)
option(XGL_BUILD_GFX103 "Build vulkan for GFX103" ON)

option(XGL_BUILD_NAVI12 "Build open source vulkan for Navi12" ON)
option(XGL_BUILD_NAVI12 "Build vulkan for Navi12" ON)

option(XGL_BUILD_NAVI22 "Build open source vulkan for Navi22" ON)
option(XGL_BUILD_NAVI22 "Build vulkan for Navi22" ON)

option(XGL_BUILD_NAVI23 "Build open source vulkan for Navi23" ON)
option(XGL_BUILD_NAVI23 "Build vulkan for Navi23" ON)

option(XGL_BUILD_NAVI24 "Build open source vulkan for Navi24" ON)
option(XGL_BUILD_NAVI24 "Build vulkan for Navi24" ON)

option(XGL_BUILD_TESTS "Build all tests?" OFF)

Expand Down
16 changes: 9 additions & 7 deletions cmake/XglOverrides.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ macro(xgl_get_path)
set(XGL_CACHE_CREATOR_PATH ${PROJECT_SOURCE_DIR}/tools/cache_creator CACHE PATH "Path to the cache creator tool")

# PAL path
if(EXISTS ${PROJECT_SOURCE_DIR}/../pal)
if(EXISTS ${PROJECT_SOURCE_DIR}/icd/imported/pal)
set(XGL_PAL_PATH ${PROJECT_SOURCE_DIR}/icd/imported/pal CACHE PATH "Specify the path to the PAL project.")
elseif(EXISTS ${PROJECT_SOURCE_DIR}/../pal)
set(XGL_PAL_PATH ${PROJECT_SOURCE_DIR}/../pal CACHE PATH "Specify the path to the PAL project.")
endif()

Expand All @@ -103,11 +105,11 @@ macro(xgl_get_path)
#endif

# VKGC path
if (EXISTS ${PROJECT_SOURCE_DIR}/../llpc/CMakeLists.txt)
if (EXISTS ${XGL_ICD_PATH}/api/compiler)
set(XGL_VKGC_PATH ${XGL_ICD_PATH}/api/compiler CACHE PATH "Specify the path to the compiler.")
elseif(EXISTS ${PROJECT_SOURCE_DIR}/../llpc)
# On github, the default repo name is llpc instead of compiler
set(XGL_VKGC_PATH ${PROJECT_SOURCE_DIR}/../llpc CACHE PATH "Specify the path to the llpc repository.")
else()
set(XGL_VKGC_PATH ${XGL_ICD_PATH}/api/compiler CACHE PATH "Specify the path to the compiler.")
endif()

# external Vulkan headers path
Expand All @@ -118,14 +120,14 @@ macro(xgl_get_path)
# Metrohash path
if(EXISTS ${PROJECT_SOURCE_DIR}/../MetroHash)
set(XGL_METROHASH_PATH ${PROJECT_SOURCE_DIR}/../MetroHash CACHE PATH "The path of metrohash.")
else()
elseif(EXISTS ${PROJECT_SOURCE_DIR}/../third_party/metrohash)
set(XGL_METROHASH_PATH ${PROJECT_SOURCE_DIR}/../third_party/metrohash CACHE PATH "The path of metrohash.")
endif()

# cwpack path
if(EXISTS ${PROJECT_SOURCE_DIR}/../CWPack)
set(XGL_CWPACK_PATH ${PROJECT_SOURCE_DIR}/../CWPack CACHE PATH "The path of cwpack.")
else()
elseif(EXISTS ${PROJECT_SOURCE_DIR}/../third_party/cwpack)
set(XGL_CWPACK_PATH ${PROJECT_SOURCE_DIR}/../third_party/cwpack CACHE PATH "The path of cwpack.")
endif()
endmacro()
Expand Down Expand Up @@ -220,7 +222,7 @@ macro(xgl_overrides)
xgl_get_path()

if(ICD_BUILD_LLPCONLY)
set(ICD_BUILD_LLPC ON CACHE BOOL "ICD_BUILD_LLPCONLY override." FORCE)
set(ICD_BUILD_LLPC ON CACHE BOOL "ICD_BUILD_LLPC override." FORCE)
endif()

if(NOT ICD_BUILD_LLPC)
Expand Down
12 changes: 7 additions & 5 deletions icd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ set(ICD_GEN_STRINGS_OPT -w ${ICD_STRING_DIR} -d ${ICD_STRING_DIR})

set(ICD_GEN_STRINGS_FILES ${ICD_GEN_STRINGS} ${ICD_STRING_DIR}/func_table_template.py)

set(ICD_STRING_OUTPUT_FILES ${ICD_STRING_DIR}/g_entry_points_decl.h
${ICD_STRING_DIR}/g_entry_points_impl.h
${ICD_STRING_DIR}/g_extensions_decl.h
${ICD_STRING_DIR}/g_extensions_impl.h
${ICD_STRING_DIR}/g_func_table.h
set(ICD_STRING_OUTPUT_DIR ${ICD_STRING_DIR})

set(ICD_STRING_OUTPUT_FILES ${ICD_STRING_OUTPUT_DIR}/g_entry_points_decl.h
${ICD_STRING_OUTPUT_DIR}/g_entry_points_impl.h
${ICD_STRING_OUTPUT_DIR}/g_extensions_decl.h
${ICD_STRING_OUTPUT_DIR}/g_extensions_impl.h
${ICD_STRING_OUTPUT_DIR}/g_func_table.h
)

set(ICD_STRING_SOURCE_FILES ${ICD_STRING_DIR}/entry_points.txt
Expand Down
4 changes: 2 additions & 2 deletions icd/Loader/LunarG/Lnx/amd-icd.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"file_format_version": "1.0.0",
"ICD": {
"library_path": "@AMDVLK_INSTALL_PATH@/amdvlk@[email protected]",
"api_version": "1.3.205"
"api_version": "1.3.208"
},
"layer": {
"name": "VK_LAYER_AMD_switchable_graphics_@ISABITS@",
"type": "GLOBAL",
"library_path": "@AMDVLK_INSTALL_PATH@/amdvlk@[email protected]",
"api_version": "1.3.205",
"api_version": "1.3.208",
"implementation_version": "1",
"description": "AMD switchable graphics layer",
"functions": {
Expand Down
43 changes: 42 additions & 1 deletion icd/api/app_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ constexpr AppProfilePatternEntry AppEngineSource2 =
"source2"
};

constexpr AppProfilePatternEntry AppEngineDXVK =
{
PatternEngineNameLower,
"dxvk"
};

constexpr AppProfilePatternEntry AppNameTalosWin32Bit =
{
PatternAppNameLower,
Expand Down Expand Up @@ -481,6 +487,24 @@ constexpr AppProfilePatternEntry AppNameCSGOLinux64Bit =
"csgo_linux64"
};

constexpr AppProfilePatternEntry AppNameGodOfWar
{
PatternAppNameLower,
"gow.exe"
};

constexpr AppProfilePatternEntry AppNameX4Foundations
{
PatternAppNameLower,
"x4"
};

constexpr AppProfilePatternEntry AppNameX4Engine
{
PatternEngineNameLower,
"engine name"
};

constexpr AppProfilePatternEntry PatternEnd = {};

// This is a table of patterns. The first matching pattern in this table will be returned.
Expand Down Expand Up @@ -971,8 +995,25 @@ AppProfilePattern AppPatternTable[] =
AppNameCSGOLinux64Bit,
PatternEnd
}
}
},

{
AppProfile::DxvkGodOfWar,
{
AppNameGodOfWar,
AppEngineDXVK,
PatternEnd
}
},

{
AppProfile::X4Foundations,
{
AppNameX4Foundations,
AppNameX4Engine,
PatternEnd
}
}
};

static char* GetExecutableName(size_t* pLength, bool includeExtension = false);
Expand Down
76 changes: 40 additions & 36 deletions icd/api/app_shader_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ void ShaderOptimizer::ApplyProfileToShaderCreateInfo(
{
options.pOptions->fp32DenormalMode = shaderCreate.tuningOptions.fp32DenormalMode;
}
if (shaderCreate.tuningOptions.fastMathFlags != 0)
{
options.pOptions->fastMathFlags = shaderCreate.tuningOptions.fastMathFlags;
}
if (shaderCreate.apply.waveSize)
{
options.pOptions->waveSize = shaderCreate.tuningOptions.waveSize;
Expand Down Expand Up @@ -490,7 +494,7 @@ void ShaderOptimizer::BuildTuningProfile()

// Only a single entry is currently supported
m_tuningProfile.entryCount = 1;
PipelineProfileEntry& entry = m_tuningProfile.pEntries[0];
auto pEntry = &m_tuningProfile.pEntries[0];

bool matchHash = false;
if ((m_settings.overrideShaderHashLower != 0) ||
Expand All @@ -500,7 +504,7 @@ void ShaderOptimizer::BuildTuningProfile()
}
else
{
entry.pattern.match.always = 1;
pEntry->pattern.match.always = 1;
}

// Assign ShaderStage type according to setting file
Expand Down Expand Up @@ -531,66 +535,66 @@ void ShaderOptimizer::BuildTuningProfile()

VK_ASSERT(shaderStage < ShaderStage::ShaderStageCount);

ShaderProfilePattern& pattern = entry.pattern.shaders[shaderStage];
ShaderProfileAction& action = entry.action.shaders[shaderStage];
auto pPattern = &pEntry->pattern.shaders[shaderStage];
auto pAction = &pEntry->action.shaders[shaderStage];

pattern.match.codeHash = matchHash;
pattern.codeHash.lower = m_settings.overrideShaderHashLower;
pattern.codeHash.upper = m_settings.overrideShaderHashUpper;
pPattern->match.codeHash = matchHash;
pPattern->codeHash.lower = m_settings.overrideShaderHashLower;
pPattern->codeHash.upper = m_settings.overrideShaderHashUpper;

if (m_settings.overrideNumVGPRsAvailable != 0)
{
action.shaderCreate.apply.vgprLimit = true;
action.shaderCreate.tuningOptions.vgprLimit = m_settings.overrideNumVGPRsAvailable;
pAction->shaderCreate.apply.vgprLimit = true;
pAction->shaderCreate.tuningOptions.vgprLimit = m_settings.overrideNumVGPRsAvailable;
}

if (m_settings.overrideMaxLdsSpillDwords != 0)
{
action.shaderCreate.apply.ldsSpillLimitDwords = true;
action.shaderCreate.tuningOptions.ldsSpillLimitDwords = m_settings.overrideMaxLdsSpillDwords;
pAction->shaderCreate.apply.ldsSpillLimitDwords = true;
pAction->shaderCreate.tuningOptions.ldsSpillLimitDwords = m_settings.overrideMaxLdsSpillDwords;
}

if (m_settings.overrideUserDataSpillThreshold)
{
action.shaderCreate.apply.userDataSpillThreshold = true;
action.shaderCreate.tuningOptions.userDataSpillThreshold = 0;
pAction->shaderCreate.apply.userDataSpillThreshold = true;
pAction->shaderCreate.tuningOptions.userDataSpillThreshold = 0;
}

action.shaderCreate.apply.allowReZ = m_settings.overrideAllowReZ;
action.shaderCreate.apply.enableSelectiveInline = m_settings.overrideEnableSelectiveInline;
action.shaderCreate.apply.disableLoopUnrolls = m_settings.overrideDisableLoopUnrolls;
pAction->shaderCreate.apply.allowReZ = m_settings.overrideAllowReZ;
pAction->shaderCreate.apply.enableSelectiveInline = m_settings.overrideEnableSelectiveInline;
pAction->shaderCreate.apply.disableLoopUnrolls = m_settings.overrideDisableLoopUnrolls;

if (m_settings.overrideUseSiScheduler)
{
action.shaderCreate.tuningOptions.useSiScheduler = true;
pAction->shaderCreate.tuningOptions.useSiScheduler = true;
}

if (m_settings.overrideReconfigWorkgroupLayout)
{
action.shaderCreate.tuningOptions.reconfigWorkgroupLayout = true;
pAction->shaderCreate.tuningOptions.reconfigWorkgroupLayout = true;
}

if (m_settings.overrideDisableLicm)
{
action.shaderCreate.tuningOptions.disableLicm = true;
pAction->shaderCreate.tuningOptions.disableLicm = true;
}

if (m_settings.overrideEnableLoadScalarizer)
{
action.shaderCreate.tuningOptions.enableLoadScalarizer = true;
pAction->shaderCreate.tuningOptions.enableLoadScalarizer = true;
}

switch (m_settings.overrideWaveSize)
{
case ShaderWaveSize::WaveSizeAuto:
break;
case ShaderWaveSize::WaveSize64:
action.shaderCreate.apply.waveSize = true;
action.shaderCreate.tuningOptions.waveSize = 64;
pAction->shaderCreate.apply.waveSize = true;
pAction->shaderCreate.tuningOptions.waveSize = 64;
break;
case ShaderWaveSize::WaveSize32:
action.shaderCreate.apply.waveSize = true;
action.shaderCreate.tuningOptions.waveSize = 32;
pAction->shaderCreate.apply.waveSize = true;
pAction->shaderCreate.tuningOptions.waveSize = 32;
break;
default:
VK_NEVER_CALLED();
Expand All @@ -603,45 +607,45 @@ void ShaderOptimizer::BuildTuningProfile()
case WgpMode::WgpModeCu:
break;
case WgpMode::WgpModeWgp:
action.shaderCreate.apply.wgpMode = true;
pAction->shaderCreate.apply.wgpMode = true;
break;
default:
VK_NEVER_CALLED();
}

action.shaderCreate.apply.nggDisable = m_settings.overrideUseNgg;
action.shaderCreate.apply.enableSubvector = m_settings.overrideEnableSubvector;
pAction->shaderCreate.apply.nggDisable = m_settings.overrideUseNgg;
pAction->shaderCreate.apply.enableSubvector = m_settings.overrideEnableSubvector;

if (m_settings.overrideWavesPerCu != 0)
{
action.dynamicShaderInfo.apply.maxWavesPerCu = true;
action.dynamicShaderInfo.maxWavesPerCu = m_settings.overrideWavesPerCu;
pAction->dynamicShaderInfo.apply.maxWavesPerCu = true;
pAction->dynamicShaderInfo.maxWavesPerCu = m_settings.overrideWavesPerCu;
}

if ((m_settings.overrideCsTgPerCu != 0) &&
(shaderStage == ShaderStage::ShaderStageCompute))
{
action.dynamicShaderInfo.apply.maxThreadGroupsPerCu = true;
action.dynamicShaderInfo.maxThreadGroupsPerCu = m_settings.overrideCsTgPerCu;
pAction->dynamicShaderInfo.apply.maxThreadGroupsPerCu = true;
pAction->dynamicShaderInfo.maxThreadGroupsPerCu = m_settings.overrideCsTgPerCu;
}

if (m_settings.overrideUsePbbPerCrc != PipelineBinningModeDefault)
{
entry.action.createInfo.apply.binningOverride = true;
pEntry->action.createInfo.apply.binningOverride = true;

switch (m_settings.overrideUsePbbPerCrc)
{
case PipelineBinningModeEnable:
entry.action.createInfo.binningOverride = Pal::BinningOverride::Enable;
pEntry->action.createInfo.binningOverride = Pal::BinningOverride::Enable;
break;

case PipelineBinningModeDisable:
entry.action.createInfo.binningOverride = Pal::BinningOverride::Disable;
pEntry->action.createInfo.binningOverride = Pal::BinningOverride::Disable;
break;

case PipelineBinningModeDefault:
default:
entry.action.createInfo.binningOverride = Pal::BinningOverride::Default;
pEntry->action.createInfo.binningOverride = Pal::BinningOverride::Default;
break;
}
}
Expand Down Expand Up @@ -680,7 +684,7 @@ void ShaderOptimizer::BuildAppProfileLlpc()

uint32_t i = 0;

m_appShaderProfile.BuildAppProfileLlpc(appProfile, gfxIpLevel, &m_appProfile);
m_appShaderProfile.BuildAppProfileLlpc(appProfile, gfxIpLevel, asicRevision, &m_appProfile);

if (appProfile == AppProfile::Dota2)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"entries": [
{
"pattern": {
"always": true
},
"action": {
"ps": {
"fastMathFlags": 16
}
}
}
]
}
Loading

0 comments on commit 685edbe

Please sign in to comment.