diff --git a/offline_compiler/helper.cpp b/offline_compiler/helper.cpp index 3f789a93be..fd2c516471 100644 --- a/offline_compiler/helper.cpp +++ b/offline_compiler/helper.cpp @@ -29,20 +29,4 @@ void DebugSettingsManager::writeToFile(std::string filename, const c // Global Debug Settings Manager DebugSettingsManager 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 diff --git a/runtime/built_ins/built_ins_storage.cpp b/runtime/built_ins/built_ins_storage.cpp index 0404291249..36e0dc3919 100644 --- a/runtime/built_ins/built_ins_storage.cpp +++ b/runtime/built_ins/built_ins_storage.cpp @@ -195,8 +195,8 @@ std::unique_ptr 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 diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 1a56587a2f..9bae15778f 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -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 -#include - namespace NEO { decltype(&PerformanceCounters::create) Device::createPerformanceCountersFunc = PerformanceCounters::create; @@ -51,21 +41,6 @@ void DeviceVector::toDeviceIDs(std::vector &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() { diff --git a/runtime/device/device.h b/runtime/device/device.h index b5cd9ad9f9..98e7287782 100644 --- a/runtime/device/device.h +++ b/runtime/device/device.h @@ -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 - 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 @@ -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; diff --git a/runtime/helpers/hw_info.cpp b/runtime/helpers/hw_info.cpp index 559eb26b54..ce6d1e1e2b 100644 --- a/runtime/helpers/hw_info.cpp +++ b/runtime/helpers/hw_info.cpp @@ -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(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 diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index a8e7f57f81..8fba297409 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -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 diff --git a/unit_tests/built_ins/sip_tests.cpp b/unit_tests/built_ins/sip_tests.cpp index 48692a5e7c..ec1e1f1b6f 100644 --- a/unit_tests/built_ins/sip_tests.cpp +++ b/unit_tests/built_ins/sip_tests.cpp @@ -48,7 +48,7 @@ TEST(Sip, WhenRequestingCsrSipKernelThenProperCompilerInternalOptionsAreReturned TEST(Sip, When32BitAddressesAreNotBeingForcedThenSipLlHasSameBitnessAsHostApplication) { auto mockDevice = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(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::createWithNewExecutionEnvironment(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\"")); diff --git a/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp b/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp index d2d10017d6..e0bee24aca 100644 --- a/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp +++ b/unit_tests/command_queue/enqueue_debug_kernel_tests.cpp @@ -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); diff --git a/unit_tests/command_queue/local_work_size_tests.cpp b/unit_tests/command_queue/local_work_size_tests.cpp index ffe467a10d..c2c90aaea9 100644 --- a/unit_tests/command_queue/local_work_size_tests.cpp +++ b/unit_tests/command_queue/local_work_size_tests.cpp @@ -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); diff --git a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp index f53b46f052..26f2b584dd 100644 --- a/unit_tests/mem_obj/image2d_from_buffer_tests.cpp +++ b/unit_tests/mem_obj/image2d_from_buffer_tests.cpp @@ -217,7 +217,7 @@ TEST_F(Image2dFromBufferTest, givenFourChannel8BitColorsAndTooLargeRowPitchSpeci } TEST_F(Image2dFromBufferTest, givenUnalignedImageWidthAndNoSpaceInBufferForAlignmentWhenValidatingSurfaceFormatThenReturnError) { - context.getDevice(0u)->getMutableDeviceInfo()->imagePitchAlignment = 128; + static_cast(context.getDevice(0))->deviceInfo.imagePitchAlignment = 128; imageDesc.image_width = 64; imageDesc.image_height = castToObject(imageDesc.mem_object)->getSize() / imageDesc.image_width; cl_mem_flags flags = CL_MEM_READ_ONLY; diff --git a/unit_tests/mocks/mock_device.h b/unit_tests/mocks/mock_device.h index fb1409db7f..c719f78d99 100644 --- a/unit_tests/mocks/mock_device.h +++ b/unit_tests/mocks/mock_device.h @@ -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; diff --git a/unit_tests/preemption/preemption_tests.cpp b/unit_tests/preemption/preemption_tests.cpp index 63934adb5e..d68ee28dcf 100644 --- a/unit_tests/preemption/preemption_tests.cpp +++ b/unit_tests/preemption/preemption_tests.cpp @@ -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); diff --git a/unit_tests/program/program_tests.cpp b/unit_tests/program/program_tests.cpp index 32eb3359b6..c955756185 100644 --- a/unit_tests/program/program_tests.cpp +++ b/unit_tests/program/program_tests.cpp @@ -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) {