Skip to content

Commit

Permalink
lgc: make shader arguments noundef
Browse files Browse the repository at this point in the history
Userdata and special builtin values that are setup by the hardware enter
the shader as well-defined values, at least as far as LLVM IR semantics
are concerned: they are neither poison nor are they undef-like.

Marking the corresponding function arguments with the `noundef`
attribute should occasionally help us cleanup `freeze` instructions a
bit better.

Also, remove some redundant code for attribute-twiddling.
  • Loading branch information
nhaehnle committed Oct 7, 2023
1 parent 7f3d2c7 commit 0d1d8d8
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 48 deletions.
8 changes: 6 additions & 2 deletions lgc/elfLinker/FetchShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,12 @@ Function *FetchShader::createFetchFunc() {
// Create the function. Mark SGPR inputs as "inreg".
Function *func = Function::Create(funcTy, GlobalValue::ExternalLinkage, getGlueShaderName(), module);
func->setCallingConv(m_vsEntryRegInfo.callingConv);
for (unsigned i = 0; i != m_vsEntryRegInfo.sgprCount; ++i)
func->getArg(i)->addAttr(Attribute::InReg);
for (unsigned i = 0; i != m_vsEntryRegInfo.sgprCount + m_vsEntryRegInfo.vgprCount; ++i) {
Argument *arg = func->getArg(i);
if (i < m_vsEntryRegInfo.sgprCount)
arg->addAttr(Attribute::InReg);
arg->addAttr(Attribute::NoUndef);
}

// Add mnemonic names to input args.
if (m_vsEntryRegInfo.callingConv == CallingConv::AMDGPU_HS)
Expand Down
7 changes: 6 additions & 1 deletion lgc/include/lgc/state/ShaderStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ bool isShaderEntryPoint(const llvm::Function *func);
// Gets name string of the abbreviation for the specified shader stage
const char *getShaderStageAbbreviation(ShaderStage shaderStage);

enum AddFunctionArgsFlag : unsigned {
AddFunctionArgsAppend = 0x1,
AddFunctionArgsMaybeUndef = 0x2,
};

// Add args to a function. This creates a new function with the added args, then moves everything from the old function
// across to it.
// If this changes the return type, then all the return instructions will be invalid.
Expand All @@ -89,7 +94,7 @@ const char *getShaderStageAbbreviation(ShaderStage shaderStage);
// @param append : Append new arguments if true, prepend new arguments if false
// @returns : The new function
llvm::Function *addFunctionArgs(llvm::Function *oldFunc, llvm::Type *retTy, llvm::ArrayRef<llvm::Type *> argTys,
llvm::ArrayRef<std::string> argNames, uint64_t inRegMask = 0, bool append = false);
llvm::ArrayRef<std::string> argNames, uint64_t inRegMask = 0, unsigned flags = 0);

// Get the ABI-mandated entry-point name for a shader stage
//
Expand Down
4 changes: 2 additions & 2 deletions lgc/patch/MeshTaskShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ Function *MeshTaskShader::mutateMeshShaderEntryPoint(Function *entryPoint) {

entryPoint = newEntryPoint;
newEntryPoint = addFunctionArgs(entryPoint, nullptr, {int32Ty, int32Ty, int32Ty, int32Ty, int32Ty, int32Ty},
VgprInputNames, 0, true);
VgprInputNames, 0, AddFunctionArgsAppend);

