Skip to content

Commit 4d9acf3

Browse files
Pass aubfile name to TbxCommandStreamReceiver::create and CSRWithAubDump
Change-Id: Ib10c017ce4ed2a572815053dae3f517e0dfd9eb3
1 parent e1e139f commit 4d9acf3

15 files changed

+101
-56
lines changed

runtime/command_stream/command_stream_receiver_with_aub_dump.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CommandStreamReceiverWithAUBDump : public BaseCSR {
1717

1818
public:
1919
using BaseCSR::createMemoryManager;
20-
CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment);
20+
CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, const std::string &baseName, ExecutionEnvironment &executionEnvironment);
2121
~CommandStreamReceiverWithAUBDump() override;
2222

2323
CommandStreamReceiverWithAUBDump(const CommandStreamReceiverWithAUBDump &) = delete;

runtime/command_stream/command_stream_receiver_with_aub_dump.inl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
#include "runtime/aub/aub_center.h"
89
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
910
#include "runtime/command_stream/aub_command_stream_receiver.h"
1011

@@ -13,14 +14,20 @@ namespace OCLRT {
1314
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
1415

1516
template <typename BaseCSR>
16-
CommandStreamReceiverWithAUBDump<BaseCSR>::CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment)
17+
CommandStreamReceiverWithAUBDump<BaseCSR>::CommandStreamReceiverWithAUBDump(const HardwareInfo &hwInfoIn, const std::string &baseName, ExecutionEnvironment &executionEnvironment)
1718
: BaseCSR(hwInfoIn, executionEnvironment) {
18-
aubCSR = AUBCommandStreamReceiver::create(hwInfoIn, "aubfile", false, executionEnvironment);
19+
bool createAubCsr = !executionEnvironment.aubCenter || executionEnvironment.aubCenter->getAubManager() == nullptr;
20+
21+
if (createAubCsr) {
22+
aubCSR = AUBCommandStreamReceiver::create(hwInfoIn, baseName, false, executionEnvironment);
23+
}
1924
}
2025

2126
template <typename BaseCSR>
2227
CommandStreamReceiverWithAUBDump<BaseCSR>::~CommandStreamReceiverWithAUBDump() {
23-
delete aubCSR;
28+
if (aubCSR) {
29+
delete aubCSR;
30+
}
2431
}
2532

2633
template <typename BaseCSR>

runtime/command_stream/create_command_stream_impl.cpp

Lines changed: 3 additions & 3 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
*
@@ -29,13 +29,13 @@ CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo, Exec
2929
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true, executionEnvironment);
3030
break;
3131
case CSR_TBX:
32-
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, false, executionEnvironment);
32+
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, "", false, executionEnvironment);
3333
break;
3434
case CSR_HW_WITH_AUB:
3535
commandStreamReceiver = funcCreate(*pHwInfo, true, executionEnvironment);
3636
break;
3737
case CSR_TBX_WITH_AUB:
38-
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, true, executionEnvironment);
38+
commandStreamReceiver = TbxCommandStreamReceiver::create(*pHwInfo, "aubfile", true, executionEnvironment);
3939
break;
4040
default:
4141
break;

runtime/command_stream/tbx_command_stream_receiver.cpp

