Files
compute-runtime/unit_tests/gen9/bxt/test_device_caps_bxt.cpp
Brandon Fliflet 7e9ad41290 Initial commit
Change-Id: I4bf1707bd3dfeadf2c17b0a7daff372b1925ebbd
2017-12-21 00:45:38 +01:00

91 lines
3.2 KiB
C++

/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "unit_tests/fixtures/device_fixture.h"
#include "test.h"
using namespace OCLRT;
typedef Test<DeviceFixture> BxtDeviceCaps;
BXTTEST_F(BxtDeviceCaps, reportsOcl12) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_STREQ("OpenCL 1.2 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion);
}
BXTTEST_F(BxtDeviceCaps, BxtProfilingTimerResolution) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(52u, caps.profilingTimerResolution);
}
BXTTEST_F(BxtDeviceCaps, BxtClVersionSupport) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_STREQ("OpenCL 1.2 NEO ", caps.clVersion);
EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion);
auto memoryManager = pDevice->getMemoryManager();
if (is32BitOsAllocatorAvailable) {
EXPECT_TRUE(memoryManager->peekForce32BitAllocations());
EXPECT_TRUE(caps.force32BitAddressess);
} else {
EXPECT_FALSE(memoryManager->peekForce32BitAllocations());
EXPECT_FALSE(caps.force32BitAddressess);
}
}
BXTTEST_F(BxtDeviceCaps, BxtSvmCapabilities) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(0u, caps.svmCapabilities);
}
BXTTEST_F(BxtDeviceCaps, GivenBXTWhenCheckftr64KBpagesThenFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
}
typedef Test<DeviceFixture> BxtUsDeviceIdTest;
BXTTEST_F(BxtUsDeviceIdTest, isSimulationCap) {
unsigned short bxtSimulationIds[3] = {
IBXT_A_DEVICE_F0_ID,
IBXT_C_DEVICE_F0_ID,
0, // default, non-simulation
};
OCLRT::MockDevice *mockDevice = nullptr;
for (auto id : bxtSimulationIds) {
mockDevice = createWithUsDeviceId(id);
ASSERT_NE(mockDevice, nullptr);
if (id == 0)
EXPECT_FALSE(mockDevice->isSimulation());
else
EXPECT_TRUE(mockDevice->isSimulation());
delete mockDevice;
}
}
BXTTEST_F(BxtUsDeviceIdTest, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs);
}