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

Commit 6222f1f

Browse files
committed
Update llpc from commit 1acb5e9b
[Continuations] Share WaitMask handling code lgc: Refine wmma/swmma intrinsic selection via a map Fix for upstream move to CmpPredicate [llvmraytracing] Replace `Data.Kind` checks with helper [Continuations] Move/combinie rematerialization utils into RematSupport lgc: Allow globallyCoherent flag to be set for InlineBuffer Do not query entry point for GPURT library [llvmraytracing] Add lgc.cps.jump.uniform dialect op lgc: Set correct lds size in InitializeWorkgroupMemory pass lgc: Support per draw vertex input rate Fix fast math flag for modfStruct Rename folder patch to lowering lgc: Replace InstCombine with Scalarizer in continuation transform Some renaming in passes Fix spir-v validation always passes Update RayTrace test pipeline to remove spv lgc: use reconfigWorkgroupLayout without foldXY [Continuations] Promote pointer argument for Traversal Fix LLVM_OPTIMIZED_TABLEGEN Add support for WaveMultiPrefixBitOr [llvmraytracing] Use return value of 'earlyGpurtTransform' [llvmraytracing] Make lgc.cps the default mode and remove non-lgc.cps mode [Continuations] Use size_t for enumerate::index instead of long int [Continuations] Use anonymous namespace instead of static Cleanup specialize uniform implementation lgc: Fix logic error in reconfigWorkgroupLayout [llvmraytracing] Remove remaining references to lgc.cps mode [Continuations] Check for valid continuation state layout [llvmraytracing] Handle _AmdVgprArguments struct from the scheduler function. Fix assertions in vkgcUtil that could never be triggered
1 parent 6aecd3d commit 6222f1f

File tree

733 files changed

+2913
-2265
lines changed

Some content is hidden

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

733 files changed

+2913
-2265
lines changed

CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
#######################################################################################################################
33
#
4-
# Copyright (c) 2017-2024 Advanced Micro Devices, Inc. All Rights Reserved.
4+
# Copyright (c) 2017-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
@@ -33,12 +33,9 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
3333
set(LLPC_IS_STANDALONE ON)
3434
endif()
3535

36-
### Find LLVM (needed by llpc_version.cmake).
37-
include("cmake/findllvm.cmake")
38-
39-
### Version info ###
36+
### Version info #######################################################################################################
37+
# Also runs findllvm.cmake.
4038
include(cmake/llpc_version.cmake)
41-
4239
add_llpc_version_projects()
4340

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

cmake/llpc_version.cmake

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
#######################################################################################################################
33
#
4-
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All Rights Reserved.
4+
# Copyright (c) 2023-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
@@ -25,12 +25,59 @@
2525

