[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)
Chris B via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 13:39:23 PST 2024
================
@@ -318,23 +314,31 @@ static void translateMetadata(Module &M, const DXILResourceMap &DRM,
// See https://github.com/llvm/llvm-project/issues/57928
MDTuple *Signatures = nullptr;
- if (MMDI.ShaderProfile == Triple::EnvironmentType::Library)
+ if (MMDI.ShaderProfile == Triple::EnvironmentType::Library) {
+ // Get the combined shader flag mask of all functions in the library to be
+ // used as shader flags mask value associated with top-level library entry
+ // metadata.
+ uint64_t CombinedMask = ShaderFlags.getCombinedFlags();
EntryFnMDNodes.emplace_back(
- emitTopLevelLibraryNode(M, ResourceMD, ShaderFlags));
- else if (MMDI.EntryPropertyVec.size() > 1) {
+ emitTopLevelLibraryNode(M, ResourceMD, CombinedMask));
+ } else if (MMDI.EntryPropertyVec.size() > 1) {
M.getContext().diagnose(DiagnosticInfoTranslateMD(
M, "Non-library shader: One and only one entry expected"));
}
for (const EntryProperties &EntryProp : MMDI.EntryPropertyVec) {
- // FIXME: ShaderFlagsAnalysis pass needs to collect and provide
- // ShaderFlags for each entry function. For now, assume shader flags value
- // of entry functions being compiled for lib_* shader profile viz.,
- // EntryPro.Entry is 0.
- uint64_t EntryShaderFlags =
- (MMDI.ShaderProfile == Triple::EnvironmentType::Library) ? 0
- : ShaderFlags;
+ Expected<const ComputedShaderFlags &> EntrySFMask =
+ ShaderFlags.getShaderFlagsMask(EntryProp.Entry);
+ if (Error E = EntrySFMask.takeError()) {
+ M.getContext().diagnose(
+ DiagnosticInfoTranslateMD(M, toString(std::move(E))));
+ }
----------------
llvm-beanz wrote:
This should also be a `handleAllErrors` call.
https://github.com/llvm/llvm-project/pull/112967
More information about the llvm-commits
mailing list