Skip to content

Commit

Permalink
Update xgl from commit 2a97f7f5
Browse files Browse the repository at this point in the history
Update Khronos Vulkan Headers to 1.3.280
Release PHOENIX2
Expose the extension VK_EXT_nested_command_buffer
Expose the extension VK_KHR_dynamic_rendering_local_read
Expose the extension VK_KHR_shader_maximal_reconvergence
Enable VK_KHR_shader_maximal_reconvergence for pre-Navi3
Accurately consider extended usage in VkGetPhysicalDeviceImageFormatProperties2
Add EnableFastLBVH setting
Add mapping P012: VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 to P016 format
Add support for experiments
Add TriangleSplittingBudgetPerTriangle and tsPriority GPURT settings
Changes to separate legacy/acq-rel in render pass code
Enable 8-bit integer dot product with accumulation properties
Enable RT Recursion
Implement VK_NV_device_generated_commands
MaxWavesPerCu graphics fix follow up
OR shaderIdExtraBits into traceRayGpuVa
Refine pipeline dump and option waitForDebugger
Refine pipeline dumps for graphics pipeline library
Remove IsDxgiEnabled check
Set EnableTraceRayAccelStructTracking True
Set TriangleSplittingFactor to 1.15
Split DevModeMgr into UberTrace and RGP paths
Switche app_profile.cpp::GetExecutableName to fetch the executable name using open() instead of popen()
Update PAL Version to 867
Bump LLPC version to 71
Fix bind buffers 2
Fix counter overflow with deferred operations
Fix crash in DXVK Left 4 Dead 2
Fix crash in GPURT client callback causing CTS failures
Fix MaxWavesPerCu for graphics shaders
Fix mutable descriptors when no size is specified
Fix typos in pipeline dump and shader module id
Fixes dEQP-GLES31.functional.shaders.* failures in Angle
  • Loading branch information
qiaojbao committed May 14, 2024
1 parent b7100c1 commit f6a447e
Show file tree
Hide file tree
Showing 76 changed files with 4,827 additions and 1,199 deletions.
4 changes: 4 additions & 0 deletions cmake/XglCompileDefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ macro(xgl_set_compile_definitions)
target_compile_definitions(xgl PRIVATE VKI_BUILD_PHOENIX1=1)
endif()

if(XGL_BUILD_PHOENIX2)
target_compile_definitions(xgl PRIVATE VKI_BUILD_PHOENIX2=1)
endif()

if(XGL_BUILD_REMBRANDT)
target_compile_definitions(xgl PRIVATE VKI_BUILD_REMBRANDT=1)
endif()
Expand Down
2 changes: 2 additions & 0 deletions cmake/XglOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ macro(xgl_options)

option(XGL_BUILD_PHOENIX1 "Build vulkan for PHOENIX1" ON)

option(XGL_BUILD_PHOENIX2 "Build vulkan for PHOENIX2" ON)

option(XGL_BUILD_TESTS "Build tests?" OFF)

option(XGL_BUILD_TOOLS "Build tools?" OFF)
Expand Down
4 changes: 4 additions & 0 deletions cmake/XglOverrides.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ macro(xgl_overrides_pal)
set(PAL_BUILD_GFX11 1 CACHE BOOL "${PROJECT_NAME} override." FORCE)
endif()

set(PAL_BUILD_PHOENIX2 ${XGL_BUILD_PHOENIX2} CACHE BOOL "${PROJECT_NAME} override." FORCE)

# Wayland
set(PAL_BUILD_WAYLAND ${BUILD_WAYLAND_SUPPORT} CACHE BOOL "Build PAL with Wayland support" FORCE)

Expand Down Expand Up @@ -160,6 +162,8 @@ macro(xgl_overrides_vkgc)

set(LLPC_BUILD_PHOENIX1 ${XGL_BUILD_PHOENIX1} CACHE BOOL "${PROJECT_NAME} override." FORCE)

set(LLPC_BUILD_PHOENIX2 ${XGL_BUILD_PHOENIX2} CACHE BOOL "${PROJECT_NAME} override." FORCE)

set(LLPC_ENABLE_WERROR ${ICD_ANALYSIS_WARNINGS_AS_ERRORS} CACHE BOOL "${PROJECT_NAME} override." FORCE)

endmacro()
Expand Down
4 changes: 2 additions & 2 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 "856")
set(ICD_PAL_CLIENT_MAJOR_VERSION "867")

# 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 @@ -42,4 +42,4 @@ set(ICD_GPURT_CLIENT_MAJOR_VERSION "46")

