P4 to Git Change 1545859 by cpaquot@cpaquot-ocl-lc-lnx on 2018/04/24 16:44:17
SWDEV-145570 - [HIP] Get hipCtx_simple to pass Implemented hipCtxGetDevice hipCtxCreate must push the created context onto the context stack hipCtxDestroy must check if the top of the stack is the context being destroy and not just pop the top of the stack w/o checking. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#8 edit
이 커밋은 다음에 포함됨:
1 부모
13355e5de5
커밋
d2fbde728c
1 파일이 변경됨
+13
-3
+13
-3
@@ -71,6 +71,7 @@ hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device)
|
||||
|
||||
// Increment ref count for device primary context
|
||||
g_devices[device]->retain();
|
||||
g_ctxtStack.push(g_devices[device]);
|
||||
|
||||
return hipSuccess;
|
||||
}
|
||||
@@ -122,7 +123,7 @@ hipError_t hipCtxDestroy(hipCtx_t ctx) {
|
||||
}
|
||||
|
||||
// Need to remove the ctx of calling thread if its the top one
|
||||
if (g_context == amdContext) {
|
||||
if (!g_ctxtStack.empty() && g_ctxtStack.top() == amdContext) {
|
||||
g_ctxtStack.pop();
|
||||
}
|
||||
|
||||
@@ -188,7 +189,16 @@ hipError_t hipDriverGetVersion(int* driverVersion) {
|
||||
hipError_t hipCtxGetDevice(hipDevice_t* device) {
|
||||
HIP_INIT_API(device);
|
||||
|
||||
assert(0 && "Unimplemented");
|
||||
if (device != nullptr) {
|
||||
for (unsigned int i = 0; i < g_devices.size(); i++) {
|
||||
if (g_devices[i] == g_context) {
|
||||
*device = static_cast<hipDevice_t>(i);
|
||||
return hipSuccess;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
return hipErrorUnknown;
|
||||
}
|
||||
@@ -279,4 +289,4 @@ hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags) {
|
||||
assert(0 && "Unimplemented");
|
||||
|
||||
return hipErrorUnknown;
|
||||
}
|
||||
}
|
||||
새 이슈에서 참조
사용자 차단