Skip to content

Commit 9d41fd1

Browse files
committed
mpl/ze: Add debug logging for specialized ipc handle cache
ZE uses a specialized cache contained within MPL by default. Because of this, it will bypass the generic cache in the ch4 layer and not output any cache debug messages. Add debug messages directly in MPL to mirror the generic cache for now. Eventually we will remove the specialized cache once the generic one reaches feature parity.
1 parent 6edf419 commit 9d41fd1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/mpl/src/gpu/mpl_gpu_ze.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ MPL_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING;
2828
#include "uthash.h"
2929
#include "utlist.h"
3030

31+
/* support logging for cache hits and misses */
32+
#if defined (MPL_USE_DBG_LOGGING)
33+
extern MPL_dbg_class MPIDI_CH4_DBG_IPC;
34+
#endif /* MPL_USE_DBG_LOGGING */
35+
3136
/* Latest Level-zero Specification:
3237
* http://spec.oneapi.com/level-zero/latest/index.html
3338
*/
@@ -1694,6 +1699,8 @@ static int remove_stale_sender_cache(const void *ptr, uint64_t mem_id, int local
16941699
HASH_FIND(hh, ipc_cache_tracked[memid_entry->dev_id], &mem_id, sizeof(uint64_t),
16951700
cache_entry);
16961701
if (cache_entry) {
1702+
MPL_DBG_MSG_P(MPIDI_CH4_DBG_IPC, VERBOSE, "removing STALE gpu ipc handle for %p",
1703+
ptr);
16971704
/* call putIpcHandle only if this ptr is still valid */
16981705
if (memid_entry->mem_id == mem_id && memid_entry->dev_id == local_dev_id) {
16991706
free_ipc_handle_cache(cache_entry);
@@ -1752,14 +1759,17 @@ int MPL_gpu_ipc_handle_create(const void *ptr, MPL_gpu_device_attr * ptr_attr,
17521759
}
17531760

17541761
if (cache_entry && cache_entry->handle_cached) {
1762+
MPL_DBG_MSG_P(MPIDI_CH4_DBG_IPC, VERBOSE, "cached gpu ipc handle HIT for %p", pbase);
17551763
memcpy(ipc_handle, &cache_entry->ipc_handle, sizeof(MPL_gpu_ipc_mem_handle_t));
17561764
} else {
1765+
MPL_DBG_MSG_P(MPIDI_CH4_DBG_IPC, VERBOSE, "cached gpu ipc handle MISS for %p", pbase);
17571766
mpl_err = MPL_ze_ipc_handle_create(pbase, ptr_attr, local_dev_id, true, ipc_handle);
17581767
if (mpl_err != MPL_SUCCESS) {
17591768
goto fn_fail;
17601769
}
17611770

17621771
if (likely(MPL_gpu_info.specialized_cache)) {
1772+
MPL_DBG_MSG_P(MPIDI_CH4_DBG_IPC, VERBOSE, "caching NEW gpu ipc handle for %p", pbase);
17631773
if (cache_entry) {
17641774
/* In the case where there was an entry, but no ipc handle yet */
17651775
cache_entry->handle_cached = true;

0 commit comments

Comments
 (0)