diff options
author | Maxime Schmitt <Syllo@users.noreply.github.com> | 2023-10-21 16:56:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-21 16:56:27 +0200 |
commit | 11abc2caae719c4d5a2e857593abedf73a01a037 (patch) | |
tree | 47c0fab274442b4a939755ae4c943a39647dbd1e | |
parent | 7e94d809c5744c47026a86bd09d79dcec877d2bd (diff) | |
parent | 84c9eeb4fdeea8d6e5be57822559d8db443a157e (diff) |
Merge pull request #248 from jackyyf/hash-fix
Fix cache_entry for Intel and AMD GPU.
-rw-r--r-- | src/extract_gpuinfo_amdgpu.c | 6 | ||||
-rw-r--r-- | src/extract_gpuinfo_intel.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/extract_gpuinfo_amdgpu.c b/src/extract_gpuinfo_amdgpu.c index ef5b635..93095b9 100644 --- a/src/extract_gpuinfo_amdgpu.c +++ b/src/extract_gpuinfo_amdgpu.c @@ -80,9 +80,9 @@ static int last_libdrm_return_status = 0; static char didnt_call_gpuinfo_init[] = "uninitialized"; static const char *local_error_string = didnt_call_gpuinfo_init; -#define HASH_FIND_CLIENT(head, key_ptr, out_ptr) HASH_FIND(hh, head, key_ptr, sizeof(unsigned), out_ptr) +#define HASH_FIND_CLIENT(head, key_ptr, out_ptr) HASH_FIND(hh, head, key_ptr, sizeof(struct unique_cache_id), out_ptr) -#define HASH_ADD_CLIENT(head, in_ptr) HASH_ADD(hh, head, client_id, sizeof(unsigned), in_ptr) +#define HASH_ADD_CLIENT(head, in_ptr) HASH_ADD(hh, head, client_id, sizeof(struct unique_cache_id), in_ptr) #define SET_AMDGPU_CACHE(cachePtr, field, value) SET_VALUE(cachePtr, field, value, amdgpu_cache_) #define RESET_AMDGPU_CACHE(cachePtr, field) INVALIDATE_VALUE(cachePtr, field, amdgpu_cache_) @@ -962,7 +962,7 @@ static bool parse_drm_fdinfo_amd(struct gpu_info *info, FILE *fdinfo_file, struc #ifndef NDEBUG // We should only process one fdinfo entry per client id per update struct amdgpu_process_info_cache *cache_entry_check; - HASH_FIND_CLIENT(gpu_info->current_update_process_cache, &cid, cache_entry_check); + HASH_FIND_CLIENT(gpu_info->current_update_process_cache, &cache_entry->client_id, cache_entry_check); assert(!cache_entry_check && "We should not be processing a client id twice per update"); #endif diff --git a/src/extract_gpuinfo_intel.c b/src/extract_gpuinfo_intel.c index a57f9fb..f4dabc0 100644 --- a/src/extract_gpuinfo_intel.c +++ b/src/extract_gpuinfo_intel.c @@ -29,8 +29,8 @@ #include <string.h> #include <uthash.h> -#define HASH_FIND_CLIENT(head, key_ptr, out_ptr) HASH_FIND(hh, head, key_ptr, sizeof(unsigned), out_ptr) -#define HASH_ADD_CLIENT(head, in_ptr) HASH_ADD(hh, head, client_id, sizeof(unsigned), in_ptr) +#define HASH_FIND_CLIENT(head, key_ptr, out_ptr) HASH_FIND(hh, head, key_ptr, sizeof(struct unique_cache_id), out_ptr) +#define HASH_ADD_CLIENT(head, in_ptr) HASH_ADD(hh, head, client_id, sizeof(struct unique_cache_id), in_ptr) #define SET_INTEL_CACHE(cachePtr, field, value) SET_VALUE(cachePtr, field, value, intel_cache_) #define RESET_INTEL_CACHE(cachePtr, field) INVALIDATE_VALUE(cachePtr, field, intel_cache_) @@ -226,7 +226,7 @@ static bool parse_drm_fdinfo_intel(struct gpu_info *info, FILE *fdinfo_file, str #ifndef NDEBUG // We should only process one fdinfo entry per client id per update struct intel_process_info_cache *cache_entry_check; - HASH_FIND_CLIENT(gpu_info->current_update_process_cache, &cid, cache_entry_check); + HASH_FIND_CLIENT(gpu_info->current_update_process_cache, &cache_entry->client_id, cache_entry_check); assert(!cache_entry_check && "We should not be processing a client id twice per update"); #endif |