[clang] [HLSL] Add validation for the -enable-16bit-types option (PR #85340)

Natalie Chouinard via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 08:37:39 PDT 2024


================
@@ -4258,6 +4258,18 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
       } else {
         llvm_unreachable("expected DXIL or SPIR-V target");
       }
+      // validate that if fnative-half-type is given, that
+      // the language standard is at least hlsl2021, and that
+      // the target shader model is at least 6.2
+      if (Args.getLastArg(OPT_fnative_half_type)) {
----------------
sudonatalie wrote:

Yeah, the OSVersion for the SPIR-V target represents the Vulkan version, and all Vulkan versions support FP16, so no need to check it. We should probably share the HLSL language version check for both targets though.

https://github.com/llvm/llvm-project/pull/85340


More information about the cfe-commits mailing list