Introducing hip::Device which wraps around amd::Context and deviceId

Change-Id: Ie35a6edb65c001b35eb9f5d2af26e765dc41c00e
This commit is contained in:
Christophe Paquot
2020-02-18 12:36:12 -08:00
committed by Christophe Paquot
parent 6ec4eb34f4
commit 9630e40beb
9 changed files with 145 additions and 120 deletions
+4 -6
View File
@@ -50,12 +50,12 @@ void syncStreams() {
}
}
Stream::Stream(amd::Device* dev, amd::Context* ctx, amd::CommandQueue::Priority p, unsigned int f, int d) :
queue(nullptr), device(dev), context(ctx), priority(p), flags(f), deviceId(d) {}
Stream::Stream(hip::Device* dev, amd::CommandQueue::Priority p, unsigned int f) :
queue(nullptr), device(dev), priority(p), flags(f) {}
void Stream::create() {
cl_command_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
queue = new amd::HostQueue(*context, *device, properties,
queue = new amd::HostQueue(*device->asContext(), *device->devices()[0], properties,
amd::CommandQueue::RealTimeDisabled, priority);
assert(queue != nullptr);
queue->create();
@@ -93,9 +93,7 @@ void CL_CALLBACK ihipStreamCallback(cl_event event, cl_int command_exec_status,
}
static hipError_t ihipStreamCreate(hipStream_t *stream, unsigned int flags, amd::CommandQueue::Priority priority) {
amd::Device* device = hip::getCurrentContext()->devices()[0];
hip::Stream* hStream = new hip::Stream(device, hip::getCurrentContext(), priority, flags, ihipGetDevice());
hip::Stream* hStream = new hip::Stream(hip::getCurrentDevice(), priority, flags);
if (hStream == nullptr) {
return hipErrorOutOfMemory;