2022-08-02 16:08:54 +00:00
|
|
|
/*
|
2025-02-17 11:26:17 +00:00
|
|
|
* Copyright (C) 2022-2025 Intel Corporation
|
2022-08-02 16:08:54 +00:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
|
|
|
|
#include "shared/source/utilities/spinlock.h"
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace NEO {
|
2023-01-13 15:18:40 +00:00
|
|
|
struct SvmAllocationData;
|
2022-08-02 16:08:54 +00:00
|
|
|
|
2022-11-30 00:48:56 +00:00
|
|
|
class CommandStreamReceiver;
|
2022-08-02 16:08:54 +00:00
|
|
|
class Device;
|
|
|
|
|
class SVMAllocsManager;
|
|
|
|
|
|
2022-11-22 12:33:16 +00:00
|
|
|
struct PrefetchContext {
|
2025-03-12 05:18:52 +01:00
|
|
|
std::vector<const void *> allocations;
|
2022-11-22 12:33:16 +00:00
|
|
|
SpinLock lock;
|
|
|
|
|
};
|
|
|
|
|
|
2025-02-17 11:26:17 +00:00
|
|
|
class PrefetchManager : public NonCopyableAndNonMovableClass {
|
2022-08-02 16:08:54 +00:00
|
|
|
public:
|
|
|
|
|
static std::unique_ptr<PrefetchManager> create();
|
|
|
|
|
|
|
|
|
|
virtual ~PrefetchManager() = default;
|
|
|
|
|
|
2025-03-12 05:18:52 +01:00
|
|
|
void insertAllocation(PrefetchContext &context, const void *usmPtr, SvmAllocationData &allocData);
|
2022-08-02 16:08:54 +00:00
|
|
|
|
2022-11-30 00:48:56 +00:00
|
|
|
MOCKABLE_VIRTUAL void migrateAllocationsToGpu(PrefetchContext &context, SVMAllocsManager &unifiedMemoryManager, Device &device, CommandStreamReceiver &csr);
|
2022-08-02 16:08:54 +00:00
|
|
|
|
2022-11-22 12:33:16 +00:00
|
|
|
MOCKABLE_VIRTUAL void removeAllocations(PrefetchContext &context);
|
2022-08-02 16:08:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace NEO
|