From aec03848ab0c155e30216feb32e393e700c6ac8c Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Thu, 4 Apr 2024 23:33:39 +0200
Subject: [PATCH] runtime: Add a RUNTIME_handle2tile function to make public
 the pointer conversion if needed

---
 include/chameleon/runtime.h                    | 12 ++++++++++++
 runtime/starpu/interface/cham_tile_interface.c |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/include/chameleon/runtime.h b/include/chameleon/runtime.h
index 010b8b1b5..e64390f6c 100644
--- a/include/chameleon/runtime.h
+++ b/include/chameleon/runtime.h
@@ -557,6 +557,18 @@ RUNTIME_data_migrate( const RUNTIME_sequence_t *sequence,
 void *
 RUNTIME_data_getaddr( const CHAM_desc_t *A, int Am, int An );
 
+
+/**
+ * @brief Get the CHAM_tile_t pointer to a tile from the runtime handle pointer
+ * returned by RUNTIME_data_getaddr.
+ *
+ * @param[in] ptr
+ *            The pointer to convert.
+ *
+ * @retval The associated CHAM_tile_t pointer.
+ */
+CHAM_tile_t *RUNTIME_handle2tile( void *ptr );
+
 /**
  * @}
  *
diff --git a/runtime/starpu/interface/cham_tile_interface.c b/runtime/starpu/interface/cham_tile_interface.c
index c8be6122b..352d7bd28 100644
--- a/runtime/starpu/interface/cham_tile_interface.c
+++ b/runtime/starpu/interface/cham_tile_interface.c
@@ -772,3 +772,9 @@ starpu_cham_tile_interface_fini()
 #endif
     }
 }
+
+CHAM_tile_t *
+RUNTIME_handle2tile( void *interface )
+{
+    return cti_interface_get( (starpu_cham_tile_interface_t *)interface );
+}
-- 
GitLab