Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh shader: Enable row export on GFX11 and fix issues #2821

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lgc/patch/MeshTaskShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void MeshTaskShader::processMeshShader(Function *entryPoint) {
const unsigned flatWorkgroupSize =
alignTo(m_pipelineState->enableMeshRowExport() ? numMeshThreads : primAmpFactor, waveSize);
entryPoint->addFnAttr("amdgpu-flat-work-group-size",
std::to_string(primAmpFactor) + std::string(",") + std::to_string(flatWorkgroupSize));
std::to_string(flatWorkgroupSize) + std::string(",") + std::to_string(flatWorkgroupSize));

const unsigned numWaves = flatWorkgroupSize / waveSize;
const unsigned numMeshWaves = alignTo(numMeshThreads, waveSize) / waveSize;
Expand Down Expand Up @@ -555,6 +555,9 @@ void MeshTaskShader::processMeshShader(Function *entryPoint) {
m_builder.CreateStore(m_builder.getFalse(), m_barrierToggle);
}

if (m_gfxIp.major >= 11)
prepareAttribRingAccess();

m_builder.CreateBr(initPrimitiveIndicesHeaderBlock);
}

Expand All @@ -573,9 +576,6 @@ void MeshTaskShader::processMeshShader(Function *entryPoint) {
m_builder.CreateMul(loopIndexPhi, m_builder.getInt32(waveSize)), "primitiveIndex");
}

if (m_gfxIp.major >= 11)
prepareAttribRingAccess();

auto validPrimitive =
m_builder.CreateICmpULT(m_waveThreadInfo.primOrVertexIndex, m_builder.getInt32(meshMode.outputPrimitives));
m_builder.CreateCondBr(validPrimitive, initPrimitiveIndicesBodyBlock, endInitPrimitiveIndicesBlock);
Expand Down Expand Up @@ -2234,7 +2234,7 @@ void MeshTaskShader::doExport(ExportKind kind, ArrayRef<ExportInfo> exports) {
}

m_builder.CreateIntrinsic(Intrinsic::amdgcn_struct_buffer_store, valueToStore->getType(),
{valueToStore, m_attribRingBufDesc, m_waveThreadInfo.threadIdInSubgroup,
{valueToStore, m_attribRingBufDesc, m_waveThreadInfo.primOrVertexIndex,
locationOffset, m_attribRingBaseOffset, m_builder.getInt32(coherent.u32All)});
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion lgc/state/PipelineState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static cl::opt<bool> EnableTessOffChip("enable-tess-offchip", cl::desc("Enable t

// -enable-row-export: enable row export for mesh shader
static cl::opt<bool> EnableRowExport("enable-row-export", cl::desc("Enable row export for mesh shader"),
cl::init(false));
cl::init(true));

cl::opt<bool> UseRegisterFieldFormat("use-register-field-format", cl::desc("Use register field format in pipeline ELF"),
cl::init(true));
Expand Down
Loading