mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 17:00:59 +08:00
For using fixed width integer types[1], the `<cstdint>`[2] C++ header needs to be explicitly included with GCC 15 due to changes[3] in libstdc++. For details, see the documentation[4] about porting to GCC 15. [1] https://en.cppreference.com/w/cpp/types/integer [2] https://en.cppreference.com/w/cpp/header/cstdint [3] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3a817a4a5a6d94da9127af3be9f84 [4] https://gcc.gnu.org/gcc-15/porting_to.html#cxx Signed-off-by: Daniel Bermond <dbermond@archlinux.org>
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2019-2025 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace NEO {
|
|
|
|
struct OSMemory {
|
|
public:
|
|
struct ReservedCpuAddressRange {
|
|
void *originalPtr = nullptr;
|
|
void *alignedPtr = nullptr;
|
|
size_t sizeToReserve = 0;
|
|
size_t actualReservedSize = 0;
|
|
};
|
|
|
|
struct MappedRegion {
|
|
uint64_t start = 0, end = 0;
|
|
};
|
|
|
|
using MemoryMaps = std::vector<OSMemory::MappedRegion>;
|
|
|
|
public:
|
|
static std::unique_ptr<OSMemory> create();
|
|
|
|
virtual ~OSMemory() = default;
|
|
|
|
MOCKABLE_VIRTUAL ReservedCpuAddressRange reserveCpuAddressRange(size_t sizeToReserve, size_t alignment);
|
|
MOCKABLE_VIRTUAL ReservedCpuAddressRange reserveCpuAddressRange(void *baseAddress, size_t sizeToReserve, size_t alignment);
|
|
|
|
MOCKABLE_VIRTUAL void releaseCpuAddressRange(const ReservedCpuAddressRange &reservedCpuAddressRange);
|
|
virtual void getMemoryMaps(MemoryMaps &memoryMaps) = 0;
|
|
|
|
virtual void *osReserveCpuAddressRange(void *baseAddress, size_t sizeToReserve, bool topDownHint) = 0;
|
|
virtual void osReleaseCpuAddressRange(void *reservedCpuAddressRange, size_t reservedSize) = 0;
|
|
};
|
|
|
|
} // namespace NEO
|