mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Don't store preemption mode in Wddm.
Change-Id: I6088e5fec65b6910fefb42ec9735181867c44a1b
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType)
|
||||
OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType, PreemptionMode preemptionMode)
|
||||
: contextId(contextId), engineType(engineType) {
|
||||
if (osInterface) {
|
||||
osContextImpl = std::make_unique<OsContextLinux>(*osInterface->get()->getDrm(), engineType);
|
||||
|
||||
@@ -12,16 +12,18 @@
|
||||
|
||||
namespace OCLRT {
|
||||
class OSInterface;
|
||||
enum class PreemptionMode : uint32_t;
|
||||
|
||||
class OsContext : public ReferenceTrackedObject<OsContext> {
|
||||
public:
|
||||
class OsContextImpl;
|
||||
OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType);
|
||||
OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType, PreemptionMode preemptionMode);
|
||||
~OsContext() override;
|
||||
OsContextImpl *get() const {
|
||||
return osContextImpl.get();
|
||||
};
|
||||
|
||||
uint32_t getContextId() { return contextId; }
|
||||
uint32_t getContextId() const { return contextId; }
|
||||
EngineInstanceT &getEngineType() { return engineType; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
@@ -51,7 +52,8 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, Exec
|
||||
tempHwInfos.release();
|
||||
|
||||
executionEnvironment.initGmm(*pHWInfos);
|
||||
bool success = executionEnvironment.osInterface->get()->getWddm()->init();
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(**pHWInfos);
|
||||
bool success = executionEnvironment.osInterface->get()->getWddm()->init(preemptionMode);
|
||||
DEBUG_BREAK_IF(!success);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
OsContextWin::OsContextImpl(Wddm &wddm, uint32_t osContextId, EngineInstanceT engineType) : wddm(wddm), residencyController(wddm, osContextId) {
|
||||
OsContextWin::OsContextImpl(Wddm &wddm, uint32_t osContextId, EngineInstanceT engineType, PreemptionMode preemptionMode) : wddm(wddm), residencyController(wddm, osContextId) {
|
||||
UNRECOVERABLE_IF(!wddm.isInitialized());
|
||||
auto wddmInterface = wddm.getWddmInterface();
|
||||
if (!wddm.createContext(context, engineType)) {
|
||||
if (!wddm.createContext(context, engineType, preemptionMode)) {
|
||||
return;
|
||||
}
|
||||
if (wddmInterface->hwQueuesSupported()) {
|
||||
if (!wddmInterface->createHwQueue(wddm.getPreemptionMode(), *this)) {
|
||||
if (!wddmInterface->createHwQueue(preemptionMode, *this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -31,10 +31,10 @@ OsContextWin::~OsContextImpl() {
|
||||
wddm.destroyContext(context);
|
||||
}
|
||||
|
||||
OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType)
|
||||
OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType, PreemptionMode preemptionMode)
|
||||
: contextId(contextId), engineType(engineType) {
|
||||
if (osInterface) {
|
||||
osContextImpl = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), contextId, engineType);
|
||||
osContextImpl = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), contextId, engineType, preemptionMode);
|
||||
}
|
||||
}
|
||||
OsContext::~OsContext() = default;
|
||||
|
||||
@@ -17,7 +17,7 @@ using OsContextWin = OsContext::OsContextImpl;
|
||||
class OsContext::OsContextImpl {
|
||||
public:
|
||||
OsContextImpl() = delete;
|
||||
OsContextImpl(Wddm &wddm, uint32_t osContextId, EngineInstanceT engineType);
|
||||
OsContextImpl(Wddm &wddm, uint32_t osContextId, EngineInstanceT engineType, PreemptionMode preemptionMode);
|
||||
~OsContextImpl();
|
||||
D3DKMT_HANDLE getContext() const {
|
||||
return context;
|
||||
|
||||
@@ -156,7 +156,7 @@ bool Wddm::destroyPagingQueue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Wddm::createDevice() {
|
||||
bool Wddm::createDevice(PreemptionMode preemptionMode) {
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
D3DKMT_CREATEDEVICE CreateDevice = {{0}};
|
||||
if (adapter) {
|
||||
@@ -662,7 +662,7 @@ void Wddm::kmDafLock(WddmAllocation *wddmAllocation) {
|
||||
kmDafListener->notifyLock(featureTable->ftrKmdDaf, adapter, device, wddmAllocation->handle, 0, gdi->escape);
|
||||
}
|
||||
|
||||
bool Wddm::createContext(D3DKMT_HANDLE &context, EngineInstanceT engineType) {
|
||||
bool Wddm::createContext(D3DKMT_HANDLE &context, EngineInstanceT engineType, PreemptionMode preemptionMode) {
|
||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||
D3DKMT_CREATECONTEXTVIRTUAL CreateContext = {0};
|
||||
CREATECONTEXT_PVTDATA PrivateData = {{0}};
|
||||
@@ -911,7 +911,7 @@ bool Wddm::configureDeviceAddressSpace() {
|
||||
return gmmMemory->configureDevice(adapter, device, gdi->escape, svmSize, featureTable->ftrL3IACoherency, gfxPartition, minAddress);
|
||||
}
|
||||
|
||||
bool Wddm::init() {
|
||||
bool Wddm::init(PreemptionMode preemptionMode) {
|
||||
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
|
||||
if (!openAdapter()) {
|
||||
return false;
|
||||
@@ -928,7 +928,7 @@ bool Wddm::init() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!createDevice()) {
|
||||
if (!createDevice(preemptionMode)) {
|
||||
return false;
|
||||
}
|
||||
if (!createPagingQueue()) {
|
||||
|
||||
@@ -28,11 +28,10 @@ namespace OCLRT {
|
||||
class WddmAllocation;
|
||||
class Gdi;
|
||||
class Gmm;
|
||||
class LinearStream;
|
||||
class GmmPageTableMngr;
|
||||
struct FeatureTable;
|
||||
struct WorkaroundTable;
|
||||
struct KmDafListener;
|
||||
enum class PreemptionMode : uint32_t;
|
||||
|
||||
using OsContextWin = OsContext::OsContextImpl;
|
||||
|
||||
@@ -57,7 +56,7 @@ class Wddm {
|
||||
MOCKABLE_VIRTUAL bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim);
|
||||
bool mapGpuVirtualAddress(WddmAllocation *allocation, void *cpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
||||
bool mapGpuVirtualAddress(AllocationStorageData *allocationStorageData, bool allocation32bit, bool use64kbPages);
|
||||
MOCKABLE_VIRTUAL bool createContext(D3DKMT_HANDLE &context, EngineInstanceT engineType);
|
||||
MOCKABLE_VIRTUAL bool createContext(D3DKMT_HANDLE &context, EngineInstanceT engineType, PreemptionMode preemptionMode);
|
||||
MOCKABLE_VIRTUAL void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData);
|
||||
MOCKABLE_VIRTUAL bool freeGpuVirtualAddres(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size);
|
||||
MOCKABLE_VIRTUAL NTSTATUS createAllocation(WddmAllocation *alloc);
|
||||
@@ -88,7 +87,7 @@ class Wddm {
|
||||
|
||||
bool configureDeviceAddressSpace();
|
||||
|
||||
bool init();
|
||||
bool init(PreemptionMode preemptionMode);
|
||||
|
||||
bool isInitialized() const {
|
||||
return initialized;
|
||||
@@ -128,10 +127,6 @@ class Wddm {
|
||||
|
||||
std::unique_ptr<SettingsReader> registryReader;
|
||||
|
||||
void setPreemptionMode(PreemptionMode mode) {
|
||||
this->preemptionMode = mode;
|
||||
}
|
||||
|
||||
GmmPageTableMngr *getPageTableManager() const { return pageTableManager.get(); }
|
||||
void resetPageTableManager(GmmPageTableMngr *newPageTableManager);
|
||||
bool updateAuxTable(D3DGPU_VIRTUAL_ADDRESS gpuVa, Gmm *gmm, bool map);
|
||||
@@ -142,9 +137,6 @@ class Wddm {
|
||||
WddmInterface *getWddmInterface() const {
|
||||
return wddmInterface.get();
|
||||
}
|
||||
PreemptionMode getPreemptionMode() const {
|
||||
return preemptionMode;
|
||||
}
|
||||
|
||||
unsigned int readEnablePreemptionRegKey();
|
||||
|
||||
@@ -173,7 +165,6 @@ class Wddm {
|
||||
unsigned long hwContextId = 0;
|
||||
LUID adapterLuid;
|
||||
uintptr_t maximumApplicationAddress = 0;
|
||||
PreemptionMode preemptionMode = PreemptionMode::Disabled;
|
||||
std::unique_ptr<GmmMemory> gmmMemory;
|
||||
uintptr_t minAddress = 0;
|
||||
|
||||
@@ -181,7 +172,7 @@ class Wddm {
|
||||
MOCKABLE_VIRTUAL bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
||||
MOCKABLE_VIRTUAL bool openAdapter();
|
||||
MOCKABLE_VIRTUAL bool waitOnGPU(D3DKMT_HANDLE context);
|
||||
bool createDevice();
|
||||
bool createDevice(PreemptionMode preemptionMode);
|
||||
bool createPagingQueue();
|
||||
bool destroyPagingQueue();
|
||||
bool destroyDevice();
|
||||
|
||||
@@ -41,7 +41,6 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
|
||||
this->osInterface = executionEnvironment.osInterface.get();
|
||||
|
||||
PreemptionMode preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfoIn);
|
||||
this->wddm->setPreemptionMode(preemptionMode);
|
||||
|
||||
commandBufferHeader = new COMMAND_BUFFER_HEADER;
|
||||
*commandBufferHeader = CommandBufferHeader;
|
||||
|
||||
Reference in New Issue
Block a user