On 3/25/25 05:12, Tobias Burnus wrote:
On August 24, 2024 Tobias Burnus wrote:
[...] it documents the code added at "[patch][rfc] libgomp: Add OpenMP
interop support to nvptx + gcn plugin",
https://gcc.gnu.org/pipermail/gcc-patches/2024-August/661207.html
Quite some time has passed and those features are now on mainline.
The attached patch is an updated version of it, also documenting
the settings used to create the stream/queue object, which is
mainly relevant for HSA - as the CUDA and HIP versions are pretty
standard. - I think everything else is also pretty standard.
BTW: For HIP on AMD, I assume that when HSA is found via dlopen,
also HIP will be found via dlopen and shy away from wording like
'if available/found at runtime' or similar.
Comments before I commit it? I bet someone has!
+Invoke the @ref{Interoperability Routines} on an interop object to obtain
+the following properties. For properties with integral (int), pointer (ptr),
+or string (str) data type, call @code{omp_get_interop_int},
+@code{omp_get_interop_ptr}, or @code{omp_get_interop_str}, respectively.
+To each listed property, an associated named constant exists with prefix
+@code{omp_ipr_}. Note that @code{device_num} is the OpenMP device number
+while @code{device} is the HIP device number or HSA device handle.
I find the part about the "associated named constant" really confusing;
I am not sure those are for property identifiers or property values.
Can you give an example, or actually list the named constants individually?
+
+@noindent
+Available properties for an HIP interop object:
+
+@multitable @columnfractions .20 .35 .20 .20
+@headitem Property @tab C data type @tab API routine @tab
value (if constant)
+@item @code{fr_id} @tab @code{omp_interop_fr_t} @tab int @tab
@code{omp_fr_hip}
+@item @code{fr_name} @tab @code{const char *} @tab str @tab
@code{hip}
+@item @code{vendor} @tab @code{int} @tab int @tab
@code{1}
+@item @code{vendor_name} @tab @code{const char *} @tab str @tab
@code{amd}
+@item @code{device_num} @tab @code{int} @tab int @tab
+@item @code{platform} @tab N/A @tab @tab
+@item @code{device} @tab @code{hipDevice_t} @tab int @tab
+@item @code{device_context} @tab @code{hipCtx_t} @tab ptr @tab
+@item @code{targetsync} @tab @code{hipStream_t} @tab ptr @tab
+@end multitable
+
For the string-valued constants in the table, please include the quotes,
unless those are identifiers instead of string literals.
Same complaints apply to the similar text for other offload targets.
-Sandra