Add hash function for AUB dump handle

Change-Id: I3f53f187a31ca47e7cf2717f328c216469171f90
This commit is contained in:
Milczarek, Slawomir
2018-10-30 16:25:33 -07:00
parent b051528258
commit 4a8f4aa47b
4 changed files with 47 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
#include "runtime/gmm_helper/resource_info.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/hash.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/string.h"
#include "runtime/memory_manager/graphics_allocation.h"
@@ -737,7 +738,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::activateAubSubCapture(const MultiDis
template <typename GfxFamily>
uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getDumpHandle() {
return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this));
return hashPtrToU32(this);
}
template <typename GfxFamily>

View File

@@ -104,4 +104,13 @@ class Hash {
protected:
uint32_t a, hi, lo;
};
template <typename T>
uint32_t hashPtrToU32(const T *src) {
auto asInt = reinterpret_cast<uintptr_t>(src);
constexpr auto m = sizeof(uintptr_t) / 8;
asInt = asInt ^ ((asInt & ~(m - 1)) >> (m * 32));
return static_cast<uint32_t>(asInt);
}
} // namespace OCLRT