Add ULT for getMemoryProperties

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2021-02-12 01:59:03 -08:00
committed by Compute-Runtime-Automation
parent 584da13ff8
commit 9dd5ae7ef6

View File

@@ -334,6 +334,44 @@ TEST_F(DeviceTest, whenGetExternalMemoryPropertiesIsCalledThenSuccessIsReturnedA
EXPECT_TRUE(externalMemoryProperties.memoryAllocationImportTypes & ZE_EXTERNAL_MEMORY_TYPE_FLAG_DMA_BUF);
}
using DeviceGetMemoryTests = DeviceTest;
TEST_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWithCountZeroThenOneIsReturned) {
uint32_t count = 0;
ze_result_t res = device->getMemoryProperties(&count, nullptr);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
EXPECT_EQ(1u, count);
}
TEST_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWithNullPtrThenInvalidArgumentIsReturned) {
uint32_t count = 0;
ze_result_t res = device->getMemoryProperties(&count, nullptr);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
EXPECT_EQ(1u, count);
count++;
res = device->getMemoryProperties(&count, nullptr);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
EXPECT_EQ(1u, count);
}
TEST_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWithNonNullPtrThenPropertiesAreReturned) {
uint32_t count = 0;
ze_result_t res = device->getMemoryProperties(&count, nullptr);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
EXPECT_EQ(1u, count);
count++;
ze_device_memory_properties_t memProperties = {};
res = device->getMemoryProperties(&count, &memProperties);
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
EXPECT_EQ(1u, count);
EXPECT_EQ(memProperties.maxClockRate, this->neoDevice->getDeviceInfo().maxClockFrequency);
EXPECT_EQ(memProperties.maxBusWidth, this->neoDevice->getDeviceInfo().addressBits);
EXPECT_EQ(memProperties.totalSize, this->neoDevice->getDeviceInfo().globalMemSize);
}
struct DeviceHasNoDoubleFp64Test : public ::testing::Test {
void SetUp() override {
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);