Skip to content

Commit 509ed27

Browse files
Refactor Ults finding hardware commands
- use CPU address for found dynamicStateHeap address in StateBaseAddress command Change-Id: I2d857c5a069f5a8f46169d2047cdb27efd3502b8
1 parent eaa241f commit 509ed27

File tree

10 files changed

+24
-15
lines changed

10 files changed

+24
-15
lines changed

unit_tests/command_queue/enqueue_kernel_2_tests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueWorkItemTestsWithLimitedParamSet, InterfaceDe
239239
auto IDDEnd = iddStart + cmdMIDL->getInterfaceDescriptorTotalLength();
240240
ASSERT_LE(IDDEnd, cmdSBA->getDynamicStateBufferSize() * MemoryConstants::pageSize);
241241

242-
// Extract the IDD
243-
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)(DSH + iddStart);
242+
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)cmdInterfaceDescriptorData;
244243

245244
// Validate the kernel start pointer. Technically, a kernel can start at address 0 but let's force a value.
246245
auto kernelStartPointer = ((uint64_t)IDD.getKernelStartPointerHigh() << 32) + IDD.getKernelStartPointer();

unit_tests/command_queue/enqueue_read_buffer_rect_tests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -261,8 +261,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadBufferRectTest, 2D_InterfaceDescriptorDat
261261
auto IDDEnd = iddStart + cmdMIDL->getInterfaceDescriptorTotalLength();
262262
ASSERT_LE(IDDEnd, cmdSBA->getDynamicStateBufferSize() * MemoryConstants::pageSize);
263263

264-
// Extract the IDD
265-
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)(DSH + iddStart);
264+
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)cmdInterfaceDescriptorData;
266265

267266
// Validate the kernel start pointer. Technically, a kernel can start at address 0 but let's force a value.
268267
auto kernelStartPointer = ((uint64_t)IDD.getKernelStartPointerHigh() << 32) + IDD.getKernelStartPointer();

unit_tests/command_queue/enqueue_read_buffer_tests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadBufferTypeTest, InterfaceDescriptorData)
226226
auto IDDEnd = iddStart + cmdMIDL->getInterfaceDescriptorTotalLength();
227227
ASSERT_LE(IDDEnd, cmdSBA->getDynamicStateBufferSize() * MemoryConstants::pageSize);
228228

229-
// Extract the IDD
230-
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)(DSH + iddStart);
229+
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)cmdInterfaceDescriptorData;
231230

232231
// Validate the kernel start pointer. Technically, a kernel can start at address 0 but let's force a value.
233232
auto kernelStartPointer = ((uint64_t)IDD.getKernelStartPointerHigh() << 32) + IDD.getKernelStartPointer();

unit_tests/command_queue/enqueue_write_buffer_rect_tests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2018 Intel Corporation
2+
* Copyright (C) 2017-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -235,8 +235,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteBufferRectTest, 2D_InterfaceDescriptorDa
235235
auto IDDEnd = iddStart + cmdMIDL->getInterfaceDescriptorTotalLength();
236236
ASSERT_LE(IDDEnd, cmdSBA->getDynamicStateBufferSize() * MemoryConstants::pageSize);
237237

238-
// Extract the IDD
239-
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)(DSH + iddStart);
238+
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)cmdInterfaceDescriptorData;
240239

241240
// Validate the kernel start pointer. Technically, a kernel can start at address 0 but let's force a value.
242241
auto kernelStartPointer = ((uint64_t)IDD.getKernelStartPointerHigh() << 32) + IDD.getKernelStartPointer();

unit_tests/command_queue/enqueue_write_buffer_tests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteBufferTypeTest, InterfaceDescriptorData)
226226
auto IDDEnd = iddStart + cmdMIDL->getInterfaceDescriptorTotalLength();
227227
ASSERT_LE(IDDEnd, cmdSBA->getDynamicStateBufferSize() * MemoryConstants::pageSize);
228228

229-
// Extract the IDD
230-
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)(DSH + iddStart);
229+
auto &IDD = *(INTERFACE_DESCRIPTOR_DATA *)cmdInterfaceDescriptorData;
231230

