Skip to content

Commit ba2b8f0

Browse files
committed
AubManager to accept memory bank size in bytes
Change-Id: Ie98cb7c0c0eaf93c9a2312aa87428173421609a9
1 parent 9d9b117 commit ba2b8f0

File tree

10 files changed

+29
-20
lines changed

10 files changed

+29
-20
lines changed

runtime/aub/aub_center.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
*
@@ -14,8 +14,8 @@ namespace OCLRT {
1414
AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName) {
1515
if (DebugManager.flags.UseAubStream.get()) {
1616
auto devicesCount = AubHelper::getDevicesCount(pHwInfo);
17-
auto memoryBankSizeInGB = AubHelper::getMemBankSizeInGigabytes();
18-
aubManager.reset(createAubManager(pHwInfo->pPlatform->eRenderCoreFamily, devicesCount, memoryBankSizeInGB, localMemoryEnabled, pHwInfo->capabilityTable.aubDeviceId, aubFileName));
17+
auto memoryBankSize = AubHelper::getMemBankSize();
18+
aubManager.reset(createAubManager(pHwInfo->pPlatform->eRenderCoreFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubFileName));
1919
}
2020
addressMapper = std::make_unique<AddressMapper>();
2121
streamProvider = std::make_unique<AubFileStreamProvider>();

runtime/aub/aub_center.h

Lines changed: 2 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
*
@@ -14,7 +14,7 @@
1414

1515
namespace OCLRT {
1616
struct HardwareInfo;
17-
extern AubDump::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName);
17+
extern AubDump::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName);
1818

1919
class AubCenter {
2020
public:

runtime/aub/aub_helper.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (C) 2018 Intel Corporation
2+
* Copyright (C) 2018-2019 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "runtime/aub/aub_helper.h"
99
#include "runtime/aub_mem_dump/aub_mem_dump.h"
10+
#include "runtime/helpers/basic_math.h"
1011
#include "runtime/os_interface/debug_settings_manager.h"
1112

1213
namespace OCLRT {
@@ -26,8 +27,8 @@ uint32_t AubHelper::getMemType(uint32_t addressSpace) {
2627
return 0;
2728
}
2829

29-
uint32_t AubHelper::getMemBankSizeInGigabytes() {
30-
return 2;
30+
uint64_t AubHelper::getMemBankSize() {
31+
return 2 * GB;
3132
}
3233

3334
uint32_t AubHelper::getDevicesCount(const HardwareInfo *pHwInfo) {

runtime/aub/aub_helper.h

Lines changed: 2 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
*
@@ -30,7 +30,7 @@ class AubHelper : public NonCopyableOrMovableClass {
3030
static uint64_t getPTEntryBits(uint64_t pdEntryBits);
3131
static void checkPTEAddress(uint64_t address);
3232
static uint32_t getMemType(uint32_t addressSpace);
33-
static uint32_t getMemBankSizeInGigabytes();
33+
static uint64_t getMemBankSize();
3434
static uint32_t getDevicesCount(const HardwareInfo *pHwInfo);
3535

3636
virtual int getDataHintForPml4Entry() const = 0;

runtime/aub/aub_stream_interface.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
*
@@ -8,7 +8,7 @@
88
#include "runtime/aub/aub_center.h"
99
using namespace AubDump;
1010
namespace OCLRT {
11-
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName) {
12-
return AubDump::AubManager::create(gfxFamily, devicesCount, memoryBankSizeInGB, localMemorySupported, deviceId, aubFileName);
11+
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) {
12+
return AubDump::AubManager::create(gfxFamily, devicesCount, memoryBankSize, localMemorySupported, aubFileName);
1313
}
1414
} // namespace OCLRT

runtime/aub_mem_dump/aub_stream_stubs.cpp

Lines changed: 2 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
*
@@ -9,7 +9,7 @@
99

1010
namespace AubDump {
1111

12-
AubManager *AubManager::create(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName) {
12+
AubManager *AubManager::create(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSizeInGB, bool localMemorySupported, const std::string &aubFileName) {
1313
return nullptr;
1414
}
1515

third_party/aub_stream/headers/aub_manager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ class AubManager {
1717
public:
1818
virtual ~AubManager() = default;
1919
virtual HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) = 0;
20+
virtual void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize = 65536) = 0;
2021

21-
static AubManager *create(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName);
22+
static AubManager *create(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName);
2223
};
2324

2425
} // namespace AubDump

unit_tests/aub/aub_helper_tests.cpp

Lines changed: 7 additions & 1 deletion
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,6 +10,7 @@
1010
#include "runtime/aub_mem_dump/aub_mem_dump.h"
1111
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
1212
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
13+
#include "runtime/helpers/basic_math.h"
1314
#include "unit_tests/fixtures/device_fixture.h"
1415
#include "unit_tests/helpers/debug_manager_state_restore.h"
1516
#include "test.h"
@@ -47,6 +48,11 @@ TEST(AubHelper, WhenCreateMultipleDevicesIsSetThenGetDevicesCountReturnedCorrect
4748
EXPECT_EQ(devicesCount, 1u);
4849
}
4950

51+
TEST(AubHelper, WhenGetMemBankSizeIsCalledThenItReturnsCorrectValue) {
52+
auto memBankSize = AubHelper::getMemBankSize();
53+
EXPECT_EQ(memBankSize, 2 * GB);
54+
}
55+
5056
typedef Test<DeviceFixture> AubHelperHwTest;
5157

5258
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) {
Lines changed: 2 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
*
@@ -8,7 +8,7 @@
88
#include "unit_tests/mocks/mock_aub_manager.h"
99

1010
namespace OCLRT {
11-
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName) {
11+
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) {
1212
return new MockAubManager();
1313
}
1414
} // namespace OCLRT

unit_tests/mocks/mock_aub_manager.h

Lines changed: 2 additions & 1 deletion
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
*
@@ -37,6 +37,7 @@ class MockAubManager : public AubManager {
3737
~MockAubManager() override {}
3838

3939
HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) override { return new MockHardwareContext(); }
40+
void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize = 65536) override {}
4041

4142
protected:
4243
HardwareContext *hardwareContext = nullptr;

0 commit comments

Comments
 (0)