Skip to content

Commit

Permalink
Update xgl from commit ee46f91a
Browse files Browse the repository at this point in the history
* Add navi32 support
* Update PAL Version in XGL 819
* Vulkan Graphics pipeline library fast-link revise
* Bump LLPC client version to 66
* Refine graphics pipeline api hash
* Add shader tuning option EliminateFuncLoadStore
* Gpurt Version Bump to 39
* Switch to old PAL metadata for Detroit
* Change default for EnableUpdateParallel
* Add Ac01WaNotNeeded VkPanel.
* Uber fetch shader improvements
* Workaround double free in Baldur’s Gate
* Update Khronos Vulkan Headers to 1.3.264
* Simplify LLPC cache
* Fix dEQP-VK.info.device_mandatory_features  test failed on Gfx8
* Support dynamic sample info
* Tessellation' demo cannot be seen in Wireframe mode.
* Amdvlk Treat ErrorUnknown as OOM
* RasterizationSamples fix dynamic
* AppProfile Yuzu disable DccForColorAttachments
* Handle new compiler interface for shader handle
* Fixes for blend state and uber fetch shader
* White lines observed on edges in dark locations
* Rename ShaderStageTessEvaluation to ShaderStageTessEval
  • Loading branch information
chuang13 committed Sep 28, 2023
1 parent 99fce34 commit 5f4c7d9
Show file tree
Hide file tree
Showing 44 changed files with 1,365 additions and 442 deletions.
6 changes: 6 additions & 0 deletions cmake/XglCompileDefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ macro(xgl_set_compile_definitions)
endif()
#endif

#if VKI_BUILD_NAVI32
if(XGL_BUILD_NAVI32)
target_compile_definitions(xgl PRIVATE VKI_BUILD_NAVI32=1)
endif()
#endif

#if VKI_BUILD_NAVI33
if(XGL_BUILD_NAVI33)
target_compile_definitions(xgl PRIVATE VKI_BUILD_NAVI33=1)
Expand Down
4 changes: 4 additions & 0 deletions cmake/XglOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ macro(xgl_options)
option(XGL_BUILD_NAVI31 "Build vulkan for Navi31" ON)
#endif

#if VKI_BUILD_NAVI32
option(XGL_BUILD_NAVI32 "Build vulkan for Navi32" ON)
#endif

#if VKI_BUILD_NAVI33
option(XGL_BUILD_NAVI33 "Build vulkan for Navi33" ON)
#endif
Expand Down
8 changes: 8 additions & 0 deletions cmake/XglOverrides.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ macro(xgl_overrides_pal)
set(PAL_BUILD_NAVI31 ${XGL_BUILD_NAVI31} CACHE BOOL "${PROJECT_NAME} override." FORCE)
#endif

#if VKI_BUILD_NAVI32
set(PAL_BUILD_NAVI32 ${XGL_BUILD_NAVI32} CACHE BOOL "${PROJECT_NAME} override." FORCE)
#endif

#if VKI_BUILD_NAVI33
set(PAL_BUILD_NAVI33 ${XGL_BUILD_NAVI33} CACHE BOOL "${PROJECT_NAME} override." FORCE)
#endif
Expand Down Expand Up @@ -175,6 +179,10 @@ macro(xgl_overrides_vkgc)
set(LLPC_BUILD_NAVI31 ${XGL_BUILD_NAVI31} CACHE BOOL "${PROJECT_NAME} override." FORCE)
#endif

#if VKI_BUILD_NAVI32
set(LLPC_BUILD_NAVI32 ${XGL_BUILD_NAVI32} CACHE BOOL "${PROJECT_NAME} override." FORCE)
#endif

#if VKI_BUILD_NAVI33
set(LLPC_BUILD_NAVI33 ${XGL_BUILD_NAVI33} CACHE BOOL "${PROJECT_NAME} override." FORCE)
#endif
Expand Down
6 changes: 3 additions & 3 deletions cmake/XglVersions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include_guard()
# This will become the value of PAL_CLIENT_INTERFACE_MAJOR_VERSION. It describes the version of the PAL interface
# that the ICD supports. PAL uses this value to enable backwards-compatibility for older interface versions.
# It must be updated on each PAL promotion after handling all of the interface changes described in palLib.h.
set(ICD_PAL_CLIENT_MAJOR_VERSION "816")
set(ICD_PAL_CLIENT_MAJOR_VERSION "819")