Lines changed: 3 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
*
@@ -14,7 +14,7 @@ namespace OCLRT {
1414

1515
TbxCommandStreamReceiverCreateFunc tbxCommandStreamReceiverFactory[IGFX_MAX_CORE] = {};
1616

17-
CommandStreamReceiver *TbxCommandStreamReceiver::create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
17+
CommandStreamReceiver *TbxCommandStreamReceiver::create(const HardwareInfo &hwInfo, const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
1818

1919
if (hwInfo.pPlatform->eRenderCoreFamily >= IGFX_MAX_CORE) {
2020
DEBUG_BREAK_IF(!false);
@@ -23,6 +23,6 @@ CommandStreamReceiver *TbxCommandStreamReceiver::create(const HardwareInfo &hwIn
2323

2424
auto pCreate = tbxCommandStreamReceiverFactory[hwInfo.pPlatform->eRenderCoreFamily];
2525

26-
return pCreate ? pCreate(hwInfo, withAubDump, executionEnvironment) : nullptr;
26+
return pCreate ? pCreate(hwInfo, baseName, withAubDump, executionEnvironment) : nullptr;
2727
}
2828
} // namespace OCLRT

runtime/command_stream/tbx_command_stream_receiver.h

Lines changed: 3 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
*
@@ -45,10 +45,10 @@ class TbxStream : public AubMemDump::AubStream {
4545
};
4646

4747
struct TbxCommandStreamReceiver {
48-
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment);
48+
static CommandStreamReceiver *create(const HardwareInfo &hwInfo, const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment);
4949

5050
using TbxStream = OCLRT::TbxStream;
5151
};
5252

53-
typedef CommandStreamReceiver *(*TbxCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
53+
typedef CommandStreamReceiver *(*TbxCommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment);
5454
} // namespace OCLRT

runtime/command_stream/tbx_command_stream_receiver_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
5555
MOCKABLE_VIRTUAL void submitBatchBuffer(uint64_t batchBufferGpuAddress, const void *batchBuffer, size_t batchBufferSize, uint32_t memoryBank, uint64_t entryBits);
5656
MOCKABLE_VIRTUAL void pollForCompletion();
5757

58-
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);
58+
static CommandStreamReceiver *create(const HardwareInfo &hwInfoIn, const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment);
5959

6060
TbxCommandStreamReceiverHw(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment);
6161
~TbxCommandStreamReceiverHw() override;

runtime/command_stream/tbx_command_stream_receiver_hw.inl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,14 @@ void TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine() {
166166
}
167167

168168
template <typename GfxFamily>
169-
CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
169+
CommandStreamReceiver *TbxCommandStreamReceiverHw<GfxFamily>::create(const HardwareInfo &hwInfoIn, const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
170170
TbxCommandStreamReceiverHw<GfxFamily> *csr;
171171
if (withAubDump) {
172-
csr = new CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<GfxFamily>>(hwInfoIn, executionEnvironment);
172+
auto &hwHelper = HwHelper::get(hwInfoIn.pPlatform->eRenderCoreFamily);
173+
auto localMemoryEnabled = hwHelper.isLocalMemoryEnabled(hwInfoIn);
174+
executionEnvironment.initAubCenter(&hwInfoIn, localMemoryEnabled, baseName);
175+
176+
csr = new CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<GfxFamily>>(hwInfoIn, baseName, executionEnvironment);
173177
} else {
174178
csr = new TbxCommandStreamReceiverHw<GfxFamily>(hwInfoIn, executionEnvironment);
175179
}

runtime/os_interface/linux/device_command_stream.inl

Lines changed: 2 additions & 2 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
*
@@ -16,7 +16,7 @@ namespace OCLRT {
1616
template <typename GfxFamily>
1717
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
1818
if (withAubDump) {
19-
return new CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<GfxFamily>>(hwInfo, executionEnvironment);
19+
return new CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<GfxFamily>>(hwInfo, "aubfile", executionEnvironment);
2020
} else {
2121
return new DrmCommandStreamReceiver<GfxFamily>(hwInfo, executionEnvironment);
2222
}

runtime/os_interface/windows/device_command_stream.inl

Lines changed: 2 additions & 2 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
*
@@ -20,7 +20,7 @@ namespace OCLRT {
2020
template <typename GfxFamily>
2121
CommandStreamReceiver *DeviceCommandStreamReceiver<GfxFamily>::create(const HardwareInfo &hwInfo, bool withAubDump, ExecutionEnvironment &executionEnvironment) {
2222
if (withAubDump) {
23-
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>(hwInfo, executionEnvironment);
23+
return new CommandStreamReceiverWithAUBDump<WddmCommandStreamReceiver<GfxFamily>>(hwInfo, "aubfile", executionEnvironment);
2424
} else {
2525
return new WddmCommandStreamReceiver<GfxFamily>(hwInfo, executionEnvironment);
2626
}

unit_tests/aub_tests/command_queue/enqueue_write_copy_read_buffer_aub_tests.cpp

Lines changed: 18 additions & 10 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
*
@@ -45,11 +45,13 @@ void AubWriteCopyReadBuffer::runTest() {
4545
retVal));
4646
ASSERT_NE(nullptr, dstBuffer);
4747

48-
aubCsr->writeMemory(*srcBuffer->getGraphicsAllocation());
49-
aubCsr->writeMemory(*dstBuffer->getGraphicsAllocation());
48+
if (aubCsr) {
49+
aubCsr->writeMemory(*srcBuffer->getGraphicsAllocation());
50+
aubCsr->writeMemory(*dstBuffer->getGraphicsAllocation());
5051

51-
getAubCsr<FamilyType>()->expectMemoryEqual(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation()), srcMemoryInitial, bufferSize);
52-
getAubCsr<FamilyType>()->expectMemoryEqual(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), dstMemoryInitial, bufferSize);
52+
aubCsr->expectMemoryEqual(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation()), srcMemoryInitial, bufferSize);
53+
aubCsr->expectMemoryEqual(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), dstMemoryInitial, bufferSize);
54+
}
5355

