[llvm-branch-commits] [llvm] [SPIRV][SPIRVPrepareGlobals] Map AMD's dynamic LDS 0-element globals to arrays with UINT32_MAX elements (PR #166952)

2025-11-07 Thread Marcos Maronas via llvm-branch-commits

https://github.com/maarquitos14 approved this pull request.

LGTM, just one nit.

https://github.com/llvm/llvm-project/pull/166952
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [SPIRV][SPIRVPrepareGlobals] Map AMD's dynamic LDS 0-element globals to arrays with UINT32_MAX elements (PR #166952)

2025-11-07 Thread Marcos Maronas via llvm-branch-commits


@@ -43,6 +44,29 @@ bool tryExtendLLVMBitcodeMarker(GlobalVariable &Bitcode) {
   return true;
 }
 
+bool tryExtendDynamicLDSGlobal(GlobalVariable &GV) {
+  constexpr unsigned WorkgroupAS = 3;
+  const bool IsWorkgroupExternal =
+  GV.hasExternalLinkage() && GV.getAddressSpace() == WorkgroupAS;
+  if (!IsWorkgroupExternal)
+return false;
+
+  const ArrayType *AT = dyn_cast(GV.getValueType());
+  if (!AT || AT->getNumElements() != 0)
+return false;
+
+  constexpr auto Magic = std::numeric_limits::max();

maarquitos14 wrote:

```suggestion
  constexpr auto Uint32Max= std::numeric_limits::max();
```

Or similar, so that it's more meaningful.

https://github.com/llvm/llvm-project/pull/166952
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [SPIRV][SPIRVPrepareGlobals] Map AMD's dynamic LDS 0-element globals to arrays with UINT32_MAX elements (PR #166952)

2025-11-07 Thread Marcos Maronas via llvm-branch-commits

https://github.com/maarquitos14 edited 
https://github.com/llvm/llvm-project/pull/166952
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits