From 137790def2d1e2831b5bd13a96f7ebda9db84c8f Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Fri, 16 Sep 2022 14:29:51 +0000 Subject: [PATCH] Update aubstream Signed-off-by: Mateusz Hoppe --- manifests/manifest.yml | 2 +- shared/test/common/mocks/mock_aub_manager.h | 6 +++- .../aub_stream/headers/allocation_params.h | 30 +++++++++++-------- third_party/aub_stream/headers/aub_manager.h | 26 ++++++++++++++-- third_party/aub_stream/headers/aubstream.h | 21 ++++++++++++- third_party/aub_stream/headers/engine_node.h | 2 +- .../aub_stream/headers/hardware_context.h | 3 +- third_party/aub_stream/headers/page_info.h | 10 +++++-- .../headers/physical_allocation_info.h | 23 ++++++++++++++ .../aub_stream/headers/shared_mem_info.h | 21 +++++++++++++ 10 files changed, 121 insertions(+), 23 deletions(-) create mode 100644 third_party/aub_stream/headers/physical_allocation_info.h create mode 100644 third_party/aub_stream/headers/shared_mem_info.h diff --git a/manifests/manifest.yml b/manifests/manifest.yml index 9ee6e5f1c2..4475ead38d 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -3,7 +3,7 @@ components: branch: master dest_dir: aub_stream repository: https://github.com/intel/aubstream - revision: 11f846a14596f2ac5152055052d52baaa3721320 + revision: 8b27837933ee24a307ca90243f99699f592e2753 type: git gmmlib: dest_dir: gmmlib diff --git a/shared/test/common/mocks/mock_aub_manager.h b/shared/test/common/mocks/mock_aub_manager.h index d4afa232c5..8ca02b1673 100644 --- a/shared/test/common/mocks/mock_aub_manager.h +++ b/shared/test/common/mocks/mock_aub_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -42,6 +42,7 @@ struct MockHardwareContext : public aub_stream::HardwareContext { void readMemory(uint64_t gfxAddress, void *memory, size_t size, uint32_t memoryBank, size_t pageSize) override { readMemoryCalled = true; } void dumpBufferBIN(uint64_t gfxAddress, size_t size) override { dumpBufferBINCalled = true; } void dumpSurface(const SurfaceInfo &surfaceInfo) override { dumpSurfaceCalled = true; } + void pollForFenceCompletion() override {} std::vector storedAllocationParams; bool storeAllocationParams = false; @@ -138,6 +139,9 @@ class MockAubManager : public aub_stream::AubManager { freeMemoryCalled = true; } + bool reservePhysicalMemory(aub_stream::AllocationParams allocationParams, aub_stream::PhysicalAllocationInfo &physicalAllocInfo) override { return false; }; + bool mapGpuVa(uint64_t gfxAddress, size_t size, aub_stream::PhysicalAllocationInfo physicalAllocInfo) override { return false; }; + std::vector storedAllocationParams; uint32_t openCalledCnt = 0; std::string fileName = ""; diff --git a/third_party/aub_stream/headers/allocation_params.h b/third_party/aub_stream/headers/allocation_params.h index 835e672d59..46bd7094a9 100644 --- a/third_party/aub_stream/headers/allocation_params.h +++ b/third_party/aub_stream/headers/allocation_params.h @@ -1,34 +1,40 @@ /* -* Copyright (C) 2021 Intel Corporation -* -* SPDX-License-Identifier: MIT -* -*/ + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ #pragma once #include #include +#include namespace aub_stream { struct AllocationParams { AllocationParams() = delete; AllocationParams(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, int hint, size_t pageSize) - : gfxAddress(gfxAddress), size(size), pageSize(pageSize), memoryBanks(memoryBanks), hint(hint), memory(memory) { + : gfxAddress(gfxAddress), memory(memory), size(size), memoryBanks(memoryBanks), hint(hint), pageSize(pageSize) { additionalParams = {}; } + uint64_t gfxAddress = 0; - size_t size = 0; - size_t pageSize; - uint32_t memoryBanks; - int hint = 0; const void *memory = nullptr; + size_t size = 0; + uint32_t memoryBanks = 0; + int hint = 0; + size_t pageSize = 0; struct AdditionalParams { - bool compressionEnabled :1; + bool compressionEnabled : 1; bool uncached : 1; bool padding : 6; - } additionalParams; + }; + + AdditionalParams additionalParams; }; +static_assert(std::is_standard_layout::value, "AllocationParams is not standard layout type"); + } // namespace aub_stream diff --git a/third_party/aub_stream/headers/aub_manager.h b/third_party/aub_stream/headers/aub_manager.h index 60999dc957..670718a8c9 100644 --- a/third_party/aub_stream/headers/aub_manager.h +++ b/third_party/aub_stream/headers/aub_manager.h @@ -1,22 +1,35 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once -#include "page_info.h" - #include #include #include +#include "page_info.h" +#include "shared_mem_info.h" +#include "physical_allocation_info.h" namespace aub_stream { struct AllocationParams; struct HardwareContext; +struct AubManagerOptions { + uint32_t productFamily{}; + uint32_t devicesCount{}; + uint64_t memoryBankSize{}; + uint32_t stepping{}; + bool localMemorySupported{}; + uint32_t mode{}; + uint64_t gpuAddressSpace{}; + SharedMemoryInfo sharedMemoryInfo{}; + bool throwOnError{}; +}; + class AubManager { public: virtual ~AubManager() = default; @@ -41,6 +54,13 @@ class AubManager { bool localMemorySupported, uint32_t streamMode, uint64_t gpuAddressSpace); virtual void writeMemory2(AllocationParams allocationParams) = 0; + static AubManager *create(uint32_t productFamily, uint32_t devicesCount, uint64_t memoryBankSize, uint32_t stepping, + bool localMemorySupported, uint32_t streamMode, uint64_t gpuAddressSpace, SharedMemoryInfo sharedMemoryInfo); + + static AubManager *create(const struct AubManagerOptions &options); + + virtual bool reservePhysicalMemory(AllocationParams allocationParams, PhysicalAllocationInfo &physicalAllocInfo) = 0; + virtual bool mapGpuVa(uint64_t gfxAddress, size_t size, PhysicalAllocationInfo physicalAllocInfo) = 0; }; } // namespace aub_stream diff --git a/third_party/aub_stream/headers/aubstream.h b/third_party/aub_stream/headers/aubstream.h index 7d96502661..cd595e9c4b 100644 --- a/third_party/aub_stream/headers/aubstream.h +++ b/third_party/aub_stream/headers/aubstream.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,6 +10,7 @@ #include #include #include +#include namespace aub_stream { @@ -23,6 +24,16 @@ struct SurfaceInfo { uint32_t tilingType; bool compressed; uint32_t dumpType; + bool useClearValue; + uint32_t clearColorType; + uint32_t auxEncodingFormat; + uint32_t auxSurfaceWidth; + uint32_t auxSurfaceHeight; + uint32_t auxSurfacePitch; + uint32_t auxSurfaceQPitch; + uint32_t auxSurfaceTilingType; + uint64_t clearColorAddress; + uint64_t auxSurfaceAddress; }; namespace surftype { @@ -48,8 +59,14 @@ namespace mode { constexpr uint32_t aubFile = 0; constexpr uint32_t tbx = 1; constexpr uint32_t aubFileAndTbx = 2; +constexpr uint32_t tbxShm = 3; } // namespace mode +namespace clearColorType { +constexpr uint32_t immediate = 0; +constexpr uint32_t address = 1; +} // namespace clearColorType + using MMIOPair = std::pair; using MMIOList = std::vector; @@ -58,4 +75,6 @@ extern "C" void setTbxServerPort(uint16_t port); extern "C" void setTbxServerIp(std::string server); extern "C" void setTbxFrontdoorMode(bool frontdoor); +static_assert(std::is_pod::value, "SurfaceInfo is not POD type"); + } // namespace aub_stream diff --git a/third_party/aub_stream/headers/engine_node.h b/third_party/aub_stream/headers/engine_node.h index a02148c039..6320410fbe 100644 --- a/third_party/aub_stream/headers/engine_node.h +++ b/third_party/aub_stream/headers/engine_node.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2022 Intel Corporation * * SPDX-License-Identifier: MIT * diff --git a/third_party/aub_stream/headers/hardware_context.h b/third_party/aub_stream/headers/hardware_context.h index 9938a96cd8..c1adaca9d4 100644 --- a/third_party/aub_stream/headers/hardware_context.h +++ b/third_party/aub_stream/headers/hardware_context.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -28,6 +28,7 @@ struct HardwareContext { virtual ~HardwareContext() = default; virtual void writeMemory2(AllocationParams allocationParams) = 0; virtual void writeMMIO(uint32_t offset, uint32_t value) = 0; + virtual void pollForFenceCompletion() = 0; }; } // namespace aub_stream diff --git a/third_party/aub_stream/headers/page_info.h b/third_party/aub_stream/headers/page_info.h index 0ba135d461..31d613814b 100644 --- a/third_party/aub_stream/headers/page_info.h +++ b/third_party/aub_stream/headers/page_info.h @@ -1,12 +1,13 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ + #pragma once -#include #include +#include namespace aub_stream { @@ -16,4 +17,7 @@ struct PageInfo { bool isLocalMemory; uint32_t memoryBank; }; -} // namespace aub_stream + +static_assert(std::is_pod::value, "PageInfo is not POD type"); + +} // namespace aub_stream \ No newline at end of file diff --git a/third_party/aub_stream/headers/physical_allocation_info.h b/third_party/aub_stream/headers/physical_allocation_info.h new file mode 100644 index 0000000000..0c5a08819c --- /dev/null +++ b/third_party/aub_stream/headers/physical_allocation_info.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once +#include +#include + +namespace aub_stream { + +struct PhysicalAllocationInfo { + uint64_t physicalAddress; + size_t size; + uint32_t memoryBank; + size_t pageSize; +}; + +static_assert(std::is_pod::value, "PhysicalAllocationInfo is not POD type"); + +} // namespace aub_stream \ No newline at end of file diff --git a/third_party/aub_stream/headers/shared_mem_info.h b/third_party/aub_stream/headers/shared_mem_info.h new file mode 100644 index 0000000000..d6e414b057 --- /dev/null +++ b/third_party/aub_stream/headers/shared_mem_info.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once +#include + +namespace aub_stream { + +struct SharedMemoryInfo { + uint8_t *sysMemBase{}; + uint64_t sysMemSize{}; + + uint8_t *localMemBase{}; + uint64_t localMemSize{}; +}; + +} // namespace aub_stream