[llvm] Set shader analysis flags EnableRawAndStructuredBuffers for RawBuffer and StructuredBuffer resource types (PR #114449)

Cooper Partin via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 13:49:29 PST 2024


================
@@ -36,8 +39,35 @@ static void updateFlags(ComputedShaderFlags &Flags, const Instruction &I) {
   }
 }
 
-ComputedShaderFlags ComputedShaderFlags::computeFlags(Module &M) {
+static void updateResourceFlags(ComputedShaderFlags &Flags, Module &M,
+                                ModuleAnalysisManager *AM) {
+  if (!AM)
+    return;
+
+  const DXILResourceMap &DRM = AM->getResult<DXILResourceAnalysis>(M);
+  if (DRM.empty())
+    return;
+
+  const dxil::ModuleMetadataInfo &MMDI = AM->getResult<DXILMetadataAnalysis>(M);
+  VersionTuple SM = MMDI.ShaderModelVersion;
+  Triple::EnvironmentType SP = MMDI.ShaderProfile;
+
+  // RWBuffer
+  for (const ResourceInfo &RI : DRM.uavs()) {
+    if (RI.getResourceKind() == ResourceKind::TypedBuffer) {
+      Flags.EnableRawAndStructuredBuffers = true;
+      Flags.ComputeShadersPlusRawAndStructuredBuffers =
+          (SP == Triple::EnvironmentType::Compute && SM.getMajor() == 4);
----------------
coopp wrote:

This issue has been resolved in chat.  The result is to not set this flag as it will not be used at this time.

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


More information about the llvm-commits mailing list