Reorder members and methods in Device class
Related-To: NEO-3938 Change-Id: I18e6ed4b301d5e221263ced5a3213b54dd21745a Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
4bcbd476d9
commit
ee544e2515
|
@ -30,15 +30,8 @@ class Device : public BaseObject<_cl_device_id> {
|
||||||
public:
|
public:
|
||||||
static const cl_ulong objectMagic = 0x8055832341AC8D08LL;
|
static const cl_ulong objectMagic = 0x8055832341AC8D08LL;
|
||||||
|
|
||||||
template <typename DeviceT, typename... ArgsT>
|
|
||||||
static DeviceT *create(ArgsT &&... args) {
|
|
||||||
DeviceT *device = new DeviceT(std::forward<ArgsT>(args)...);
|
|
||||||
return createDeviceInternals(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
Device &operator=(const Device &) = delete;
|
Device &operator=(const Device &) = delete;
|
||||||
Device(const Device &) = delete;
|
Device(const Device &) = delete;
|
||||||
|
|
||||||
~Device() override;
|
~Device() override;
|
||||||
|
|
||||||
// API entry points
|
// API entry points
|
||||||
|
@ -47,16 +40,6 @@ class Device : public BaseObject<_cl_device_id> {
|
||||||
void *paramValue,
|
void *paramValue,
|
||||||
size_t *paramValueSizeRet);
|
size_t *paramValueSizeRet);
|
||||||
|
|
||||||
bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const;
|
|
||||||
bool getHostTimer(uint64_t *hostTimestamp) const;
|
|
||||||
|
|
||||||
// Helper functions
|
|
||||||
const HardwareInfo &getHardwareInfo() const;
|
|
||||||
const DeviceInfo &getDeviceInfo() const;
|
|
||||||
|
|
||||||
EngineControl &getEngine(aub_stream::EngineType engineType, bool lowPriority);
|
|
||||||
EngineControl &getDefaultEngine();
|
|
||||||
|
|
||||||
// This helper template is meant to simplify getDeviceInfo
|
// This helper template is meant to simplify getDeviceInfo
|
||||||
template <cl_device_info Param>
|
template <cl_device_info Param>
|
||||||
void getCap(const void *&src,
|
void getCap(const void *&src,
|
||||||
|
@ -67,41 +50,55 @@ class Device : public BaseObject<_cl_device_id> {
|
||||||
void getStr(const void *&src,
|
void getStr(const void *&src,
|
||||||
size_t &size,
|
size_t &size,
|
||||||
size_t &retSize);
|
size_t &retSize);
|
||||||
|
|
||||||
MemoryManager *getMemoryManager() const;
|
|
||||||
GmmHelper *getGmmHelper() const;
|
|
||||||
|
|
||||||
OSTime *getOSTime() const { return osTime.get(); };
|
|
||||||
double getProfilingTimerResolution();
|
|
||||||
unsigned int getEnabledClVersion() const { return enabledClVersion; };
|
unsigned int getEnabledClVersion() const { return enabledClVersion; };
|
||||||
unsigned int getSupportedClVersion() const;
|
unsigned int getSupportedClVersion() const;
|
||||||
|
|
||||||
|
template <typename DeviceT, typename... ArgsT>
|
||||||
|
static DeviceT *create(ArgsT &&... args) {
|
||||||
|
DeviceT *device = new DeviceT(std::forward<ArgsT>(args)...);
|
||||||
|
return createDeviceInternals(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const;
|
||||||
|
bool getHostTimer(uint64_t *hostTimestamp) const;
|
||||||
|
const HardwareInfo &getHardwareInfo() const;
|
||||||
|
const DeviceInfo &getDeviceInfo() const;
|
||||||
|
EngineControl &getEngine(aub_stream::EngineType engineType, bool lowPriority);
|
||||||
|
EngineControl &getDefaultEngine();
|
||||||
|
MemoryManager *getMemoryManager() const;
|
||||||
|
GmmHelper *getGmmHelper() const;
|
||||||
|
OSTime *getOSTime() const { return osTime.get(); };
|
||||||
|
double getProfilingTimerResolution();
|
||||||
double getPlatformHostTimerResolution() const;
|
double getPlatformHostTimerResolution() const;
|
||||||
bool isSimulation() const;
|
bool isSimulation() const;
|
||||||
GFXCORE_FAMILY getRenderCoreFamily() const;
|
GFXCORE_FAMILY getRenderCoreFamily() const;
|
||||||
PerformanceCounters *getPerformanceCounters() { return performanceCounters.get(); }
|
PerformanceCounters *getPerformanceCounters() { return performanceCounters.get(); }
|
||||||
static decltype(&PerformanceCounters::create) createPerformanceCountersFunc;
|
|
||||||
PreemptionMode getPreemptionMode() const { return preemptionMode; }
|
PreemptionMode getPreemptionMode() const { return preemptionMode; }
|
||||||
std::vector<unsigned int> simultaneousInterops;
|
|
||||||
std::string deviceExtensions;
|
|
||||||
std::string name;
|
|
||||||
MOCKABLE_VIRTUAL bool isSourceLevelDebuggerActive() const;
|
MOCKABLE_VIRTUAL bool isSourceLevelDebuggerActive() const;
|
||||||
SourceLevelDebugger *getSourceLevelDebugger() { return executionEnvironment->sourceLevelDebugger.get(); }
|
SourceLevelDebugger *getSourceLevelDebugger() { return executionEnvironment->sourceLevelDebugger.get(); }
|
||||||
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
|
||||||
const HardwareCapabilities &getHardwareCapabilities() const { return hardwareCapabilities; }
|
const HardwareCapabilities &getHardwareCapabilities() const { return hardwareCapabilities; }
|
||||||
virtual uint32_t getRootDeviceIndex() const = 0;
|
|
||||||
bool isFullRangeSvm() const {
|
bool isFullRangeSvm() const {
|
||||||
return executionEnvironment->isFullRangeSvm();
|
return executionEnvironment->isFullRangeSvm();
|
||||||
}
|
}
|
||||||
bool areSharedSystemAllocationsAllowed() const {
|
bool areSharedSystemAllocationsAllowed() const {
|
||||||
return this->deviceInfo.sharedSystemMemCapabilities != 0u;
|
return this->deviceInfo.sharedSystemMemCapabilities != 0u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual uint32_t getRootDeviceIndex() const = 0;
|
||||||
virtual uint32_t getNumAvailableDevices() const = 0;
|
virtual uint32_t getNumAvailableDevices() const = 0;
|
||||||
virtual Device *getDeviceById(uint32_t deviceId) const = 0;
|
virtual Device *getDeviceById(uint32_t deviceId) const = 0;
|
||||||
|
|
||||||
|
static decltype(&PerformanceCounters::create) createPerformanceCountersFunc;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Device() = delete;
|
Device() = delete;
|
||||||
Device(ExecutionEnvironment *executionEnvironment);
|
Device(ExecutionEnvironment *executionEnvironment);
|
||||||
|
|
||||||
|
MOCKABLE_VIRTUAL void initializeCaps();
|
||||||
|
void setupFp64Flags();
|
||||||
|
void appendOSExtensions(std::string &deviceExtensions);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static T *createDeviceInternals(T *device) {
|
static T *createDeviceInternals(T *device) {
|
||||||
if (false == device->createDeviceImpl()) {
|
if (false == device->createDeviceImpl()) {
|
||||||
|
@ -112,27 +109,26 @@ class Device : public BaseObject<_cl_device_id> {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool createDeviceImpl();
|
virtual bool createDeviceImpl();
|
||||||
virtual DeviceBitfield getDeviceBitfieldForOsContext() const = 0;
|
|
||||||
virtual bool createEngines();
|
virtual bool createEngines();
|
||||||
bool createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engineType);
|
bool createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engineType);
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const;
|
MOCKABLE_VIRTUAL std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const;
|
||||||
MOCKABLE_VIRTUAL void initializeCaps();
|
|
||||||
void setupFp64Flags();
|
|
||||||
void appendOSExtensions(std::string &deviceExtensions);
|
|
||||||
unsigned int enabledClVersion = 0u;
|
|
||||||
|
|
||||||
HardwareCapabilities hardwareCapabilities = {};
|
virtual DeviceBitfield getDeviceBitfieldForOsContext() const = 0;
|
||||||
|
|
||||||
|
std::vector<unsigned int> simultaneousInterops;
|
||||||
|
unsigned int enabledClVersion = 0u;
|
||||||
|
std::string deviceExtensions;
|
||||||
|
std::string exposedBuiltinKernels = "";
|
||||||
|
|
||||||
DeviceInfo deviceInfo;
|
DeviceInfo deviceInfo;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
HardwareCapabilities hardwareCapabilities = {};
|
||||||
std::unique_ptr<OSTime> osTime;
|
std::unique_ptr<OSTime> osTime;
|
||||||
std::unique_ptr<DriverInfo> driverInfo;
|
std::unique_ptr<DriverInfo> driverInfo;
|
||||||
std::unique_ptr<PerformanceCounters> performanceCounters;
|
std::unique_ptr<PerformanceCounters> performanceCounters;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<CommandStreamReceiver>> commandStreamReceivers;
|
std::vector<std::unique_ptr<CommandStreamReceiver>> commandStreamReceivers;
|
||||||
std::vector<EngineControl> engines;
|
std::vector<EngineControl> engines;
|
||||||
|
|
||||||
std::string exposedBuiltinKernels = "";
|
|
||||||
|
|
||||||
PreemptionMode preemptionMode;
|
PreemptionMode preemptionMode;
|
||||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||||
uint32_t defaultEngineIndex = 0;
|
uint32_t defaultEngineIndex = 0;
|
||||||
|
|
|
@ -39,6 +39,8 @@ class MockDevice : public RootDevice {
|
||||||
using Device::engines;
|
using Device::engines;
|
||||||
using Device::executionEnvironment;
|
using Device::executionEnvironment;
|
||||||
using Device::initializeCaps;
|
using Device::initializeCaps;
|
||||||
|
using Device::name;
|
||||||
|
using Device::simultaneousInterops;
|
||||||
using RootDevice::createEngines;
|
using RootDevice::createEngines;
|
||||||
using RootDevice::subdevices;
|
using RootDevice::subdevices;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ TEST(DeviceOsTest, osSpecificExtensions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
||||||
auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(*platformDevices));
|
auto pDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||||
|
|
||||||
std::vector<unsigned int> expected = {0};
|
std::vector<unsigned int> expected = {0};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ TEST(DeviceOsTest, osSpecificExtensions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
TEST(DeviceOsTest, supportedSimultaneousInterops) {
|
||||||
auto pDevice = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(*platformDevices));
|
auto pDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
|
||||||
|
|
||||||
std::vector<unsigned int> expected = {CL_GL_CONTEXT_KHR,
|
std::vector<unsigned int> expected = {CL_GL_CONTEXT_KHR,
|
||||||
CL_WGL_HDC_KHR,
|
CL_WGL_HDC_KHR,
|
||||||
|
|
Loading…
Reference in New Issue