[PATCH] D122865: [HLSL][clang][Driver] Support target profile command line option.

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 22:18:18 PDT 2022


python3kgae created this revision.
python3kgae added reviewers: beanz, steven_wu, JonChesterfield.
python3kgae added a project: clang.
Herald added a subscriber: mgorny.
Herald added a reviewer: sscalpone.
Herald added a project: All.
python3kgae requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.

The target profile option(/T) decide the shader model when compile hlsl.
The format is shaderKind_major_minor like ps_6_1.
The shader model is saved as llvm::Triple is clang/llvm like dxil-unknown-shadermodel6.1-hull.
The main job to support the option is translating ps_6_1 into shadermodel6.1-pixel.
That is done inside tryParseProfile  at HLSL.cpp.

To integrate the option into clang Driver, a new DriverMode DxcMode is created. When DxcMode is enabled, OSType for TargetTriple will be forced into Triple::ShaderModel. And new ToolChain HLSLToolChain will be created when OSType is Triple::ShaderModel.

In HLSLToolChain, ComputeEffectiveClangTriple is overridden to call tryParseProfile when targetProfile option is set.

To make test work, Fo option is added and .hlsl is added for active -xhlsl.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122865

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Driver/Driver.h
  clang/include/clang/Driver/Options.h
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/HLSL.cpp
  clang/lib/Driver/ToolChains/HLSL.h
  clang/lib/Driver/Types.cpp
  clang/test/Driver/dxil_target_profile.hlsl
  clang/test/lit.cfg.py
  clang/unittests/Driver/ToolChainTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122865.419592.patch
Type: text/x-patch
Size: 16081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220401/2d6ae52a/attachment-0001.bin>


More information about the cfe-commits mailing list