Skip to content

Commit 6aecd3d

Browse files
committed
Update llpc from commit 9046d0be
lgc: Refactor wave size related code lgc: Set insert point in visitStridedIndexAdd [NFC] Rename GS calcFactor to hwConfig [Continuations] Refactor around maximum passed Fix PsExtraLdsSize was not being merged in the new metadata Do some renaming for tessellation terms Add transform shader passes [Continuations] Add check for strided buffer load to improve performance [Continuations] Remove 32-bit GPURT define Add more dialect ops to support NGG lowering [NFC] Rename some passes VK_EXT_shader_replicated_composites - Frontend Shader Compiler Implementation Expanding precision underflow peephole to pow Fix assert crash in dEQP-VK.ycbcr.query.lod.fragment.* Vulkan Shader/Fine MALL Tuning Use zero-sized array for variable length array Hash vertex shader for transform shader [DEBUG] Add InstructionSlot class RT: Ensure payload and hit attribute are scalar-aligned Add option forceMemoryBarrierScope Move the adjustment of Ij to lowerInOut Fix the lit test failures llvmraytracing: Remove unused MaxContStateBytes lgc: zero-sized array follow-up Update PeepholeOptPhiWithIdenticalLoad.lgc Restore ostream format for pipeline dump RT: Fix another likely issue with multithreaded compiles Add support for MbPassManager Make SpirvLowerRayTracing re-usable Add lit tests for subgroup shuffle codegen quality Use readlane for shuffle with constant index llvmraytracing: Add debug print to PipelineState vfx: Fix printf format strings More use of IRBuilder Hit the unused 'gfxIp' local variables [Continuations] Fix up lit tests with jump arguments Hook up AmdExtD3DShaderIntrinsics_Halt Remove the unnecessary internal built-in GsWaveId Only align elf when it is actually an ELF Fix the parser of gfxip Remove m_out Remove uses of getPointerTo Update transGroupArithOp to use Optional ClusterSize [Continuations] Pass 'shader index' as argument Add an extra simplify pass to Gpurt lib passes Set correct syncScope in transScope lgc: Make task payload buffer desc globally coherent lgc: Use BuilderImpl::buildBufferCompactDesc() in LowerBufferOperations Enable LCG test after LLVM update [Continuations] Add 'RayTracingShaderStage' helper Optimize HS output writes for zero/negative outer TFs [VKD3D] Add rtIgnoreDeclaredPayloadSize for Proton RT games [Continuations] Propagate used payload count to intersection shaders Remove 16-bit transform feedback support [Continuations] Remove 'AwaitTraversal' return address WA. lgc: Refine handling of GpurtFloatWithRoundModeOp Update the LLPC_INTERFACE_MINOR_VERSION to 9 Use iterator for insertion position RT: start to use a ModuleBunch representation Test updates for entry_point change Disable fast math for Position only in pre-fragment stage. [Continuations] Cleanup system data / hit attribute arguments [Continuations] Cleanups in LowerRaytracingPipeline llvmraytracing: Some Builder-related cleanups Test updates for entry_point change extra Update tests for new LLVM upstream [Continuations] Update 'lower-traversal.ll' test. [Continuations] Early exit from replaceAllPointerUses and remove unused argument Fix amber tests lgccps: Run InstCombine before CoroSplit Unify the InternalDescriptorSetId with D3D lgc: Create StridedBufferDescToPtrOp for strided normal descriptor lgc: Relax occupancy target for memory bound functions lgc: Add globallyCoherent flag to StridedBufferDescToPtrOp [compilerutils] Remove getWithSamePointeeType [Continuations] Continuation State Builder -- Basic [Continuations] Use generically typed opaque.use in cont-state-builder lit-test
1 parent 5893f70 commit 6aecd3d

File tree

357 files changed

+10388
-16869
lines changed

Some content is hidden

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

357 files changed

+10388
-16869
lines changed

cmake/CompilerFlags.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
##
2+
#######################################################################################################################
3+
#
4+
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to
8+
# deal in the Software without restriction, including without limitation the
9+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+
# sell copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22+
# IN THE SOFTWARE.
23+
#
24+
#######################################################################################################################
25+
126
function(set_compiler_options PROJECT_NAME ENABLE_WERROR)
227
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
328
set_target_properties(${PROJECT_NAME} PROPERTIES

cmake/findllvm.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ if (NOT LLPC_LLVM_SRC_PATH)
2727
# Find LLVM source. Allow client driver to override using its own name for overlay builds.
2828
set(DEFAULT_LLPC_LLVM_SRC_PATH ${XGL_LLVM_SRC_PATH})
2929
if (NOT DEFAULT_LLPC_LLVM_SRC_PATH)
30-
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../../imported/llvm-project/llvm)
31-
set(DEFAULT_LLPC_LLVM_SRC_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../imported/llvm-project/llvm)
30+
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../imported/llvm-project/llvm)
31+
set(DEFAULT_LLPC_LLVM_SRC_PATH ${CMAKE_CURRENT_LIST_DIR}/../imported/llvm-project/llvm)
3232
elseif(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../llvm-project/llvm)
3333
set(DEFAULT_LLPC_LLVM_SRC_PATH ${CMAKE_CURRENT_LIST_DIR}/../../llvm-project/llvm)
3434
endif()
3535
endif()
36-
set(LLPC_LLVM_SRC_PATH ${DEFAULT_LLPC_LLVM_SRC_PATH} CACHE PATH "Specify the path to LLVM.")
36+
set(LLPC_LLVM_SRC_PATH ${DEFAULT_LLPC_LLVM_SRC_PATH} CACHE PATH "Specify the path to LLVM." FORCE)
3737
endif()

cmake/llvm.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ if(CMAKE_BUILD_TYPE_DEBUG)
5656
# See: llvm-project/llvm/cmake/modules/CrossCompile.cmake
5757
set(CROSS_TOOLCHAIN_FLAGS_NATIVE "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" CACHE STRING
5858
"Toolchain flags for native build" FORCE)
59+
60+
# Fail early to avoid the dreaded -ologo error.
61+
if(CMAKE_VERSION VERSION_LESS "3.27")
62+
message(FATAL_ERROR "Using LLVM_OPTIMIZED_TABLEGEN in a Debug build requires CMake 3.27 or higher."
63+
" The current CMake version is ${CMAKE_VERSION}.")
64+
endif()
5965
endif()
6066
#endif
6167
endif()

compilerutils/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
##
2+
#######################################################################################################################
3+
#
4+
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to
8+
# deal in the Software without restriction, including without limitation the
9+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+
# sell copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22+
# IN THE SOFTWARE.
23+
#
24+
#######################################################################################################################
25+
126
cmake_minimum_required(VERSION 3.13.4)
227

328
project(CompilerUtils LANGUAGES CXX)