2626
set(LLPC_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
2727

28-
include("${LLPC_SOURCE_DIR}/cmake/findllvm.cmake")
28+
# Function to set variable named ${varName} to the first of:
29+
#
30+
# - the value it already has (which might be set by driver or developer);
31+
# - the value of the variable whose name has PAL_ instead of LLPC_ (which might be set by driver or developer);
32+
# - the given default.
33+
#
34+
# Then, if the value is true, the function adds it to the target_compile_definitions of ${target} at
35+
# scope ${scope}, and appends the setting to LLPC_SET_PROPERTY_SUMMARY_${target} for the caller to report the
36+
# summary.
37+
#
38+
# This function is defined here so that multiple components in the LLPC repo, starting with llvm_version,
39+
# can use it.
40+
#
41+
function(llpc_set_property target scope varName default propertyName)
42+
if (NOT DEFINED ${varName})
43+
string(REGEX REPLACE "^[A-Z][A-Z]*_(.*)$" "PAL_\\1" palVarName "${varName}")
44+
if (DEFINED ${palVarName})
45+
set(${varName} ${${palVarName}})
46+
else()
47+
set(${varName} ${default})
48+
endif()
49+
# For an LLPC_ variable, cache it as an option so that GPURT can see it.
50+
if ("${varName}" MATCHES "^LLPC_")
51+
option(${varName} "Support ${varName}?" ${${varName}})
52+
endif()
53+
set(${varName} ${${varName}} PARENT_SCOPE)
54+
endif()
55+
if (${${varName}})
56+
target_compile_definitions(${target} ${scope} ${varName}=1)
57+
set(LLPC_SET_PROPERTY_SUMMARY_${target}
58+
"${LLPC_SET_PROPERTY_SUMMARY_${target}} ${varName}=${${varName}}" PARENT_SCOPE)
59+
endif()
60+
endfunction()
61+
62+
if (FALSE
63+
OR ICD_BUILD_LLPC
64+
)
2965

30-
macro(add_llpc_version_projects)
31-
if (NOT TARGET llpc_version)
32-
# Force the binary directory to account for the possibility that LLPC is
33-
# taken from an external source directory.
34-
add_subdirectory(${LLPC_SOURCE_DIR}/version ${CMAKE_CURRENT_BINARY_DIR}/llpc_version)
66+
# Find LLVM source.
67+
if (NOT DISABLE_LLPC_VERSION_USES_LLVM)
68+
include("${LLPC_SOURCE_DIR}/cmake/findllvm.cmake")
3569
endif()
36-
endmacro()
70+
71+
# Macro for caller to call the llpc_version CMakeLists.txt and add its target.
72+
macro(add_llpc_version_projects)
73+
if (NOT TARGET llpc_version)
74+
# Force the binary directory to account for the possibility that LLPC is
75+
# taken from an external source directory.
76+
add_subdirectory(${LLPC_SOURCE_DIR}/version ${CMAKE_CURRENT_BINARY_DIR}/llpc_version)
77+
endif()
78+
endmacro()
79+
80+
else()
81+
macro(add_llpc_version_projects)
82+
endmacro()
83+
endif()

cmake/llvm.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
#######################################################################################################################
33
#
4-
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
4+
# Copyright (c) 2024-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
@@ -45,7 +45,7 @@ set(LLVM_INCLUDE_UTILS ON CACHE BOOL "LLVM include utils")
4545
set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "LLVM enable terminfo")
4646
set(LLVM_RAM_PER_TABLEGEN_JOB 4000 CACHE STRING "LLVM RAM per tablegen job")
4747
set(LLVM_RAM_PER_LINK_JOB 5000 CACHE STRING "LLVM RAM per link job")
48-
if(CMAKE_BUILD_TYPE_DEBUG)
48+
if("${CMAKE_BUILD_TYPE}" STREQUAL Debug)
4949
# Build optimized version of llvm-tblgen even in debug builds, for faster build times.
5050
set(LLVM_OPTIMIZED_TABLEGEN ON CACHE BOOL "Build optimized llvm-tblgen")
5151
#if _WIN32

docs/DdnRelocatableShaderElf.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ and the `.vertexInputs` metadata to load all of the vertex input attributes into
110110
registers. See the `FetchShader` class in
111111
[GlueShader.cpp](../lgc/elfLinker/GlueShader.cpp) for the generation of the
112112
prologue. To see how the unlinked shader handles vertex inputs see the
113-
`LowerVertexFetch` pass in [VertexFetch.cpp](../lgc/patch/VertexFetch.cpp).
113+
`LowerVertexFetch` pass in [VertexFetch.cpp](../lgc/lowering/VertexFetch.cpp).
114114

115115
A fragment shader will require a epilogue to export its outputs. The unlinked
116116
fragment shader will have the standard name for the fragment shader. Instead of
@@ -122,7 +122,7 @@ appended to the end of the unlinked shader. See the `ColorExportShader` class in
122122
[GlueShader.cpp](../lgc/elfLinker/GlueShader.cpp) for the generation of the
123123
epilogue. To see how the unlinked shader handles color export see the
124124
`LowerFragmentColorExport` pass in
125-
[FragmentColorExport.cpp](../lgc/patch/FragmentColorExport.cpp).
125+
[FragmentColorExport.cpp](../lgc/lowering/FragmentColorExport.cpp).
126126

127127
These epilogues and prologues mean that unlinked shaders do not have to depend
128128
on the format of the vertex input attributes and color exports.

include/vkgcDefs.h

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
***********************************************************************************************************************
33
*
4-
* Copyright (c) 2020-2024 Advanced Micro Devices, Inc. All Rights Reserved.
4+
* Copyright (c) 2020-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
@@ -233,6 +233,9 @@ enum InternalBinding : unsigned {
233233
SpecConstInternalBufferBindingIdEnd = SpecConstInternalBufferBindingId + ShaderStageCount,
234234
ConstantBuffer0Binding = 24, ///< Binding ID of default uniform block
235235
ConstantBuffer0BindingEnd = ConstantBuffer0Binding + ShaderStageGfxCount,
236+
DescHeapBufferBindingId = 32, ///< Binding ID of internal buffer for buffer descriptor heap.
237+
DescHeapImageBindingId = 33, ///< Binding ID of internal buffer for image descriptor heap.
238+
DescHeapSamplerBindingId = 34, ///< Binding ID of internal buffer for sampler descriptor heap.
236239
};
237240

