[clang] [llvm] [DirectX] Implement UseNativeLowPrecision shader flag analysis (PR #134288)

Deric C. via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 13:12:39 PDT 2025


================
@@ -188,6 +188,13 @@ void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM,
         continue;
       }
 
+      // Set UseNativeLowPrecision using dx.nativelowprec module metadata
+      if (auto *NativeLowPrec = mdconst::extract_or_null<ConstantInt>(
+              M.getModuleFlag("dx.nativelowprec")))
+        if (MMDI.DXILVersion >= VersionTuple(1, 2) &&
----------------
Icohedron wrote:

The frontend is what is adding `!0 = !{i32 1, !"dx.nativelowprec", i32 1}`, so we wouldn't see it in the module.

If it is manually added to a module that is SM 6.1 or older, then it should have no effect on the shader flags.
Should I add a test for this?

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


More information about the cfe-commits mailing list