# This will become the value of GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION if ICD_GPUOPEN_DEVMODE_BUILD=1.
# It describes the interface version of the gpuopen shared module (part of PAL) that the ICD supports.
Expand All @@ -37,9 +37,9 @@ set(ICD_GPUOPEN_CLIENT_MAJOR_VERSION "42")
#if VKI_RAY_TRACING
# This will become the value of GPURT_CLIENT_INTERFACE_MAJOR_VERSION if VKI_RAY_TRACING=1.
# It describes the interface version of the GpuRT shared module that the ICD supports.
set(ICD_GPURT_CLIENT_MAJOR_VERSION "33")
set(ICD_GPURT_CLIENT_MAJOR_VERSION "39")
#endif

# This will become the value of LLPC_CLIENT_INTERFACE_MAJOR_VERSION if ICD_BUILD_LLPC=1.
# It describes the version of the interface version of LLPC that the ICD supports.
set(ICD_LLPC_CLIENT_MAJOR_VERSION "63")
set(ICD_LLPC_CLIENT_MAJOR_VERSION "66")
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.261"
"api_version": "1.3.264"
},
"layer": {
"name": "VK_LAYER_AMD_switchable_graphics_@ISABITS@",
"type": "GLOBAL",
"library_path": "@AMDVLK_INSTALL_PATH@/amdvlk@[email protected]",
"api_version": "1.3.261",
"api_version": "1.3.264",
"implementation_version": "1",
"description": "AMD switchable graphics layer",
"functions": {
Expand Down
20 changes: 0 additions & 20 deletions icd/api/app_resource_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,26 +481,6 @@ void ResourceOptimizer::BuildAppProfile()
m_appProfile.entries[i].action.resourceCreate.dccMode = DccMode::DccDisableMode;
}
}
#if PAL_BUILD_GFX11
else if (appProfile == AppProfile::Yuzu)
{
if (gfxIpLevel == Pal::GfxIpLevel::GfxIp11_0)
{
// 0x0000064000000384f83db7fb629521bd
i = m_appProfile.entryCount++;
m_appProfile.entries[i].pattern.match.apiHash = true;
m_appProfile.entries[i].pattern.targetKey.apiHash = 0xf83db7fb629521bd;
m_appProfile.entries[i].action.resourceCreate.apply.dccMode = true;
m_appProfile.entries[i].action.resourceCreate.dccMode = DccMode::DccDisableMode;
// 0x00000640000003845a18ecbb795c8bed
i = m_appProfile.entryCount++;
m_appProfile.entries[i].pattern.match.apiHash = true;
m_appProfile.entries[i].pattern.targetKey.apiHash = 0x5a18ecbb795c8bed;
m_appProfile.entries[i].action.resourceCreate.apply.dccMode = true;
m_appProfile.entries[i].action.resourceCreate.dccMode = DccMode::DccDisableMode;
}
}
#endif
}

