Merge pull request #23 from avinashkethineedi/bugfix/memory-usage

Automatic Memory Management with `shared_ptr` for host interface
Этот коммит содержится в:
Avinash Kethineedi
2025-01-15 02:34:14 +05:30
коммит произвёл GitHub
родитель 4a3c3d54fb 1ef2d3a6b7
Коммит 17b7afdcba
3 изменённых файлов: 7 добавлений и 11 удалений
+3 -7
Просмотреть файл
@@ -77,8 +77,9 @@ IPCBackend::IPCBackend(MPI_Comm comm)
bp->heap_ptr = &heap;
/* Initialize the host interface */
host_interface =
new HostInterface(hdp_proxy_.get(), thread_comm, &heap);
host_interface = std::make_shared<HostInterface>(hdp_proxy_.get(),
thread_comm,
&heap);
default_host_ctx = std::make_unique<IPCHostContext>(this, 0);
@@ -117,11 +118,6 @@ IPCBackend::~IPCBackend() {
*/
CHECK_HIP(hipFree(bp->atomic_ret->atomic_base_ptr));
// TODO(Avinash) Free g_ret
// delete host_interface;
// host_interface = nullptr;
/**
* Destroy teams infrastructure
* and team world
+2 -2
Просмотреть файл
@@ -124,9 +124,9 @@ class IPCBackend : public Backend {
/**
* @brief The host-facing interface that will be used
* by all contexts of the ROBackend
* by all contexts of the IPCBackend
*/
HostInterface *host_interface{nullptr};
std::shared_ptr<HostInterface> host_interface{nullptr};
/**
* @brief Scratchpad for the internal barrier algorithms.
+2 -2
Просмотреть файл
@@ -136,8 +136,8 @@ class IPCHostContext : public Context {
__host__ int test(T *ivars, int cmp, T val);
public:
/* Pointer to the backend's host interface */
HostInterface *host_interface{nullptr};
/* Shared pointer to the backend's host interface */
std::shared_ptr<HostInterface> host_interface{nullptr};
/* An MPI Window implements a context */
WindowInfo *context_window_info{nullptr};