2018-11-22 15:16:20 +01:00
|
|
|
/*
|
2019-02-27 11:39:32 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-11-22 15:16:20 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2019-12-02 21:04:32 +01:00
|
|
|
#include "core/indirect_heap/indirect_heap.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2018-11-22 15:16:20 +01:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-11-22 15:16:20 +01:00
|
|
|
|
|
|
|
class Device;
|
|
|
|
class ExecutionEnvironment;
|
|
|
|
class GraphicsAllocation;
|
|
|
|
class InternalAllocationStorage;
|
|
|
|
class MemoryManager;
|
|
|
|
struct HardwareInfo;
|
2019-09-16 14:59:54 +02:00
|
|
|
class OsContext;
|
2018-11-22 15:16:20 +01:00
|
|
|
|
2019-08-23 11:17:09 +02:00
|
|
|
namespace ScratchSpaceConstants {
|
|
|
|
constexpr size_t scratchSpaceOffsetFor64Bit = 4096u;
|
|
|
|
}
|
|
|
|
|
2018-11-22 15:16:20 +01:00
|
|
|
class ScratchSpaceController {
|
|
|
|
public:
|
2019-11-07 14:15:04 +01:00
|
|
|
ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
2018-11-22 15:16:20 +01:00
|
|
|
virtual ~ScratchSpaceController();
|
|
|
|
|
|
|
|
GraphicsAllocation *getScratchSpaceAllocation() {
|
|
|
|
return scratchAllocation;
|
|
|
|
}
|
2019-06-27 12:59:27 +02:00
|
|
|
GraphicsAllocation *getPrivateScratchSpaceAllocation() {
|
|
|
|
return privateScratchAllocation;
|
|
|
|
}
|
2018-11-22 15:16:20 +01:00
|
|
|
virtual void setRequiredScratchSpace(void *sshBaseAddress,
|
|
|
|
uint32_t requiredPerThreadScratchSize,
|
2019-06-27 12:59:27 +02:00
|
|
|
uint32_t requiredPerThreadPrivateScratchSize,
|
2018-11-22 15:16:20 +01:00
|
|
|
uint32_t currentTaskCount,
|
2019-09-16 14:59:54 +02:00
|
|
|
OsContext &osContext,
|
2018-11-22 15:16:20 +01:00
|
|
|
bool &stateBaseAddressDirty,
|
|
|
|
bool &vfeStateDirty) = 0;
|
|
|
|
virtual uint64_t calculateNewGSH() = 0;
|
|
|
|
virtual uint64_t getScratchPatchAddress() = 0;
|
|
|
|
|
|
|
|
virtual void reserveHeap(IndirectHeap::Type heapType, IndirectHeap *&indirectHeap) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
MemoryManager *getMemoryManager() const;
|
|
|
|
|
2019-11-07 14:15:04 +01:00
|
|
|
const uint32_t rootDeviceIndex;
|
2018-11-22 15:16:20 +01:00
|
|
|
ExecutionEnvironment &executionEnvironment;
|
|
|
|
GraphicsAllocation *scratchAllocation = nullptr;
|
2019-06-27 12:59:27 +02:00
|
|
|
GraphicsAllocation *privateScratchAllocation = nullptr;
|
2018-11-22 15:16:20 +01:00
|
|
|
InternalAllocationStorage &csrAllocationStorage;
|
|
|
|
size_t scratchSizeBytes = 0;
|
2019-06-27 12:59:27 +02:00
|
|
|
size_t privateScratchSizeBytes = 0;
|
2018-11-22 15:16:20 +01:00
|
|
|
bool force32BitAllocation = false;
|
|
|
|
uint32_t computeUnitsUsedForScratch = 0;
|
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|