[llvm] [DXIL][Analysis] Add validator version to info collected by Module Metadata Analysis (PR #104828)
S. Bharadwaj Yadavalli via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 12:09:45 PDT 2024
================
@@ -25,6 +25,14 @@ static ModuleMetadataInfo collectMetadataInfo(Module &M) {
MMDAI.DXILVersion = TT.getDXILVersion();
MMDAI.ShaderModelVersion = TT.getOSVersion();
MMDAI.ShaderStage = TT.getEnvironment();
+ NamedMDNode *ValidatorVerNode = M.getNamedMetadata("dx.valver");
+ if (ValidatorVerNode) {
+ auto *ValVerMD = cast<MDNode>(ValidatorVerNode->getOperand(0));
+ auto *MajorMD = mdconst::extract<ConstantInt>(ValVerMD->getOperand(0));
+ auto *MinorMD = mdconst::extract<ConstantInt>(ValVerMD->getOperand(1));
+ MMDAI.ValidatorVersion =
+ VersionTuple(MajorMD->getZExtValue(), MinorMD->getZExtValue());
+ }
----------------
bharadwajy wrote:
> Shall we report error when `dx.valver` not exist?
Since this is an analysis pass, the thought behind **not** reporting an error here but just retaining the default value of `{}`, is to allow for the consumer of the analysis information the option of emitting an error, emitting a warning or may be setting the validator version, depending on the usage context.
https://github.com/llvm/llvm-project/pull/104828
More information about the llvm-commits
mailing list