Files
compute-runtime/opencl/test/unit_test/api/cl_svm_free_tests.inl
Filip Hazubski ed59e46c72 Update clSVMFree
Do nothing when received context does not have a device supporting svm.

Related-To: NEO-4368

Change-Id: I612fae138d6c40406a108f5b1e370eccee233236
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2020-03-05 12:34:19 +01:00

38 lines
971 B
C++

/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "cl_api_tests.h"
using namespace NEO;
typedef api_tests clSVMFreeTests;
namespace ULT {
TEST_F(clSVMFreeTests, GivenNullPtrWhenFreeingSvmThenNoAction) {
clSVMFree(
nullptr, // cl_context context
nullptr // void *svm_pointer
);
}
TEST_F(clSVMFreeTests, GivenContextWithDeviceNotSupportingSvmWhenFreeingSvmThenNoAction) {
HardwareInfo hwInfo = *platformDevices[0];
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));
}
} // namespace ULT