238241
/// Internal vertex attribute location start from 0.
@@ -494,26 +497,7 @@ struct PipelineOptions {
494497
bool internalRtShaders; ///< Whether this pipeline has internal raytracing shaders
495498
unsigned forceNonUniformResourceIndexStageMask; ///< Mask of the stage to force using non-uniform resource index.
496499
bool reserved16;
497-
#if LLPC_CLIENT_INTERFACE_MAJOR_VERSION < 73
498-
bool replaceSetWithResourceType; ///< For OGL only, replace 'set' with resource type during spirv translate
499-
bool disableSampleMask; ///< For OGL only, disabled if framebuffer doesn't attach multisample texture
500-
bool buildResourcesDataForShaderModule; ///< For OGL only, build resources usage data while building shader module
501-
bool disableTruncCoordForGather; ///< If set, trunc_coord of sampler srd is disabled for gather4
502-
bool enableCombinedTexture; ///< For OGL only, use the 'set' for DescriptorCombinedTexture
503-
///< for sampled images and samplers
504-
bool vertex64BitsAttribSingleLoc; ///< For OGL only, dvec3/dvec4 vertex attrib only consumes 1 location.
505-
bool enableFragColor; ///< For OGL only, need to do frag color broadcast if it is enabled.
506-
bool disableBaseVertex; ///< For OGL only, force the BaseVertex builtin to 0 instead of
507-
/// loading it from userdata
508-
bool bindlessTextureMode; ///< For OGL only, true if bindless textures are used
509-
bool bindlessImageMode; ///< For OGL only, true if bindless images are used
510-
bool enablePolygonStipple; ///< For OGL only, enable polygon stipple pattern.
511-
bool enableLineSmooth; ///< For OGL only, enable line smooth mode.
512-
bool emulateWideLineStipple; ///< For OGL only, enable line AA stipple.
513-
bool enablePointSmooth; ///< For OGL only, enable point smooth mode.
514-
bool enableRemapLocation; ///< For OGL only, enables location remapping.
515-
const auto &getGlState() const { return *this; }
516-
#else
500+
517501
struct GLState {
518502
bool replaceSetWithResourceType; ///< For OGL only, replace 'set' with resource type during spirv translate
519503
bool disableSampleMask; ///< For OGL only, disabled if framebuffer doesn't attach multisample texture
@@ -533,7 +517,7 @@ struct PipelineOptions {
533517
bool enableRemapLocation; ///< For OGL only, enables location remapping.
534518
} glState;
535519
const auto &getGlState() const { return glState; }
536-
#endif
520+
537521
unsigned reserved20;
538522
bool enablePrimGeneratedQuery; ///< If set, primitive generated query is enabled
539523
bool disablePerCompFetch; ///< Disable per component fetch in uber fetch shader.
@@ -1386,15 +1370,7 @@ struct GraphicsPipelineBuildInfo {
13861370
BinaryData shaderLibrary; ///< SPIR-V library binary data
13871371
#endif
13881372
RtState rtState; ///< Ray tracing state
1389-
#if LLPC_CLIENT_INTERFACE_MAJOR_VERSION < 71
1390-
bool originUpperLeft; ///< Whether origin coordinate of framebuffer is upper-left.
1391-
unsigned numUniformConstantMaps; ///< Number of uniform constant maps
1392-
UniformConstantMap **ppUniformMaps; ///< Pointers to array of pointers for the uniform constant map.
1393-
ApiXfbOutData apiXfbOutData; ///< Transform feedback data specified by API interface.
1394-
bool vbAddressLowBitsKnown; ///< Whether vbAddressLowBits is valid
1395-
uint8_t vbAddressLowBits[MaxVertexBindings]; ///< Lowest two bits of vertex buffer addresses
1396-
const auto &getGlState() const { return *this; }
1397-
#else
1373+
13981374
struct {
13991375
bool originUpperLeft; ///< Whether origin coordinate of framebuffer is upper-left.
14001376
bool vbAddressLowBitsKnown; ///< Whether vbAddressLowBits is valid
@@ -1417,7 +1393,7 @@ struct GraphicsPipelineBuildInfo {
14171393
AlphaTestFunc alphaTestFunc; ///< AlphaTestFunc type
14181394
} glState;
14191395
const auto &getGlState() const { return glState; }
1420-
#endif
1396+
14211397
const void *pClientMetadata; ///< Pointer to (optional) client-defined data to be stored inside the ELF
14221398
size_t clientMetadataSize; ///< Size (in bytes) of the client-defined data
14231399
AdvancedBlendInfo advancedBlendInfo; ///< The info of advanced blend

lgc/CMakeLists.txt

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##
22
#######################################################################################################################
33
#
4-
# Copyright (c) 2020-2024 Advanced Micro Devices, Inc. All Rights Reserved.
4+
# Copyright (c) 2020-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
@@ -156,90 +156,90 @@ target_sources(LLVMlgc PRIVATE
156156
elfLinker/NullFragmentShader.h
157157
)
158158

159-
# lgc/patch
159+
# lgc/lowering
160160
target_sources(LLVMlgc PRIVATE
161-
patch/ConfigBuilderBase.cpp
162-
patch/Continufy.cpp
163-
patch/FragmentColorExport.cpp
164-
patch/LowerDebugPrintf.cpp
165-
patch/LowerDesc.cpp
166-
patch/LowerPopsInterlock.cpp
167-
patch/LowerSubgroupOps.cpp
168-
patch/MeshTaskShader.cpp
169-
patch/NggPrimShader.cpp
170-
patch/LgcLowering.cpp
171-
patch/StructurizeBuffers.cpp
172-
patch/LowerBufferOperations.cpp
173-
patch/CheckShaderCache.cpp
174-
patch/GenerateCopyShader.cpp
175-
patch/MutateEntryPoint.cpp
176-
patch/LowerImageDerivatives.cpp
177-
patch/LowerInOut.cpp
178-
patch/LowerInvariantLoads.cpp
179-
patch/IncludeLlvmIr.cpp
180-
patch/InitializeWorkgroupMemory.cpp
181-
patch/ScalarizeLoads.cpp
182-
patch/LowerMulDx9Zero.cpp
183-
patch/AddLoopMetadata.cpp
184-
patch/GenerateNullFragmentShader.cpp
185-
patch/PeepholeOptimization.cpp
186-
patch/PreparePipelineAbi.cpp
187-
patch/LowerReadFirstLane.cpp
188-
patch/CollectResourceUsage.cpp
189-
patch/SetupTargetFeatures.cpp
190-
patch/PassthroughHullShader.cpp
191-
patch/ApplyWorkarounds.cpp
192-
patch/ShaderInputs.cpp
193-
patch/ShaderMerger.cpp
194-
patch/SystemValues.cpp
195-
patch/VertexFetch.cpp
196-
patch/CollectImageOperations.cpp
197-
patch/RegisterMetadataBuilder.cpp
161+
lowering/ConfigBuilderBase.cpp
162+
lowering/Continufy.cpp
163+
lowering/FragmentColorExport.cpp
164+
lowering/LowerDebugPrintf.cpp
165+
lowering/LowerDesc.cpp
166+
lowering/LowerPopsInterlock.cpp
167+
lowering/LowerSubgroupOps.cpp
168+
lowering/MeshTaskShader.cpp
169+
lowering/NggPrimShader.cpp
170+
lowering/LgcLowering.cpp
171+
lowering/StructurizeBuffers.cpp
172+
lowering/LowerBufferOperations.cpp
173+
lowering/CheckShaderCache.cpp
174+
lowering/GenerateCopyShader.cpp
175+
lowering/MutateEntryPoint.cpp
176+
lowering/LowerImageDerivatives.cpp
177+
lowering/LowerInOut.cpp
178+
lowering/LowerInvariantLoads.cpp
179+
lowering/IncludeLlvmIr.cpp
180+
lowering/InitializeWorkgroupMemory.cpp
181+
lowering/ScalarizeLoads.cpp
182+
lowering/LowerMulDx9Zero.cpp
183+
lowering/AddLoopMetadata.cpp
184+
lowering/GenerateNullFragmentShader.cpp
185+
lowering/PeepholeOptimization.cpp
186+
lowering/PreparePipelineAbi.cpp
187+
lowering/LowerReadFirstLane.cpp
188+
lowering/CollectResourceUsage.cpp
189+
lowering/SetupTargetFeatures.cpp
190+
lowering/PassthroughHullShader.cpp
191+
lowering/ApplyWorkarounds.cpp
192+
lowering/ShaderInputs.cpp
193+
lowering/ShaderMerger.cpp
194+
lowering/SystemValues.cpp
195+
lowering/VertexFetch.cpp
196+
lowering/CollectImageOperations.cpp
197+
lowering/RegisterMetadataBuilder.cpp
198198
#if LLPC_BUILD_STRIX1
199-
patch/WorkaroundDsSubdwordWrite.cpp
199+
lowering/WorkaroundDsSubdwordWrite.cpp
200200
#endif
201-
patch/CombineCooperativeMatrix.cpp
202-
patch/LowerCooperativeMatrix.cpp
203-
patch/LowerGpuRt.cpp
204-
patch/LowerRayQueryWrapper.cpp
201+
lowering/CombineCooperativeMatrix.cpp
202+
lowering/LowerCooperativeMatrix.cpp
203+
lowering/LowerGpuRt.cpp
204+
lowering/LowerRayQueryWrapper.cpp
205205
)
206206

207-
# include/lgc/patch
207+
# include/lgc/lowering
208208
target_sources(LLVMlgc PRIVATE
209-
include/lgc/patch/AddLoopMetadata.h
210-
include/lgc/patch/ApplyWorkarounds.h
211-
include/lgc/patch/CheckShaderCache.h
212-
include/lgc/patch/CollectImageOperations.h
213-
include/lgc/patch/CollectResourceUsage.h
214-
include/lgc/patch/CombineCooperativeMatrix.h
215-
include/lgc/patch/Continufy.h
216-
include/lgc/patch/FragmentColorExport.h
217-
include/lgc/patch/GenerateCopyShader.h
218-
include/lgc/patch/IncludeLlvmIr.h
219-
include/lgc/patch/InitializeWorkgroupMemory.h
220-
include/lgc/patch/LgcLowering.h
221-
include/lgc/patch/LowerBufferOperations.h
222-
include/lgc/patch/LowerCooperativeMatrix.h
223-
include/lgc/patch/LowerDebugPrintf.h
224-
include/lgc/patch/LowerDesc.h
225-
include/lgc/patch/LowerGpuRt.h
226-
include/lgc/patch/LowerImageDerivatives.h
227-
include/lgc/patch/LowerInOut.h
228-
include/lgc/patch/LowerInvariantLoads.h
229-
include/lgc/patch/LowerMulDx9Zero.h
230-
include/lgc/patch/LowerReadFirstLane.h
231-
include/lgc/patch/LowerSubgroupOps.h
232-
include/lgc/patch/MutateEntryPoint.h
233-
include/lgc/patch/PassthroughHullShader.h
234-
include/lgc/patch/PeepholeOptimization.h
235-
include/lgc/patch/PreparePipelineAbi.h
236-
include/lgc/patch/ScalarizeLoads.h
237-
include/lgc/patch/SetupTargetFeatures.h
238-
include/lgc/patch/ShaderInputs.h
239-
include/lgc/patch/StructurizeBuffers.h
240-
include/lgc/patch/SystemValues.h
241-
include/lgc/patch/VertexFetch.h
242-
include/lgc/patch/WorkaroundDsSubdwordWrite.h
209+
include/lgc/lowering/AddLoopMetadata.h
210+
include/lgc/lowering/ApplyWorkarounds.h
211+
include/lgc/lowering/CheckShaderCache.h
212+
include/lgc/lowering/CollectImageOperations.h
213+
include/lgc/lowering/CollectResourceUsage.h
214+
include/lgc/lowering/CombineCooperativeMatrix.h
215+
include/lgc/lowering/Continufy.h
216+
include/lgc/lowering/FragmentColorExport.h
217+
include/lgc/lowering/GenerateCopyShader.h
218+
include/lgc/lowering/IncludeLlvmIr.h
219+
include/lgc/lowering/InitializeWorkgroupMemory.h
220+
include/lgc/lowering/LgcLowering.h
221+
include/lgc/lowering/LowerBufferOperations.h
222+
include/lgc/lowering/LowerCooperativeMatrix.h
223+
include/lgc/lowering/LowerDebugPrintf.h
224+
include/lgc/lowering/LowerDesc.h
225+
include/lgc/lowering/LowerGpuRt.h
226+
include/lgc/lowering/LowerImageDerivatives.h
227+
include/lgc/lowering/LowerInOut.h
228+
include/lgc/lowering/LowerInvariantLoads.h
229+
include/lgc/lowering/LowerMulDx9Zero.h
230+
include/lgc/lowering/LowerReadFirstLane.h
231+
include/lgc/lowering/LowerSubgroupOps.h
232+
include/lgc/lowering/MutateEntryPoint.h
233+
include/lgc/lowering/PassthroughHullShader.h
234+
include/lgc/lowering/PeepholeOptimization.h
235+
include/lgc/lowering/PreparePipelineAbi.h
236+
include/lgc/lowering/ScalarizeLoads.h
237+
include/lgc/lowering/SetupTargetFeatures.h
238+
include/lgc/lowering/ShaderInputs.h
239+
include/lgc/lowering/StructurizeBuffers.h
240+
include/lgc/lowering/SystemValues.h
241+
include/lgc/lowering/VertexFetch.h
242+
include/lgc/lowering/WorkaroundDsSubdwordWrite.h
243243
)
244244

245245
# lgc/state

0 commit comments

Comments
 (0)