Optimize virtual calls #2.

Optimize frequently used virtual cost.
Compiler cannot inline those which causes overhead.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2021-12-16 12:29:09 +00:00
committed by Compute-Runtime-Automation
parent c30f65fe40
commit 62faecf6d5
13 changed files with 35 additions and 42 deletions

View File

@@ -43,7 +43,13 @@ struct DebugSession;
enum class ModuleType;
struct Device : _ze_device_handle_t {
virtual uint32_t getRootDeviceIndex() = 0;
uint32_t getRootDeviceIndex() const {
return neoDevice->getRootDeviceIndex();
}
NEO::Device *getNEODevice() const {
return this->neoDevice;
}
virtual ze_result_t canAccessPeer(ze_device_handle_t hPeerDevice, ze_bool_t *value) = 0;
virtual ze_result_t createCommandList(const ze_command_list_desc_t *desc,
ze_command_list_handle_t *commandList) = 0;
@@ -118,7 +124,6 @@ struct Device : _ze_device_handle_t {
virtual NEO::PreemptionMode getDevicePreemptionMode() const = 0;
virtual const NEO::DeviceInfo &getDeviceInfo() const = 0;
virtual NEO::Device *getNEODevice() = 0;
NEO::SourceLevelDebugger *getSourceLevelDebugger() { return getNEODevice()->getSourceLevelDebugger(); }
DebuggerL0 *getL0Debugger() {
auto debugger = getNEODevice()->getDebugger();
@@ -142,6 +147,7 @@ struct Device : _ze_device_handle_t {
virtual void storeReusableAllocation(NEO::GraphicsAllocation &alloc) = 0;
protected:
NEO::Device *neoDevice = nullptr;
bool implicitScalingCapable = false;
};