P4 to Git Change 1548476 by cpaquot@cpaquot-ocl-lc-lnx on 2018/05/01 15:50:51

SWDEV-145570 - [HIP]
	Added support for null stream avoiding creating/destroying dummy streams.
	Added basic event class for hipEvent* support.
	Refactored some common functionality: No more direct access to g_context.
	Support hipStreamSynchronize(0).

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_context.cpp#9 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_device_runtime.cpp#7 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_event.cpp#3 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_event.hpp#1 add
... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#8 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#15 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#8 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#9 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_texture.cpp#7 edit
This commit is contained in:
foreman
2018-05-01 18:10:09 -04:00
parent dc1497535d
commit 61378a359c
10 changed files with 177 additions and 126 deletions
+14 -3
View File
@@ -27,9 +27,9 @@ THE SOFTWARE.
static hipError_t ihipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags) {
assert(flags == 0); // we don't handle flags yet
amd::Device* device = g_context->devices()[0];
amd::Device* device = hip::getCurrentContext()->devices()[0];
amd::HostQueue* queue = new amd::HostQueue(*g_context, *device, 0,
amd::HostQueue* queue = new amd::HostQueue(*hip::getCurrentContext(), *device, 0,
amd::CommandQueue::RealTimeDisabled,
amd::CommandQueue::Priority::Normal);
@@ -68,7 +68,14 @@ hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags) {
hipError_t hipStreamSynchronize(hipStream_t stream) {
HIP_INIT_API(stream);
amd::HostQueue* hostQueue = as_amd(reinterpret_cast<cl_command_queue>(stream))->asHostQueue();
amd::HostQueue* hostQueue;
if (stream == nullptr) {
hostQueue = hip::getNullStream();
} else {
hostQueue = as_amd(reinterpret_cast<cl_command_queue>(stream))->asHostQueue();
}
if (hostQueue == nullptr) {
return hipErrorUnknown;
}
@@ -82,6 +89,10 @@ hipError_t hipStreamSynchronize(hipStream_t stream) {
hipError_t hipStreamDestroy(hipStream_t stream) {
HIP_INIT_API(stream);
if (stream == nullptr) {
return hipErrorInvalidResourceHandle;
}
as_amd(reinterpret_cast<cl_command_queue>(stream))->release();
return hipSuccess;