Skip to content

Commit c39f9c0

Browse files
Add addressSpace to AubFileStream::expectMemory
- addressSpace can be passed as argument from layers above where address space is known Change-Id: If9075dde4e207296df91b46eccecd0b5fa183aa9
1 parent 070bbf4 commit c39f9c0

File tree

4 files changed

+16
-59
lines changed

4 files changed

+16
-59
lines changed

runtime/aub_mem_dump/aub_mem_dump.h

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
/*
2-
* Copyright (c) 2017 - 2018, Intel Corporation
2+
* Copyright (C) 2017-2018 Intel Corporation
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
4+
* SPDX-License-Identifier: MIT
105
*
11-
* The above copyright notice and this permission notice shall be included
12-
* in all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20-
* OTHER DEALINGS IN THE SOFTWARE.
216
*/
227

238
#pragma once
@@ -150,7 +135,7 @@ struct AubFileStream : public AubStream {
150135
const std::string &getFileName() const { return fileName; }
151136
MOCKABLE_VIRTUAL void write(const char *data, size_t size);
152137
MOCKABLE_VIRTUAL void flush();
153-
MOCKABLE_VIRTUAL void expectMemory(uint64_t physAddress, const void *memory, size_t size);
138+
MOCKABLE_VIRTUAL void expectMemory(uint64_t physAddress, const void *memory, size_t size, uint32_t addressSpace);
154139
MOCKABLE_VIRTUAL bool addComment(const char *message);
155140

156141
std::ofstream fileHandle;

runtime/command_stream/aub_command_stream_receiver.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
/*
2-
* Copyright (c) 2017 - 2018, Intel Corporation
2+
* Copyright (C) 2017-2018 Intel Corporation
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
4+
* SPDX-License-Identifier: MIT
105
*
11-
* The above copyright notice and this permission notice shall be included
12-
* in all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20-
* OTHER DEALINGS IN THE SOFTWARE.
216
*/
227

238
#include "runtime/command_stream/aub_command_stream_receiver.h"
@@ -190,7 +175,7 @@ void AubFileStream::registerPoll(uint32_t registerOffset, uint32_t mask, uint32_
190175
write(reinterpret_cast<char *>(&header), sizeof(header));
191176
}
192177

193-
void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_t sizeRemaining) {
178+
void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_t sizeRemaining, uint32_t addressSpace) {
194179
using CmdServicesMemTraceMemoryCompare = AubMemDump::CmdServicesMemTraceMemoryCompare;
195180
CmdServicesMemTraceMemoryCompare header = {};
196181
header.setHeader();
@@ -200,7 +185,7 @@ void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_
200185
header.tiling = CmdServicesMemTraceMemoryCompare::TilingValues::NoTiling;
201186
header.crcCompare = CmdServicesMemTraceMemoryCompare::CrcCompareValues::NoCrc;
202187
header.dataTypeHint = CmdServicesMemTraceMemoryCompare::DataTypeHintValues::TraceNotype;
203-
header.addressSpace = CmdServicesMemTraceMemoryCompare::AddressSpaceValues::TraceNonlocal;
188+
header.addressSpace = addressSpace;
204189

205190
auto headerSize = sizeof(CmdServicesMemTraceMemoryCompare) - sizeof(CmdServicesMemTraceMemoryCompare::data);
206191
auto blockSizeMax = g_dwordCountMax * sizeof(uint32_t) - headerSize;

unit_tests/aub_tests/command_stream/aub_command_stream_fixture.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#pragma once
9+
#include "runtime/aub_mem_dump/aub_mem_dump.h"
910
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
1011
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
1112
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
@@ -62,7 +63,8 @@ class AUBCommandStreamFixture : public CommandStreamFixture {
6263

6364
aubCsr->stream->expectMemory(physAddress,
6465
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(srcAddress) + offset),
65-
size);
66+
size,
67+
AubMemDump::CmdServicesMemTraceMemoryCompare::AddressSpaceValues::TraceNonlocal);
6668
};
6769

6870
aubCsr->ppgtt->pageWalk(reinterpret_cast<uintptr_t>(gfxAddress), length, 0, 0, walker, PageTableHelper::memoryBankNotSpecified);

unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
/*
2-
* Copyright (c) 2017 - 2018, Intel Corporation
2+
* Copyright (C) 2017-2018 Intel Corporation
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
4+
* SPDX-License-Identifier: MIT
105
*
11-
* The above copyright notice and this permission notice shall be included
12-
* in all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20-
* OTHER DEALINGS IN THE SOFTWARE.
216
*/
227

238
#include "aub_mem_dump_tests.h"
@@ -120,7 +105,7 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneBytePPGTT) {
120105
OCLRT::AubHelperHw<FamilyType> aubHelperHw(false);
121106
AUB::reserveAddressPPGTT(aubFile, gAddress, sizeof(byte), physAddress, 7, aubHelperHw);
122107
AUB::addMemoryWrite(aubFile, physAddress, &byte, sizeof(byte), AubMemDump::AddressSpaceValues::TraceNonlocal);
123-
aubFile.expectMemory(physAddress, &byte, sizeof(byte));
108+
aubFile.expectMemory(physAddress, &byte, sizeof(byte), AubMemDump::AddressSpaceValues::TraceNonlocal);
124109

125110
aubFile.fileHandle.close();
126111
}
@@ -142,7 +127,7 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneByteGGTT) {
142127
AubGTTData data = {true, false};
143128
AUB::reserveAddressGGTT(aubFile, &byte, sizeof(byte), physAddress, data);
144129
AUB::addMemoryWrite(aubFile, physAddress, &byte, sizeof(byte), AubMemDump::AddressSpaceValues::TraceNonlocal);
145-
aubFile.expectMemory(physAddress, &byte, sizeof(byte));
130+
aubFile.expectMemory(physAddress, &byte, sizeof(byte), AubMemDump::AddressSpaceValues::TraceNonlocal);
146131

147132
aubFile.fileHandle.close();
148133
}
@@ -166,7 +151,7 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesPPGTT) {
166151
OCLRT::AubHelperHw<FamilyType> aubHelperHw(false);
167152
AUB::reserveAddressPPGTT(aubFile, gAddress, sizeof(bytes), physAddress, 7, aubHelperHw);
168153
AUB::addMemoryWrite(aubFile, physAddress, bytes, sizeof(bytes), AubMemDump::AddressSpaceValues::TraceNonlocal);
169-
aubFile.expectMemory(physAddress, bytes, sizeof(bytes));
154+
aubFile.expectMemory(physAddress, bytes, sizeof(bytes), AubMemDump::AddressSpaceValues::TraceNonlocal);
170155

171156
aubFile.fileHandle.close();
172157
}
@@ -188,7 +173,7 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesGGTT) {
188173
AubGTTData data = {true, false};
189174
AUB::reserveAddressGGTT(aubFile, bytes, sizeof(bytes), physAddress, data);
190175
AUB::addMemoryWrite(aubFile, physAddress, bytes, sizeof(bytes), AubMemDump::AddressSpaceValues::TraceNonlocal);
191-
aubFile.expectMemory(physAddress, bytes, sizeof(bytes));
176+
aubFile.expectMemory(physAddress, bytes, sizeof(bytes), AubMemDump::AddressSpaceValues::TraceNonlocal);
192177

193178
aubFile.fileHandle.close();
194179
}

0 commit comments

Comments
 (0)