77
88#pragma once
99
10+ #include " shared/source/helpers/debug_helpers.h"
11+
1012#include " third_party/aub_stream/headers/allocation_params.h"
1113#include " third_party/aub_stream/headers/aub_manager.h"
1214#include " third_party/aub_stream/headers/aubstream.h"
@@ -23,26 +25,29 @@ struct MockHardwareContext : public aub_stream::HardwareContext {
2325 void writeAndSubmitBatchBuffer (uint64_t gfxAddress, const void *batchBuffer, size_t size, uint32_t memoryBank, size_t pageSize) override { writeAndSubmitCalled = true ; }
2426 void submitBatchBuffer (uint64_t gfxAddress, bool overrideRingHead) override { submitCalled = true ; }
2527 void writeMemory (uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize) override {
26- writeMemoryCalled = true ;
27- writeMemoryPageSizePassed = pageSize;
28- memoryBanksPassed = memoryBanks;
28+ UNRECOVERABLE_IF (true ); // shouldnt be used
2929 }
3030 void writeMemory2 (aub_stream::AllocationParams allocationParams) override {
3131 writeMemory2Called = true ;
3232 writeMemoryPageSizePassed = allocationParams.pageSize ;
3333 memoryBanksPassed = allocationParams.memoryBanks ;
34+
35+ if (storeAllocationParams) {
36+ storedAllocationParams.push_back (allocationParams);
37+ }
3438 }
3539 void freeMemory (uint64_t gfxAddress, size_t size) override { freeMemoryCalled = true ; }
3640 void expectMemory (uint64_t gfxAddress, const void *memory, size_t size, uint32_t compareOperation) override { expectMemoryCalled = true ; }
3741 void readMemory (uint64_t gfxAddress, void *memory, size_t size, uint32_t memoryBank, size_t pageSize) override { readMemoryCalled = true ; }
3842 void dumpBufferBIN (uint64_t gfxAddress, size_t size) override { dumpBufferBINCalled = true ; }
3943 void dumpSurface (const SurfaceInfo &surfaceInfo) override { dumpSurfaceCalled = true ; }
4044
45+ std::vector<aub_stream::AllocationParams> storedAllocationParams;
46+ bool storeAllocationParams = false ;
4147 bool initializeCalled = false ;
4248 bool pollForCompletionCalled = false ;
4349 bool writeAndSubmitCalled = false ;
4450 bool submitCalled = false ;
45- bool writeMemoryCalled = false ;
4651 bool writeMemory2Called = false ;
4752 bool freeMemoryCalled = false ;
4853 bool expectMemoryCalled = false ;
@@ -105,15 +110,17 @@ class MockAubManager : public aub_stream::AubManager {
105110 }
106111
107112 void writeMemory (uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize) override {
108- writeMemoryCalled = true ;
109- hintToWriteMemory = hint;
110- writeMemoryPageSizePassed = pageSize;
113+ UNRECOVERABLE_IF (true ); // shouldnt be used
111114 }
112115
113116 void writeMemory2 (aub_stream::AllocationParams allocationParams) override {
114117 writeMemory2Called = true ;
115118 hintToWriteMemory = allocationParams.hint ;
116119 writeMemoryPageSizePassed = allocationParams.pageSize ;
120+
121+ if (storeAllocationParams) {
122+ storedAllocationParams.push_back (allocationParams);
123+ }
117124 }
118125
119126 void writePageTableEntries (uint64_t gfxAddress, size_t size, uint32_t memoryBanks, int hint,
@@ -129,6 +136,7 @@ class MockAubManager : public aub_stream::AubManager {
129136 freeMemoryCalled = true ;
130137 }
131138
139+ std::vector<aub_stream::AllocationParams> storedAllocationParams;
132140 uint32_t openCalledCnt = 0 ;
133141 std::string fileName = " " ;
134142 bool closeCalled = false ;
@@ -137,11 +145,11 @@ class MockAubManager : public aub_stream::AubManager {
137145 bool isPaused = false ;
138146 bool addCommentCalled = false ;
139147 std::string receivedComment = " " ;
140- bool writeMemoryCalled = false ;
141148 bool writeMemory2Called = false ;
142149 bool writePageTableEntriesCalled = false ;
143150 bool writePhysicalMemoryPagesCalled = false ;
144151 bool freeMemoryCalled = false ;
152+ bool storeAllocationParams = false ;
145153 uint32_t contextFlags = 0 ;
146154 int hintToWriteMemory = 0 ;
147155 size_t writeMemoryPageSizePassed = 0 ;
0 commit comments