232231
// Validate the kernel start pointer. Technically, a kernel can start at address 0 but let's force a value.
233232
auto kernelStartPointer = ((uint64_t)IDD.getKernelStartPointerHigh() << 32) + IDD.getKernelStartPointer();

unit_tests/gen10/cmd_parse_gen10.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,6 @@ template struct CmdParse<GenGfxFamily>;
8383

8484
namespace OCLRT {
8585
template void HardwareParse::findHardwareCommands<CNLFamily>();
86+
template void HardwareParse::findHardwareCommands<CNLFamily>(IndirectHeap *);
8687
template const void *HardwareParse::getStatelessArgumentPointer<CNLFamily>(const Kernel &kernel, uint32_t indexArg, IndirectHeap &ioh);
8788
} // namespace OCLRT

unit_tests/gen8/cmd_parse_gen8.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ template struct CmdParse<GenGfxFamily>;
6565

6666
namespace OCLRT {
6767
template void HardwareParse::findHardwareCommands<BDWFamily>();
68+
template void HardwareParse::findHardwareCommands<BDWFamily>(IndirectHeap *);
6869
template const void *HardwareParse::getStatelessArgumentPointer<BDWFamily>(const Kernel &kernel, uint32_t indexArg, IndirectHeap &ioh);
6970
} // namespace OCLRT

unit_tests/gen9/cmd_parse_gen9.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,6 @@ template struct CmdParse<GenGfxFamily>;
8383

8484
namespace OCLRT {
8585
template void HardwareParse::findHardwareCommands<SKLFamily>();
86+
template void HardwareParse::findHardwareCommands<SKLFamily>(IndirectHeap *);
8687
template const void *HardwareParse::getStatelessArgumentPointer<SKLFamily>(const Kernel &kernel, uint32_t indexArg, IndirectHeap &ioh);
8788
} // namespace OCLRT

unit_tests/helpers/hw_parse.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ struct HardwareParse {
6464
template <typename FamilyType>
6565
void findHardwareCommands();
6666

67+
template <typename FamilyType>
68+
void findHardwareCommands(IndirectHeap *dsh);
69+
6770
template <typename FamilyType>
6871
void parseCommands(OCLRT::LinearStream &commandStream, size_t startOffset = 0) {
6972
ASSERT_LE(startOffset, commandStream.getUsed());
@@ -91,7 +94,7 @@ struct HardwareParse {
9194
previousCS = &commandStream;
9295

9396
sizeUsed = commandStream.getUsed();
94-
findHardwareCommands<FamilyType>();
97+
findHardwareCommands<FamilyType>(&commandStreamReceiver.getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 0));
9598
}
9699

97100
template <typename FamilyType>

unit_tests/helpers/hw_parse.inl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018 Intel Corporation
2+
* Copyright (C) 2018-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -10,7 +10,7 @@
1010
namespace OCLRT {
1111

1212
template <typename FamilyType>
13-
void HardwareParse::findHardwareCommands() {
13+
void HardwareParse::findHardwareCommands(IndirectHeap *dsh) {
1414
typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER;
1515
typedef typename FamilyType::PIPELINE_SELECT PIPELINE_SELECT;
1616
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
@@ -62,6 +62,9 @@ void HardwareParse::findHardwareCommands() {
6262

6363
// Extract the dynamicStateHeap
6464
dynamicStateHeap = cmdSBA->getDynamicStateBaseAddress();
65+
if (dsh && (dsh->getHeapGpuBase() == dynamicStateHeap)) {
66+
dynamicStateHeap = reinterpret_cast<uint64_t>(dsh->getCpuBase());
67+
}
6568
ASSERT_NE(0u, dynamicStateHeap);
6669
}
6770

@@ -76,6 +79,11 @@ void HardwareParse::findHardwareCommands() {
7679
}
7780
}
7881

82+
template <typename FamilyType>
83+
void HardwareParse::findHardwareCommands() {
84+
findHardwareCommands<FamilyType>(nullptr);
85+
}
86+
7987
template <typename FamilyType>
8088
const void *HardwareParse::getStatelessArgumentPointer(const Kernel &kernel, uint32_t indexArg, IndirectHeap &ioh) {
8189
typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER;

0 commit comments

Comments
 (0)