================
@@ -845,10 +1128,41 @@ extern "C" int 
__llvm_profile_hip_collect_device_data(void) {
   return Ret;
 }
 
-/* Interceptors for hipModuleLoad* / hipModuleUnload. Linux only. */
+/* Linux HIP interceptors. */
 
 #if defined(__linux__) && !defined(_WIN32)
 
+typedef struct {
+  unsigned int x;
+  unsigned int y;
+  unsigned int z;
+} HipDim3;
+
+typedef void *HipFunction;
+typedef void *HipStream;
+
+static int recordHipLaunchResult(int Rc) {
+  if (Rc == 0)
+    markCurrentDeviceUsed();
+  return Rc;
+}
+
----------------
lfmeadow wrote:

There are several additional untracked launch APis: hipExtLaunchKernel, 
hipLaunchCooperativeKernel, hipExtModuleLaunchKernel, HIP graph launches 
(hipGraphLaunch).
If only those APIs are used, there will be a crash: AnyDeviceUsed == 0 -> falls 
back to collect-all 
If, say, device 0 uses a tracked APi and device 1 uses an untracked API, then 
any data from device 1 will be lost.
The tracked APIs should be listed as a limitation, and probably should track 
the other APIs also.

https://github.com/llvm/llvm-project/pull/202095
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to