mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Add use of device from context instead of platform in clCreatePipe
Change-Id: I2c42275183b7f5a096240905e7e14d39afcf9104 Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
98408e120e
commit
236ac104bb
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/unit_tests/utilities/base_object_utils.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/helpers/base_object.h"
|
||||
@@ -161,4 +162,29 @@ TEST_F(clCreatePipeTests, GivenNullContextWhenCreatingPipeThenInvalidContextErro
|
||||
|
||||
clReleaseMemObject(pipe);
|
||||
}
|
||||
|
||||
TEST(clCreatePipeTest, givenPlatformWithoutDevicesWhenClCreatePipeIsCalledThenDeviceIsTakenFromContext) {
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, 0u));
|
||||
const DeviceInfo &devInfo = device->getDeviceInfo();
|
||||
if (devInfo.svmCapabilities == 0) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
cl_device_id clDevice = device.get();
|
||||
cl_int retVal;
|
||||
auto context = ReleaseableObjectPtr<Context>(Context::create<Context>(nullptr, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
EXPECT_EQ(0u, platform()->getNumDevices());
|
||||
cl_uint packetSize = context->getDevice(0)->getDeviceInfo().pipeMaxPacketSize;
|
||||
cl_mem_flags flags = CL_MEM_READ_WRITE;
|
||||
|
||||
auto pipe = clCreatePipe(context.get(), flags, packetSize, 20, nullptr, &retVal);
|
||||
EXPECT_NE(nullptr, pipe);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
clReleaseMemObject(pipe);
|
||||
}
|
||||
} // namespace ClCreatePipeTests
|
||||
|
||||
Reference in New Issue
Block a user