[flang-commits] [flang] [flang][cuda] Force default allocator in device code (PR #102238)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Aug 6 15:15:19 PDT 2024


================
@@ -162,11 +162,17 @@ RT_API_ATTRS int Descriptor::Allocate() {
     elementBytes = raw_.elem_len = 0;
   }
   std::size_t byteSize{Elements() * elementBytes};
+
+  // Force default allocator in device code.
+#ifdef RT_DEVICE_COMPILATION
----------------
klausler wrote:

GetAllocIdx is the only way to decode that field, and that's its purpose.  Wrap it with something new to do the replacement for these purposes.  It doesn't have to be in Descriptor if it only needs to be used in this source file.

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


More information about the flang-commits mailing list