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:
committad av
GitHub
förälder
a8630e866d
incheckning
3decd4f975
@@ -3454,7 +3454,17 @@ hipError_t ihipPointerGetAttributes(void* data, hipPointer_attribute attribute,
|
|||||||
|
|
||||||
switch (attribute) {
|
switch (attribute) {
|
||||||
case HIP_POINTER_ATTRIBUTE_CONTEXT : {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case HIP_POINTER_ATTRIBUTE_MEMORY_TYPE : {
|
case HIP_POINTER_ATTRIBUTE_MEMORY_TYPE : {
|
||||||
|
|||||||
Referens i nytt ärende
Block a user