[llvm] [Offload] Re-allocate overlapping memory (PR #159567)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 06:56:30 PDT 2025
================
@@ -615,18 +621,58 @@ TargetAllocTy convertOlToPluginAllocTy(ol_alloc_type_t Type) {
Error olMemAlloc_impl(ol_device_handle_t Device, ol_alloc_type_t Type,
size_t Size, void **AllocationOut) {
- auto Alloc =
- Device->Device->dataAlloc(Size, nullptr, convertOlToPluginAllocTy(Type));
- if (!Alloc)
- return Alloc.takeError();
+ void *OldAlloc = nullptr;
+
+ // Repeat the allocation up to a certain amount of times. If it happens to
+ // already be allocated (e.g. by a device from another vendor) throw it away
+ // and try again.
+ for (size_t Count = 0; Count < 10; Count++) {
----------------
RossBrunton wrote:
I chose 10 fairly arbitrarily, what do you mean by a stack?
https://github.com/llvm/llvm-project/pull/159567
More information about the llvm-commits
mailing list