[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)
S. Bharadwaj Yadavalli via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 09:13:08 PDT 2024
================
@@ -760,7 +760,7 @@ using namespace clang::targets;
TargetInfo *
TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
const std::shared_ptr<TargetOptions> &Opts) {
- llvm::Triple Triple(Opts->Triple);
+ llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple));
----------------
bharadwajy wrote:
> I see. It is trying to add subarch for dxil. Could we allow Triple::NoSubArch for dxil?
`setArch(dxil, Triple::NoSubArch)` should work.
> Backend could do the job to translate NoSubArch to the version based on shader model.
One of the principles I tried to adhere to in the implementation of part (2) is to pass an appropriately constructed DXIL target triple string at creation-time of (DXIL) TargetMachine instance to maintain consistency between all the fields of the instance of DXIL `Triple` viz., Data, Arch, SubArch etc.
Delegating or expecting the backend to do the same may lead to inconsistencies in the Triple instance. What benefit do you see in letting Backend perform the same steps that can be performed at creation time? Of course, if the backend needs to change the triple information for any reason, it is still free to do so - but I think it should expect to have the target triple information that reflects command-line or IR module specification of target triple.
https://github.com/llvm/llvm-project/pull/90809
More information about the cfe-commits
mailing list