compilerutils/include/compilerutils/CompilerUtils.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class CrossModuleInliner {
156156
// Writes instructions which are redundant after the replacement into
157157
// the given ToBeRemoved vector.
158158
// The caller has to handle the erasure afterwards.
159-
void replaceAllPointerUses(llvm::IRBuilder<> *builder, llvm::Value *oldPointerValue, llvm::Value *newPointerValue,
159+
void replaceAllPointerUses(llvm::Value *oldPointerValue, llvm::Value *newPointerValue,
160160
llvm::SmallVectorImpl<llvm::Instruction *> &toBeRemoved);
161161

162162
// Create a GEP if idx is non-null, otherwise return the pointer.
@@ -169,13 +169,6 @@ llvm::Value *simplifyingCreateConstInBoundsGEP1_32(llvm::IRBuilder<> &builder, l
169169

170170
namespace llvm {
171171

172-
// Replacement for PointerType::getWithSamePointeeType that works with new LLVM.
173-
// Returns a typed pointer type if the pointer type is typed.
174-
//
175-
// TODO: Remove this as soon as all internal users of opaque pointers have been
176-
// fixed.
177-
PointerType *getWithSamePointeeType(PointerType *ptrTy, unsigned addressSpace);
178-
179172
/// Free-standing helpers.
180173

181174
// Helper to visit all calls of a function.

compilerutils/include/compilerutils/ModuleBunch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class ModuleBunchToModulePassAdaptor : public PassInfoMixin<ModuleBunchToModuleP
144144

145145
/// Construct with a function that returns a pass. It can then parallelize compilation by calling
146146
/// the function once for each parallel thread.
147-
explicit ModuleBunchToModulePassAdaptor(function_ref<std::unique_ptr<PassConceptT>()> PassMaker,
147+
explicit ModuleBunchToModulePassAdaptor(std::function<std::unique_ptr<PassConceptT>()> PassMaker,
148148
bool EagerlyInvalidate = false)
149149
: PassMaker(PassMaker), EagerlyInvalidate(EagerlyInvalidate) {}
150150

@@ -160,7 +160,7 @@ class ModuleBunchToModulePassAdaptor : public PassInfoMixin<ModuleBunchToModuleP
160160

161161
private:
162162
std::unique_ptr<PassConceptT> Pass;
163-
function_ref<std::unique_ptr<PassConceptT>()> PassMaker;
163+
std::function<std::unique_ptr<PassConceptT>()> PassMaker;
164164
bool EagerlyInvalidate;
165165
};
166166

compilerutils/lib/CompilerUtils.cpp

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Value *CrossModuleInliner::CrossModuleValueMaterializer::materialize(Value *v) {
276276
auto InsertToMappedTypes = [&mappedTypes](Type *sourceType, Type *copiedType) {
277277
assert((sourceType != nullptr) && (copiedType != nullptr));
278278
if (sourceType != copiedType) {
279-
auto found = mappedTypes.insert(std::make_pair(sourceType, copiedType));
279+
[[maybe_unused]] auto found = mappedTypes.insert(std::make_pair(sourceType, copiedType));
280280
assert((found.second || copiedType == found.first->second) && "Inconsistent type mapping");
281281
}
282282
};
@@ -527,18 +527,14 @@ std::string CrossModuleInliner::getCrossModuleName(GlobalValue &gv) {
527527
return (Twine(gv.getName()) + ".cloned." + gv.getParent()->getName()).str();
528528
}
529529

530-
PointerType *llvm::getWithSamePointeeType(PointerType *ptrTy, unsigned addressSpace) {
531-
return PointerType::get(ptrTy->getContext(), addressSpace);
532-
}
533-
534530
void CrossModuleInliner::checkTargetModule(llvm::Module &targetModule) {
535531
if (impl->targetMod == nullptr)
536532
impl->targetMod = &targetModule;
537533
else
538534
assert(impl->targetMod == &targetModule);
539535
}
540536

541-
void CompilerUtils::replaceAllPointerUses(IRBuilder<> *builder, Value *oldPointerValue, Value *newPointerValue,
537+
void CompilerUtils::replaceAllPointerUses(Value *oldPointerValue, Value *newPointerValue,
542538
SmallVectorImpl<Instruction *> &toBeRemoved) {
543539
// Note: The implementation explicitly supports typed pointers, which
544540
// complicates some of the code below.
@@ -548,23 +544,20 @@ void CompilerUtils::replaceAllPointerUses(IRBuilder<> *builder, Value *oldPointe
548544
(void)oldPtrTy;
549545
PointerType *newPtrTy = cast<PointerType>(newPointerValue->getType());
550546
unsigned newAS = newPtrTy->getAddressSpace();
551-
assert(newAS != oldPtrTy->getAddressSpace());
552-
assert(getWithSamePointeeType(oldPtrTy, newAS) == newPtrTy);
547+
548+
// If a change of address space is not necessary then simply replace uses.
549+
if (newAS == oldPtrTy->getAddressSpace()) {
550+
oldPointerValue->replaceAllUsesWith(newPointerValue);
551+
return;
552+
}
553+
554+
// Propagate a change of address space by traversing through the users and setup the addrspace.
553555

554556
oldPointerValue->mutateType(newPtrTy);
555557

556-
// Traverse through the users and setup the addrspace
557558
SmallVector<Use *> worklist(make_pointer_range(oldPointerValue->uses()));
558559
oldPointerValue->replaceAllUsesWith(newPointerValue);
559560

560-
// Given a pointer type, get a pointer with the same pointee type (possibly
561-
// opaque) as the given type that uses the newAS address space.
562-
auto getMutatedPtrTy = [newAS](Type *ty) {
563-
PointerType *ptrTy = cast<PointerType>(ty);
564-
// Support typed pointers:
565-
return getWithSamePointeeType(ptrTy, newAS);
566-
};
567-
568561
#ifndef NDEBUG
569562
DenseSet<Value *> PhiElems;
570563
#endif
@@ -620,29 +613,29 @@ void CompilerUtils::replaceAllPointerUses(IRBuilder<> *builder, Value *oldPointe
620613
// This can happen with typed pointers
621614
assert(cast<BitCastOperator>(inst)->getSrcTy()->isPointerTy() &&
622615
cast<BitCastOperator>(inst)->getDestTy()->isPointerTy());
623-
inst->mutateType(getMutatedPtrTy(inst->getType()));
616+
inst->mutateType(newPtrTy);
624617
break;
625618
}
626619
case Instruction::AddrSpaceCast:
627620
// Check that the pointer operand has already been fixed
628621
assert(inst->getOperand(0)->getType()->getPointerAddressSpace() == newAS);
629622
// Push the correct users before RAUW.
630623
worklist.append(usesRange.begin(), usesRange.end());
631-
inst->mutateType(getMutatedPtrTy(inst->getType()));
624+
inst->mutateType(newPtrTy);
632625
// Since we are mutating the address spaces of users as well,
633626
// we can just use the (already mutated) cast operand.
634627
inst->replaceAllUsesWith(inst->getOperand(0));
635628
toBeRemoved.push_back(inst);
636629
continue;
637630
case Instruction::IntToPtr:
638631
case Instruction::GetElementPtr: {
639-
inst->mutateType(getMutatedPtrTy(inst->getType()));
632+
inst->mutateType(newPtrTy);
640633
break;
641634
}
642635
case Instruction::Select: {
643636
auto *oldType = inst->getType();
644637
if (oldType->isPointerTy()) {
645-
Type *newType = getMutatedPtrTy(oldType);
638+
Type *newType = newPtrTy;
646639
// No further processing if the type has the correct pointer type
647640
if (newType == oldType)
648641
continue;
@@ -666,7 +659,7 @@ void CompilerUtils::replaceAllPointerUses(IRBuilder<> *builder, Value *oldPointe
666659
}
667660
#endif
668661

669-
Type *newType = getMutatedPtrTy(oldType);
662+
Type *newType = newPtrTy;
670663
// No further processing if the type has the correct pointer type
671664
if (newType == oldType)
672665
continue;

compilerutils/plugin/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
##
2+
#######################################################################################################################
3+
#
4+
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to
8+
# deal in the Software without restriction, including without limitation the
9+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+
# sell copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22+
# IN THE SOFTWARE.
23+
#
24+
#######################################################################################################################
25+
126
set(LLVM_COMPILERUTILSPLUGIN_LINK_INTO_TOOLS ON CACHE BOOL "Link plugin into tools" FORCE)
227

328
add_llvm_pass_plugin(CompilerUtilsPlugin

compilerutils/test/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
##
2+
#######################################################################################################################
3+
#
4+
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to
8+
# deal in the Software without restriction, including without limitation the
9+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+
# sell copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22+
# IN THE SOFTWARE.
23+
#
24+
#######################################################################################################################
25+
126
set(COMPILERUTILS_TEST_DEPENDS cross-module-inline FileCheck count not opt)
227
add_custom_target(compilerutils-test-depends DEPENDS ${COMPILERUTILS_TEST_DEPENDS})
328
set_target_properties(compilerutils-test-depends PROPERTIES FOLDER "Tests")

0 commit comments

Comments
 (0)