assert(entryPoint->use_empty());
entryPoint->eraseFromParent();
Expand All @@ -1649,7 +1649,7 @@ Function *MeshTaskShader::mutateMeshShaderEntryPoint(Function *entryPoint) {
// +-----------------------+-----------------------+-----------------------+
if (m_gfxIp.major >= 11) {
entryPoint = newEntryPoint;
newEntryPoint = addFunctionArgs(entryPoint, nullptr, int32Ty, {"localInvocationId"}, 0, true);
newEntryPoint = addFunctionArgs(entryPoint, nullptr, int32Ty, {"localInvocationId"}, 0, AddFunctionArgsAppend);

assert(entryPoint->use_empty());
entryPoint->eraseFromParent();
Expand Down
4 changes: 3 additions & 1 deletion lgc/patch/NggPrimShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ Function *NggPrimShader::generate(Function *esMain, Function *gsMain, Function *
auto argIdx = arg.getArgNo();
if (inRegMask & (1ull << argIdx))
arg.addAttr(Attribute::InReg);
arg.addAttr(Attribute::NoUndef);
args.push_back(&arg);
}

Expand Down Expand Up @@ -3514,7 +3515,8 @@ void NggPrimShader::splitEs() {

// NOTE: Here, we just mutate original ES to do deferred vertex export. We add vertex position data as an additional
// argument. This could avoid re-fetching it since we already get the data before NGG culling.
auto esVertexExporter = addFunctionArgs(m_esHandlers.main, nullptr, {positionTy}, {"position"});
auto esVertexExporter =
addFunctionArgs(m_esHandlers.main, nullptr, {positionTy}, {"position"}, 0, AddFunctionArgsMaybeUndef);
esVertexExporter->setName(NggEsVertexExporter);

position = esVertexExporter->getArg(0); // The first argument is vertex position data
Expand Down
3 changes: 2 additions & 1 deletion lgc/patch/PatchEntryPointMutate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,8 @@ void PatchEntryPointMutate::processComputeFuncs(ShaderInputs *shaderInputs, Modu
} else {
inRegMask = generateEntryPointArgTys(shaderInputs, origFunc, shaderInputTys, shaderInputNames,
origType->getNumParams(), true);
newFunc = addFunctionArgs(origFunc, origType->getReturnType(), shaderInputTys, shaderInputNames, inRegMask, true);
newFunc = addFunctionArgs(origFunc, origType->getReturnType(), shaderInputTys, shaderInputNames, inRegMask,
AddFunctionArgsAppend);
const bool isEntryPoint = isShaderEntryPoint(newFunc);
newFunc->setCallingConv(isEntryPoint ? CallingConv::AMDGPU_CS : CallingConv::AMDGPU_Gfx);
}
Expand Down
2 changes: 2 additions & 0 deletions lgc/patch/ShaderMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ Function *ShaderMerger::generateLsHsEntryPoint(Function *lsEntryPoint, Function
auto argIdx = arg.getArgNo();
if (inRegMask & (1ull << argIdx))
arg.addAttr(Attribute::InReg);
arg.addAttr(Attribute::NoUndef);
}

//
Expand Down Expand Up @@ -675,6 +676,7 @@ Function *ShaderMerger::generateEsGsEntryPoint(Function *esEntryPoint, Function
auto argIdx = arg.getArgNo();
if (inRegMask & (1ull << argIdx))
arg.addAttr(Attribute::InReg);
arg.addAttr(Attribute::NoUndef);
}

//
Expand Down
24 changes: 10 additions & 14 deletions lgc/state/ShaderStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,17 @@ const char *lgc::getShaderStageAbbreviation(ShaderStage shaderStage) {
// across to it.
// If this changes the return type, then all the return instructions will be invalid.
// This does not erase the old function, as the caller needs to do something with its uses (if any).
// The added arguments are `noundef` by default.
//
// @param oldFunc : Original function
// @param retTy : New return type, nullptr to use the same as in the original function
// @param argTys : Types of new args
// @param inRegMask : Bitmask of which args should be marked "inreg", to be passed in SGPRs
// @param append : Append new arguments if true, prepend new arguments if false
// @param flags : Bitwise combination of AddFunctionArgsFlags (or 0)
// @returns : The new function
Function *lgc::addFunctionArgs(Function *oldFunc, Type *retTy, ArrayRef<Type *> argTys, ArrayRef<std::string> argNames,
uint64_t inRegMask, bool append) {
uint64_t inRegMask, unsigned flags) {
const bool append = flags & AddFunctionArgsAppend;
// Gather all arg types: first the new ones, then the ones from the original function.
FunctionType *oldFuncTy = oldFunc->getFunctionType();
SmallVector<Type *, 8> allArgTys;
Expand Down Expand Up @@ -170,13 +172,15 @@ Function *lgc::addFunctionArgs(Function *oldFunc, Type *retTy, ArrayRef<Type *>
}

// New arguments.
AttributeSet emptyAttrSet;
AttributeSet inRegAttrSet = emptyAttrSet.addAttribute(oldFunc->getContext(), Attribute::InReg);
AttributeSet defaultAttrSet;
if (!(flags & AddFunctionArgsMaybeUndef))
defaultAttrSet = defaultAttrSet.addAttribute(oldFunc->getContext(), Attribute::NoUndef);
AttributeSet inRegAttrSet = defaultAttrSet.addAttribute(oldFunc->getContext(), Attribute::InReg);
for (unsigned idx = 0; idx != argTys.size(); ++idx)
argAttrs.push_back((inRegMask >> idx) & 1 ? inRegAttrSet : emptyAttrSet);
argAttrs.push_back((inRegMask >> idx) & 1 ? inRegAttrSet : defaultAttrSet);
if (!append) {
// Old arguments.
for (unsigned idx = 0; idx != argTys.size(); ++idx)
for (unsigned idx = 0; idx != oldFuncTy->getNumParams(); ++idx)
argAttrs.push_back(oldAttrList.getParamAttrs(idx));
}
// Construct new AttributeList and set it on the new function.
Expand All @@ -193,20 +197,12 @@ Function *lgc::addFunctionArgs(Function *oldFunc, Type *retTy, ArrayRef<Type *>
for (unsigned idx = 0; idx != argTys.size(); ++idx) {
Argument *arg = newFunc->getArg(append ? idx + oldFuncTy->getNumParams() : idx);
arg->setName(argNames[idx]);
if ((inRegMask >> idx) & 1)
arg->addAttr(Attribute::InReg);
else if (!oldFuncTy->params().empty())
arg->removeAttr(Attribute::AttrKind::InReg);
}
for (unsigned idx = 0; idx != oldFuncTy->params().size(); ++idx) {
Argument *arg = newFunc->getArg(append ? idx : idx + argTys.size());
Argument *oldArg = oldFunc->getArg(idx);
arg->setName(oldArg->getName());
oldArg->replaceAllUsesWith(arg);
if (oldArg->hasInRegAttr())
arg->addAttr(Attribute::InReg);
else
arg->removeAttr(Attribute::AttrKind::InReg);
}

return newFunc;
Expand Down
2 changes: 1 addition & 1 deletion lgc/test/CallLibFromCs-indirect.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

; RUN: lgc -mcpu=gfx1010 -print-after=lgc-patch-entry-point-mutate -o /dev/null 2>&1 - <%s | FileCheck --check-prefixes=CHECK %s
; CHECK: IR Dump After Patch LLVM for entry-point mutation
; CHECK: define dllexport amdgpu_cs void @lgc.shader.CS.main(i32 inreg %globalTable, ptr addrspace(4) inreg %numWorkgroupsPtr, i32 inreg %userdata0, i32 inreg %userdata1, i32 inreg %userdata2, i32 inreg %userdata3, i32 inreg %userdata4, i32 inreg %userdata5, i32 inreg %userdata6, i32 inreg %userdata7, i32 inreg %userdata8, i32 inreg %userdata9, i32 inreg %userdata10, i32 inreg %userdata11, i32 inreg %spillTable, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId) #0 !lgc.shaderstage !7 {
; CHECK: define dllexport amdgpu_cs void @lgc.shader.CS.main(i32 inreg noundef %globalTable, ptr addrspace(4) inreg noundef %numWorkgroupsPtr, i32 inreg noundef %userdata0, i32 inreg noundef %userdata1, i32 inreg noundef %userdata2, i32 inreg noundef %userdata3, i32 inreg noundef %userdata4, i32 inreg noundef %userdata5, i32 inreg noundef %userdata6, i32 inreg noundef %userdata7, i32 inreg noundef %userdata8, i32 inreg noundef %userdata9, i32 inreg noundef %userdata10, i32 inreg noundef %userdata11, i32 inreg noundef %spillTable, <3 x i32> inreg noundef %WorkgroupId, i32 inreg noundef %MultiDispatchInfo, <3 x i32> noundef %LocalInvocationId) #0 !lgc.shaderstage !7 {
; CHECK: call amdgpu_gfx i32 %func_ptr(i32 inreg %globalTable, ptr addrspace(4) inreg %numWorkgroupsPtr, i32 inreg %userdata0, i32 inreg %userdata1, i32 inreg %userdata2, i32 inreg %userdata3, i32 inreg %userdata4, i32 inreg %userdata5, i32 inreg %userdata6, i32 inreg %userdata7, i32 inreg %userdata8, i32 inreg %userdata9, i32 inreg %userdata10, i32 inreg %userdata11, i32 inreg %spillTable, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId)
; CHECK: !7 = !{i32 7}

Expand Down
2 changes: 1 addition & 1 deletion lgc/test/CallLibFromCs.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; RUN: lgc -mcpu=gfx1010 -print-after=lgc-patch-entry-point-mutate -o /dev/null 2>&1 - <%s | FileCheck --check-prefixes=CHECK %s
; CHECK: IR Dump After Patch LLVM for entry-point mutation
; CHECK: declare amdgpu_gfx i32 @compute_library_func() #0
; CHECK: define dllexport amdgpu_cs void @lgc.shader.CS.main(i32 inreg %globalTable, ptr addrspace(4) inreg %numWorkgroupsPtr, i32 inreg %userdata0, i32 inreg %userdata1, i32 inreg %userdata2, i32 inreg %userdata3, i32 inreg %userdata4, i32 inreg %userdata5, i32 inreg %userdata6, i32 inreg %userdata7, i32 inreg %userdata8, i32 inreg %userdata9, i32 inreg %userdata10, i32 inreg %userdata11, i32 inreg %spillTable, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId) #1 !lgc.shaderstage !7 {
; CHECK: define dllexport amdgpu_cs void @lgc.shader.CS.main(i32 inreg noundef %globalTable, ptr addrspace(4) inreg noundef %numWorkgroupsPtr, i32 inreg noundef %userdata0, i32 inreg noundef %userdata1, i32 inreg noundef %userdata2, i32 inreg noundef %userdata3, i32 inreg noundef %userdata4, i32 inreg noundef %userdata5, i32 inreg noundef %userdata6, i32 inreg noundef %userdata7, i32 inreg noundef %userdata8, i32 inreg noundef %userdata9, i32 inreg noundef %userdata10, i32 inreg noundef %userdata11, i32 inreg noundef %spillTable, <3 x i32> inreg noundef %WorkgroupId, i32 inreg noundef %MultiDispatchInfo, <3 x i32> noundef %LocalInvocationId) #1 !lgc.shaderstage !7 {
; CHECK: call amdgpu_gfx i32 @compute_library_func(i32 inreg %globalTable, ptr addrspace(4) inreg %numWorkgroupsPtr, i32 inreg %userdata0, i32 inreg %userdata1, i32 inreg %userdata2, i32 inreg %userdata3, i32 inreg %userdata4, i32 inreg %userdata5, i32 inreg %userdata6, i32 inreg %userdata7, i32 inreg %userdata8, i32 inreg %userdata9, i32 inreg %userdata10, i32 inreg %userdata11, i32 inreg %spillTable, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId)
; CHECK: !7 = !{i32 7}

Expand Down
4 changes: 2 additions & 2 deletions lgc/test/CsComputeLibrary.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

; RUN: lgc -mcpu=gfx1010 -print-after=lgc-patch-entry-point-mutate -print-after=lgc-patch-prepare-pipeline-abi -print-after=lgc-patch-setup-target-features -o /dev/null 2>&1 - <%s | FileCheck --check-prefixes=CHECK %s
; CHECK: IR Dump After Patch LLVM for entry-point mutation
; CHECK: define amdgpu_gfx void @func(i32 inreg %globalTable, ptr addrspace(4) inreg %numWorkgroupsPtr, i32 inreg %userdata0, i32 inreg %userdata1, i32 inreg %userdata2, i32 inreg %userdata3, i32 inreg %userdata4, i32 inreg %userdata5, i32 inreg %userdata6, i32 inreg %userdata7, i32 inreg %userdata8, i32 inreg %userdata9, i32 inreg %userdata10, i32 inreg %userdata11, i32 inreg %spillTable, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId) #0 !lgc.shaderstage !7 {
; CHECK: define amdgpu_gfx void @func(i32 inreg noundef %globalTable, ptr addrspace(4) inreg noundef %numWorkgroupsPtr, i32 inreg noundef %userdata0, i32 inreg noundef %userdata1, i32 inreg noundef %userdata2, i32 inreg noundef %userdata3, i32 inreg noundef %userdata4, i32 inreg noundef %userdata5, i32 inreg noundef %userdata6, i32 inreg noundef %userdata7, i32 inreg noundef %userdata8, i32 inreg noundef %userdata9, i32 inreg noundef %userdata10, i32 inreg noundef %userdata11, i32 inreg noundef %spillTable, <3 x i32> inreg noundef %WorkgroupId, i32 inreg noundef %MultiDispatchInfo, <3 x i32> noundef %LocalInvocationId) #0 !lgc.shaderstage !7 {
; CHECK: !7 = !{i32 7}
; CHECK: IR Dump After Patch LLVM for preparing pipeline ABI
; CHECK: define amdgpu_gfx void @func(i32 inreg %globalTable, ptr addrspace(4) inreg %numWorkgroupsPtr, i32 inreg %userdata0, i32 inreg %userdata1, i32 inreg %userdata2, i32 inreg %userdata3, i32 inreg %userdata4, i32 inreg %userdata5, i32 inreg %userdata6, i32 inreg %userdata7, i32 inreg %userdata8, i32 inreg %userdata9, i32 inreg %userdata10, i32 inreg %userdata11, i32 inreg %spillTable, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId) #0 !lgc.shaderstage !7 {
; CHECK: define amdgpu_gfx void @func(i32 inreg noundef %globalTable, ptr addrspace(4) inreg noundef %numWorkgroupsPtr, i32 inreg noundef %userdata0, i32 inreg noundef %userdata1, i32 inreg noundef %userdata2, i32 inreg noundef %userdata3, i32 inreg noundef %userdata4, i32 inreg noundef %userdata5, i32 inreg noundef %userdata6, i32 inreg noundef %userdata7, i32 inreg noundef %userdata8, i32 inreg noundef %userdata9, i32 inreg noundef %userdata10, i32 inreg noundef %userdata11, i32 inreg noundef %spillTable, <3 x i32> inreg noundef %WorkgroupId, i32 inreg noundef %MultiDispatchInfo, <3 x i32> noundef %LocalInvocationId) #0 !lgc.shaderstage !7 {

; CHECK: IR Dump After Patch LLVM to set up target features
; CHECK: attributes #0 = { nounwind {{.*}}"amdgpu-flat-work-group-size"="6,6"
Expand Down
2 changes: 1 addition & 1 deletion lgc/test/TaskShaderEntryArgs.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; arguments should be present in order: meshTaskDispatchDims, meshTaskRingIndex, meshPipeStatsBuf.
;
; CHECK-LABEL: _amdgpu_cs_main
; CHECK: <3 x i32> inreg %meshTaskDispatchDims, i32 inreg %meshTaskRingIndex, i32 inreg %meshPipeStatsBuf
; CHECK: <3 x i32> inreg noundef %meshTaskDispatchDims, i32 inreg noundef %meshTaskRingIndex, i32 inreg noundef %meshPipeStatsBuf

; ModuleID = 'lgcPipeline'
source_filename = "llpctask1"
Expand Down
2 changes: 1 addition & 1 deletion lgc/test/Transforms/CpsLowering/cps-entry-point.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ attributes #5 = { nounwind willreturn memory(none) }
!2 = !{i32 8, i32 4, i32 1}
!3 = !{i32 7}
; CHECK-LABEL: define {{[^@]+}}@lgc.shader.CS.main
; CHECK-SAME: (i32 inreg [[GLOBALTABLE:%.*]], ptr addrspace(4) inreg [[NUMWORKGROUPSPTR:%.*]], i32 inreg [[USERDATA0:%.*]], i32 inreg [[USERDATA1:%.*]], i32 inreg [[USERDATA2:%.*]], i32 inreg [[USERDATA3:%.*]], i32 inreg [[PAD4:%.*]], i32 inreg [[PAD5:%.*]], i32 inreg [[PAD6:%.*]], i32 inreg [[PAD7:%.*]], i32 inreg [[PAD8:%.*]], i32 inreg [[PAD9:%.*]], i32 inreg [[PAD10:%.*]], i32 inreg [[PAD11:%.*]], i32 inreg [[SPILLTABLE:%.*]], <3 x i32> inreg [[WORKGROUPID:%.*]], i32 inreg [[MULTIDISPATCHINFO:%.*]], <3 x i32> [[LOCALINVOCATIONID:%.*]]) #[[ATTR3:[0-9]+]] !lgc.shaderstage !4 {
; CHECK-SAME: (i32 inreg noundef [[GLOBALTABLE:%.*]], ptr addrspace(4) inreg noundef [[NUMWORKGROUPSPTR:%.*]], i32 inreg noundef [[USERDATA0:%.*]], i32 inreg noundef [[USERDATA1:%.*]], i32 inreg noundef [[USERDATA2:%.*]], i32 inreg noundef [[USERDATA3:%.*]], i32 inreg noundef [[PAD4:%.*]], i32 inreg noundef [[PAD5:%.*]], i32 inreg noundef [[PAD6:%.*]], i32 inreg noundef [[PAD7:%.*]], i32 inreg noundef [[PAD8:%.*]], i32 inreg noundef [[PAD9:%.*]], i32 inreg noundef [[PAD10:%.*]], i32 inreg noundef [[PAD11:%.*]], i32 inreg noundef [[SPILLTABLE:%.*]], <3 x i32> inreg noundef [[WORKGROUPID:%.*]], i32 inreg noundef [[MULTIDISPATCHINFO:%.*]], <3 x i32> noundef [[LOCALINVOCATIONID:%.*]]) #[[ATTR3:[0-9]+]] !lgc.shaderstage !4 {
; CHECK-NEXT: .entry:
; CHECK-NEXT: [[TMP0:%.*]] = alloca ptr addrspace(5), align 4, addrspace(5)
; CHECK-NEXT: [[TMP1:%.*]] = call i64 @llvm.amdgcn.s.getpc()
Expand Down
4 changes: 2 additions & 2 deletions lgc/test/UnlinkedTessFetches.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

; Find the second run of Patch LLVM for preparing pipeline ABI
; CHECK: IR Dump After Patch LLVM for preparing pipeline ABI
; CHECK: define dllexport amdgpu_hs void @_amdgpu_hs_main_fetchless({{.*}}, <4 x float> [[vertInput:%[0-9]*]])
; CHECK: define dllexport amdgpu_hs void @_amdgpu_hs_main_fetchless({{.*}}, <4 x float> noundef [[vertInput:%[0-9]*]])
; CHECK: call amdgpu_ls void @_amdgpu_ls_main_fetchless({{.*}}, <4 x float> [[vertInput]])
; CHECK: define internal{{.*}} amdgpu_ls void @_amdgpu_ls_main_fetchless({{.*}}, <4 x float> %vertex{{[0-9]*.[0-9]*}})
; CHECK: define internal{{.*}} amdgpu_ls void @_amdgpu_ls_main_fetchless({{.*}}, <4 x float> noundef %vertex{{[0-9]*.[0-9]*}})

; ModuleID = 'lgcPipeline'
source_filename = "lgcPipeline"
Expand Down
4 changes: 2 additions & 2 deletions lgc/test/UnlinkedVsGsInputs.lgc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
; to the vertex shader, which expects it as the last parameter.
; RUN: lgc -mcpu=gfx900 %s -o /dev/null -print-after=lgc-patch-prepare-pipeline-abi 2>&1 | FileCheck --check-prefixes=CHECK %s
; CHECK: IR Dump After Patch LLVM for preparing pipeline ABI on [module]
; CHECK: define dllexport amdgpu_gs void @_amdgpu_gs_main_fetchless({{.*}}, <2 x float> [[vertInput:%[0-9]*]])
; CHECK: define dllexport amdgpu_gs void @_amdgpu_gs_main_fetchless({{.*}}, <2 x float> noundef [[vertInput:%[0-9]*]])
; CHECK: call amdgpu_es void @_amdgpu_es_main_fetchless({{.*}}, <2 x float> [[vertInput]])
; CHECK: define internal{{.*}} amdgpu_es void @_amdgpu_es_main_fetchless({{.*}}, <2 x float> %vertex0.0)
; CHECK: define internal{{.*}} amdgpu_es void @_amdgpu_es_main_fetchless({{.*}}, <2 x float> noundef %vertex0.0)

; ModuleID = 'lgcPipeline'
source_filename = "lgcPipeline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; SHADERTEST: !llpc.compute.mode = !{![[COMPUTEMODE:[0-9]+]]}
; SHADERTEST: ![[COMPUTEMODE]] = !{i32 1, i32 1, i32 1}
; SHADERTEST-LABEL: {{^// LLPC}} pipeline patching results
; SHADERTEST: define {{.*}} void @_amdgpu_cs_main(i32 inreg %globalTable, i32 inreg %userdata0, <3 x i32> inreg %WorkgroupId, i32 inreg %MultiDispatchInfo, <3 x i32> %LocalInvocationId)
; SHADERTEST: define {{.*}} void @_amdgpu_cs_main(i32 inreg noundef %globalTable, i32 inreg noundef %userdata0, <3 x i32> inreg noundef %WorkgroupId, i32 inreg noundef %MultiDispatchInfo, <3 x i32> noundef %LocalInvocationId)
; SHADERTEST: AMDLLPC SUCCESS
; END_SHADERTEST

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; BEGIN_SHADERTEST
; RUN: amdllpc -v %gfxip %s | FileCheck -check-prefix=SHADERTEST %s
// barycentric coordinate: (1 - i - j, i + j, 0)
; SHADERTEST-LABEL: define dllexport amdgpu_ps void @_amdgpu_ps_main(i32 inreg %globalTable,
; SHADERTEST-LABEL: define dllexport amdgpu_ps void @_amdgpu_ps_main(
; SHADERTEST: %[[jCoord:[^,]*]] = extractelement <2 x float> %PerspInterpCenter, i64 1
; SHADERTEST: %[[iCoord:[^,]*]] = extractelement <2 x float> %PerspInterpCenter, i64 0
; SHADERTEST: %[[subICoord:[0-9]*]] = fsub float 1.000000e+00, %[[iCoord]]
Expand Down
Loading

0 comments on commit 0d1d8d8

Please sign in to comment.