Files
compute-runtime/unit_tests/api/cl_retain_release_device_tests.inl
Maciej Plewka 9e52684f5b Change namespace from OCLRT to NEO
Change-Id: If965c79d70392db26597aea4c2f3b7ae2820fe96
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
2019-03-26 15:48:19 +01:00

61 lines
1.5 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/platform/platform.h"
#include "cl_api_tests.h"
using namespace NEO;
typedef api_tests clRetainReleaseDeviceTests;
namespace ULT {
TEST_F(clRetainReleaseDeviceTests, retain) {
cl_uint numEntries = 1;
cl_device_id devices[1];
retVal = clGetDeviceIDs(pPlatform, CL_DEVICE_TYPE_GPU, numEntries, devices,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clRetainDevice(devices[0]);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clRetainDevice(devices[0]);
EXPECT_EQ(CL_SUCCESS, retVal);
cl_uint theRef;
retVal = clGetDeviceInfo(devices[0], CL_DEVICE_REFERENCE_COUNT,
sizeof(cl_uint), &theRef, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(1u, theRef);
}
TEST_F(clRetainReleaseDeviceTests, release) {
cl_uint numEntries = 1;
cl_device_id devices[1];
retVal = clGetDeviceIDs(pPlatform, CL_DEVICE_TYPE_GPU, numEntries, devices,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clReleaseDevice(devices[0]);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clReleaseDevice(devices[0]);
EXPECT_EQ(CL_SUCCESS, retVal);
cl_uint theRef;
retVal = clGetDeviceInfo(devices[0], CL_DEVICE_REFERENCE_COUNT,
sizeof(cl_uint), &theRef, NULL);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(1u, theRef);
}
} // namespace ULT