#if ICD_RUNTIME_APP_PROFILE
Expand Down
4 changes: 2 additions & 2 deletions icd/api/app_shader_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void ShaderOptimizer::ApplyProfileToGraphicsPipelineCreateInfo(
case ShaderStage::ShaderStageTessControl:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->hs);
break;
case ShaderStage::ShaderStageTessEvaluation:
case ShaderStage::ShaderStageTessEval:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ds);
break;
case ShaderStage::ShaderStageGeometry:
Expand Down Expand Up @@ -1300,7 +1300,7 @@ void ShaderOptimizer::PrintProfileEntryMatch(
case ShaderStage::ShaderStageTessControl:
pStage = "HS";
break;
case ShaderStage::ShaderStageTessEvaluation:
case ShaderStage::ShaderStageTessEval:
pStage = "DS";
break;
case ShaderStage::ShaderStageGeometry:
Expand Down
16 changes: 4 additions & 12 deletions icd/api/compiler_solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ const char* CompilerSolution::GetGraphicsLibraryName(
static const char* GraphicsLibraryTypeNames[] =
{
"PreRasterLib",
"FragmentLib"
"FragmentLib",
"ColorExportLib"
};

pName = GraphicsLibraryTypeNames[static_cast<uint32_t>(libraryType)];
Expand Down Expand Up @@ -204,17 +205,8 @@ void CompilerSolution::UpdateRayTracingFunctionNames(

VK_ASSERT(result == VK_SUCCESS);

if (settings.rtUseRayQueryForTraceRays)
{
SetRayTracingFunctionName(
entryFuncTable.traceRay.pTraceRayUsingRayQuery, pTable->pFunc[Vkgc::RT_ENTRY_TRACE_RAY]);
}
else
{
SetRayTracingFunctionName(
entryFuncTable.traceRay.pTraceRay, pTable->pFunc[Vkgc::RT_ENTRY_TRACE_RAY]);
}

SetRayTracingFunctionName(
entryFuncTable.traceRay.pTraceRay, pTable->pFunc[Vkgc::RT_ENTRY_TRACE_RAY]);
SetRayTracingFunctionName(
entryFuncTable.traceRay.pTraceRayUsingHitToken, pTable->pFunc[Vkgc::RT_ENTRY_TRACE_RAY_HIT_TOKEN]);
SetRayTracingFunctionName(
Expand Down
105 changes: 72 additions & 33 deletions icd/api/compiler_solution_llpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ VkResult CompilerSolutionLlpc::CreateGraphicsPipelineBinary(
pPipelineBuildInfo->pInstance = pInstance;
pPipelineBuildInfo->pfnOutputAlloc = AllocateShaderOutput;
pPipelineBuildInfo->iaState.deviceIndex = deviceIdx;
if ((pPipelineCache != nullptr) && (settings.shaderCacheMode != ShaderCacheDisable))
{
pPipelineBuildInfo->cache = pPipelineCache->GetCacheAdapter();
}

// By default the client hash provided to PAL is more accurate than the one used by pipeline
// profiles.
Expand Down Expand Up @@ -411,6 +407,47 @@ VkResult CompilerSolutionLlpc::CreateGraphicsPipelineBinary(
return result;
}

// =====================================================================================================================
// Creates color export binary.
VkResult CompilerSolutionLlpc::CreateColorExportBinary(
GraphicsPipelineBinaryCreateInfo* pCreateInfo,
void* pPipelineDumpHandle,
Vkgc::BinaryData* pOutputPackage)
{
const RuntimeSettings& settings = m_pPhysicalDevice->GetRuntimeSettings();
auto pInstance = m_pPhysicalDevice->Manager()->VkInstance();

VkResult result = VK_SUCCESS;
Llpc::GraphicsPipelineBuildOut pipelineOut = {};

auto pPipelineBuildInfo = &pCreateInfo->pipelineInfo;
pPipelineBuildInfo->pInstance = pInstance;
pPipelineBuildInfo->pfnOutputAlloc = AllocateShaderOutput;

VK_ASSERT(pCreateInfo->pBinaryMetadata->pFsOutputMetaData != nullptr);
Vkgc::Result llpcResult = m_pLlpc->BuildColorExportShader(pPipelineBuildInfo,
pCreateInfo->pBinaryMetadata->pFsOutputMetaData,
&pipelineOut,
pPipelineDumpHandle);

if (llpcResult == Vkgc::Result::Success)
{
pOutputPackage->pCode = pipelineOut.pipelineBin.pCode;
pOutputPackage->codeSize = pipelineOut.pipelineBin.codeSize;
if (settings.enablePipelineDump && (pPipelineDumpHandle != nullptr))
{
Vkgc::IPipelineDumper::DumpPipelineBinary(pPipelineDumpHandle, m_gfxIp, &pipelineOut.pipelineBin);
}
}
else
{
result = (llpcResult == Vkgc::Result::RequireFullPipeline) ? VK_PIPELINE_COMPILE_REQUIRED :
VK_ERROR_INITIALIZATION_FAILED;
}

return result;
}

// =====================================================================================================================
// Build ElfPackage for a specific shader module based on pipeline information
VkResult CompilerSolutionLlpc::CreateGraphicsShaderBinary(
Expand Down Expand Up @@ -469,38 +506,43 @@ VkResult CompilerSolutionLlpc::CreateGraphicsShaderBinary(
pPipelineDumpHandle);
if (llpcResult == Vkgc::Result::Success)
{
if (stage == ShaderStage::ShaderStageFragment)
{
pCreateInfo->pBinaryMetadata->pFsOutputMetaData = pipelineOut.fsOutputMetaData;
pCreateInfo->pBinaryMetadata->fsOutputMetaDataSize = pipelineOut.fsOutputMetaDataSize;
pipelineOut.pipelineBin.codeSize += pipelineOut.fsOutputMetaDataSize;
}

pShaderModule->elfPackage = pipelineOut.pipelineBin;
if ((pPipelineCache != nullptr) && (pPipelineCache->GetPipelineCache() != nullptr))
{
pPipelineCache->GetPipelineCache()->StorePipelineBinary(
&cacheId, pipelineOut.pipelineBin.codeSize, pipelineOut.pipelineBin.pCode);
}
}
else
else if (llpcResult != Vkgc::Result::RequireFullPipeline)
{

result = (llpcResult == Vkgc::Result::ErrorOutOfMemory) ?
VK_ERROR_OUT_OF_HOST_MEMORY : VK_ERROR_INITIALIZATION_FAILED;

result = (llpcResult == Vkgc::Result::ErrorOutOfMemory) ? VK_ERROR_OUT_OF_HOST_MEMORY :
VK_ERROR_INITIALIZATION_FAILED;
}
}

if (result == VK_SUCCESS)
{
pCreateInfo->earlyElfPackage[gplType] = pShaderModule->elfPackage;
pCreateInfo->earlyElfPackageHash[gplType] = cacheId;

if (stage == ShaderStage::ShaderStageFragment)
if (llpcResult == Vkgc::Result::Success)
{
const auto* pModuleData =
reinterpret_cast<const Vkgc::ShaderModuleData*>(pCreateInfo->pipelineInfo.fs.pModuleData);
pCreateInfo->pBinaryMetadata->needsSampleInfo = pModuleData->usage.useSampleInfo;
}
pCreateInfo->earlyElfPackage[gplType] = pShaderModule->elfPackage;
pCreateInfo->earlyElfPackageHash[gplType] = cacheId;

if (pPipelineDumpHandle != nullptr)
{
Vkgc::IPipelineDumper::DumpPipelineBinary(
pPipelineDumpHandle, m_gfxIp, &pCreateInfo->earlyElfPackage[gplType]);
if (stage == ShaderStage::ShaderStageFragment)
{
const auto* pModuleData =
reinterpret_cast<const Vkgc::ShaderModuleData*>(pCreateInfo->pipelineInfo.fs.pModuleData);
pCreateInfo->pBinaryMetadata->needsSampleInfo = pModuleData->usage.useSampleInfo;
}

if (pPipelineDumpHandle != nullptr)
{
Vkgc::IPipelineDumper::DumpPipelineBinary(
pPipelineDumpHandle, m_gfxIp, &pCreateInfo->earlyElfPackage[gplType]);
}
}
}
}
Expand Down Expand Up @@ -540,10 +582,6 @@ VkResult CompilerSolutionLlpc::CreateComputePipelineBinary(
// Fill pipeline create info for LLPC
pPipelineBuildInfo->pInstance = pInstance;
pPipelineBuildInfo->pfnOutputAlloc = AllocateShaderOutput;
if ((pPipelineCache != nullptr) && (settings.shaderCacheMode != ShaderCacheDisable))
{
pPipelineBuildInfo->cache = pPipelineCache->GetCacheAdapter();
}

// Force enable automatic workgroup reconfigure.
if (appProfile == AppProfile::DawnOfWarIII)
Expand Down Expand Up @@ -798,10 +836,6 @@ VkResult CompilerSolutionLlpc::CreateRayTracingPipelineBinary(
pPipelineBuildInfo->pfnOutputAlloc = AllocateShaderOutput;
pPipelineBuildInfo->deviceIndex = deviceIdx;
pPipelineBuildInfo->deviceCount = m_pPhysicalDevice->Manager()->GetDeviceCount();
if ((pPipelineCache != nullptr) && (settings.shaderCacheMode != ShaderCacheDisable))
{
pPipelineBuildInfo->cache = pPipelineCache->GetCacheAdapter();
}

auto llpcResult = m_pLlpc->BuildRayTracingPipeline(pPipelineBuildInfo,
&pipelineOut,
Expand Down Expand Up @@ -966,13 +1000,15 @@ VkResult CompilerSolutionLlpc::CreateLlpcCompiler(
llpcOptions[numOptions++] = "-amdgpu-max-memory-clause=1";
}

#if LLPC_CLIENT_INTERFACE_MAJOR_VERSION < 66
optionLength = Util::Snprintf(pOptionBuffer, bufSize, "-executable-name=%s", pExecutablePtr);
++optionLength;
llpcOptions[numOptions++] = pOptionBuffer;
pOptionBuffer += optionLength;
bufSize -= optionLength;

optionLength = Util::Snprintf(pOptionBuffer, bufSize, "-shader-cache-file-dir=%s", m_pPhysicalDevice->PalDevice()->GetCacheFilePath());
optionLength = Util::Snprintf(pOptionBuffer, bufSize, "-shader-cache-file-dir=%s",
m_pPhysicalDevice->PalDevice()->GetCacheFilePath());
++optionLength;
llpcOptions[numOptions++] = pOptionBuffer;
pOptionBuffer += optionLength;
Expand All @@ -983,6 +1019,9 @@ VkResult CompilerSolutionLlpc::CreateLlpcCompiler(
llpcOptions[numOptions++] = pOptionBuffer;
pOptionBuffer += optionLength;
bufSize -= optionLength;
#endif

llpcOptions[numOptions++] = "-cache-full-pipelines=0";

optionLength = Util::Snprintf(pOptionBuffer, bufSize, "-subgroup-size=%d", m_pPhysicalDevice->GetSubgroupSize());
++optionLength;
Expand Down
Loading

0 comments on commit 5f4c7d9

Please sign in to comment.