|
| 1 | +/* |
| 2 | + * Copyright (C) 2017-2019 Intel Corporation |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + * |
| 6 | + */ |
| 7 | + |
| 8 | +#include "unit_tests/fixtures/device_host_queue_fixture.h" |
| 9 | +#include "unit_tests/mocks/mock_context.h" |
| 10 | +#include "unit_tests/mocks/mock_device.h" |
| 11 | +#include "unit_tests/mocks/mock_device_queue.h" |
| 12 | +#include "unit_tests/mocks/mock_kernel.h" |
| 13 | + |
| 14 | +using namespace NEO; |
| 15 | +using namespace DeviceHostQueue; |
| 16 | + |
| 17 | +GEN12LPTEST_F(DeviceQueueHwTest, givenDeviceQueueWhenRunningOnCCsThenFfidSkipOffsetIsAddedToBlockKernelStartPointer) { |
| 18 | + auto device = pContext->getDevice(0); |
| 19 | + std::unique_ptr<MockParentKernel> mockParentKernel(MockParentKernel::create(*pContext)); |
| 20 | + KernelInfo *blockInfo = const_cast<KernelInfo *>(mockParentKernel->mockProgram->blockKernelManager->getBlockKernelInfo(0)); |
| 21 | + blockInfo->createKernelAllocation(device->getRootDeviceIndex(), device->getMemoryManager()); |
| 22 | + ASSERT_NE(nullptr, blockInfo->getGraphicsAllocation()); |
| 23 | + const_cast<SPatchThreadPayload *>(blockInfo->patchInfo.threadPayload)->OffsetToSkipSetFFIDGP = 0x1234; |
| 24 | + |
| 25 | + const_cast<HardwareInfo &>(device->getHardwareInfo()).platform.usRevId = REVISION_A0; |
| 26 | + |
| 27 | + uint64_t expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch() + blockInfo->patchInfo.threadPayload->OffsetToSkipSetFFIDGP; |
| 28 | + uint64_t offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, true); |
| 29 | + EXPECT_EQ(expectedOffset, offset); |
| 30 | + |
| 31 | + expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch(); |
| 32 | + offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, false); |
| 33 | + EXPECT_EQ(expectedOffset, offset); |
| 34 | + |
| 35 | + const_cast<HardwareInfo &>(device->getHardwareInfo()).platform.usRevId = REVISION_B; |
| 36 | + |
| 37 | + expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch(); |
| 38 | + offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, true); |
| 39 | + EXPECT_EQ(expectedOffset, offset); |
| 40 | + |
| 41 | + offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, false); |
| 42 | + EXPECT_EQ(expectedOffset, offset); |
| 43 | +} |
0 commit comments