Set proper command type in unified memory methods
Related-To: NEO-3610 Change-Id: I9758c63d0a1ee5c978259c2675519a388ffc9c4f Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
parent
58b2e91bfb
commit
ae7ec589fc
|
@ -3547,14 +3547,20 @@ cl_int clEnqueueMemsetINTEL(
|
||||||
cl_uint numEventsInWaitList,
|
cl_uint numEventsInWaitList,
|
||||||
const cl_event *eventWaitList,
|
const cl_event *eventWaitList,
|
||||||
cl_event *event) {
|
cl_event *event) {
|
||||||
return clEnqueueSVMMemFill(commandQueue,
|
auto retVal = clEnqueueSVMMemFill(commandQueue,
|
||||||
dstPtr,
|
dstPtr,
|
||||||
&value,
|
&value,
|
||||||
1u,
|
1u,
|
||||||
size,
|
size,
|
||||||
numEventsInWaitList,
|
numEventsInWaitList,
|
||||||
eventWaitList,
|
eventWaitList,
|
||||||
event);
|
event);
|
||||||
|
if (retVal == CL_SUCCESS && event) {
|
||||||
|
auto pEvent = castToObjectOrAbort<Event>(*event);
|
||||||
|
pEvent->setCmdType(CL_COMMAND_MEMSET_INTEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_int clEnqueueMemcpyINTEL(
|
cl_int clEnqueueMemcpyINTEL(
|
||||||
|
@ -3566,14 +3572,20 @@ cl_int clEnqueueMemcpyINTEL(
|
||||||
cl_uint numEventsInWaitList,
|
cl_uint numEventsInWaitList,
|
||||||
const cl_event *eventWaitList,
|
const cl_event *eventWaitList,
|
||||||
cl_event *event) {
|
cl_event *event) {
|
||||||
return clEnqueueSVMMemcpy(commandQueue,
|
auto retVal = clEnqueueSVMMemcpy(commandQueue,
|
||||||
blocking,
|
blocking,
|
||||||
dstPtr,
|
dstPtr,
|
||||||
srcPtr,
|
srcPtr,
|
||||||
size,
|
size,
|
||||||
numEventsInWaitList,
|
numEventsInWaitList,
|
||||||
eventWaitList,
|
eventWaitList,
|
||||||
event);
|
event);
|
||||||
|
if (retVal == CL_SUCCESS && event) {
|
||||||
|
auto pEvent = castToObjectOrAbort<Event>(*event);
|
||||||
|
pEvent->setCmdType(CL_COMMAND_MEMCPY_INTEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl_int clEnqueueMigrateMemINTEL(
|
cl_int clEnqueueMigrateMemINTEL(
|
||||||
|
@ -3591,6 +3603,11 @@ cl_int clEnqueueMigrateMemINTEL(
|
||||||
|
|
||||||
if (retVal == CL_SUCCESS) {
|
if (retVal == CL_SUCCESS) {
|
||||||
pCommandQueue->enqueueMarkerWithWaitList(numEventsInWaitList, eventWaitList, event);
|
pCommandQueue->enqueueMarkerWithWaitList(numEventsInWaitList, eventWaitList, event);
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
auto pEvent = castToObjectOrAbort<Event>(*event);
|
||||||
|
pEvent->setCmdType(CL_COMMAND_MIGRATEMEM_INTEL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -3611,6 +3628,11 @@ cl_int clEnqueueMemAdviseINTEL(
|
||||||
|
|
||||||
if (retVal == CL_SUCCESS) {
|
if (retVal == CL_SUCCESS) {
|
||||||
pCommandQueue->enqueueMarkerWithWaitList(numEventsInWaitList, eventWaitList, event);
|
pCommandQueue->enqueueMarkerWithWaitList(numEventsInWaitList, eventWaitList, event);
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
auto pEvent = castToObjectOrAbort<Event>(*event);
|
||||||
|
pEvent->setCmdType(CL_COMMAND_MEMADVISE_INTEL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "runtime/api/api.h"
|
#include "runtime/api/api.h"
|
||||||
#include "runtime/memory_manager/unified_memory_manager.h"
|
#include "runtime/memory_manager/unified_memory_manager.h"
|
||||||
|
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||||
#include "unit_tests/mocks/mock_context.h"
|
#include "unit_tests/mocks/mock_context.h"
|
||||||
#include "unit_tests/mocks/mock_kernel.h"
|
#include "unit_tests/mocks/mock_kernel.h"
|
||||||
|
|
||||||
|
@ -453,3 +454,71 @@ TEST(clUnifiedSharedMemoryTests, whenClEnqueueMemAdviseINTELisCalledWithProperPa
|
||||||
auto retVal = clEnqueueMemAdviseINTEL(&cmdQ, unifiedMemoryAlloc, 10, 0, 0, nullptr, nullptr);
|
auto retVal = clEnqueueMemAdviseINTEL(&cmdQ, unifiedMemoryAlloc, 10, 0, 0, nullptr, nullptr);
|
||||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class clUnifiedSharedMemoryEventTests : public CommandQueueHwFixture,
|
||||||
|
public ::testing::Test {
|
||||||
|
public:
|
||||||
|
void SetUp() override {
|
||||||
|
this->pCmdQ = createCommandQueue(nullptr);
|
||||||
|
}
|
||||||
|
void TearDown() override {
|
||||||
|
clReleaseEvent(event);
|
||||||
|
CommandQueueHwFixture::TearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
cl_event event = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(clUnifiedSharedMemoryEventTests, whenClEnqueueMigrateMemINTELIsCalledWithEventThenProperCmdTypeIsSet) {
|
||||||
|
void *unifiedMemoryAlloc = reinterpret_cast<void *>(0x1234);
|
||||||
|
|
||||||
|
auto retVal = clEnqueueMigrateMemINTEL(this->pCmdQ, unifiedMemoryAlloc, 10, 0, 0, nullptr, &event);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
constexpr cl_command_type expectedCmd = CL_COMMAND_MIGRATEMEM_INTEL;
|
||||||
|
cl_command_type actualCmd = castToObjectOrAbort<Event>(event)->getCommandType();
|
||||||
|
EXPECT_EQ(expectedCmd, actualCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(clUnifiedSharedMemoryEventTests, whenClEnqueueMemAdviseINTELIsCalledWithEventThenProperCmdTypeIsSet) {
|
||||||
|
void *unifiedMemoryAlloc = reinterpret_cast<void *>(0x1234);
|
||||||
|
|
||||||
|
auto retVal = clEnqueueMemAdviseINTEL(this->pCmdQ, unifiedMemoryAlloc, 10, 0, 0, nullptr, &event);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
constexpr cl_command_type expectedCmd = CL_COMMAND_MEMADVISE_INTEL;
|
||||||
|
cl_command_type actualCmd = castToObjectOrAbort<Event>(event)->getCommandType();
|
||||||
|
EXPECT_EQ(expectedCmd, actualCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(clUnifiedSharedMemoryEventTests, whenClEnqueueMemcpyINTELIsCalledWithEventThenProperCmdTypeIsSet) {
|
||||||
|
cl_int retVal = CL_SUCCESS;
|
||||||
|
|
||||||
|
auto unfiedMemoryDst = clSharedMemAllocINTEL(this->context, this->context->getDevice(0u), nullptr, 400, 0, &retVal);
|
||||||
|
auto unfiedMemorySrc = clSharedMemAllocINTEL(this->context, this->context->getDevice(0u), nullptr, 400, 0, &retVal);
|
||||||
|
|
||||||
|
retVal = clEnqueueMemcpyINTEL(this->pCmdQ, 0, unfiedMemoryDst, unfiedMemorySrc, 400u, 0, nullptr, &event);
|
||||||
|
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||||
|
|
||||||
|
constexpr cl_command_type expectedCmd = CL_COMMAND_MEMCPY_INTEL;
|
||||||
|
cl_command_type actualCmd = castToObjectOrAbort<Event>(event)->getCommandType();
|
||||||
|
EXPECT_EQ(expectedCmd, actualCmd);
|
||||||
|
|
||||||
|
clMemFreeINTEL(this->context, unfiedMemoryDst);
|
||||||
|
clMemFreeINTEL(this->context, unfiedMemorySrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(clUnifiedSharedMemoryEventTests, whenClEnqueueMemsetINTELIsCalledWithEventThenProperCmdTypeIsSet) {
|
||||||
|
cl_int retVal = CL_SUCCESS;
|
||||||
|
|
||||||
|
auto unfiedMemorySharedAllocation = clSharedMemAllocINTEL(this->context, this->context->getDevice(0u), nullptr, 400, 0, &retVal);
|
||||||
|
cl_int setValue = 12u;
|
||||||
|
|
||||||
|
retVal = clEnqueueMemsetINTEL(this->pCmdQ, unfiedMemorySharedAllocation, setValue, 400u, 0, nullptr, &event);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
|
||||||
|
constexpr cl_command_type expectedCmd = CL_COMMAND_MEMSET_INTEL;
|
||||||
|
cl_command_type actualCmd = castToObjectOrAbort<Event>(event)->getCommandType();
|
||||||
|
EXPECT_EQ(expectedCmd, actualCmd);
|
||||||
|
clMemFreeINTEL(this->context, unfiedMemorySharedAllocation);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue