Skip to content

Commit 6a571dc

Browse files
AnastasiaStulovamantogninisvenvh
authored
[C++ for OpenCL] define __opencl_cpp_global_destructors (#510)
* [C++ for OpenCL] define __opencl_cpp_global_destructors Co-authored-by: Marco Antognini <antognini.marco@gmail.com> Co-authored-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
1 parent 02142f3 commit 6a571dc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

cxx4opencl/address_spaces.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,15 @@ __global const int& f(__global float &ref) {
332332

333333
Construction, initialization and destruction of objects in `+__private+`
334334
and `+__global+` address space follow the general principles of {cpp}. For
335-
program scope objects, the implementation (i.e. compiler) defines an ABI
336-
format for initialization and destruction of global objects before/after
337-
all kernels are enqueued.
335+
program scope objects or static objects in the function scope with non-trivial
336+
constructors and destructors, the implementation defines an ABI format for
337+
runtime initialization and destruction of global objects before/after all
338+
kernels are enqueued.
339+
340+
Non-trivial destructors for global objects are not required to be supported
341+
by all implementations. The macro `__opencl_cpp_global_destructor`,
342+
which is defined if and only if such destructors are supported by the implementation,
343+
can be used to check whether this functionality is available when compiling kernel code.
338344

339345
Objects in `__local` address space can not have initializers in
340346
declarations and therefore a constructor can not be called. All objects

0 commit comments

Comments
 (0)