Remove not needed methods from Device.

Change-Id: I179089a4b248ba1ebd6502e001fda18238c4767b
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-08-26 15:36:24 +02:00
committed by sys_ocldev
parent 7a5bc461eb
commit 7749f28f70
13 changed files with 38 additions and 87 deletions

View File

@@ -29,20 +29,4 @@ void DebugSettingsManager<DebugLevel>::writeToFile(std::string filename, const c
// Global Debug Settings Manager
DebugSettingsManager<globalDebugFunctionalityLevel> DebugManager;
// Global table of hardware prefixes
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = {
nullptr,
};
// Global table of family names
const char *familyName[IGFX_MAX_CORE] = {
nullptr,
};
// Global table of family names
bool familyEnabled[IGFX_MAX_CORE] = {
false,
};
} // namespace NEO

View File

@@ -195,8 +195,8 @@ std::unique_ptr<Program> BuiltinsLib::createProgramFromCode(const BuiltinCode &b
BuiltinResourceT BuiltinsLib::getBuiltinResource(EBuiltInOps::Type builtin, BuiltinCode::ECodeType requestedCodeType, Device &device) {
BuiltinResourceT bc;
std::string resourceNameGeneric = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType));
std::string resourceNameForPlatformType = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getFamilyNameWithType());
std::string resourceNameForPlatformTypeAndStepping = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getFamilyNameWithType(),
std::string resourceNameForPlatformType = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), getFamilyNameWithType(device.getHardwareInfo()));
std::string resourceNameForPlatformTypeAndStepping = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), getFamilyNameWithType(device.getHardwareInfo()),
device.getHardwareInfo().platform.usRevId);
for (auto &rn : {resourceNameForPlatformTypeAndStepping, resourceNameForPlatformType, resourceNameGeneric}) { // first look for dedicated version, only fallback to generic one

View File

@@ -7,29 +7,19 @@
#include "runtime/device/device.h"
#include "runtime/built_ins/built_ins.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/device_command_stream.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/command_stream/preemption.h"
#include "runtime/compiler_interface/compiler_interface.h"
#include "runtime/device/device_vector.h"
#include "runtime/device/driver_info.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/options.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/os_interface/os_context.h"
#include "runtime/os_interface/os_interface.h"
#include "runtime/os_interface/os_time.h"
#include "runtime/source_level_debugger/source_level_debugger.h"
#include "hw_cmds.h"
#include <cstring>
#include <map>
namespace NEO {
decltype(&PerformanceCounters::create) Device::createPerformanceCountersFunc = PerformanceCounters::create;
@@ -51,21 +41,6 @@ void DeviceVector::toDeviceIDs(std::vector<cl_device_id> &devIDs) {
}
}
CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment);
// Global table of hardware prefixes
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = {
nullptr,
};
// Global table of family names
const char *familyName[IGFX_MAX_CORE] = {
nullptr,
};
// Global table of family names
bool familyEnabled[IGFX_MAX_CORE] = {
false,
};
Device::Device(ExecutionEnvironment *executionEnvironment, uint32_t deviceIndex)
: executionEnvironment(executionEnvironment), deviceIndex(deviceIndex) {
memset(&deviceInfo, 0, sizeof(deviceInfo));
@@ -200,10 +175,6 @@ const DeviceInfo &Device::getDeviceInfo() const {
return deviceInfo;
}
DeviceInfo *Device::getMutableDeviceInfo() {
return &deviceInfo;
}
void *Device::getSLMWindowStartAddress() {
prepareSLMWindow();
return this->slmWindowStartAddress;
@@ -216,14 +187,7 @@ void Device::prepareSLMWindow() {
}
const char *Device::getProductAbbrev() const {
return hardwarePrefix[executionEnvironment->getHardwareInfo()->platform.eProductFamily];
}
const std::string Device::getFamilyNameWithType() const {
auto &hwInfo = getHardwareInfo();
std::string platformName = familyName[hwInfo.platform.eRenderCoreFamily];
platformName.append(hwInfo.capabilityTable.platformType);
return platformName;
return hardwarePrefix[getHardwareInfo().platform.eProductFamily];
}
double Device::getProfilingTimerResolution() {

View File

@@ -11,23 +11,11 @@
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/base_object.h"
#include "runtime/helpers/engine_control.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/os_interface/performance_counters.h"
#include "engine_node.h"
#include <vector>
namespace NEO {
class GraphicsAllocation;
class MemoryManager;
class OSTime;
class DriverInfo;
struct HardwareInfo;
class SourceLevelDebugger;
class OsContext;
template <>
struct OpenCLObjectMapper<_cl_device_id> {
@@ -61,20 +49,15 @@ class Device : public BaseObject<_cl_device_id> {
// Helper functions
const HardwareInfo &getHardwareInfo() const;
const DeviceInfo &getDeviceInfo() const;
DeviceInfo *getMutableDeviceInfo();
MOCKABLE_VIRTUAL const WorkaroundTable *getWaTable() const;
void *getSLMWindowStartAddress();
void prepareSLMWindow();
void setForce32BitAddressing(bool value) {
deviceInfo.force32BitAddressess = value;
}
EngineControl &getEngine(aub_stream::EngineType engineType, bool lowPriority);
EngineControl &getDefaultEngine();
const char *getProductAbbrev() const;
const std::string getFamilyNameWithType() const;
// This helper template is meant to simplify getDeviceInfo
template <cl_device_info Param>
@@ -99,7 +82,6 @@ class Device : public BaseObject<_cl_device_id> {
unsigned int getSupportedClVersion() const;
double getPlatformHostTimerResolution() const;
bool isSimulation() const;
void checkPriorityHints();
GFXCORE_FAMILY getRenderCoreFamily() const;
PerformanceCounters *getPerformanceCounters() { return performanceCounters.get(); }
static decltype(&PerformanceCounters::create) createPerformanceCountersFunc;

View File

@@ -19,6 +19,19 @@ HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *feature
: platform(*platform), featureTable(*featureTable), workaroundTable(*workaroundTable), gtSystemInfo(*gtSystemInfo), capabilityTable(capabilityTable) {
}
// Global table of hardware prefixes
const char *hardwarePrefix[IGFX_MAX_PRODUCT] = {
nullptr,
};
// Global table of family names
const char *familyName[IGFX_MAX_CORE] = {
nullptr,
};
// Global table of family names
bool familyEnabled[IGFX_MAX_CORE] = {
false,
};
const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {};
void (*hardwareInfoSetup[IGFX_MAX_PRODUCT])(HardwareInfo *, bool, const std::string &) = {
nullptr,
@@ -45,4 +58,10 @@ aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo) {
? hwInfo.capabilityTable.defaultEngineType
: static_cast<aub_stream::EngineType>(DebugManager.flags.NodeOrdinal.get());
}
const std::string getFamilyNameWithType(const HardwareInfo &hwInfo) {
std::string platformName = familyName[hwInfo.platform.eRenderCoreFamily];
platformName.append(hwInfo.capabilityTable.platformType);
return platformName;
}
} // namespace NEO

View File

@@ -96,4 +96,5 @@ struct EnableGfxFamilyHw {
bool getHwInfoForPlatformString(std::string &platform, const HardwareInfo *&hwInfoIn);
aub_stream::EngineType getChosenEngineType(const HardwareInfo &hwInfo);
const std::string getFamilyNameWithType(const HardwareInfo &hwInfo);
} // namespace NEO

View File

@@ -48,7 +48,7 @@ TEST(Sip, WhenRequestingCsrSipKernelThenProperCompilerInternalOptionsAreReturned
TEST(Sip, When32BitAddressesAreNotBeingForcedThenSipLlHasSameBitnessAsHostApplication) {
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
EXPECT_NE(nullptr, mockDevice);
mockDevice->setForce32BitAddressing(false);
mockDevice->deviceInfo.force32BitAddressess = false;
const char *src = getSipLlSrc(*mockDevice);
ASSERT_NE(nullptr, src);
if (sizeof(void *) == 8) {
@@ -64,7 +64,7 @@ TEST(Sip, When32BitAddressesAreNotBeingForcedThenSipLlHasSameBitnessAsHostApplic
TEST(Sip, When32BitAddressesAreBeingForcedThenSipLlHas32BitAddresses) {
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
EXPECT_NE(nullptr, mockDevice);
mockDevice->setForce32BitAddressing(true);
mockDevice->deviceInfo.force32BitAddressess = true;
const char *src = getSipLlSrc(*mockDevice);
ASSERT_NE(nullptr, src);
EXPECT_NE(nullptr, strstr(src, "target datalayout = \"e-p:32:32:32\""));

View File

@@ -35,7 +35,7 @@ class EnqueueDebugKernelTest : public ProgramSimpleFixture,
pDevice->executionEnvironment->sourceLevelDebugger.reset(new SourceLevelDebugger(nullptr));
if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) {
pDevice->getMutableDeviceInfo()->sourceLevelDebuggerActive = true;
pDevice->deviceInfo.sourceLevelDebuggerActive = true;
std::string filename;
std::string kernelOption(CompilerOptions::debugKernelEnable);
KernelFilenameHelper::getKernelFilenameFromInternalOption(kernelOption, filename);

View File

@@ -633,9 +633,9 @@ TEST(localWorkSizeTest, givenDispatchInfoWhenWorkSizeInfoIsCreatedThenItHasCorre
auto threadsPerEu = platformDevices[0]->gtSystemInfo.ThreadCount / platformDevices[0]->gtSystemInfo.EUCount;
auto euPerSubSlice = platformDevices[0]->gtSystemInfo.ThreadCount / platformDevices[0]->gtSystemInfo.MaxEuPerSubSlice;
auto deviceInfo = device.getMutableDeviceInfo();
deviceInfo->maxNumEUsPerSubSlice = euPerSubSlice;
deviceInfo->numThreadsPerEU = threadsPerEu;
auto &deviceInfo = device.deviceInfo;
deviceInfo.maxNumEUsPerSubSlice = euPerSubSlice;
deviceInfo.numThreadsPerEU = threadsPerEu;
WorkSizeInfo workSizeInfo(dispatchInfo);
EXPECT_EQ(workSizeInfo.numThreadsPerSubSlice, threadsPerEu * euPerSubSlice);

View File

@@ -217,7 +217,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci
}
TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlignmentWhenValidatingSurfaceFormatThenReturnError) {
context.getDevice(0u)->getMutableDeviceInfo()->imagePitchAlignment = 128;
static_cast<MockDevice *>(context.getDevice(0))->deviceInfo.imagePitchAlignment = 128;
imageDesc.image_width = 64;
imageDesc.image_height = castToObject<Buffer>(imageDesc.mem_object)->getSize() / imageDesc.image_width;
cl_mem_flags flags = CL_MEM_READ_ONLY;

View File

@@ -22,6 +22,7 @@ class MockDevice : public Device {
public:
using Device::createDeviceInternals;
using Device::createEngine;
using Device::deviceInfo;
using Device::enabledClVersion;
using Device::engines;
using Device::executionEnvironment;

View File

@@ -165,7 +165,7 @@ TEST_F(MidThreadPreemptionTests, allowMidThreadPreemptionNullKernel) {
TEST_F(MidThreadPreemptionTests, allowMidThreadPreemptionDeviceSupportPreemptionOnVmeKernel) {
device->setPreemptionMode(PreemptionMode::MidThread);
device->getMutableDeviceInfo()->vmeAvcSupportsPreemption = true;
device->deviceInfo.vmeAvcSupportsPreemption = true;
kernelInfo->isVmeWorkload = true;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
EXPECT_TRUE(PreemptionHelper::allowMidThreadPreemption(kernel.get(), *device));
@@ -185,7 +185,7 @@ TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByKernel) {
TEST_F(MidThreadPreemptionTests, disallowMidThreadPreemptionByVmeKernel) {
device->setPreemptionMode(PreemptionMode::MidThread);
device->getMutableDeviceInfo()->vmeAvcSupportsPreemption = false;
device->deviceInfo.vmeAvcSupportsPreemption = false;
kernelInfo->isVmeWorkload = true;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
EXPECT_FALSE(PreemptionHelper::allowMidThreadPreemption(kernel.get(), *device));
@@ -207,7 +207,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByKernel) {
TEST_F(MidThreadPreemptionTests, taskPreemptionDisallowMidThreadByVmeKernel) {
kernelInfo->isVmeWorkload = true;
device->getMutableDeviceInfo()->vmeAvcSupportsPreemption = false;
device->deviceInfo.vmeAvcSupportsPreemption = false;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(*device, kernel.get());
@@ -226,7 +226,7 @@ TEST_F(MidThreadPreemptionTests, taskPreemptionAllowDeviceSupportsPreemptionOnVm
executionEnvironment->DisableMidThreadPreemption = 0;
kernelInfo->isVmeWorkload = true;
kernel.reset(new MockKernel(program.get(), *kernelInfo, *device));
device->getMutableDeviceInfo()->vmeAvcSupportsPreemption = true;
device->deviceInfo.vmeAvcSupportsPreemption = true;
device->setPreemptionMode(PreemptionMode::MidThread);
PreemptionMode outMode = PreemptionHelper::taskPreemptionMode(*device, kernel.get());
EXPECT_EQ(PreemptionMode::MidThread, outMode);

View File

@@ -1702,9 +1702,9 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptions) {
}
TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsForced20) {
auto defaultVersion = pDevice->getMutableDeviceInfo()->clVersion;
auto defaultVersion = pDevice->deviceInfo.clVersion;
pDevice->getMutableDeviceInfo()->clVersion = "OpenCL 2.0 ";
pDevice->deviceInfo.clVersion = "OpenCL 2.0 ";
if (pDevice) {
MockProgram program(*pDevice->getExecutionEnvironment(), pContext, false);
char paramValue[32];
@@ -1712,7 +1712,7 @@ TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsForced20) {
ASSERT_EQ(std::string(paramValue), "OpenCL 2.0 ");
EXPECT_THAT(program.getInternalOptions(), testing::HasSubstr(std::string("-ocl-version=200")));
}
pDevice->getMutableDeviceInfo()->clVersion = defaultVersion;
pDevice->deviceInfo.clVersion = defaultVersion;
}
TEST_F(ProgramTests, ProgramCtorSetsProperInternalOptionsWhenStatelessToStatefulIsDisabled) {