AubManager to accept memory bank size in bytes

Change-Id: Ie98cb7c0c0eaf93c9a2312aa87428173421609a9
This commit is contained in:
Milczarek, Slawomir
2019-01-01 21:14:17 +01:00
parent 9d9b11734d
commit ba2b8f05fc
10 changed files with 29 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,8 +14,8 @@ namespace OCLRT {
AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName) {
if (DebugManager.flags.UseAubStream.get()) {
auto devicesCount = AubHelper::getDevicesCount(pHwInfo);
auto memoryBankSizeInGB = AubHelper::getMemBankSizeInGigabytes();
aubManager.reset(createAubManager(pHwInfo->pPlatform->eRenderCoreFamily, devicesCount, memoryBankSizeInGB, localMemoryEnabled, pHwInfo->capabilityTable.aubDeviceId, aubFileName));
auto memoryBankSize = AubHelper::getMemBankSize();
aubManager.reset(createAubManager(pHwInfo->pPlatform->eRenderCoreFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubFileName));
}
addressMapper = std::make_unique<AddressMapper>();
streamProvider = std::make_unique<AubFileStreamProvider>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,7 @@
namespace OCLRT {
struct HardwareInfo;
extern AubDump::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName);
extern AubDump::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName);
class AubCenter {
public:

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "runtime/aub/aub_helper.h"
#include "runtime/aub_mem_dump/aub_mem_dump.h"
#include "runtime/helpers/basic_math.h"
#include "runtime/os_interface/debug_settings_manager.h"
namespace OCLRT {
@@ -26,8 +27,8 @@ uint32_t AubHelper::getMemType(uint32_t addressSpace) {
return 0;
}
uint32_t AubHelper::getMemBankSizeInGigabytes() {
return 2;
uint64_t AubHelper::getMemBankSize() {
return 2 * GB;
}
uint32_t AubHelper::getDevicesCount(const HardwareInfo *pHwInfo) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,7 +30,7 @@ class AubHelper : public NonCopyableOrMovableClass {
static uint64_t getPTEntryBits(uint64_t pdEntryBits);
static void checkPTEAddress(uint64_t address);
static uint32_t getMemType(uint32_t addressSpace);
static uint32_t getMemBankSizeInGigabytes();
static uint64_t getMemBankSize();
static uint32_t getDevicesCount(const HardwareInfo *pHwInfo);
virtual int getDataHintForPml4Entry() const = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,7 +8,7 @@
#include "runtime/aub/aub_center.h"
using namespace AubDump;
namespace OCLRT {
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName) {
return AubDump::AubManager::create(gfxFamily, devicesCount, memoryBankSizeInGB, localMemorySupported, deviceId, aubFileName);
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) {
return AubDump::AubManager::create(gfxFamily, devicesCount, memoryBankSize, localMemorySupported, aubFileName);
}
} // namespace OCLRT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,7 +9,7 @@
namespace AubDump {
AubManager *AubManager::create(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName) {
AubManager *AubManager::create(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSizeInGB, bool localMemorySupported, const std::string &aubFileName) {
return nullptr;
}

View File

@@ -17,8 +17,9 @@ class AubManager {
public:
virtual ~AubManager() = default;
virtual HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) = 0;
virtual void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize = 65536) = 0;
static AubManager *create(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName);
static AubManager *create(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName);
};
} // namespace AubDump

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,6 +10,7 @@
#include "runtime/aub_mem_dump/aub_mem_dump.h"
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
#include "runtime/helpers/basic_math.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "test.h"
@@ -47,6 +48,11 @@ TEST(AubHelper, WhenCreateMultipleDevicesIsSetThenGetDevicesCountReturnedCorrect
EXPECT_EQ(devicesCount, 1u);
}
TEST(AubHelper, WhenGetMemBankSizeIsCalledThenItReturnsCorrectValue) {
auto memBankSize = AubHelper::getMemBankSize();
EXPECT_EQ(memBankSize, 2 * GB);
}
typedef Test<DeviceFixture> AubHelperHwTest;
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,7 +8,7 @@
#include "unit_tests/mocks/mock_aub_manager.h"
namespace OCLRT {
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, size_t memoryBankSizeInGB, bool localMemorySupported, uint32_t deviceId, const std::string &aubFileName) {
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) {
return new MockAubManager();
}
} // namespace OCLRT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Intel Corporation
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -37,6 +37,7 @@ class MockAubManager : public AubManager {
~MockAubManager() override {}
HardwareContext *createHardwareContext(uint32_t device, uint32_t engine) override { return new MockHardwareContext(); }
void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize = 65536) override {}
protected:
HardwareContext *hardwareContext = nullptr;