[llvm] [DirectX] Set shader feature flags MinimumPrecision and NativeLowPrecision (PR #139623)
Deric C. via llvm-commits
llvm-commits at lists.llvm.org
Tue May 13 15:03:46 PDT 2025
================
@@ -286,6 +290,17 @@ void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM,
*(EntryFunProps.Entry), "Inconsistent optnone attribute "));
}
+ // Set ResMayNotAlias to true if DXIL validator version < 1.8 and there
+ // are UAVs present globally.
+ if (CanSetResMayNotAlias && MMDI.ValidatorVersion < VersionTuple(1, 8))
+ CombinedSFMask.ResMayNotAlias = !DRM.uavs().empty();
+
+ // Set the module flag that enables native low-precision execution mode. This
+ // is needed even if the module does not use 16-bit types because a
+ // corresponding debug module may include 16-bit types, and tools that use the
+ // debug module may expect it to have the same flags as the original
+ CombinedSFMask.NativeLowPrecisionMode = NativeLowPrecisionMode;
----------------
Icohedron wrote:
Setting the flag in CombinedSFMask instead of SCCSF will make the module flags be set on the module only and not the functions themselves. This is consistent with the way the DisableOptimizations flag is currently set in Clang.
However, it does not match the behavior of DXC (see [DxilShaderFlags.cpp](https://github.com/microsoft/DirectXShaderCompiler/blob/fb4d7d17bd5104cbbf259e8484390175fdc23192/lib/DXIL/DxilShaderFlags.cpp#L412-L413)) which sets every flag at the function level.
I don't think it matters though? The final DXIL module flags and shader feature flags work out to be the same in the end.
https://github.com/llvm/llvm-project/pull/139623
More information about the llvm-commits
mailing list