5456
cl_uint numEventsInWaitList = 0;
5557
cl_event *eventWaitList = nullptr;
@@ -79,8 +81,10 @@ void AubWriteCopyReadBuffer::runTest() {
7981

8082
EXPECT_EQ(CL_SUCCESS, retVal);
8183

82-
getAubCsr<FamilyType>()->expectMemoryEqual(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation()), srcMemoryToWrite, bufferSize);
83-
getAubCsr<FamilyType>()->expectMemoryEqual(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), dstMemoryToWrite, bufferSize);
84+
if (aubCsr) {
85+
aubCsr->expectMemoryEqual(AUBFixture::getGpuPointer(srcBuffer->getGraphicsAllocation()), srcMemoryToWrite, bufferSize);
86+
aubCsr->expectMemoryEqual(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), dstMemoryToWrite, bufferSize);
87+
}
8488

8589
retVal = pCmdQ->enqueueCopyBuffer(
8690
srcBuffer.get(),
@@ -96,8 +100,10 @@ void AubWriteCopyReadBuffer::runTest() {
96100

97101
pCmdQ->flush();
98102

99-
// Destination buffer should have src buffer content
100-
getAubCsr<FamilyType>()->expectMemoryEqual(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), srcMemoryToWrite, bufferSize);
103+
if (aubCsr) {
104+
// Destination buffer should have src buffer content
105+
aubCsr->expectMemoryEqual(AUBFixture::getGpuPointer(dstBuffer->getGraphicsAllocation()), srcMemoryToWrite, bufferSize);
106+
}
101107

102108
char hostPtrMemory[] = {0, 0, 0, 0, 0, 0, 0, 0};
103109
ASSERT_EQ(bufferSize, sizeof(hostPtrMemory));
@@ -119,7 +125,9 @@ void AubWriteCopyReadBuffer::runTest() {
119125
allocation = allocation->next;
120126
}
121127

122-
getAubCsr<FamilyType>()->expectMemoryEqual(AUBFixture::getGpuPointer(allocation), srcMemoryToWrite, bufferSize);
128+
if (aubCsr) {
129+
aubCsr->expectMemoryEqual(AUBFixture::getGpuPointer(allocation), srcMemoryToWrite, bufferSize);
130+
}
123131
}
124132

125133
HWTEST_F(AubWriteCopyReadBuffer, givenTwoBuffersFilledWithPatternWhenSourceIsCopiedToDestinationThenDestinationDataValidates) {

0 commit comments

Comments
 (0)