SWDEV-527299 - Support HIP_POINTER_ATTRIBUTE_CONTEXT (#180)

* SWDEV-527299 - Support HIP_POINTER_ATTRIBUTE_CONTEXT

As HIP enables UVA by default, it seems we can simply expose the context to support this feature.


[ROCm/clr commit: b434fbe2bd]
This commit is contained in:
Huang, AnZhong
2025-05-09 17:34:16 +08:00
zatwierdzone przez GitHub
rodzic a8630e866d
commit 3decd4f975
+11 -1
Wyświetl plik
@@ -3454,7 +3454,17 @@ hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute,
switch (attribute) {
case HIP_POINTER_ATTRIBUTE_CONTEXT : {
status = hipErrorNotSupported;
if (memObj) {
amd::Context& context = memObj->getContext();
int devId = getDeviceID(context);
if (devId >= 0) {
*reinterpret_cast<hipCtx_t*>(data) = reinterpret_cast<hipCtx_t>(g_devices[devId]);
} else {
return hipErrorInvalidValue;
}
} else {
return hipErrorInvalidValue;
}
break;
}
case HIP_POINTER_ATTRIBUTE_MEMORY_TYPE : {