Skip to content

Commit

Permalink
Remove the shader input IsOffChip
Browse files Browse the repository at this point in the history
This SGPR was originally for pre-GFX9 when tessellation on-chip mode is
available. Now, this SGPR is necessary when merged shader doesn't
provide it since tessellation is always in off-chip mode.
  • Loading branch information
amdrexu committed Dec 3, 2023
1 parent 7eb4d8a commit c6f5fd8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion lgc/include/lgc/patch/ShaderInputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ enum class ShaderInput : unsigned {
GsWaveId, // GS wave ID

// Unmerged hardware ES SGPRs
IsOffChip, // is_off_chip
EsGsOffset, // ES to GS offset

// Unmerged hardware HS SGPRs
Expand Down
8 changes: 1 addition & 7 deletions lgc/patch/NggPrimShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3118,9 +3118,7 @@ void NggPrimShader::runEs(ArrayRef<Argument *> args) {
if (m_hasTes) {
// Set up system value SGPRs
if (m_pipelineState->isTessOffChip()) {
Value *isOffChip = PoisonValue::get(m_builder.getInt32Ty()); // Unused
esArgs.push_back(m_hasGs ? offChipLdsBase : isOffChip);
esArgs.push_back(m_hasGs ? isOffChip : offChipLdsBase);
esArgs.push_back(offChipLdsBase);
}

if (m_hasGs)
Expand Down Expand Up @@ -3336,8 +3334,6 @@ Value *NggPrimShader::runPartEs(ArrayRef<Argument *> args, Value *position) {
if (m_hasTes) {
// Set up system value SGPRs
if (m_pipelineState->isTessOffChip()) {
Value *isOffChip = PoisonValue::get(m_builder.getInt32Ty()); // Unused
partEsArgs.push_back(isOffChip);
partEsArgs.push_back(offChipLdsBase);
}

Expand Down Expand Up @@ -7511,8 +7507,6 @@ Value *NggPrimShader::fetchXfbOutput(Function *target, ArrayRef<Argument *> args
if (m_hasTes) {
// Set up system value SGPRs
if (m_pipelineState->isTessOffChip()) {
Value *isOffChip = PoisonValue::get(m_builder.getInt32Ty()); // Unused
xfbFetcherArgs.push_back(isOffChip);
xfbFetcherArgs.push_back(offChipLdsBase);
}

Expand Down
5 changes: 0 additions & 5 deletions lgc/patch/ShaderInputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ const char *ShaderInputs::getInputName(ShaderInput inputKind) {
return "GsVsOffset";
case ShaderInput::GsWaveId:
return "GsWaveId";
case ShaderInput::IsOffChip:
return "IsOffChip";
case ShaderInput::EsGsOffset:
return "EsGsOffset";
case ShaderInput::TfBufferBase:
Expand Down Expand Up @@ -459,7 +457,6 @@ static const ShaderInputDesc VsAsVsSgprInputs[] = {
// SGPRs: TES as hardware ES
static const ShaderInputDesc TesAsEsSgprInputs[] = {
{ShaderInput::OffChipLdsBase, offsetof(InterfaceData, entryArgIdxs.tes.offChipLdsBase)},
{ShaderInput::IsOffChip, 0},
{ShaderInput::EsGsOffset, offsetof(InterfaceData, entryArgIdxs.tes.esGsOffset), true},
};

Expand Down Expand Up @@ -618,8 +615,6 @@ uint64_t ShaderInputs::getShaderArgTys(PipelineState *pipelineState, ShaderStage
if (pipelineState->isTessOffChip()) {
// LDS buffer base for off-chip
getShaderInputUsage(shaderStage, ShaderInput::OffChipLdsBase)->enable();
// is_off_chip register. Enabling it here only has an effect when TES is hardware ES.
getShaderInputUsage(shaderStage, ShaderInput::IsOffChip)->enable();
}
if (!hasGs) {
// TES as hardware VS: handle HW stream-out. StreamOutInfo is required for off-chip even if there is no
Expand Down

0 comments on commit c6f5fd8

Please sign in to comment.