# 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 "70")
set(ICD_LLPC_CLIENT_MAJOR_VERSION "71")
34 changes: 33 additions & 1 deletion icd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ target_sources(xgl PRIVATE
api/vk_gpa_session.cpp
api/vk_descriptor_update_template.cpp
api/vk_utils.cpp
api/vk_indirect_commands_layout.cpp
api/appopt/barrier_filter_layer.cpp
api/appopt/strange_brigade_layer.cpp
api/appopt/g_shader_profile.cpp
Expand Down Expand Up @@ -302,6 +303,34 @@ target_sources(xgl PRIVATE
settings/settings_xgl.json
)

add_custom_command(
OUTPUT ${ICD_SETTINGS_DIR}/g_experiments.cpp ${ICD_SETTINGS_DIR}/g_experiments.h
COMMAND ${PYTHON_CMD} ${ICD_GEN_SETTINGS}
-i ${ICD_SETTINGS_DIR}/experiments_settings_xgl.json
-o ${ICD_SETTINGS_DIR}
-g experiments
-s settings/experimentsLoader.h
--namespaces vk
--settings-struct-name ExpSettings
--classname ExperimentsLoader
DEPENDS ${ICD_GEN_SETTINGS_FILES} ${ICD_SETTINGS_DIR}/experiments_settings_xgl.json
COMMENT "Generating Vulkan settings code from experiments_settings_xgl.json"
)

add_custom_target(
RunVKExperimentsGenerator
DEPENDS ${ICD_GEN_SETTINGS_FILES} ${ICD_SETTINGS_DIR}/experiments_settings_xgl.json
COMMENT "Checking if re-generation is required for settings"
)

add_dependencies(xgl RunVKExperimentsGenerator)

target_sources(xgl PRIVATE
settings/g_experiments.cpp
settings/experimentsLoader.cpp
settings/experiments_settings_xgl.json
)

### ICD api/sqtt ##############################################################
target_sources(xgl PRIVATE
api/sqtt/sqtt_layer.cpp
Expand All @@ -311,7 +340,10 @@ target_sources(xgl PRIVATE

### ICD api/devmode ###########################################################
if(ICD_GPUOPEN_DEVMODE_BUILD)
target_sources(xgl PRIVATE api/devmode/devmode_mgr.cpp)
target_sources(xgl PRIVATE
api/devmode/devmode_rgp.cpp
api/devmode/devmode_ubertrace.cpp
)
endif()

### ICD layer ##################################################################
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.279"
"api_version": "1.3.280"
},
"layer": {
"name": "VK_LAYER_AMD_switchable_graphics_@ISABITS@",
"type": "GLOBAL",
"library_path": "@AMDVLK_INSTALL_PATH@/amdvlk@[email protected]",
"api_version": "1.3.279",
"api_version": "1.3.280",
"implementation_version": "1",
"description": "AMD switchable graphics layer",
"functions": {
Expand Down
50 changes: 6 additions & 44 deletions icd/api/app_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#if defined(__unix__)
#include <unistd.h>
#include <fcntl.h>
#include <linux/limits.h>
#endif

Expand Down Expand Up @@ -731,18 +732,6 @@ constexpr AppProfilePatternEntry AppEngineQuanticDream
"quantic dream engine"
};

constexpr AppProfilePatternEntry AppNameEnshrouded =
{
PatternAppNameLower,
"enshrouded"
};

constexpr AppProfilePatternEntry AppEngineHolistic =
{
PatternEngineNameLower,
"holistic"
};

constexpr AppProfilePatternEntry PatternEnd = {};

// This is a table of patterns. The first matching pattern in this table will be returned.
Expand Down Expand Up @@ -1477,23 +1466,6 @@ AppProfilePattern AppPatternTable[] =
}
},

{
AppProfile::Enshrouded,
{
AppNameEnshrouded,
AppEngineHolistic,
PatternEnd
}
},

{
AppProfile::HolisticEngine,
{
AppEngineHolistic,
PatternEnd
}
},

{
AppProfile::Zink,
{
Expand Down Expand Up @@ -1702,24 +1674,14 @@ static char* GetExecutableName(
size_t* pLength,
bool includeExtension) // true if you want the extension on the file name.
{
pid_t pid = getpid();
char* pExecutable = nullptr;
char* pModuleFileName = nullptr;
char path[PATH_MAX] = {0};
char commandStringBuffer[PATH_MAX] = {0};
sprintf(commandStringBuffer, "cat /proc/%d/cmdline", pid);
FILE* pCommand = popen(commandStringBuffer, "r");
if (pCommand != nullptr)
pExecutable = static_cast<char*>(malloc(PATH_MAX));

if (pExecutable != nullptr)
{
if (fgets(path, PATH_MAX, pCommand) != nullptr)
{
pExecutable = static_cast<char*>(malloc(PATH_MAX));
pModuleFileName = strrchr(path, '/') ? strrchr(path, '/') + 1 : path;
pModuleFileName = strrchr(pModuleFileName, '\\') ? strrchr(pModuleFileName, '\\') + 1 : pModuleFileName;
strcpy(pExecutable, pModuleFileName);
*pLength = strlen(pExecutable);
}
pclose(pCommand);
utils::GetExecutableNameAndPath(pExecutable, &path[0]);
*pLength = strlen(pExecutable);
}
return pExecutable;
}
Expand Down
29 changes: 21 additions & 8 deletions icd/api/app_shader_optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,20 @@ void ShaderOptimizer::ApplyProfileToDynamicComputeShaderInfo(
}

// =====================================================================================================================
void ShaderOptimizer::ApplyProfileToDynamicGraphicsShaderInfo(
bool ShaderOptimizer::ApplyProfileToDynamicGraphicsShaderInfo(
const ShaderProfileAction& action,
Pal::DynamicGraphicsShaderInfo* pGraphicsShaderInfo) const
{
bool hasUpdate = false;

if (action.dynamicShaderInfo.apply.maxWavesPerCu)
{
pGraphicsShaderInfo->maxWavesPerCu = static_cast<float>(action.dynamicShaderInfo.maxWavesPerCu);

hasUpdate = true;
}

return hasUpdate;
}

// =====================================================================================================================
Expand Down Expand Up @@ -631,25 +637,32 @@ void ShaderOptimizer::ApplyProfileToGraphicsPipelineCreateInfo(
switch (vkgcStage)
{
case ShaderStage::ShaderStageTask:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ts);
pGraphicsShaderInfos->enable.ts |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ts);
break;
case ShaderStage::ShaderStageVertex:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->vs);
pGraphicsShaderInfos->enable.vs |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->vs);
break;
case ShaderStage::ShaderStageTessControl:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->hs);
pGraphicsShaderInfos->enable.hs |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->hs);
break;
case ShaderStage::ShaderStageTessEval:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ds);
pGraphicsShaderInfos->enable.ds |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ds);
break;
case ShaderStage::ShaderStageGeometry:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->gs);
pGraphicsShaderInfos->enable.gs |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->gs);
break;
case ShaderStage::ShaderStageMesh:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ms);
pGraphicsShaderInfos->enable.ms |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ms);
break;
case ShaderStage::ShaderStageFragment:
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ps);
pGraphicsShaderInfos->enable.ps |=
ApplyProfileToDynamicGraphicsShaderInfo(shaders[vkgcStage], &pGraphicsShaderInfos->ps);
break;
default:
PAL_ASSERT_ALWAYS();
Expand Down
2 changes: 1 addition & 1 deletion icd/api/cmd_buffer_ring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void CmdBufferRing::DestroyCmdBufState(
// Wait to finish in case still in flight
if (pCmdBufState->pFence->GetStatus() == Pal::Result::NotReady)
{
pDevice->PalDevice(deviceIdx)->WaitForFences(1, &pCmdBufState->pFence, true, ~0ULL);
pDevice->PalDevice(deviceIdx)->WaitForFences(1, &pCmdBufState->pFence, true, std::chrono::nanoseconds::max());
}

// Destroy Fence
Expand Down
7 changes: 5 additions & 2 deletions icd/api/compiler_solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void CompilerSolution::StoreShaderBinaryToCache(

if (updateBinaryCache || updateAppCache || (pCacheBinary->pCode == nullptr))
{
if ((pHeader->binaryLength > 0) && (pCacheBinary->codeSize == 0))
if (((pHeader->binaryLength > 0) || (pHeader->requireFullPipeline)) && (pCacheBinary->codeSize == 0))
{
size_t cacheSize = sizeof(ShaderLibraryBlobHeader) + pHeader->binaryLength + pHeader->fragMetaLength;

Expand All @@ -218,7 +218,10 @@ void CompilerSolution::StoreShaderBinaryToCache(
if (pBuffer != nullptr)
{
memcpy(pBuffer, pHeader, sizeof(ShaderLibraryBlobHeader));
memcpy(Util::VoidPtrInc(pBuffer, sizeof(ShaderLibraryBlobHeader)), pBlob, pHeader->binaryLength);
if (pBlob != nullptr)
{
memcpy(Util::VoidPtrInc(pBuffer, sizeof(ShaderLibraryBlobHeader)), pBlob, pHeader->binaryLength);
}
if (pFragmentMeta != nullptr)
{
memcpy(Util::VoidPtrInc(pBuffer, sizeof(ShaderLibraryBlobHeader) + pHeader->binaryLength),
Expand Down
55 changes: 37 additions & 18 deletions icd/api/compiler_solution_llpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,22 @@ VkResult CompilerSolutionLlpc::CreateGraphicsShaderBinary(
}
}

if (hitCache == false)
bool checkShaderModuleIdUsage = false;
if (hitCache)
{
const auto* pShaderLibraryHeader =
reinterpret_cast<const ShaderLibraryBlobHeader*>(shaderLibraryBinary.pCode);
if (pShaderLibraryHeader->requireFullPipeline)
{
checkShaderModuleIdUsage = true;
}
}
else
{
checkShaderModuleIdUsage = true;
}

if (checkShaderModuleIdUsage)
{
for (uint32_t stage = 0; stage < ShaderStage::ShaderStageGfxCount; stage++)
{
Expand Down Expand Up @@ -552,10 +567,14 @@ VkResult CompilerSolutionLlpc::CreateGraphicsShaderBinary(

if (llpcResult == Vkgc::Result::Success)
{
blobHeader.binaryLength = finalBinary.codeSize;
blobHeader.binaryLength = finalBinary.codeSize;
blobHeader.fragMetaLength = pipelineOut.fsOutputMetaDataSize;
}
else if (llpcResult != Vkgc::Result::RequireFullPipeline)
else if (llpcResult == Vkgc::Result::RequireFullPipeline)
{
blobHeader.requireFullPipeline = true;
}
else
{
result = (llpcResult == Vkgc::Result::ErrorOutOfMemory) ? VK_ERROR_OUT_OF_HOST_MEMORY :
VK_ERROR_INITIALIZATION_FAILED;
Expand All @@ -567,18 +586,15 @@ VkResult CompilerSolutionLlpc::CreateGraphicsShaderBinary(
// Always call StoreShaderBinaryToCache to sync data between app cache and binary cache except
// RequireFullPipeline. When cache is hit, blobHeader is zero, StoreShaderBinaryToCache will ignore
// finalBinary, and reuse shaderLibraryBinary.
if ((finalBinary.pCode != nullptr) || (shaderLibraryBinary.pCode != nullptr))
{
StoreShaderBinaryToCache(
pPipelineCache,
&cacheId,
&blobHeader,
finalBinary.pCode,
pipelineOut.fsOutputMetaData,
hitCache,
hitAppCache,
&shaderLibraryBinary);
}
StoreShaderBinaryToCache(
pPipelineCache,
&cacheId,
&blobHeader,
finalBinary.pCode,
pipelineOut.fsOutputMetaData,
hitCache,
hitAppCache,
&shaderLibraryBinary);

pModuleState->elfPackage = shaderLibraryBinary;
pModuleState->pFsOutputMetaData = nullptr;
Expand Down Expand Up @@ -830,7 +846,7 @@ void LlpcHelperThreadProvider::WaitForTasks()
{
while (m_pDeferredWorkload->completedInstances < m_pDeferredWorkload->totalInstances)
{
m_pDeferredWorkload->event.Wait(1.0f);
m_pDeferredWorkload->event.Wait(Util::fseconds { 1.0f });
}
}

Expand Down Expand Up @@ -1229,8 +1245,11 @@ Vkgc::BinaryData CompilerSolutionLlpc::ExtractPalElfBinary(
{
Vkgc::BinaryData elfBinary = {};
const ShaderLibraryBlobHeader* pHeader = reinterpret_cast<const ShaderLibraryBlobHeader*>(shaderBinary.pCode);
elfBinary.pCode = pHeader + 1;
elfBinary.codeSize = pHeader->binaryLength;
if (pHeader->binaryLength > 0)
{
elfBinary.pCode = pHeader + 1;
elfBinary.codeSize = pHeader->binaryLength;
}
return elfBinary;
}

Expand Down
2 changes: 1 addition & 1 deletion icd/api/debug_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ Pal::Result DebugPrintf::PostQueueProcess(
while (true)
{
palResult = pDevice->PalDevice(DefaultDeviceIndex)->WaitForSemaphores(
1, palSemaphores, waitValues, 0, 1000000llu);
1, palSemaphores, waitValues, 0, std::chrono::nanoseconds {1000000llu});

decodeOffset = ProcessDebugPrintfBuffer(pDevice, deviceIdx, decodeOffset, &file);
if ((PalToVkResult(palResult) <= 0) || (loopIndex++ > 1000))
Expand Down
Loading

0 comments on commit f6a447e

Please sign in to comment.