This is an archive of the discontinued LLVM Phabricator instance.

[DirectX backend] add pass to collect Resource information from dxil metadata.
AbandonedPublic

Authored by python3kgae on Feb 7 2023, 10:11 AM.

Details

Summary

This is for container builder which need resource information after dxil metadata generation.

New analysis pass DXILMetadataResourceAnalysis is added to collect the information.
New constructor for dxil::ResourceBase/UAV/ConstantBuffer is added to build from dxil metadata.

Diff Detail

Event Timeline

python3kgae created this revision.Feb 7 2023, 10:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2023, 10:12 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
python3kgae requested review of this revision.Feb 7 2023, 10:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2023, 10:12 AM
beanz added a comment.Feb 7 2023, 10:56 AM

I don't think this PR is correct. It seems like we should be able to ensure that the analysis result remains preserved after the metadata is generated allowing us to re-use the analysis result that was used to generate the metadata.

llvm/lib/Target/DirectX/DXILResource.cpp
45

If the tuple _must_ have the operand (as demonstrated by the asserts below), this can just be a dyn_cast.

dyn_cast_or_null has been replaced by dyn_cast_if_present, and should only be used when null is a valid input and output.

python3kgae abandoned this revision.Feb 8 2023, 6:47 AM

Add

 void getAnalysisUsage(AnalysisUsage &AU) const override {
  AU.addPreserved<DXILResourceWrapper>();
}

to DXILPrepareModule resolved the issue.