2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cl_api_tests.h"
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
typedef api_tests clSVMFreeTests;
|
|
|
|
|
|
|
|
namespace ULT {
|
|
|
|
|
2019-08-06 20:11:28 +02:00
|
|
|
TEST_F(clSVMFreeTests, GivenNullPtrWhenFreeingSvmThenNoAction) {
|
2017-12-21 00:45:38 +01:00
|
|
|
clSVMFree(
|
|
|
|
nullptr, // cl_context context
|
|
|
|
nullptr // void *svm_pointer
|
2018-06-12 21:54:39 +02:00
|
|
|
);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2020-03-04 15:44:33 +01:00
|
|
|
|
|
|
|
TEST_F(clSVMFreeTests, GivenContextWithDeviceNotSupportingSvmWhenFreeingSvmThenNoAction) {
|
2020-03-23 10:23:43 +01:00
|
|
|
HardwareInfo hwInfo = *defaultHwInfo;
|
2020-03-04 15:44:33 +01:00
|
|
|
hwInfo.capabilityTable.ftrSvm = false;
|
|
|
|
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
|
|
|
|
|
|
|
cl_device_id deviceId = clDevice.get();
|
|
|
|
auto context = clUniquePtr(Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal));
|
|
|
|
EXPECT_EQ(retVal, CL_SUCCESS);
|
|
|
|
|
|
|
|
clSVMFree(
|
|
|
|
context.get(),
|
|
|
|
reinterpret_cast<void *>(0x1234));
|
|
|
|
}
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
} // namespace ULT
|