File: platform_tests_lin.cpp

package info (click to toggle)
intel-compute-runtime 25.48.36300.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,652 kB
  • sloc: cpp: 939,022; lisp: 2,090; sh: 722; makefile: 162; python: 21
file content (33 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (C) 2023-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/test/common/test_macros/test.h"

#include "opencl/source/cl_device/cl_device.h"
#include "opencl/test/unit_test/fixtures/platform_fixture.h"

using namespace NEO;

using GetPlatformInfoLinuxTest = Test<PlatformFixture>;

TEST_F(GetPlatformInfoLinuxTest, GivenPlatformWhenGettingInfoForExternalMemoryThenCorrectHandlesAreReturned) {
    size_t retSize = 0;
    auto retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR, 0, nullptr, &retSize);
    EXPECT_EQ(CL_SUCCESS, retVal);

    size_t handlesCount = retSize / sizeof(cl_external_memory_handle_type_khr);
    ASSERT_EQ(1u, handlesCount);

    auto handleTypes = std::make_unique<cl_external_memory_handle_type_khr[]>(handlesCount);

    retVal = clGetPlatformInfo(pPlatform, CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR,
                               retSize, handleTypes.get(), nullptr);
    EXPECT_EQ(CL_SUCCESS, retVal);

    EXPECT_EQ(pPlatform->getClDevice(0)->getDeviceInfo().externalMemorySharing, handleTypes[0]);
    EXPECT_EQ(static_cast<cl_external_memory_handle_type_khr>(CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR), handleTypes[0]);
}