2018-11-22 22:16:20 +08:00
|
|
|
/*
|
2020-01-28 00:28:10 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-11-22 22:16:20 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2018-11-22 22:16:20 +08:00
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-11-22 22:16:20 +08:00
|
|
|
|
|
|
|
class Device;
|
|
|
|
class ExecutionEnvironment;
|
|
|
|
class GraphicsAllocation;
|
|
|
|
class InternalAllocationStorage;
|
|
|
|
class MemoryManager;
|
|
|
|
struct HardwareInfo;
|
2019-09-16 20:59:54 +08:00
|
|
|
class OsContext;
|
2018-11-22 22:16:20 +08:00
|
|
|
|
2019-08-23 17:17:09 +08:00
|
|
|
namespace ScratchSpaceConstants {
|
|
|
|
constexpr size_t scratchSpaceOffsetFor64Bit = 4096u;
|
|
|
|
}
|
|
|
|
|
2018-11-22 22:16:20 +08:00
|
|
|
class ScratchSpaceController {
|
|
|
|
public:
|
2019-11-07 21:15:04 +08:00
|
|
|
ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
|
2018-11-22 22:16:20 +08:00
|
|
|
virtual ~ScratchSpaceController();
|
|
|
|
|
|
|
|
GraphicsAllocation *getScratchSpaceAllocation() {
|
|
|
|
return scratchAllocation;
|
|
|
|
}
|
2019-06-27 18:59:27 +08:00
|
|
|
GraphicsAllocation *getPrivateScratchSpaceAllocation() {
|
|
|
|
return privateScratchAllocation;
|
|
|
|
}
|
2018-11-22 22:16:20 +08:00
|
|
|
virtual void setRequiredScratchSpace(void *sshBaseAddress,
|
|
|
|
uint32_t requiredPerThreadScratchSize,
|
2019-06-27 18:59:27 +08:00
|
|
|
uint32_t requiredPerThreadPrivateScratchSize,
|
2018-11-22 22:16:20 +08:00
|
|
|
uint32_t currentTaskCount,
|
2019-09-16 20:59:54 +08:00
|
|
|
OsContext &osContext,
|
2018-11-22 22:16:20 +08: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 21:15:04 +08:00
|
|
|
const uint32_t rootDeviceIndex;
|
2018-11-22 22:16:20 +08:00
|
|
|
ExecutionEnvironment &executionEnvironment;
|
|
|
|
GraphicsAllocation *scratchAllocation = nullptr;
|
2019-06-27 18:59:27 +08:00
|
|
|
GraphicsAllocation *privateScratchAllocation = nullptr;
|
2018-11-22 22:16:20 +08:00
|
|
|
InternalAllocationStorage &csrAllocationStorage;
|
|
|
|
size_t scratchSizeBytes = 0;
|
2019-06-27 18:59:27 +08:00
|
|
|
size_t privateScratchSizeBytes = 0;
|
2018-11-22 22:16:20 +08:00
|
|
|
bool force32BitAllocation = false;
|
|
|
|
uint32_t computeUnitsUsedForScratch = 0;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|