llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.98k stars 11.95k forks source link

Introduce DXIL Metadata analysis pass #63835

Closed bogner closed 1 month ago

bogner commented 1 year ago

We need an analysis pass, DXILMetadataAnalysis, that reads information such as the validator version, shader model and stage, entry point properties, and pre SM6.6 resource bindings from a DXIL module. The result of this analysis should be an abstraction of the various pieces of metadata that DXIL stores. This will be used for translating DXIL into modern LLVM for tooling and testing purposes.

This should also mean we can drop the abstractions in lib/Target/DirectX/DXILMetadata.cpp and have DXILTranslateMetadata and friends use the DXILMetadataAnalysis structures as necessary instead.

Acceptance Criteria

bogner commented 3 months ago

To do this we'll need to start by doing something like the resource analysis in #100700 and #100699, but with a much simpler analysis result - essentially just a struct containing the various pieces of metadata we'll need throughout the backend. We can collect the necessary info from the various internal LLVM constructs (like the target triple, entry point attributes, etc) and then consumers can just look at the analysis result. Keep in mind that at some point we'll also want to be able to collect the same info from the DXIL metadata itself so that we can support translation in the other direction through the same abstraction.

bharadwajy commented 2 months ago

Item2 of AC viz, "DXILTranslateMetadata uses the types defined for the analysis results of that pass where appropriate" needs to be implemented.