diff --git a/level_zero/core/source/driver/driver.cpp b/level_zero/core/source/driver/driver.cpp index eacdcaabe2..50a81bfe50 100644 --- a/level_zero/core/source/driver/driver.cpp +++ b/level_zero/core/source/driver/driver.cpp @@ -24,8 +24,8 @@ namespace L0 { -_ze_driver_handle_t *GlobalDriverHandle; -bool LevelZeroDriverInitialized = false; +_ze_driver_handle_t *globalDriverHandle; +bool levelZeroDriverInitialized = false; uint32_t driverCount = 0; void DriverImp::initialize(ze_result_t *result) { @@ -68,8 +68,8 @@ void DriverImp::initialize(ze_result_t *result) { auto neoDevices = NEO::DeviceFactory::createDevices(*executionEnvironment); executionEnvironment->decRefInternal(); if (!neoDevices.empty()) { - GlobalDriverHandle = DriverHandle::create(std::move(neoDevices), envVariables, result); - if (GlobalDriverHandle != nullptr) { + globalDriverHandle = DriverHandle::create(std::move(neoDevices), envVariables, result); + if (globalDriverHandle != nullptr) { driverCount = 1; *result = ZE_RESULT_SUCCESS; @@ -84,9 +84,9 @@ void DriverImp::initialize(ze_result_t *result) { } } if (*result != ZE_RESULT_SUCCESS) { - delete GlobalDriver; - GlobalDriverHandle = nullptr; - GlobalDriver = nullptr; + delete globalDriver; + globalDriverHandle = nullptr; + globalDriver = nullptr; driverCount = 0; } } @@ -119,7 +119,7 @@ ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDriverHandle } for (uint32_t i = 0; i < *pCount; i++) { - phDriverHandles[i] = GlobalDriverHandle; + phDriverHandles[i] = globalDriverHandle; } return ZE_RESULT_SUCCESS; @@ -130,14 +130,14 @@ Driver *Driver::driver = &driverImp; ze_result_t init(ze_init_flags_t flags) { if (flags && !(flags & ZE_INIT_FLAG_GPU_ONLY)) { - L0::LevelZeroDriverInitialized = false; + L0::levelZeroDriverInitialized = false; return ZE_RESULT_ERROR_UNINITIALIZED; } else { ze_result_t result = Driver::get()->driverInit(flags); if (result == ZE_RESULT_SUCCESS) { - L0::LevelZeroDriverInitialized = true; + L0::levelZeroDriverInitialized = true; } else { - L0::LevelZeroDriverInitialized = false; + L0::levelZeroDriverInitialized = false; } return result; } diff --git a/level_zero/core/source/driver/driver.h b/level_zero/core/source/driver/driver.h index 4bab543763..c5887265f6 100644 --- a/level_zero/core/source/driver/driver.h +++ b/level_zero/core/source/driver/driver.h @@ -25,6 +25,6 @@ ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDrivers); extern bool sysmanInitFromCore; extern uint32_t driverCount; -extern _ze_driver_handle_t *GlobalDriverHandle; -extern bool LevelZeroDriverInitialized; +extern _ze_driver_handle_t *globalDriverHandle; +extern bool levelZeroDriverInitialized; } // namespace L0 diff --git a/level_zero/core/source/driver/driver_handle_imp.cpp b/level_zero/core/source/driver/driver_handle_imp.cpp index 14cf3075ad..1c205c9902 100644 --- a/level_zero/core/source/driver/driver_handle_imp.cpp +++ b/level_zero/core/source/driver/driver_handle_imp.cpp @@ -40,7 +40,7 @@ namespace L0 { -struct DriverHandleImp *GlobalDriver; +struct DriverHandleImp *globalDriver; DriverHandleImp::DriverHandleImp() = default; @@ -289,7 +289,7 @@ DriverHandle *DriverHandle::create(std::vector> dev return nullptr; } - GlobalDriver = driverHandle; + globalDriver = driverHandle; driverHandle->getMemoryManager()->setForceNonSvmForExternalHostPtr(true); diff --git a/level_zero/core/source/driver/driver_handle_imp.h b/level_zero/core/source/driver/driver_handle_imp.h index 8b9dd8a6ef..7a9d389d91 100644 --- a/level_zero/core/source/driver/driver_handle_imp.h +++ b/level_zero/core/source/driver/driver_handle_imp.h @@ -175,6 +175,6 @@ struct DriverHandleImp : public DriverHandle { ze_result_t clearErrorDescription() override; }; -extern struct DriverHandleImp *GlobalDriver; +extern struct DriverHandleImp *globalDriver; } // namespace L0 diff --git a/level_zero/core/source/global_teardown.cpp b/level_zero/core/source/global_teardown.cpp index 44ca5fb146..6f27d7e10c 100644 --- a/level_zero/core/source/global_teardown.cpp +++ b/level_zero/core/source/global_teardown.cpp @@ -11,13 +11,13 @@ namespace L0 { void globalDriverTeardown() { - if (GlobalDriver != nullptr) { - delete GlobalDriver; - GlobalDriver = nullptr; + if (globalDriver != nullptr) { + delete globalDriver; + globalDriver = nullptr; } - if (Sysman::GlobalSysmanDriver != nullptr) { - delete Sysman::GlobalSysmanDriver; - Sysman::GlobalSysmanDriver = nullptr; + if (Sysman::globalSysmanDriver != nullptr) { + delete Sysman::globalSysmanDriver; + Sysman::globalSysmanDriver = nullptr; } } } // namespace L0 diff --git a/level_zero/core/source/linux/driver_teardown.cpp b/level_zero/core/source/linux/driver_teardown.cpp index afecb7b736..61e5a23dbb 100644 --- a/level_zero/core/source/linux/driver_teardown.cpp +++ b/level_zero/core/source/linux/driver_teardown.cpp @@ -15,7 +15,7 @@ namespace L0 { ze_result_t setDriverTeardownHandleInLoader(const char *loaderLibraryName) { - if (L0::LevelZeroDriverInitialized) { + if (L0::levelZeroDriverInitialized) { ze_result_t result = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; std::unique_ptr loaderLibrary = std::unique_ptr{NEO::OsLibrary::load(loaderLibraryName)}; if (loaderLibrary) { diff --git a/level_zero/core/source/windows/driver_teardown.cpp b/level_zero/core/source/windows/driver_teardown.cpp index badfbaac96..a9d89e0543 100644 --- a/level_zero/core/source/windows/driver_teardown.cpp +++ b/level_zero/core/source/windows/driver_teardown.cpp @@ -15,7 +15,7 @@ namespace L0 { ze_result_t setDriverTeardownHandleInLoader(const char *loaderLibraryName) { - if (L0::LevelZeroDriverInitialized) { + if (L0::levelZeroDriverInitialized) { HMODULE handle = nullptr; ze_result_t result = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; handle = GetModuleHandleA(loaderLibraryName); @@ -37,9 +37,9 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { L0::setDriverTeardownHandleInLoader("ze_loader.dll"); L0::globalDriverTeardown(); - if (L0::GlobalOsSysmanDriver != nullptr) { - delete L0::GlobalOsSysmanDriver; - L0::GlobalOsSysmanDriver = nullptr; + if (L0::globalOsSysmanDriver != nullptr) { + delete L0::globalOsSysmanDriver; + L0::globalOsSysmanDriver = nullptr; } } return TRUE; diff --git a/level_zero/core/test/common/ult_config_listener_l0.cpp b/level_zero/core/test/common/ult_config_listener_l0.cpp index 3f9767fb22..77d8104863 100644 --- a/level_zero/core/test/common/ult_config_listener_l0.cpp +++ b/level_zero/core/test/common/ult_config_listener_l0.cpp @@ -12,13 +12,13 @@ void L0::UltConfigListenerL0::OnTestStart(const ::testing::TestInfo &testInfo) { BaseUltConfigListener::OnTestStart(testInfo); - GlobalDriverHandle = nullptr; + globalDriverHandle = nullptr; driverCount = 0; } void L0::UltConfigListenerL0::OnTestEnd(const ::testing::TestInfo &testInfo) { - EXPECT_EQ(nullptr, GlobalDriverHandle); + EXPECT_EQ(nullptr, globalDriverHandle); EXPECT_EQ(0u, driverCount); BaseUltConfigListener::OnTestEnd(testInfo); diff --git a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp index 89247a849d..49cacb9c47 100644 --- a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp +++ b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.cpp @@ -576,7 +576,7 @@ void CommandQueueThreadArbitrationPolicyFixture::setUp() { void CommandQueueThreadArbitrationPolicyFixture::tearDown() { commandList->destroy(); commandQueue->destroy(); - L0::GlobalDriver = nullptr; + L0::globalDriver = nullptr; } } // namespace ult diff --git a/level_zero/core/test/unit_tests/fixtures/device_fixture.h b/level_zero/core/test/unit_tests/fixtures/device_fixture.h index 47f67c6b46..e311dabfc3 100644 --- a/level_zero/core/test/unit_tests/fixtures/device_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/device_fixture.h @@ -32,7 +32,7 @@ struct Device; struct ContextImp; extern uint32_t driverCount; -extern _ze_driver_handle_t *GlobalDriverHandle; +extern _ze_driver_handle_t *globalDriverHandle; namespace ult { class MockBuiltins; @@ -54,7 +54,7 @@ struct DeviceFixture { const uint32_t rootDeviceIndex = 0u; template HelperType &getHelper() const; - VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&GlobalDriverHandle}; + VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&globalDriverHandle}; VariableBackup driverCountBackup{&driverCount}; }; @@ -117,7 +117,7 @@ struct MultiDeviceFixture { uint32_t numSubDevices = 2u; L0::ContextImp *context = nullptr; - VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&GlobalDriverHandle}; + VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&globalDriverHandle}; VariableBackup driverCountBackup{&driverCount}; }; diff --git a/level_zero/core/test/unit_tests/os_interface/global_teardown_tests.cpp b/level_zero/core/test/unit_tests/os_interface/global_teardown_tests.cpp index 62a2732e43..ee20a04acf 100644 --- a/level_zero/core/test/unit_tests/os_interface/global_teardown_tests.cpp +++ b/level_zero/core/test/unit_tests/os_interface/global_teardown_tests.cpp @@ -19,37 +19,37 @@ namespace L0 { namespace ult { TEST(GlobalTearDownCallbackTests, givenL0LoaderThenGlobalTeardownCallbackIsCalled) { - L0::LevelZeroDriverInitialized = true; + L0::levelZeroDriverInitialized = true; std::unique_ptr loaderLibrary = std::unique_ptr{NEO::OsLibrary::load(L0::ult::testLoaderDllName)}; EXPECT_EQ(ZE_RESULT_SUCCESS, setDriverTeardownHandleInLoader(L0::ult::testLoaderDllName)); - L0::LevelZeroDriverInitialized = false; + L0::levelZeroDriverInitialized = false; } TEST(GlobalTearDownCallbackTests, givenL0LoaderButL0DriverDidNotInitThenSetTearDownReturnsUninitialized) { - L0::LevelZeroDriverInitialized = false; + L0::levelZeroDriverInitialized = false; std::unique_ptr loaderLibrary = std::unique_ptr{NEO::OsLibrary::load(L0::ult::testLoaderDllName)}; EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, setDriverTeardownHandleInLoader(L0::ult::testLoaderDllName)); } TEST(GlobalTearDownCallbackTests, givenL0LoaderIsMissingThenGlobalTeardownCallbackIsNotCalled) { - L0::LevelZeroDriverInitialized = true; + L0::levelZeroDriverInitialized = true; EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, setDriverTeardownHandleInLoader("invalid.so")); - L0::LevelZeroDriverInitialized = false; + L0::levelZeroDriverInitialized = false; } TEST(GlobalTearDownCallbackTests, givenL0LoaderWithoutGlobalTeardownCallbackThenGlobalTeardownCallbackIsNotCalled) { - L0::LevelZeroDriverInitialized = true; + L0::levelZeroDriverInitialized = true; EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, setDriverTeardownHandleInLoader(L0::ult::testDllName)); - L0::LevelZeroDriverInitialized = false; + L0::levelZeroDriverInitialized = false; } TEST(GlobalTearDownTests, givenCallToGlobalTearDownFunctionThenGlobalDriversAreNull) { globalDriverTeardown(); - EXPECT_EQ(GlobalDriver, nullptr); - EXPECT_EQ(Sysman::GlobalSysmanDriver, nullptr); + EXPECT_EQ(globalDriver, nullptr); + EXPECT_EQ(Sysman::globalSysmanDriver, nullptr); } TEST(GlobalTearDownTests, givenCallToGlobalTearDownFunctionWithNullSysManDriverThenGlobalDriverIsNull) { - delete Sysman::GlobalSysmanDriver; - Sysman::GlobalSysmanDriver = nullptr; + delete Sysman::globalSysmanDriver; + Sysman::globalSysmanDriver = nullptr; globalDriverTeardown(); - EXPECT_EQ(GlobalDriver, nullptr); - EXPECT_EQ(Sysman::GlobalSysmanDriver, nullptr); + EXPECT_EQ(globalDriver, nullptr); + EXPECT_EQ(Sysman::globalSysmanDriver, nullptr); } } // namespace ult } // namespace L0 \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp index b451bd380a..872777a2ba 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp @@ -192,7 +192,6 @@ HWTEST2_F(CommandListCreate, givenHostAllocInMapWhenGetHostPtrAllocCalledThenCor commandList->hostPtrMap.clear(); } -template class DeviceHostPtrFailMock : public MockDeviceImp { public: using MockDeviceImp::MockDeviceImp; @@ -205,7 +204,7 @@ class DeviceHostPtrFailMock : public MockDeviceImp { }; HWTEST2_F(CommandListCreate, givenGetAlignedAllocationCalledWithInvalidPtrThenNullptrReturned, IsAtLeastSkl) { - auto failDevice = std::make_unique>(device->getNEODevice(), execEnv); + auto failDevice = std::make_unique(device->getNEODevice(), execEnv); failDevice->neoDevice = device->getNEODevice(); auto commandList = std::make_unique>>(); commandList->initialize(failDevice.get(), NEO::EngineGroupType::Copy, 0u); @@ -1429,13 +1428,13 @@ HWTEST2_F(CommandListCreate, givenNonEmptyCommandsToPatchWhenClearCommandsToPatc EXPECT_TRUE(pCommandList->commandsToPatch.empty()); } -template +template class MyDeviceMock : public MockDeviceImp { public: using MockDeviceImp::MockDeviceImp; NEO::GraphicsAllocation *allocateMemoryFromHostPtr(const void *buffer, size_t size, bool hostCopyAllowed) override { auto alloc = std::make_unique(const_cast(buffer), reinterpret_cast(buffer), size); - alloc->allocationType = AllocType; + alloc->allocationType = allocType; return alloc.release(); } const NEO::HardwareInfo &getHwInfo() const override { diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp index fea30b8f00..13e03a93cf 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp @@ -296,8 +296,9 @@ struct PauseOnGpuFixture : public Test { commandListHandle = commandList->toHandle(); } - template + template bool verifySemaphore(const GenCmdList::iterator &iterator, uint64_t debugPauseStateAddress, DebugPauseState requiredDebugPauseState) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto semaphoreCmd = genCmdCast(*iterator); if ((static_cast(requiredDebugPauseState) == semaphoreCmd->getSemaphoreDataDword()) && @@ -344,16 +345,17 @@ struct PauseOnGpuFixture : public Test { return false; } - template + template void findSemaphores(GenCmdList &cmdList) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto semaphore = find(cmdList.begin(), cmdList.end()); while (semaphore != cmdList.end()) { - if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) { + if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) { semaphoreBeforeWalkerFound++; } - if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) { + if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) { semaphoreAfterWalkerFound++; } @@ -451,7 +453,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenInser ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); EXPECT_EQ(1u, semaphoreBeforeWalkerFound); @@ -478,7 +480,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetToAlwaysWhenDispatchWalkersT ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); EXPECT_EQ(2u, semaphoreBeforeWalkerFound); @@ -506,7 +508,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeOnlyWhenDispatchingThenInsert ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); @@ -534,7 +536,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToAfterOnlyWhenDispatchingThenInsertP ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); EXPECT_EQ(0u, semaphoreBeforeWalkerFound); @@ -561,7 +563,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeAndAfterWhenDispatchingThenIn ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); @@ -610,7 +612,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseOnEnqueueFlagSetWhen ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); EXPECT_EQ(1u, semaphoreBeforeWalkerFound); @@ -637,7 +639,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseOnEnqueueFlagSetToAl ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); EXPECT_EQ(2u, semaphoreBeforeWalkerFound); @@ -665,7 +667,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToBeforeOnlyW ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); @@ -693,7 +695,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToAfterOnlyWh ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); EXPECT_EQ(0u, semaphoreBeforeWalkerFound); @@ -720,7 +722,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToBeforeAndAf ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); - findSemaphores(cmdList); + findSemaphores(cmdList); findPipeControls(cmdList); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index 2307ef21cb..42c4cd2b4a 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/command_container/encode_surface_state.h" #include "shared/source/gen_common/reg_configs_common.h" #include "shared/source/gmm_helper/gmm_lib.h" #include "shared/source/helpers/preamble.h" @@ -224,7 +225,7 @@ HWTEST2_P(L0DebuggerParameterizedTests, givenDebuggerWhenAppendingKernelToComman auto debugSurfaceState = reinterpret_cast(ssh->getCpuBase()); auto debugSurface = static_cast(device)->getDebugSurface(); - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; length.length = static_cast(debugSurface->getUnderlyingBufferSize() - 1); EXPECT_EQ(length.surfaceState.depth + 1u, debugSurfaceState->getDepth()); @@ -782,7 +783,7 @@ HWTEST_F(DebuggerWithGlobalBindlessTest, GivenGlobalBindlessHeapWhenDeviceIsCrea EXPECT_EQ(globalBindlessBase, bindlessHelper->getHeap(NEO::BindlessHeapsHelper::SPECIAL_SSH)->getHeapGpuBase()); - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; length.length = static_cast(debugSurface->getUnderlyingBufferSize() - 1); EXPECT_EQ(length.surfaceState.depth + 1u, debugSurfaceState->getDepth()); diff --git a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp index e9f0e9e9b8..30157af55b 100644 --- a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp +++ b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp @@ -52,7 +52,7 @@ TEST(zeInit, whenCallingZeInitThenLevelZeroDriverInitializedIsSetToTrue) { auto result = zeInit(ZE_INIT_FLAG_GPU_ONLY); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_TRUE(LevelZeroDriverInitialized); + EXPECT_TRUE(levelZeroDriverInitialized); EXPECT_EQ(1u, driver.initCalledCount); } @@ -62,7 +62,7 @@ TEST(zeInit, whenCallingZeInitWithFailureInIinitThenLevelZeroDriverInitializedIs auto result = zeInit(ZE_INIT_FLAG_GPU_ONLY); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, result); - EXPECT_FALSE(LevelZeroDriverInitialized); + EXPECT_FALSE(levelZeroDriverInitialized); } TEST(zeInit, whenCallingZeInitWithVpuOnlyThenLevelZeroDriverInitializedIsSetToFalse) { @@ -70,7 +70,7 @@ TEST(zeInit, whenCallingZeInitWithVpuOnlyThenLevelZeroDriverInitializedIsSetToFa auto result = zeInit(ZE_INIT_FLAG_VPU_ONLY); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, result); - EXPECT_FALSE(LevelZeroDriverInitialized); + EXPECT_FALSE(levelZeroDriverInitialized); } TEST(zeInit, whenCallingZeInitWithNoFlagsThenInitializeOnDriverIsCalled) { @@ -379,7 +379,7 @@ TEST(DriverTestFamilySupport, whenInitializingDriverOnSupportedFamilyThenDriverI auto driverHandle = DriverHandle::create(std::move(devices), L0EnvVariables{}, &returnValue); EXPECT_NE(nullptr, driverHandle); delete driverHandle; - L0::GlobalDriver = nullptr; + L0::globalDriver = nullptr; } TEST(DriverTestFamilySupport, whenInitializingDriverOnNotSupportedFamilyThenDriverIsNotCreated) { @@ -413,11 +413,11 @@ TEST(DriverTest, givenNullEnvVariableWhenCreatingDriverThenEnableProgramDebuggin EXPECT_EQ(NEO::DebuggingMode::Disabled, driverHandle->enableProgramDebugging); delete driverHandle; - L0::GlobalDriver = nullptr; + L0::globalDriver = nullptr; } struct DriverImpTest : public ::testing::Test { - VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&GlobalDriverHandle}; + VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&globalDriverHandle}; VariableBackup driverCountBackup{&driverCount}; }; @@ -434,9 +434,9 @@ TEST_F(DriverImpTest, givenDriverImpWhenInitializedThenEnvVariablesAreRead) { EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_LE(3u, IoFunctions::mockGetenvCalled); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenMissingMetricApiDependenciesWhenInitializingDriverImpThenGlobalDriverHandleIsNull) { @@ -459,8 +459,8 @@ TEST_F(DriverImpTest, givenMissingMetricApiDependenciesWhenInitializingDriverImp DriverImp driverImp; driverImp.initialize(&result); EXPECT_NE(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(nullptr, L0::GlobalDriverHandle); - EXPECT_EQ(nullptr, L0::GlobalDriver); + EXPECT_EQ(nullptr, L0::globalDriverHandle); + EXPECT_EQ(nullptr, L0::globalDriver); } TEST_F(DriverImpTest, givenEnabledProgramDebuggingWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsTrue) { @@ -476,13 +476,13 @@ TEST_F(DriverImpTest, givenEnabledProgramDebuggingWhenCreatingExecutionEnvironme DriverImp driverImp; driverImp.initialize(&result); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); - EXPECT_TRUE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); + EXPECT_TRUE(L0::globalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, whenCreatingExecutionEnvironmentThenDefaultHierarchyIsEnabled) { @@ -493,19 +493,19 @@ TEST_F(DriverImpTest, whenCreatingExecutionEnvironmentThenDefaultHierarchyIsEnab ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; driverImp.initialize(&result); - L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::GlobalDriverHandle); + L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::globalDriverHandle); auto &gfxCoreHelper = driverHandleImp->memoryManager->peekExecutionEnvironment().rootDeviceEnvironments[0]->getHelper(); if (strcmp(gfxCoreHelper.getDefaultDeviceHierarchy(), "COMPOSITE") == 0) { EXPECT_EQ(driverHandleImp->deviceHierarchyMode, L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_COMPOSITE); } else { EXPECT_EQ(driverHandleImp->deviceHierarchyMode, L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT); } - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenFlatDeviceHierarchyWhenCreatingExecutionEnvironmentThenFlatHierarchyIsEnabled) { @@ -520,14 +520,14 @@ TEST_F(DriverImpTest, givenFlatDeviceHierarchyWhenCreatingExecutionEnvironmentTh ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; driverImp.initialize(&result); - L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::GlobalDriverHandle); + L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::globalDriverHandle); EXPECT_EQ(driverHandleImp->deviceHierarchyMode, L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenCompositeDeviceHierarchyWhenCreatingExecutionEnvironmentThenCompositeHierarchyIsEnabled) { @@ -542,14 +542,14 @@ TEST_F(DriverImpTest, givenCompositeDeviceHierarchyWhenCreatingExecutionEnvironm ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; driverImp.initialize(&result); - L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::GlobalDriverHandle); + L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::globalDriverHandle); EXPECT_EQ(driverHandleImp->deviceHierarchyMode, L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_COMPOSITE); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenCombinedDeviceHierarchyWhenCreatingExecutionEnvironmentThenCombinedHierarchyIsEnabled) { @@ -564,14 +564,14 @@ TEST_F(DriverImpTest, givenCombinedDeviceHierarchyWhenCreatingExecutionEnvironme ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; driverImp.initialize(&result); - L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::GlobalDriverHandle); + L0::DriverHandleImp *driverHandleImp = reinterpret_cast(L0::globalDriverHandle); EXPECT_EQ(driverHandleImp->deviceHierarchyMode, L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_COMBINED); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenEnableProgramDebuggingWithValue2WhenCreatingExecutionEnvironmentThenDebuggingEnabledIsTrue) { @@ -587,13 +587,13 @@ TEST_F(DriverImpTest, givenEnableProgramDebuggingWithValue2WhenCreatingExecution DriverImp driverImp; driverImp.initialize(&result); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); - EXPECT_TRUE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); + EXPECT_TRUE(L0::globalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenEnabledFP64EmulationWhenCreatingExecutionEnvironmentThenFP64EmulationIsEnabled) { @@ -609,19 +609,19 @@ TEST_F(DriverImpTest, givenEnabledFP64EmulationWhenCreatingExecutionEnvironmentT DriverImp driverImp; driverImp.initialize(&result); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); - EXPECT_TRUE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isFP64EmulationEnabled()); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); + EXPECT_TRUE(L0::globalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isFP64EmulationEnabled()); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST_F(DriverImpTest, givenEnabledProgramDebuggingAndEnabledExperimentalOpenCLWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) { DebugManagerStateRestore restorer; - VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&GlobalDriverHandle}; + VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&globalDriverHandle}; VariableBackup driverCountBackup{&driverCount}; NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); hwInfo.capabilityTable.levelZeroSupported = true; @@ -631,18 +631,18 @@ TEST_F(DriverImpTest, givenEnabledProgramDebuggingAndEnabledExperimentalOpenCLWh VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "1"}}; VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); - VariableBackup mockableDriverHandle(&L0::GlobalDriverHandle); - VariableBackup mockableDriver(&L0::GlobalDriver); + VariableBackup mockableDriverHandle(&L0::globalDriverHandle); + VariableBackup mockableDriver(&L0::globalDriver); ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; driverImp.initialize(&result); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); - EXPECT_FALSE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); + EXPECT_FALSE(L0::globalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); - delete L0::GlobalDriver; + delete L0::globalDriver; } TEST_F(DriverImpTest, givenEnableProgramDebuggingWithValue2AndEnabledExperimentalOpenCLWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) { @@ -655,18 +655,18 @@ TEST_F(DriverImpTest, givenEnableProgramDebuggingWithValue2AndEnabledExperimenta VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}}; VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); - VariableBackup mockableDriverHandle(&L0::GlobalDriverHandle); - VariableBackup mockableDriver(&L0::GlobalDriver); + VariableBackup mockableDriverHandle(&L0::globalDriverHandle); + VariableBackup mockableDriver(&L0::globalDriver); ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; driverImp.initialize(&result); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); - EXPECT_FALSE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); + EXPECT_FALSE(L0::globalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); - delete L0::GlobalDriver; + delete L0::globalDriver; } TEST_F(DriverImpTest, givenNoProgramDebuggingEnvVarWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) { @@ -678,13 +678,13 @@ TEST_F(DriverImpTest, givenNoProgramDebuggingEnvVarWhenCreatingExecutionEnvironm DriverImp driverImp; driverImp.initialize(&result); - ASSERT_NE(nullptr, L0::GlobalDriver); - ASSERT_NE(0u, L0::GlobalDriver->numDevices); - EXPECT_FALSE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + ASSERT_NE(nullptr, L0::globalDriver); + ASSERT_NE(0u, L0::globalDriver->numDevices); + EXPECT_FALSE(L0::globalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); - delete L0::GlobalDriver; - L0::GlobalDriverHandle = nullptr; - L0::GlobalDriver = nullptr; + delete L0::globalDriver; + L0::globalDriverHandle = nullptr; + L0::globalDriver = nullptr; } TEST(DriverTest, givenProgramDebuggingEnvVarValue1WhenCreatingDriverThenEnableProgramDebuggingIsSetToTrue) { @@ -706,7 +706,7 @@ TEST(DriverTest, givenProgramDebuggingEnvVarValue1WhenCreatingDriverThenEnablePr EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Online); delete driverHandle; - L0::GlobalDriver = nullptr; + L0::globalDriver = nullptr; } TEST(DriverTest, givenProgramDebuggingEnvVarValue2WhenCreatingDriverThenEnableProgramDebuggingIsSetToTrue) { @@ -728,7 +728,7 @@ TEST(DriverTest, givenProgramDebuggingEnvVarValue2WhenCreatingDriverThenEnablePr EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Offline); delete driverHandle; - L0::GlobalDriver = nullptr; + L0::globalDriver = nullptr; } TEST(DriverTest, givenInvalidCompilerEnvironmentThenDependencyUnavailableErrorIsReturned) { @@ -750,7 +750,7 @@ TEST(DriverTest, givenInvalidCompilerEnvironmentThenDependencyUnavailableErrorIs Os::igcDllName = oldIgcDllName; Os::frontEndDllName = oldFclDllName; - ASSERT_EQ(nullptr, L0::GlobalDriver); + ASSERT_EQ(nullptr, L0::globalDriver); } TEST(DriverTest, givenInvalidCompilerEnvironmentAndEnableProgramDebuggingWithValue2ThenDependencyUnavailableErrorIsReturned) { @@ -772,7 +772,7 @@ TEST(DriverTest, givenInvalidCompilerEnvironmentAndEnableProgramDebuggingWithVal Os::igcDllName = oldIgcDllName; Os::frontEndDllName = oldFclDllName; - ASSERT_EQ(nullptr, L0::GlobalDriver); + ASSERT_EQ(nullptr, L0::globalDriver); } struct DriverTestMultipleFamilySupport : public ::testing::Test { @@ -813,7 +813,7 @@ TEST_F(DriverTestMultipleFamilySupport, whenInitializingDriverWithArrayOfDevices } delete driverHandle; - L0::GlobalDriver = nullptr; + L0::globalDriver = nullptr; } TEST(MultiRootDeviceDriverTest, whenInitializingDriverHandleWithMultipleDevicesThenOrderInRootDeviceIndicesMatchesOrderInDeviceVector) { @@ -907,16 +907,16 @@ struct DriverHandleTest : public ::testing::Test { envVariables.programDebugging = true; driverHandle = whiteboxCast(DriverHandle::create(std::move(devices), envVariables, &returnValue)); - L0::GlobalDriverHandle = driverHandle; + L0::globalDriverHandle = driverHandle; L0::driverCount = 1; } void TearDown() override { delete driverHandle; - L0::GlobalDriver = nullptr; - L0::GlobalDriverHandle = nullptr; + L0::globalDriver = nullptr; + L0::globalDriverHandle = nullptr; } L0::DriverHandle *driverHandle; - VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&GlobalDriverHandle}; + VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&globalDriverHandle}; VariableBackup driverCountBackup{&driverCount}; }; @@ -984,7 +984,7 @@ TEST_F(DriverHandleTest, givenInitializedDriverWhenZeDriverGetIsCalledThenGlobal result = zeDriverGet(&count, &hDriverHandle); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, hDriverHandle); - EXPECT_EQ(hDriverHandle, GlobalDriver); + EXPECT_EQ(hDriverHandle, globalDriver); } TEST_F(DriverHandleTest, givenInitializedDriverWhenGetDeviceIsCalledThenOneDeviceIsObtained) { diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index 463ef8510c..638f2f5b17 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -406,7 +406,7 @@ HWTEST_F(ModuleTest, givenBufferWhenOffsetIsNotPatchedThenSizeIsDecereasedByOffs auto argInfo = kernelImp->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[argIndex].as(); auto surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful); auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast((gpuAlloc->getUnderlyingBufferSize() - offset) - 1); EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast(length.surfaceState.width + 1)); EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast(length.surfaceState.height + 1)); @@ -447,7 +447,7 @@ HWTEST_F(ModuleTest, givenUnalignedHostBufferWhenSurfaceStateProgrammedThenUnali auto argInfo = kernelImp->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[argIndex].as(); auto surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful); auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = alignUp(static_cast((mockGa.getUnderlyingBufferSize() + allocationOffset)), alignment) - 1; EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast(length.surfaceState.width + 1)); EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast(length.surfaceState.height + 1)); @@ -2462,7 +2462,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest, auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as(); auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful); auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast((baseAlloc->getUnderlyingBufferSize() + offsetAlloc->getUnderlyingBufferSize()) - 1); EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast(length.surfaceState.width + 1)); EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast(length.surfaceState.height + 1)); @@ -2534,7 +2534,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest, auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as(); auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful); auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast(offsetAlloc->getUnderlyingBufferSize() - 1); EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast(length.surfaceState.width + 1)); EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast(length.surfaceState.height + 1)); @@ -2596,7 +2596,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest, auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as(); auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful); auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast(baseAlloc->getUnderlyingBufferSize() - 1); EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast(length.surfaceState.width + 1)); EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast(length.surfaceState.height + 1)); @@ -2673,7 +2673,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest, auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as(); auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful); auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast((MemoryConstants::gigaByte * 4) - 1); EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast(length.surfaceState.width + 1)); EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast(length.surfaceState.height + 1)); diff --git a/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp b/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp index 977a307a54..4c28bc01c4 100644 --- a/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp +++ b/level_zero/sysman/source/api/events/linux/sysman_os_events_imp.cpp @@ -38,7 +38,7 @@ ze_result_t LinuxEventsImp::eventRegister(zes_event_type_flags_t events) { return ZE_RESULT_ERROR_INVALID_ENUMERATION; } - auto pLinuxSysmanDriverImp = static_cast(GlobalSysmanDriver->pOsSysmanDriver); + auto pLinuxSysmanDriverImp = static_cast(globalSysmanDriver->pOsSysmanDriver); if (pLinuxSysmanDriverImp == nullptr) { NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Os Sysman driver not initialized\n"); diff --git a/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper_prelim.cpp b/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper_prelim.cpp index 715e9c5013..16a680be16 100644 --- a/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper_prelim.cpp +++ b/level_zero/sysman/source/api/firmware/linux/sysman_os_firmware_imp_helper_prelim.cpp @@ -13,7 +13,7 @@ const std::string iafPath = "device/"; const std::string iafDirectory = "iaf."; -const std::string pscbin_version = "/pscbin_version"; +const std::string pscbinVersion = "/pscbin_version"; namespace L0 { namespace Sysman { @@ -34,7 +34,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar for (const auto &entry : list) { if (!iafDirectory.compare(entry.substr(0, iafDirectory.length()))) { // device/iaf.X/pscbin_version, where X is the hardware slot number - path = iafPath + entry + pscbin_version; + path = iafPath + entry + pscbinVersion; } } if (path.empty()) { diff --git a/level_zero/sysman/source/driver/sysman_driver.cpp b/level_zero/sysman/source/driver/sysman_driver.cpp index 159552b207..0e656e4201 100644 --- a/level_zero/sysman/source/driver/sysman_driver.cpp +++ b/level_zero/sysman/source/driver/sysman_driver.cpp @@ -21,7 +21,7 @@ namespace L0 { namespace Sysman { -_ze_driver_handle_t *GlobalSysmanDriverHandle = nullptr; +_ze_driver_handle_t *globalSysmanDriverHandle = nullptr; uint32_t driverCount = 0; bool sysmanOnlyInit = false; @@ -60,7 +60,7 @@ void SysmanDriverImp::initialize(ze_result_t *result) { rootDeviceIndex++; } - GlobalSysmanDriverHandle = SysmanDriverHandle::create(*executionEnvironment, result); + globalSysmanDriverHandle = SysmanDriverHandle::create(*executionEnvironment, result); driverCount = 1; } else { NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, @@ -103,7 +103,7 @@ ze_result_t driverHandleGet(uint32_t *pCount, zes_driver_handle_t *phDriverHandl } for (uint32_t i = 0; i < *pCount; i++) { - phDriverHandles[i] = GlobalSysmanDriverHandle; + phDriverHandles[i] = globalSysmanDriverHandle; } return ZE_RESULT_SUCCESS; diff --git a/level_zero/sysman/source/driver/sysman_driver.h b/level_zero/sysman/source/driver/sysman_driver.h index 96da42b743..df155eb81f 100644 --- a/level_zero/sysman/source/driver/sysman_driver.h +++ b/level_zero/sysman/source/driver/sysman_driver.h @@ -26,7 +26,7 @@ ze_result_t init(zes_init_flags_t); ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDrivers); extern uint32_t driverCount; -extern _ze_driver_handle_t *GlobalSysmanDriverHandle; +extern _ze_driver_handle_t *globalSysmanDriverHandle; extern bool sysmanOnlyInit; } // namespace Sysman diff --git a/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp b/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp index 1a93b56404..0801a9d7c9 100644 --- a/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp +++ b/level_zero/sysman/source/driver/sysman_driver_handle_imp.cpp @@ -24,7 +24,7 @@ namespace L0 { namespace Sysman { -struct SysmanDriverHandleImp *GlobalSysmanDriver; +struct SysmanDriverHandleImp *globalSysmanDriver; SysmanDriverHandleImp::SysmanDriverHandleImp() = default; @@ -70,7 +70,7 @@ SysmanDriverHandle *SysmanDriverHandle::create(NEO::ExecutionEnvironment &execut } driverHandle->extensionFunctionsLookupMap = getExtensionFunctionsLookupMap(); - GlobalSysmanDriver = driverHandle; + globalSysmanDriver = driverHandle; *returnValue = res; return driverHandle; } diff --git a/level_zero/sysman/source/driver/sysman_driver_handle_imp.h b/level_zero/sysman/source/driver/sysman_driver_handle_imp.h index 7127446856..3171cc2b4a 100644 --- a/level_zero/sysman/source/driver/sysman_driver_handle_imp.h +++ b/level_zero/sysman/source/driver/sysman_driver_handle_imp.h @@ -31,7 +31,7 @@ struct SysmanDriverHandleImp : SysmanDriverHandle { struct OsSysmanDriver *pOsSysmanDriver = nullptr; }; -extern struct SysmanDriverHandleImp *GlobalSysmanDriver; +extern struct SysmanDriverHandleImp *globalSysmanDriver; } // namespace Sysman } // namespace L0 diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp index 1c9fa6fe88..faf146cee3 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.cpp @@ -10,7 +10,7 @@ namespace L0 { namespace Sysman { -SysmanProductHelperCreateFunctionType SysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {}; +SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {}; } } // namespace L0 \ No newline at end of file diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h index 5322116bc5..3685454484 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h @@ -21,12 +21,12 @@ class SysmanProductHelper; class LinuxSysmanImp; using SysmanProductHelperCreateFunctionType = std::unique_ptr (*)(); -extern SysmanProductHelperCreateFunctionType SysmanProductHelperFactory[IGFX_MAX_PRODUCT]; +extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT]; class SysmanProductHelper { public: static std::unique_ptr create(PRODUCT_FAMILY product) { - auto productHelperCreateFunction = SysmanProductHelperFactory[product]; + auto productHelperCreateFunction = sysmanProductHelperFactory[product]; if (productHelperCreateFunction == nullptr) { return nullptr; } diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h index 9f50fa577a..4fbf8bce36 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h @@ -32,7 +32,7 @@ template struct EnableSysmanProductHelper { EnableSysmanProductHelper() { auto sysmanProductHelperCreateFunction = SysmanProductHelperHw::create; - SysmanProductHelperFactory[gfxProduct] = sysmanProductHelperCreateFunction; + sysmanProductHelperFactory[gfxProduct] = sysmanProductHelperCreateFunction; } }; diff --git a/level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h b/level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h index d604fc5ee8..04fc126aac 100644 --- a/level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h +++ b/level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h @@ -73,7 +73,7 @@ class SysmanDeviceFixture : public ::testing::Test { driverHandle = std::make_unique(); driverHandle->initialize(*execEnv); pSysmanDevice = driverHandle->sysmanDevices[0]; - L0::Sysman::GlobalSysmanDriver = driverHandle.get(); + L0::Sysman::globalSysmanDriver = driverHandle.get(); L0::Sysman::sysmanOnlyInit = true; @@ -83,7 +83,7 @@ class SysmanDeviceFixture : public ::testing::Test { pLinuxSysmanImp->pFwUtilInterface = new MockFwUtilInterface(); } void TearDown() override { - L0::Sysman::GlobalSysmanDriver = nullptr; + L0::Sysman::globalSysmanDriver = nullptr; L0::Sysman::sysmanOnlyInit = false; } diff --git a/level_zero/sysman/test/unit_tests/sources/linux/test_sysman_driver.cpp b/level_zero/sysman/test/unit_tests/sources/linux/test_sysman_driver.cpp index ff17b3727e..c7c25b163a 100644 --- a/level_zero/sysman/test/unit_tests/sources/linux/test_sysman_driver.cpp +++ b/level_zero/sysman/test/unit_tests/sources/linux/test_sysman_driver.cpp @@ -104,7 +104,7 @@ TEST_F(SysmanDriverTestMultipleFamilySupport, whenInitializingSysmanDriverWithAr } delete driverHandle; - L0::Sysman::GlobalSysmanDriver = nullptr; + L0::Sysman::globalSysmanDriver = nullptr; } struct SysmanDriverTestMultipleFamilyNoSupport : public ::testing::Test { @@ -202,7 +202,7 @@ struct SysmanDriverHandleTest : public ::testing::Test { } driverHandle = L0::Sysman::SysmanDriverHandle::create(*executionEnvironment, &returnValue); - L0::Sysman::GlobalSysmanDriverHandle = driverHandle; + L0::Sysman::globalSysmanDriverHandle = driverHandle; L0::Sysman::driverCount = 1; L0::Sysman::sysmanOnlyInit = true; } @@ -210,8 +210,8 @@ struct SysmanDriverHandleTest : public ::testing::Test { if (driverHandle) { delete driverHandle; } - L0::Sysman::GlobalSysmanDriver = nullptr; - L0::Sysman::GlobalSysmanDriverHandle = nullptr; + L0::Sysman::globalSysmanDriver = nullptr; + L0::Sysman::globalSysmanDriverHandle = nullptr; L0::Sysman::driverCount = 0; L0::Sysman::sysmanOnlyInit = false; } @@ -277,7 +277,7 @@ TEST_F(SysmanDriverHandleTest, givenInitializedDriverWhenZesDriverGetIsCalledThe result = zesDriverGet(&count, &hDriverHandle); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, hDriverHandle); - EXPECT_EQ(hDriverHandle, L0::Sysman::GlobalSysmanDriver); + EXPECT_EQ(hDriverHandle, L0::Sysman::globalSysmanDriver); } TEST_F(SysmanDriverHandleTest, givenInitializedDriverWhenGetDeviceIsCalledThenOneDeviceIsObtained) { diff --git a/level_zero/tools/source/debug/linux/debug_session.cpp b/level_zero/tools/source/debug/linux/debug_session.cpp index f06ff9c44f..94789a0134 100644 --- a/level_zero/tools/source/debug/linux/debug_session.cpp +++ b/level_zero/tools/source/debug/linux/debug_session.cpp @@ -15,7 +15,7 @@ #include "level_zero/tools/source/debug/linux/debug_session_factory.h" namespace L0 { -DebugSessionLinuxAllocatorFn DebugSessionLinuxFactory[DEBUG_SESSION_LINUX_TYPE_MAX] = {}; +DebugSessionLinuxAllocatorFn debugSessionLinuxFactory[DEBUG_SESSION_LINUX_TYPE_MAX] = {}; DebugSession *DebugSession::create(const zet_debug_config_t &config, Device *device, ze_result_t &result, bool isRootAttach) { @@ -28,9 +28,9 @@ DebugSession *DebugSession::create(const zet_debug_config_t &config, Device *dev DebugSessionLinuxAllocatorFn allocator = nullptr; if ("xe" == drmVersion) { - allocator = DebugSessionLinuxFactory[DEBUG_SESSION_LINUX_TYPE_XE]; + allocator = debugSessionLinuxFactory[DEBUG_SESSION_LINUX_TYPE_XE]; } else { - allocator = DebugSessionLinuxFactory[DEBUG_SESSION_LINUX_TYPE_I915]; + allocator = debugSessionLinuxFactory[DEBUG_SESSION_LINUX_TYPE_I915]; } if (!allocator) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; diff --git a/level_zero/tools/source/debug/linux/debug_session_factory.h b/level_zero/tools/source/debug/linux/debug_session_factory.h index c064ba5be5..2a288d1e76 100644 --- a/level_zero/tools/source/debug/linux/debug_session_factory.h +++ b/level_zero/tools/source/debug/linux/debug_session_factory.h @@ -16,12 +16,12 @@ enum DebugSessionLinuxType { }; using DebugSessionLinuxAllocatorFn = DebugSession *(*)(const zet_debug_config_t &, Device *, ze_result_t &, bool); -extern DebugSessionLinuxAllocatorFn DebugSessionLinuxFactory[]; +extern DebugSessionLinuxAllocatorFn debugSessionLinuxFactory[]; template struct DebugSessionLinuxPopulateFactory { DebugSessionLinuxPopulateFactory() { - DebugSessionLinuxFactory[driverType] = DebugSessionType::createLinuxSession; + debugSessionLinuxFactory[driverType] = DebugSessionType::createLinuxSession; } }; diff --git a/level_zero/tools/source/metrics/metric.cpp b/level_zero/tools/source/metrics/metric.cpp index 1ea53c4023..231288e0c6 100644 --- a/level_zero/tools/source/metrics/metric.cpp +++ b/level_zero/tools/source/metrics/metric.cpp @@ -226,7 +226,7 @@ ze_result_t MetricDeviceContext::enableMetricApi() { bool failed = false; - auto driverHandle = L0::DriverHandle::fromHandle(GlobalDriverHandle); + auto driverHandle = L0::DriverHandle::fromHandle(globalDriverHandle); auto rootDevices = std::vector(); auto subDevices = std::vector(); diff --git a/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp b/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp index 8b043956a1..4775919eac 100644 --- a/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp +++ b/level_zero/tools/source/sysman/events/linux/os_events_imp.cpp @@ -36,12 +36,12 @@ ze_result_t LinuxEventsImp::eventRegister(zes_event_type_flags_t events) { return ZE_RESULT_ERROR_INVALID_ENUMERATION; } - if (GlobalOsSysmanDriver == nullptr) { + if (globalOsSysmanDriver == nullptr) { NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Os Sysman driver not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } - static_cast(GlobalOsSysmanDriver)->eventRegister(events, pLinuxSysmanImp->getSysmanDeviceImp()); + static_cast(globalOsSysmanDriver)->eventRegister(events, pLinuxSysmanImp->getSysmanDeviceImp()); return ZE_RESULT_SUCCESS; } @@ -137,7 +137,7 @@ void LinuxEventsUtil::eventRegister(zes_event_type_flags_t events, SysmanDeviceI } void LinuxEventsUtil::init() { - pUdevLib = static_cast(GlobalOsSysmanDriver)->getUdevLibHandle(); + pUdevLib = static_cast(globalOsSysmanDriver)->getUdevLibHandle(); } ze_result_t LinuxEventsUtil::eventsListen(uint64_t timeout, uint32_t count, zes_device_handle_t *phDevices, uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) { diff --git a/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp b/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp index d6e6433163..ae2538c422 100644 --- a/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp +++ b/level_zero/tools/source/sysman/firmware/linux/os_firmware_imp_helper_prelim.cpp @@ -12,7 +12,7 @@ const std::string iafPath = "device/"; const std::string iafDirectory = "iaf."; -const std::string pscbin_version = "/pscbin_version"; +const std::string pscbinVersion = "/pscbin_version"; namespace L0 { @@ -32,7 +32,7 @@ ze_result_t LinuxFirmwareImp::getFirmwareVersion(std::string fwType, zes_firmwar for (const auto &entry : list) { if (!iafDirectory.compare(entry.substr(0, iafDirectory.length()))) { // device/iaf.X/pscbin_version, where X is the hardware slot number - path = iafPath + entry + pscbin_version; + path = iafPath + entry + pscbinVersion; } } if (path.empty()) { diff --git a/level_zero/tools/source/sysman/linux/os_sysman_driver_imp.cpp b/level_zero/tools/source/sysman/linux/os_sysman_driver_imp.cpp index 3385ac96f9..3dfe6f2d56 100644 --- a/level_zero/tools/source/sysman/linux/os_sysman_driver_imp.cpp +++ b/level_zero/tools/source/sysman/linux/os_sysman_driver_imp.cpp @@ -53,9 +53,9 @@ OsSysmanDriver *OsSysmanDriver::create() { } void __attribute__((destructor)) osSysmanDriverDestructor() { - if (GlobalOsSysmanDriver != nullptr) { - delete GlobalOsSysmanDriver; - GlobalOsSysmanDriver = nullptr; + if (globalOsSysmanDriver != nullptr) { + delete globalOsSysmanDriver; + globalOsSysmanDriver = nullptr; } } diff --git a/level_zero/tools/source/sysman/sysman.cpp b/level_zero/tools/source/sysman/sysman.cpp index ce2a32b32b..ed8aef11f8 100644 --- a/level_zero/tools/source/sysman/sysman.cpp +++ b/level_zero/tools/source/sysman/sysman.cpp @@ -22,7 +22,7 @@ namespace L0 { bool sysmanInitFromCore = false; -struct OsSysmanDriver *GlobalOsSysmanDriver = nullptr; +struct OsSysmanDriver *globalOsSysmanDriver = nullptr; void DeviceImp::createSysmanHandle(bool isSubDevice) { if (static_cast(driverHandle)->enableSysman && !isSubDevice) { @@ -47,8 +47,8 @@ SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t coreDevice) { static_cast(subDevice)->setSysmanHandle(sysmanDevice); } - if (GlobalOsSysmanDriver == nullptr) { - GlobalOsSysmanDriver = L0::OsSysmanDriver::create(); + if (globalOsSysmanDriver == nullptr) { + globalOsSysmanDriver = L0::OsSysmanDriver::create(); } return sysmanDevice; } @@ -68,13 +68,13 @@ ze_result_t DriverHandleImp::sysmanEventsListen( uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) { - if (GlobalOsSysmanDriver == nullptr) { + if (globalOsSysmanDriver == nullptr) { NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Os Sysman Driver Not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } - return GlobalOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); + return globalOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); } ze_result_t DriverHandleImp::sysmanEventsListenEx( @@ -84,12 +84,12 @@ ze_result_t DriverHandleImp::sysmanEventsListenEx( uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) { - if (GlobalOsSysmanDriver == nullptr) { + if (globalOsSysmanDriver == nullptr) { NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "Os Sysman Driver Not initialized\n"); return ZE_RESULT_ERROR_UNINITIALIZED; } - return GlobalOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); + return globalOsSysmanDriver->eventsListen(timeout, count, phDevices, pNumDeviceEvents, pEvents); } ze_result_t SysmanDevice::performanceGet(zes_device_handle_t hDevice, uint32_t *pCount, zes_perf_handle_t *phPerformance) { diff --git a/level_zero/tools/source/sysman/sysman.h b/level_zero/tools/source/sysman/sysman.h index 137b3f497e..692b605c70 100644 --- a/level_zero/tools/source/sysman/sysman.h +++ b/level_zero/tools/source/sysman/sysman.h @@ -98,7 +98,7 @@ struct SysmanDevice : _ze_device_handle_t { virtual ~SysmanDevice() = default; }; -extern struct OsSysmanDriver *GlobalOsSysmanDriver; +extern struct OsSysmanDriver *globalOsSysmanDriver; class SysmanDeviceHandleContext { public: diff --git a/level_zero/tools/test/unit_tests/sources/metrics/metric_ip_sampling_fixture.cpp b/level_zero/tools/test/unit_tests/sources/metrics/metric_ip_sampling_fixture.cpp index ce354a0602..0f4274f5e8 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/metric_ip_sampling_fixture.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/metric_ip_sampling_fixture.cpp @@ -14,7 +14,7 @@ #include namespace L0 { -extern _ze_driver_handle_t *GlobalDriverHandle; +extern _ze_driver_handle_t *globalDriverHandle; namespace ult { @@ -48,7 +48,7 @@ void MetricIpSamplingFixture::SetUp() { auto &metricOaSource = device->getMetricDeviceContext().getMetricSource(); metricOaSource.setInitializationState(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); } - GlobalDriverHandle = static_cast<_ze_driver_handle_t *>(driverHandle.get()); + globalDriverHandle = static_cast<_ze_driver_handle_t *>(driverHandle.get()); } void MetricIpSamplingFixture::TearDown() { @@ -67,7 +67,7 @@ void MetricIpSamplingTimestampFixture::SetUp() { auto &metricOaSource = device->getMetricDeviceContext().getMetricSource(); metricOaSource.setInitializationState(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - GlobalDriverHandle = static_cast<_ze_driver_handle_t *>(driverHandle.get()); + globalDriverHandle = static_cast<_ze_driver_handle_t *>(driverHandle.get()); } void MetricIpSamplingTimestampFixture::TearDown() { diff --git a/level_zero/tools/test/unit_tests/sources/metrics/metric_query_pool_fixture.cpp b/level_zero/tools/test/unit_tests/sources/metrics/metric_query_pool_fixture.cpp index 97ae4ce21d..b274636190 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/metric_query_pool_fixture.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/metric_query_pool_fixture.cpp @@ -23,7 +23,7 @@ void MetricQueryPoolTest::SetUp() { void MetricQueryPoolTest::TearDown() { MetricContextFixture::tearDown(); driverHandle.reset(); - GlobalDriver = nullptr; + globalDriver = nullptr; } void MultiDeviceMetricQueryPoolTest::SetUp() { @@ -36,7 +36,7 @@ void MultiDeviceMetricQueryPoolTest::SetUp() { void MultiDeviceMetricQueryPoolTest::TearDown() { MetricMultiDeviceFixture::tearDown(); driverHandle.reset(); - GlobalDriver = nullptr; + globalDriver = nullptr; } } // namespace ult diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp index af91030c23..c4ef30865f 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp @@ -19,7 +19,7 @@ #include namespace L0 { -extern _ze_driver_handle_t *GlobalDriverHandle; +extern _ze_driver_handle_t *globalDriverHandle; namespace ult { diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp index fe7f93b3ea..b253b94375 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp @@ -17,7 +17,7 @@ #include namespace L0 { -extern _ze_driver_handle_t *GlobalDriverHandle; +extern _ze_driver_handle_t *globalDriverHandle; namespace ult { diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_initialization.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_initialization.cpp index 319741cbe6..3bc099cd61 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_initialization.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_initialization.cpp @@ -15,7 +15,7 @@ namespace L0 { -extern _ze_driver_handle_t *GlobalDriverHandle; +extern _ze_driver_handle_t *globalDriverHandle; namespace ult { class MockOsLibrary : public NEO::OsLibrary { @@ -48,7 +48,7 @@ using MetricInitializationTest = Test; TEST_F(MetricInitializationTest, GivenOaDependenciesAreAvailableThenMetricInitializationIsSuccess) { - GlobalDriverHandle = static_cast<_ze_driver_handle_t *>(driverHandle.get()); + globalDriverHandle = static_cast<_ze_driver_handle_t *>(driverHandle.get()); OaMetricSourceImp::osLibraryLoadFunction = MockOsLibrary::load; EXPECT_EQ(device->getMetricDeviceContext().enableMetricApi(), ZE_RESULT_SUCCESS); OaMetricSourceImp::osLibraryLoadFunction = NEO::OsLibrary::load; diff --git a/level_zero/tools/test/unit_tests/sources/sysman/events/linux/test_zes_events.cpp b/level_zero/tools/test/unit_tests/sources/sysman/events/linux/test_zes_events.cpp index a5387811b5..71561ee208 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/events/linux/test_zes_events.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/events/linux/test_zes_events.cpp @@ -125,8 +125,8 @@ TEST_F(SysmanEventsFixture, GivenValidSysmanHandleWhenEventsAreClearedThenDevice pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -166,8 +166,8 @@ TEST_F(SysmanEventsFixture, GivenPollSystemCallReturnsFailureWhenlisteningForRes pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -210,8 +210,8 @@ TEST_F(SysmanEventsFixture, GivenPipeSystemCallReturnsFailureWhenlisteningForRes pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -258,8 +258,8 @@ TEST_F(SysmanEventsFixture, GivenPollSystemCallReturnsOnAllFdsWhenlisteningForRe pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -308,8 +308,8 @@ TEST_F(SysmanEventsFixture, GivenPollSystemCallReturnsOnPipeFdWhenlisteningForRe pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -337,8 +337,8 @@ TEST_F(SysmanEventsFixture, GivenValidSysmanHandleWhenDeviceEventListenIsInvoked TEST_F(SysmanEventsFixture, GivenLibUdevNotFoundWhenListeningForEventsThenEventListenIsNotSuccess) { auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); auto pLinuxEventsImp = new PublicLinuxEventsUtil(); auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil; @@ -376,8 +376,8 @@ TEST_F(SysmanEventsFixture, GivenNoEventsAreRegisteredWhenListeningForEventsThen pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -401,8 +401,8 @@ TEST_F(SysmanEventsFixture, GivenNoEventsAreRegisteredWhenListeningForEventsThen } TEST_F(SysmanEventsFixture, GivenOsSysmanDriverAsNullWhenListeningForEventsThenVerifyEventListenIsNotSuccess) { - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = nullptr; + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = nullptr; zes_device_handle_t *phDevices = new zes_device_handle_t[1]; phDevices[0] = device->toHandle(); uint32_t numDeviceEvents = 0; @@ -414,16 +414,16 @@ TEST_F(SysmanEventsFixture, GivenOsSysmanDriverAsNullWhenListeningForEventsThenV } TEST_F(SysmanEventsFixture, GivenOsSysmanDriverAsNullWhenRegisteringForEventsThenVerifyEventListenIsNotSuccess) { - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = nullptr; + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = nullptr; zes_event_type_flags_t events = 0; EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceEventRegister(device->toHandle(), events)); L0::osSysmanDriverDestructor(); } TEST_F(SysmanEventsFixture, GivenOsSysmanDriverAsNullWhenCallingDriverEventListenExThenVerifyEventListenIsNotSuccess) { - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = nullptr; + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = nullptr; zes_device_handle_t *phDevices = new zes_device_handle_t[1]; phDevices[0] = device->toHandle(); uint32_t numDeviceEvents = 0; @@ -477,8 +477,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->eventPropertyValueDevPathResult.clear(); auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -521,8 +521,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -562,8 +562,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleAndListeningEventsWhenNullEven pUdevLibLocal->getEventTypeResult = nullptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -608,8 +608,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventGenerationSourceDeviceResult = 10; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -656,8 +656,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForResetRequiredE pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -681,8 +681,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForResetRequiredE TEST_F(SysmanDeviceFixture, GivenValidDeviceHandleWhenEventRegisterIsCalledThenSuccessIsReturned) { auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); auto pLinuxEventsImp = new PublicLinuxEventsUtil(); auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil; @@ -700,8 +700,8 @@ TEST_F(SysmanDeviceFixture, GivenValidDeviceHandleWhenEventRegisterIsCalledThenS TEST_F(SysmanEventsFixture, GivenEventsAreRegisteredWhenEventRegisterWithNoEventsIsCalledAgainThenSuccessIsReturned) { auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); auto pLinuxEventsImp = new PublicLinuxEventsUtil(); auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil; @@ -747,8 +747,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForFabricHealthEv pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -798,8 +798,8 @@ TEST_F(SysmanEventsFixture, GivenImproperDevPathForUeventWhenListeningForFabricH pUdevLibLocal->eventPropertyValueDevPathResult = "/devices/pci0000:97/0000:97:02.0/0000:98:00.0/0000:99:01.0/"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -848,8 +848,8 @@ TEST_F(SysmanEventsFixture, GivenInvalidEventTypeWhenListeningForFabricHealthEve pUdevLibLocal->getEventTypeResult = "Invalid"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -899,8 +899,8 @@ TEST_F(SysmanEventsFixture, GivenRealPathSystemCallFailsWhenListeningForFabricHe pUdevLibLocal->getEventGenerationSourceDeviceResult = 20; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -950,8 +950,8 @@ TEST_F(SysmanEventsFixture, GivenRealPathSystemCallReturnsInvalidDeviceWhenListe pUdevLibLocal->getEventGenerationSourceDeviceResult = 20; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1000,8 +1000,8 @@ TEST_F(SysmanEventsFixture, GivenEventPropertyForTypeKeyIsNullPtrWhenListeningFo pUdevLibLocal->eventPropertyValueTypeResult = ""; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1050,8 +1050,8 @@ TEST_F(SysmanEventsFixture, GivenEventPropertyForTypeKeyInvalidWhenListeningForF pUdevLibLocal->eventPropertyValueTypeResult = "Invalid"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1074,8 +1074,8 @@ TEST_F(SysmanEventsFixture, GivenEventPropertyForTypeKeyInvalidWhenListeningForF TEST_F(SysmanEventsFixture, GivenEventsAreRegisteredWhenEventRegisterIsCalledAgainThenSuccessIsReturned) { auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); auto pLinuxEventsImp = new PublicLinuxEventsUtil(); auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil; @@ -1100,8 +1100,8 @@ TEST_F(SysmanEventsFixture, GivenWriteSystemCallReturnsFailureWhenEventRegisterI }); auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); auto pLinuxEventsImp = new PublicLinuxEventsUtil(); auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil; @@ -1145,8 +1145,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventPropertyValueResult = "0"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1195,8 +1195,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventTypeResult = "add"; // In order to receive RESET_REQUIRED event type must be "change" auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1245,8 +1245,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventPropertyValueResult.clear(); auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1327,8 +1327,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForDeviceDetachEv pUdevLibLocal->getEventTypeResult = "remove"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1373,8 +1373,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventTypeResult = "change"; // ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH will be received only if EventType is "remove" auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1417,8 +1417,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForDeviceAttachEv pUdevLibLocal->getEventTypeResult = "add"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1463,8 +1463,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventTypeResult = "change"; // ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH will be received only if EventType is "add" auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1507,8 +1507,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForDeviceAttachEv pUdevLibLocal->getEventTypeResult = "add"; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1551,8 +1551,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForMemHealthEvent pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr; auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1597,8 +1597,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventPropertyValueResult = "0"; // getEventPropertyValue must return 1 in order to assure that MEM_HEALTH event is there auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1642,8 +1642,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventTypeResult = "add"; // In order to receive MEM_HEALTH event type must be "change" auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; @@ -1687,8 +1687,8 @@ TEST_F(SysmanEventsFixture, pUdevLibLocal->getEventPropertyValueResult.clear(); // getEventPropertyValue must return 1 in order to assure that MEM_HEALTH event is there auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - VariableBackup driverBackup(&GlobalOsSysmanDriver); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + VariableBackup driverBackup(&globalOsSysmanDriver); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); VariableBackup udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal; diff --git a/level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h b/level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h index faf3e35794..ad370c37ce 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h +++ b/level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h @@ -75,8 +75,8 @@ class SysmanDeviceFixture : public DeviceFixture, public ::testing::Test { pLinuxSysmanImp->pSysfsAccess = pSysfsAccess; pLinuxSysmanImp->pProcfsAccess = pProcfsAccess; - if (GlobalOsSysmanDriver == nullptr) { - GlobalOsSysmanDriver = L0::OsSysmanDriver::create(); + if (globalOsSysmanDriver == nullptr) { + globalOsSysmanDriver = L0::OsSysmanDriver::create(); } pSysmanDeviceImp->init(); @@ -87,9 +87,9 @@ class SysmanDeviceFixture : public DeviceFixture, public ::testing::Test { GTEST_SKIP(); } - if (GlobalOsSysmanDriver != nullptr) { - delete GlobalOsSysmanDriver; - GlobalOsSysmanDriver = nullptr; + if (globalOsSysmanDriver != nullptr) { + delete globalOsSysmanDriver; + globalOsSysmanDriver = nullptr; } DeviceFixture::tearDown(); @@ -135,8 +135,8 @@ class SysmanMultiDeviceFixture : public MultiDeviceFixture, public ::testing::Te pLinuxSysmanImp->pSysfsAccess = pSysfsAccess; pLinuxSysmanImp->pProcfsAccess = pProcfsAccess; - if (GlobalOsSysmanDriver == nullptr) { - GlobalOsSysmanDriver = L0::OsSysmanDriver::create(); + if (globalOsSysmanDriver == nullptr) { + globalOsSysmanDriver = L0::OsSysmanDriver::create(); } pSysmanDeviceImp->init(); @@ -147,9 +147,9 @@ class SysmanMultiDeviceFixture : public MultiDeviceFixture, public ::testing::Te if (!sysmanUltsEnable) { GTEST_SKIP(); } - if (GlobalOsSysmanDriver != nullptr) { - delete GlobalOsSysmanDriver; - GlobalOsSysmanDriver = nullptr; + if (globalOsSysmanDriver != nullptr) { + delete globalOsSysmanDriver; + globalOsSysmanDriver = nullptr; } unsetenv("ZES_ENABLE_SYSMAN"); MultiDeviceFixture::tearDown(); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/linux/test_sysman.cpp b/level_zero/tools/test/unit_tests/sources/sysman/linux/test_sysman.cpp index 311276f9d2..3925a0f421 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/linux/test_sysman.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/linux/test_sysman.cpp @@ -787,9 +787,9 @@ TEST_F(SysmanDeviceFixture, GivenValidEnumeratedHandlesWhenReleaseIsCalledThenHa } TEST_F(SysmanDeviceFixture, GivenDriverEventsUtilAsNullWhenSysmanDriverDestructorIsCalledThenVerifyNoExceptionOccured) { - VariableBackup driverBackup(&GlobalOsSysmanDriver); + VariableBackup driverBackup(&globalOsSysmanDriver); auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp(); - GlobalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); + globalOsSysmanDriver = static_cast(pPublicLinuxSysmanDriverImp); auto pUdevLib = new UdevLibMock(); pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLib; diff --git a/level_zero/tools/test/unit_tests/sources/sysman/windows/mock_sysman_fixture.cpp b/level_zero/tools/test/unit_tests/sources/sysman/windows/mock_sysman_fixture.cpp index 6fdb450527..03facb4648 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/windows/mock_sysman_fixture.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/windows/mock_sysman_fixture.cpp @@ -30,8 +30,8 @@ void SysmanDeviceFixture::SetUp() { pOsSysman = pSysmanDeviceImp->pOsSysman; pWddmSysmanImp = static_cast(pOsSysman); - if (GlobalOsSysmanDriver == nullptr) { - GlobalOsSysmanDriver = L0::OsSysmanDriver::create(); + if (globalOsSysmanDriver == nullptr) { + globalOsSysmanDriver = L0::OsSysmanDriver::create(); } } @@ -40,9 +40,9 @@ void SysmanDeviceFixture::TearDown() { GTEST_SKIP(); } - if (GlobalOsSysmanDriver != nullptr) { - delete GlobalOsSysmanDriver; - GlobalOsSysmanDriver = nullptr; + if (globalOsSysmanDriver != nullptr) { + delete globalOsSysmanDriver; + globalOsSysmanDriver = nullptr; } SysmanEnabledFixture::TearDown(); diff --git a/opencl/source/cl_device/cl_device.h b/opencl/source/cl_device/cl_device.h index f5fc613158..eea18e5d94 100644 --- a/opencl/source/cl_device/cl_device.h +++ b/opencl/source/cl_device/cl_device.h @@ -103,12 +103,12 @@ class ClDevice : public BaseObject<_cl_device_id> { size_t &retSize); // This helper template is meant to simplify getDeviceInfo - template + template void getCap(const void *&src, size_t &size, size_t &retSize); - template + template void getStr(const void *&src, size_t &size, size_t &retSize); diff --git a/opencl/source/cl_device/cl_device_get_cap.inl b/opencl/source/cl_device/cl_device_get_cap.inl index 4b2e614810..db3bfd65ec 100644 --- a/opencl/source/cl_device/cl_device_get_cap.inl +++ b/opencl/source/cl_device/cl_device_get_cap.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,12 +10,12 @@ namespace NEO { -template +template inline void ClDevice::getCap(const void *&src, size_t &size, size_t &retSize) { - src = &ClDeviceInfoTable::Map::getValue(*this); - retSize = size = ClDeviceInfoTable::Map::size; + src = &ClDeviceInfoTable::Map::getValue(*this); + retSize = size = ClDeviceInfoTable::Map::size; } } // namespace NEO diff --git a/opencl/source/cl_device/cl_device_info.cpp b/opencl/source/cl_device/cl_device_info.cpp index f42a2db1a2..79324d9237 100644 --- a/opencl/source/cl_device/cl_device_info.cpp +++ b/opencl/source/cl_device/cl_device_info.cpp @@ -29,12 +29,12 @@ namespace NEO { using ClDeviceInfoTable::Map; -template +template inline void ClDevice::getStr(const void *&src, size_t &size, size_t &retSize) { - src = Map::getValue(*this); - retSize = size = strlen(Map::getValue(*this)) + 1; + src = Map::getValue(*this); + retSize = size = strlen(Map::getValue(*this)) + 1; } template <> diff --git a/opencl/source/cl_device/cl_device_info_map.h b/opencl/source/cl_device/cl_device_info_map.h index 2eb84a831a..e4e5a5a9a7 100644 --- a/opencl/source/cl_device/cl_device_info_map.h +++ b/opencl/source/cl_device/cl_device_info_map.h @@ -19,9 +19,9 @@ namespace NEO { namespace ClDeviceInfoTable { -template +template struct ClMapBase { - enum { param = Param }; + enum { param = clDeviceInfoParam }; typedef _Type Type; enum { size = sizeof(Type) }; @@ -30,9 +30,9 @@ struct ClMapBase { } }; -template +template struct MapBase { - enum { param = Param }; + enum { param = clDeviceInfoParam }; typedef _Type Type; enum { size = sizeof(Type) }; @@ -41,15 +41,15 @@ struct MapBase { } }; -template +template struct Map {}; ////////////////////////////////////////////////////// // DeviceInfo mapping table -// Map::param - i.e. CL_DEVICE_ADDRESS_BITS -// Map::Type - i.e. cl_uint -// Map::size - ie. sizeof( cl_uint ) -// Map::getValue - ie. return deviceInfo.AddressBits +// Map::param - i.e. CL_DEVICE_ADDRESS_BITS +// Map::Type - i.e. cl_uint +// Map::size - ie. sizeof( cl_uint ) +// Map::getValue - ie. return deviceInfo.AddressBits ////////////////////////////////////////////////////// // clang-format off // please keep alphabetical order diff --git a/opencl/source/compiler_interface/default_cache_config.cpp b/opencl/source/compiler_interface/default_cache_config.cpp index 94b086d028..55b0a3fc8f 100644 --- a/opencl/source/compiler_interface/default_cache_config.cpp +++ b/opencl/source/compiler_interface/default_cache_config.cpp @@ -19,19 +19,19 @@ #include namespace NEO { -std::string NeoCachePersistent = "NEO_CACHE_PERSISTENT"; -std::string NeoCacheMaxSize = "NEO_CACHE_MAX_SIZE"; -std::string NeoCacheDir = "NEO_CACHE_DIR"; -std::string ClCacheDir = "cl_cache_dir"; +std::string neoCachePersistent = "NEO_CACHE_PERSISTENT"; +std::string neoCacheMaxSize = "NEO_CACHE_MAX_SIZE"; +std::string neoCacheDir = "NEO_CACHE_DIR"; +std::string clCacheDir = "cl_cache_dir"; CompilerCacheConfig getDefaultCompilerCacheConfig() { CompilerCacheConfig ret; NEO::EnvironmentVariableReader envReader; - if (envReader.getSetting(NeoCachePersistent.c_str(), defaultCacheEnabled()) != 0) { + if (envReader.getSetting(neoCachePersistent.c_str(), defaultCacheEnabled()) != 0) { ret.enabled = true; std::string emptyString = ""; - ret.cacheDir = envReader.getSetting(NeoCacheDir.c_str(), emptyString); + ret.cacheDir = envReader.getSetting(neoCacheDir.c_str(), emptyString); if (ret.cacheDir.empty()) { if (!checkDefaultCacheDirSettings(ret.cacheDir, envReader)) { @@ -47,7 +47,7 @@ CompilerCacheConfig getDefaultCompilerCacheConfig() { } ret.cacheFileExtension = ".cl_cache"; - ret.cacheSize = static_cast(envReader.getSetting(NeoCacheMaxSize.c_str(), static_cast(MemoryConstants::gigaByte))); + ret.cacheSize = static_cast(envReader.getSetting(neoCacheMaxSize.c_str(), static_cast(MemoryConstants::gigaByte))); if (ret.cacheSize == 0u) { ret.cacheSize = std::numeric_limits::max(); @@ -56,7 +56,7 @@ CompilerCacheConfig getDefaultCompilerCacheConfig() { return ret; } - ret.cacheDir = envReader.getSetting(ClCacheDir.c_str(), static_cast(CL_CACHE_LOCATION)); + ret.cacheDir = envReader.getSetting(clCacheDir.c_str(), static_cast(CL_CACHE_LOCATION)); if (NEO::SysCalls::pathExists(ret.cacheDir)) { ret.enabled = true; diff --git a/opencl/source/gtpin/gtpin_callbacks.cpp b/opencl/source/gtpin/gtpin_callbacks.cpp index 5821228255..4715689b85 100644 --- a/opencl/source/gtpin/gtpin_callbacks.cpp +++ b/opencl/source/gtpin/gtpin_callbacks.cpp @@ -36,7 +36,7 @@ namespace NEO { using GTPinLockType = std::recursive_mutex; -extern gtpin::ocl::gtpin_events_t GTPinCallbacks; +extern gtpin::ocl::gtpin_events_t gtpinCallbacks; igc_init_t *pIgcInit = nullptr; std::atomic sequenceCount(1); @@ -53,13 +53,13 @@ void gtpinNotifyContextCreate(cl_context context) { auto >pinHelper = pDevice->getGTPinGfxCoreHelper(); gtpinPlatformInfo.gen_version = (gtpin::GTPIN_GEN_VERSION)gtpinHelper.getGenVersion(); gtpinPlatformInfo.device_id = static_cast(pDevice->getHardwareInfo().platform.usDeviceID); - (*GTPinCallbacks.onContextCreate)((context_handle_t)context, >pinPlatformInfo, &pIgcInit); + (*gtpinCallbacks.onContextCreate)((context_handle_t)context, >pinPlatformInfo, &pIgcInit); } } void gtpinNotifyContextDestroy(cl_context context) { if (isGTPinInitialized) { - (*GTPinCallbacks.onContextDestroy)((context_handle_t)context); + (*gtpinCallbacks.onContextDestroy)((context_handle_t)context); } } @@ -105,7 +105,7 @@ void gtpinNotifyKernelCreate(cl_kernel kernel) { paramsIn.debug_data_size = static_cast(pMultiDeviceKernel->getProgram()->getDebugDataSize(rootDeviceIndex)); } instrument_params_out_t paramsOut = {0}; - (*GTPinCallbacks.onKernelCreate)((context_handle_t)(cl_context)context, ¶msIn, ¶msOut); + (*gtpinCallbacks.onKernelCreate)((context_handle_t)(cl_context)context, ¶msIn, ¶msOut); // Substitute ISA of created kernel with instrumented code pKernel->substituteKernelHeap(paramsOut.inst_kernel_binary, paramsOut.inst_kernel_size); pKernel->setKernelId(paramsOut.kernel_id); @@ -126,9 +126,9 @@ void gtpinNotifyKernelSubmit(cl_kernel kernel, void *pCmdQueue) { uint32_t kernelOffset = 0; resource_handle_t resource = 0; // Notify GT-Pin that abstract "command buffer" was created - (*GTPinCallbacks.onCommandBufferCreate)((context_handle_t)context, commandBuffer); + (*gtpinCallbacks.onCommandBufferCreate)((context_handle_t)context, commandBuffer); // Notify GT-Pin that kernel was submited for execution - (*GTPinCallbacks.onKernelSubmit)(commandBuffer, kernelId, &kernelOffset, &resource); + (*gtpinCallbacks.onKernelSubmit)(commandBuffer, kernelId, &kernelOffset, &resource); // Create new record in Kernel Execution Queue describing submited kernel pKernel->setStartOffset(kernelOffset); gtpinkexec_t kExec; @@ -194,7 +194,7 @@ void gtpinNotifyTaskCompletion(TaskCountType completedTaskCount) { for (size_t n = 0; n < numElems;) { if (kernelExecQueue[n].isTaskCountValid && (kernelExecQueue[n].taskCount <= completedTaskCount)) { // Notify GT-Pin that execution of "command buffer" was completed - (*GTPinCallbacks.onCommandBufferComplete)(kernelExecQueue[n].commandBuffer); + (*gtpinCallbacks.onCommandBufferComplete)(kernelExecQueue[n].commandBuffer); // Remove kernel's record from Kernel Execution Queue kernelExecQueue.erase(kernelExecQueue.begin() + n); numElems--; diff --git a/opencl/source/gtpin/gtpin_init.cpp b/opencl/source/gtpin/gtpin_init.cpp index c7db845688..349bd471a8 100644 --- a/opencl/source/gtpin/gtpin_init.cpp +++ b/opencl/source/gtpin/gtpin_init.cpp @@ -14,7 +14,7 @@ using namespace NEO; namespace NEO { bool isGTPinInitialized = false; -gtpin::ocl::gtpin_events_t GTPinCallbacks = {0}; +gtpin::ocl::gtpin_events_t gtpinCallbacks = {0}; } // namespace NEO // Do not change this code, needed to avoid compiler optimization that breaks GTPin_Init @@ -70,7 +70,7 @@ GTPIN_DI_STATUS GTPin_Init(gtpin::ocl::gtpin_events_t *pGtpinEvents, driver_serv passMapBuffer(mapBuffer, pDriverServices->bufferMap); passUnMapBuffer(unMapBuffer, pDriverServices->bufferUnMap); // End of WA - GTPinCallbacks = *pGtpinEvents; + gtpinCallbacks = *pGtpinEvents; isGTPinInitialized = true; return GTPIN_DI_SUCCESS; diff --git a/opencl/source/mem_obj/buffer_base.inl b/opencl/source/mem_obj/buffer_base.inl index d66019c81c..5bd4fd2ce3 100644 --- a/opencl/source/mem_obj/buffer_base.inl +++ b/opencl/source/mem_obj/buffer_base.inl @@ -17,15 +17,6 @@ namespace NEO { -union SURFACE_STATE_BUFFER_LENGTH { - uint32_t length; - struct SurfaceState { - uint32_t width : 7; - uint32_t height : 14; - uint32_t depth : 11; - } surfaceState; -}; - template void BufferHw::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) { diff --git a/opencl/source/mem_obj/image.inl b/opencl/source/mem_obj/image.inl index ec9d80d5ee..d124627e2e 100644 --- a/opencl/source/mem_obj/image.inl +++ b/opencl/source/mem_obj/image.inl @@ -24,15 +24,6 @@ namespace NEO { -union SURFACE_STATE_BUFFER_LENGTH { - uint32_t length; - struct SurfaceState { - uint32_t width : BITFIELD_RANGE(0, 6); - uint32_t height : BITFIELD_RANGE(7, 20); - uint32_t depth : BITFIELD_RANGE(21, 31); - } surfaceState; -}; - template void ImageHw::setImageArg(void *memory, bool setAsMediaBlockImage, uint32_t mipLevel, uint32_t rootDeviceIndex, bool useGlobalAtomics) { using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT; @@ -58,7 +49,7 @@ void ImageHw::setImageArg(void *memory, bool setAsMediaBlockImage, ui if (getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) { // image1d_buffer is image1d created from buffer. The length of buffer could be larger // than the maximal image width. Mock image1d_buffer with SURFACE_TYPE_SURFTYPE_BUFFER. - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast(getImageDesc().image_width - 1); depth = static_cast(length.surfaceState.depth + 1); diff --git a/opencl/source/utilities/cl_logger.cpp b/opencl/source/utilities/cl_logger.cpp index bef0de97a2..e5f94cc7d5 100644 --- a/opencl/source/utilities/cl_logger.cpp +++ b/opencl/source/utilities/cl_logger.cpp @@ -17,8 +17,8 @@ namespace NEO { -template -ClFileLogger::ClFileLogger(FileLogger &baseLoggerIn, const DebugVariables &flags) : baseLogger(baseLoggerIn) { +template +ClFileLogger::ClFileLogger(FileLogger &baseLoggerIn, const DebugVariables &flags) : baseLogger(baseLoggerIn) { dumpKernelArgsEnabled = flags.DumpKernelArgs.get(); } @@ -27,8 +27,8 @@ ClFileLogger &getClFileLogger() { return clFileLoggerInstance; } -template -void ClFileLogger::dumpKernelArgs(const MultiDispatchInfo *multiDispatchInfo) { +template +void ClFileLogger::dumpKernelArgs(const MultiDispatchInfo *multiDispatchInfo) { if (false == baseLogger.enabled()) { return; } @@ -100,8 +100,8 @@ void ClFileLogger::dumpKernelArgs(const MultiDispatchInfo *multiDisp } } -template -const std::string ClFileLogger::getEvents(const uintptr_t *input, uint32_t numOfEvents) { +template +const std::string ClFileLogger::getEvents(const uintptr_t *input, uint32_t numOfEvents) { if (false == baseLogger.enabled()) { return ""; } @@ -116,8 +116,8 @@ const std::string ClFileLogger::getEvents(const uintptr_t *input, ui return os.str(); } -template -const std::string ClFileLogger::getMemObjects(const uintptr_t *input, uint32_t numOfObjects) { +template +const std::string ClFileLogger::getMemObjects(const uintptr_t *input, uint32_t numOfObjects) { if (false == baseLogger.enabled()) { return ""; } diff --git a/opencl/source/utilities/cl_logger.h b/opencl/source/utilities/cl_logger.h index 03536f23aa..015f8897f4 100644 --- a/opencl/source/utilities/cl_logger.h +++ b/opencl/source/utilities/cl_logger.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,10 +16,10 @@ namespace NEO { struct MultiDispatchInfo; -template +template class ClFileLogger : public NonCopyableOrMovableClass { public: - ClFileLogger(FileLogger &baseLoggerInm, const DebugVariables &flags); + ClFileLogger(FileLogger &baseLoggerInm, const DebugVariables &flags); void dumpKernelArgs(const MultiDispatchInfo *multiDispatchInfo); const std::string getEvents(const uintptr_t *input, uint32_t numOfEvents); @@ -27,7 +27,7 @@ class ClFileLogger : public NonCopyableOrMovableClass { protected: bool dumpKernelArgsEnabled = false; - FileLogger &baseLogger; + FileLogger &baseLogger; }; ClFileLogger &getClFileLogger(); diff --git a/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl b/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl index e1940b28e9..57807ce65d 100644 --- a/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl +++ b/opencl/test/unit_test/api/cl_enqueue_wait_for_events_tests.inl @@ -278,7 +278,7 @@ void onCommandBufferComplete(gtpin::command_buffer_handle_t cb) { namespace NEO { extern bool isGTPinInitialized; -extern gtpin::ocl::gtpin_events_t GTPinCallbacks; +extern gtpin::ocl::gtpin_events_t gtpinCallbacks; extern std::deque kernelExecQueue; TEST_F(ClEnqueueWaitForEventsTests, WhenGTPinIsInitializedAndEnqueingWaitForEventsThenGTPinIsNotified) { @@ -289,7 +289,7 @@ TEST_F(ClEnqueueWaitForEventsTests, WhenGTPinIsInitializedAndEnqueingWaitForEven auto retVal = CL_SUCCESS; isGTPinInitialized = true; - GTPinCallbacks.onCommandBufferComplete = onCommandBufferComplete; + gtpinCallbacks.onCommandBufferComplete = onCommandBufferComplete; gtpin::resource_handle_t resource = 0; gtpin::command_buffer_handle_t commandBuffer = 0; gtpinkexec_t kExec; diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp index 517659b6fe..8c40b66016 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_fill_image_aub_tests.cpp @@ -18,61 +18,58 @@ using namespace NEO; -// clang-format off struct FillImageParams { cl_mem_object_type imageType; size_t offsets[3]; } imageParams[] = { - {CL_MEM_OBJECT_IMAGE1D, { 0u, 0u, 0u}}, - {CL_MEM_OBJECT_IMAGE1D, { 1u, 0u, 0u}}, - {CL_MEM_OBJECT_IMAGE2D, { 0u, 0u, 0u}}, - {CL_MEM_OBJECT_IMAGE2D, { 1u, 2u, 0u}}, - {CL_MEM_OBJECT_IMAGE3D, { 0u, 0u, 0u}}, - {CL_MEM_OBJECT_IMAGE3D, { 1u, 2u, 3u}} -}; + {CL_MEM_OBJECT_IMAGE1D, {0u, 0u, 0u}}, + {CL_MEM_OBJECT_IMAGE1D, {1u, 0u, 0u}}, + {CL_MEM_OBJECT_IMAGE2D, {0u, 0u, 0u}}, + {CL_MEM_OBJECT_IMAGE2D, {1u, 2u, 0u}}, + {CL_MEM_OBJECT_IMAGE3D, {0u, 0u, 0u}}, + {CL_MEM_OBJECT_IMAGE3D, {1u, 2u, 3u}}}; -static const uint32_t fillValues[4] = { 0x3f800000, 0x00000000, 0x3f555555, 0x3f2aaaaa }; +static const uint32_t fillValues[4] = {0x3f800000, 0x00000000, 0x3f555555, 0x3f2aaaaa}; -static const uint16_t expectedHALF_FLOAT[4] = {0x3c00, 0x0000, 0x3aaa, 0x3955}; +static const uint16_t expectedHalfFloat[4] = {0x3c00, 0x0000, 0x3aaa, 0x3955}; -static const uint16_t expectedUNORM16[4] = {0xffff, 0x0000, 0xd554, 0xaaa9}; -static const uint8_t expectedUNORM8[4] = { 0xff, 0x00, 0xd4, 0xa9}; -//The distance between sRGB values and the expected values should not be greater than 0.6f -//In this test, for simplicity purposes, we are checking if the distance is 0 -static const uint8_t expectedUNORM8sRGB[4] = { 0xff, 0x00, 0xeb, 0xa9}; -static const uint8_t expectedUNORM8sBGR[4] = { 0xeb, 0x00, 0xff, 0xa9}; +static const uint16_t expectedUnorm16[4] = {0xffff, 0x0000, 0xd554, 0xaaa9}; +static const uint8_t expectedUnorm8[4] = {0xff, 0x00, 0xd4, 0xa9}; +// The distance between sRGB values and the expected values should not be greater than 0.6f +// In this test, for simplicity purposes, we are checking if the distance is 0 +static const uint8_t expectedUnorm8srgb[4] = {0xff, 0x00, 0xeb, 0xa9}; +static const uint8_t expectedUnorm8sbgr[4] = {0xeb, 0x00, 0xff, 0xa9}; -static const uint16_t expectedSNORM16[4] = {0x7fff, 0x0000, 0x6AA9, 0x5554}; -static const uint8_t expectedSNORM8[4] = { 0x7f, 0x00, 0x69, 0x54}; +static const uint16_t expectedSnorm16[4] = {0x7fff, 0x0000, 0x6AA9, 0x5554}; +static const uint8_t expectedSnorm8[4] = {0x7f, 0x00, 0x69, 0x54}; -static auto expectedSINT32 = fillValues; -static uint16_t expectedSINT16[4] = { 0x0000, 0x0000, 0x5555, 0xaaaa }; -static uint8_t expectedSINT8[4] = { 0x00, 0x00, 0x55, 0xaa }; +static auto expectedSint32 = fillValues; +static uint16_t expectedSint16[4] = {0x0000, 0x0000, 0x5555, 0xaaaa}; +static uint8_t expectedSint8[4] = {0x00, 0x00, 0x55, 0xaa}; -static auto expectedUINT32 = fillValues; -static uint16_t expectedUINT16[4] = { 0x0000, 0x0000, 0x5555, 0xaaaa }; -static uint8_t expectedUINT8[4] = { 0x00, 0x00, 0x55, 0xaa }; +static auto expectedUint32 = fillValues; +static uint16_t expectedUint16[4] = {0x0000, 0x0000, 0x5555, 0xaaaa}; +static uint8_t expectedUint8[4] = {0x00, 0x00, 0x55, 0xaa}; -static auto expectedFLOAT = fillValues; +static auto expectedFloat = fillValues; // ChannelTypes/FillValues for test struct FillChannelType { cl_channel_type type; const void *expectedValues; } fillChannelTypes[] = { - {CL_SNORM_INT8, expectedSNORM8}, - {CL_SNORM_INT16, expectedSNORM16}, - {CL_UNORM_INT8, expectedUNORM8}, - {CL_UNORM_INT16, expectedUNORM16}, - {CL_SIGNED_INT8, expectedSINT8}, - {CL_SIGNED_INT16, expectedSINT16}, - {CL_SIGNED_INT32, expectedSINT32}, - {CL_UNSIGNED_INT8, expectedUINT8}, - {CL_UNSIGNED_INT16, expectedUINT16}, - {CL_UNSIGNED_INT32, expectedUINT32}, - {CL_HALF_FLOAT, expectedHALF_FLOAT}, - {CL_FLOAT, expectedFLOAT}}; -// clang-format on + {CL_SNORM_INT8, expectedSnorm8}, + {CL_SNORM_INT16, expectedSnorm16}, + {CL_UNORM_INT8, expectedUnorm8}, + {CL_UNORM_INT16, expectedUnorm16}, + {CL_SIGNED_INT8, expectedSint8}, + {CL_SIGNED_INT16, expectedSint16}, + {CL_SIGNED_INT32, expectedSint32}, + {CL_UNSIGNED_INT8, expectedUint8}, + {CL_UNSIGNED_INT16, expectedUint16}, + {CL_UNSIGNED_INT32, expectedUint32}, + {CL_HALF_FLOAT, expectedHalfFloat}, + {CL_FLOAT, expectedFloat}}; struct AubFillImage : public AUBCommandStreamFixture, @@ -228,10 +225,10 @@ HWTEST_P(AubFillImage, WhenFillingThenExpectationsMet) { auto expected = std::get<0>(GetParam()).expectedValues; if (imageFormat.image_channel_order == CL_sRGBA) { - expected = expectedUNORM8sRGB; + expected = expectedUnorm8srgb; } if (imageFormat.image_channel_order == CL_sBGRA) { - expected = expectedUNORM8sBGR; + expected = expectedUnorm8sbgr; } auto pImageData = dstMemory; diff --git a/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp b/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp index 98b6797df2..634e46dc92 100644 --- a/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/blit_enqueue_1_tests.cpp @@ -873,8 +873,9 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithNoTimestampPacketTests, givenNoTimestampPacket } struct BlitEnqueueWithDebugCapabilityTests : public BlitEnqueueTests<0> { - template + template void findSemaphores(GenCmdList &cmdList) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto semaphore = find(cmdList.begin(), cmdList.end()); while (semaphore != cmdList.end()) { @@ -901,8 +902,9 @@ struct BlitEnqueueWithDebugCapabilityTests : public BlitEnqueueTests<0> { } } - template + template void findMiFlushes(GenCmdList &cmdList) { + using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW; auto miFlush = find(cmdList.begin(), cmdList.end()); while (miFlush != cmdList.end()) { @@ -956,12 +958,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenDis HardwareParse hwParser; hwParser.parseCommands(ultBcsCsr->commandStream); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); EXPECT_EQ(1u, semaphoreBeforeCopyFound); EXPECT_EQ(1u, semaphoreAfterCopyFound); - findMiFlushes(hwParser.cmdList); + findMiFlushes(hwParser.cmdList); EXPECT_EQ(1u, miFlushBeforeCopyFound); EXPECT_EQ(1u, miFlushAfterCopyFound); @@ -1000,12 +1002,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetToMinus HardwareParse hwParser; hwParser.parseCommands(ultBcsCsr->commandStream); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); EXPECT_EQ(2u, semaphoreBeforeCopyFound); EXPECT_EQ(2u, semaphoreAfterCopyFound); - findMiFlushes(hwParser.cmdList); + findMiFlushes(hwParser.cmdList); EXPECT_EQ(2u, miFlushBeforeCopyFound); EXPECT_EQ(2u, miFlushAfterCopyFound); @@ -1030,12 +1032,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenPauseModeSetToBefor HardwareParse hwParser; hwParser.parseCommands(ultBcsCsr->commandStream); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); EXPECT_EQ(1u, semaphoreBeforeCopyFound); EXPECT_EQ(0u, semaphoreAfterCopyFound); - findMiFlushes(hwParser.cmdList); + findMiFlushes(hwParser.cmdList); EXPECT_EQ(1u, miFlushBeforeCopyFound); EXPECT_EQ(0u, miFlushAfterCopyFound); @@ -1060,12 +1062,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenPauseModeSetToAfter HardwareParse hwParser; hwParser.parseCommands(ultBcsCsr->commandStream); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); EXPECT_EQ(0u, semaphoreBeforeCopyFound); EXPECT_EQ(1u, semaphoreAfterCopyFound); - findMiFlushes(hwParser.cmdList); + findMiFlushes(hwParser.cmdList); EXPECT_EQ(0u, miFlushBeforeCopyFound); EXPECT_EQ(1u, miFlushAfterCopyFound); @@ -1090,12 +1092,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenPauseModeSetToBefor HardwareParse hwParser; hwParser.parseCommands(ultBcsCsr->commandStream); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); EXPECT_EQ(1u, semaphoreBeforeCopyFound); EXPECT_EQ(1u, semaphoreAfterCopyFound); - findMiFlushes(hwParser.cmdList); + findMiFlushes(hwParser.cmdList); EXPECT_EQ(1u, miFlushBeforeCopyFound); EXPECT_EQ(1u, miFlushAfterCopyFound); diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp index c14256e572..2130ccd463 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp @@ -1728,8 +1728,9 @@ struct PauseOnGpuTests : public EnqueueKernelTest { debugPauseStateAddress = csr.getDebugPauseStateGPUAddress(); } - template + template bool verifySemaphore(const GenCmdList::iterator &iterator, uint64_t debugPauseStateAddress, DebugPauseState requiredDebugPauseState) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto semaphoreCmd = genCmdCast(*iterator); if ((static_cast(requiredDebugPauseState) == semaphoreCmd->getSemaphoreDataDword()) && @@ -1780,16 +1781,17 @@ struct PauseOnGpuTests : public EnqueueKernelTest { return false; } - template + template void findSemaphores(GenCmdList &cmdList) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto semaphore = find(cmdList.begin(), cmdList.end()); while (semaphore != cmdList.end()) { - if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) { + if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) { semaphoreBeforeWalkerFound++; } - if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) { + if (verifySemaphore(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) { semaphoreAfterWalkerFound++; } @@ -1857,7 +1859,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenInser ClHardwareParse hwParser; hwParser.parseCommands(*pCmdQ); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); EXPECT_EQ(1u, semaphoreBeforeWalkerFound); EXPECT_EQ(1u, semaphoreAfterWalkerFound); @@ -1882,7 +1884,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetToMinusTwoWhenDispatchWalker ClHardwareParse hwParser; hwParser.parseCommands(*pCmdQ); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); findPipeControls(hwParser.cmdList); @@ -1906,7 +1908,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeOnlyWhenDispatchingThenInsert ClHardwareParse hwParser; hwParser.parseCommands(*pCmdQ); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); findPipeControls(hwParser.cmdList); @@ -1930,7 +1932,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToAfterOnlyWhenDispatchingThenInsertP ClHardwareParse hwParser; hwParser.parseCommands(*pCmdQ); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); findPipeControls(hwParser.cmdList); @@ -1954,7 +1956,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeAndAfterWhenDispatchingThenIn ClHardwareParse hwParser; hwParser.parseCommands(*pCmdQ); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); findPipeControls(hwParser.cmdList); @@ -1979,7 +1981,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenDontI ClHardwareParse hwParser; hwParser.parseCommands(*pCmdQ); - findSemaphores(hwParser.cmdList); + findSemaphores(hwParser.cmdList); findPipeControls(hwParser.cmdList); diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp index b6c911a3c3..40f48f6abf 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp @@ -81,8 +81,8 @@ struct EnqueueKernelTypeTest : public HelloWorldFixture - typename std::enable_if::type enqueueKernel(Kernel *inputKernel = nullptr) { + template + typename std::enable_if::type enqueueKernel(Kernel *inputKernel = nullptr) { cl_uint workDim = 1; size_t globalWorkOffset[3] = {0, 0, 0}; @@ -111,11 +111,11 @@ struct EnqueueKernelTypeTest : public HelloWorldFixture - typename std::enable_if::type enqueueKernel(Kernel *inputKernel = nullptr) { + template + typename std::enable_if::type enqueueKernel(Kernel *inputKernel = nullptr) { enqueueKernel(inputKernel); - parseCommands(*pCmdQ); + this->template parseCommands(*pCmdQ); } template diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp index 1b8f00e0b9..b64e64c577 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_tests_xehp_and_later.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/command_container/encode_surface_state.h" #include "shared/source/command_stream/command_stream_receiver.h" #include "shared/source/command_stream/linear_stream.h" #include "shared/source/command_stream/preemption.h" @@ -195,7 +196,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenScrat EXPECT_EQ(scratchController->scratchAllocation->getGpuAddress(), scratchState->getSurfaceBaseAddress()); EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_SCRATCH, scratchState->getSurfaceType()); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast(computeUnits - 1); EXPECT_EQ(length.surfaceState.depth + 1u, scratchState->getDepth()); EXPECT_EQ(length.surfaceState.width + 1u, scratchState->getWidth()); diff --git a/opencl/test/unit_test/context/context_tests.cpp b/opencl/test/unit_test/context/context_tests.cpp index 641ec769f2..b7e3d18dfa 100644 --- a/opencl/test/unit_test/context/context_tests.cpp +++ b/opencl/test/unit_test/context/context_tests.cpp @@ -800,7 +800,7 @@ void onContextDestroy(gtpin::context_handle_t context) { } namespace NEO { -extern gtpin::ocl::gtpin_events_t GTPinCallbacks; +extern gtpin::ocl::gtpin_events_t gtpinCallbacks; TEST_F(GTPinContextDestroyTest, whenCallingConxtextDestructorThenGTPinIsNotifiedBeforeSVMAllocManagerGetsDestroyed) { auto mockContext = reinterpret_cast(context); if (mockContext->svmAllocsManager) { @@ -808,7 +808,7 @@ TEST_F(GTPinContextDestroyTest, whenCallingConxtextDestructorThenGTPinIsNotified } mockContext->svmAllocsManager = new MockSVMAllocManager(); - GTPinCallbacks.onContextDestroy = onContextDestroy; + gtpinCallbacks.onContextDestroy = onContextDestroy; delete context; EXPECT_TRUE(MockSVMAllocManager::svmAllocManagerDeleted); } diff --git a/opencl/test/unit_test/d3d_sharing/cl_dx_sharing_tests.cpp b/opencl/test/unit_test/d3d_sharing/cl_dx_sharing_tests.cpp index 3a42541424..36aa58606c 100644 --- a/opencl/test/unit_test/d3d_sharing/cl_dx_sharing_tests.cpp +++ b/opencl/test/unit_test/d3d_sharing/cl_dx_sharing_tests.cpp @@ -21,7 +21,7 @@ #include "gtest/gtest.h" -static const DXGI_FORMAT DXGIformats[] = { +static const DXGI_FORMAT dxgiFormats[] = { DXGI_FORMAT_R32G32B32A32_TYPELESS, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_UINT, @@ -162,7 +162,7 @@ struct ClIntelSharingFormatQueryDX1X : public PlatformFixture, public ::testing: mockSharingFcns->checkFormatSupportSetParam1 = true; mockSharingFcns->checkFormatSupportParamsSet.pFormat = D3D11_FORMAT_SUPPORT_BUFFER | D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURE3D; - availableFormats = ArrayRef(DXGIformats); + availableFormats = ArrayRef(dxgiFormats); retrievedFormats.assign(availableFormats.size(), DXGI_FORMAT_UNKNOWN); } void TearDown() override { diff --git a/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp b/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp index 9ebd7e9942..ced39d1e8c 100644 --- a/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp +++ b/opencl/test/unit_test/helpers/dispatch_info_builder_tests.cpp @@ -72,12 +72,12 @@ class DispatchInfoBuilderFixture : public ContextFixture, public ClDeviceFixture typedef Test DispatchInfoBuilderTest; -template -class DispatchInfoBuilderMock : DispatchInfoBuilder { +template +class DispatchInfoBuilderMock : DispatchInfoBuilder { public: - using DispatchInfoBuilder::DispatchInfoBuilder; + using DispatchInfoBuilder::DispatchInfoBuilder; void pushSplit(const DispatchInfo &dispatchInfo, MultiDispatchInfo &outMdi) { - DispatchInfoBuilder::pushSplit(dispatchInfo, outMdi); + DispatchInfoBuilder::pushSplit(dispatchInfo, outMdi); } }; diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index c378a300a6..bd8d76b5fd 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -40,7 +40,7 @@ using namespace NEO; -static const unsigned int g_scTestBufferSizeInBytes = 16; +static const unsigned int testBufferSizeInBytes = 16; TEST(Buffer, giveBufferWhenAskedForPtrOffsetForMappingThenReturnCorrectValue) { MockContext ctx; @@ -875,7 +875,7 @@ class BufferTest : public ClDeviceFixture, std::unique_ptr context; MemoryManager *contextMemoryManager; cl_mem_flags flags = 0; - unsigned char pHostPtr[g_scTestBufferSizeInBytes]; + unsigned char pHostPtr[testBufferSizeInBytes]; }; typedef BufferTest NoHostPtr; @@ -884,7 +884,7 @@ TEST_P(NoHostPtr, GivenValidFlagsWhenCreatingBufferThenBufferIsCreated) { auto buffer = Buffer::create( context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, nullptr, retVal); @@ -920,7 +920,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenHwBufferCreationFailsThenReturnNullptr) { auto buffer = Buffer::create( context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, nullptr, retVal); @@ -935,7 +935,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenCreatingBufferWithMemUseHostPtrThenInvalidHo auto buffer = Buffer::create( context.get(), flags | CL_MEM_USE_HOST_PTR, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, nullptr, retVal); EXPECT_EQ(CL_INVALID_HOST_PTR, retVal); @@ -948,7 +948,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenCreatingBufferWithMemCopyHostPtrThenInvalidH auto buffer = Buffer::create( context.get(), flags | CL_MEM_COPY_HOST_PTR, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, nullptr, retVal); EXPECT_EQ(CL_INVALID_HOST_PTR, retVal); @@ -961,7 +961,7 @@ TEST_P(NoHostPtr, WhenGettingAllocationTypeThenCorrectBufferTypeIsReturned) { auto buffer = Buffer::create( context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, nullptr, retVal); ASSERT_EQ(CL_SUCCESS, retVal); @@ -1023,7 +1023,7 @@ struct ValidHostPtr return Buffer::create( context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, pHostPtr, retVal); } @@ -1056,7 +1056,7 @@ TEST_P(ValidHostPtr, WhenBufferIsCreatedThenAddressMatchesOnlyForHostPtr) { if (flags & CL_MEM_COPY_HOST_PTR) { // Buffer should contain a copy of host memory - EXPECT_EQ(0, memcmp(pHostPtr, address, sizeof(g_scTestBufferSizeInBytes))); + EXPECT_EQ(0, memcmp(pHostPtr, address, sizeof(testBufferSizeInBytes))); EXPECT_EQ(nullptr, buffer->getHostPtr()); } } @@ -1065,20 +1065,20 @@ TEST_P(ValidHostPtr, WhenGettingBufferSizeThenSizeIsCorrect) { buffer = createBuffer(); ASSERT_NE(nullptr, buffer); - EXPECT_EQ(g_scTestBufferSizeInBytes, buffer->getSize()); + EXPECT_EQ(testBufferSizeInBytes, buffer->getSize()); } TEST_P(ValidHostPtr, givenValidHostPtrParentFlagsWhenSubBufferIsCreatedWithZeroFlagsThenItCreatesSuccesfuly) { auto retVal = CL_SUCCESS; auto clBuffer = clCreateBuffer(context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, pHostPtr, &retVal); ASSERT_NE(nullptr, clBuffer); - cl_buffer_region region = {0, g_scTestBufferSizeInBytes}; + cl_buffer_region region = {0, testBufferSizeInBytes}; auto subBuffer = clCreateSubBuffer(clBuffer, 0, @@ -1096,12 +1096,12 @@ TEST_P(ValidHostPtr, givenValidHostPtrParentFlagsWhenSubBufferIsCreatedWithParen auto retVal = CL_SUCCESS; auto clBuffer = clCreateBuffer(context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, pHostPtr, &retVal); ASSERT_NE(nullptr, clBuffer); - cl_buffer_region region = {0, g_scTestBufferSizeInBytes}; + cl_buffer_region region = {0, testBufferSizeInBytes}; const cl_mem_flags allValidFlags = CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | @@ -1145,12 +1145,12 @@ TEST_P(ValidHostPtr, givenValidHostPtrParentFlagsWhenSubBufferIsCreatedWithInval auto clBuffer = clCreateBuffer(context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, pHostPtr, &retVal); ASSERT_NE(nullptr, clBuffer); - cl_buffer_region region = {0, g_scTestBufferSizeInBytes}; + cl_buffer_region region = {0, testBufferSizeInBytes}; auto subBuffer = clCreateSubBuffer(clBuffer, invalidFlags, @@ -1200,7 +1200,7 @@ TEST_P(ValidHostPtr, GivenSvmHostPtrWhenCreatingBufferThenBufferIsCreatedCorrect } TEST_P(ValidHostPtr, WhenValidateInputAndCreateBufferThenCorrectBufferIsSet) { - auto buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), nullptr, flags, 0, g_scTestBufferSizeInBytes, pHostPtr, retVal); + auto buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), nullptr, flags, 0, testBufferSizeInBytes, pHostPtr, retVal); EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_NE(nullptr, buffer); @@ -1249,7 +1249,7 @@ class BufferCalculateHostPtrSize : public testing::TestWithParam Inputs[] = {std::make_tuple(0, 0, 0, 1, 1, 1, 10, 1, 1), +static std::tuple inputs[] = {std::make_tuple(0, 0, 0, 1, 1, 1, 10, 1, 1), std::make_tuple(0, 0, 0, 7, 1, 1, 10, 1, 7), std::make_tuple(0, 0, 0, 7, 3, 1, 10, 1, 27), std::make_tuple(0, 0, 0, 7, 1, 3, 10, 10, 27), @@ -1271,7 +1271,7 @@ TEST_P(BufferCalculateHostPtrSize, WhenCalculatingHostPtrSizeThenItIsCorrect) { INSTANTIATE_TEST_CASE_P( BufferCalculateHostPtrSizes, BufferCalculateHostPtrSize, - testing::ValuesIn(Inputs)); + testing::ValuesIn(inputs)); TEST(Buffers64on32Tests, given32BitBufferCreatedWithUseHostPtrFlagThatIsZeroCopyWhenAskedForStorageThenHostPtrIsReturned) { DebugManagerStateRestore dbgRestorer; @@ -1773,7 +1773,7 @@ HWTEST_F(BufferSetSurfaceTests, givenMisalignedPointerWhenSurfaceStateIsProgramm Buffer::setSurfaceState(device.get(), &surfaceState, false, false, 5, svmPtr, 0, nullptr, 0, 0, false, false); EXPECT_EQ(castToUint64(svmPtr), surfaceState.getSurfaceBaseAddress()); - SURFACE_STATE_BUFFER_LENGTH length = {}; + SurfaceStateBufferLength length = {}; length.surfaceState.width = surfaceState.getWidth() - 1; length.surfaceState.height = surfaceState.getHeight() - 1; length.surfaceState.depth = surfaceState.getDepth() - 1; diff --git a/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp b/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp index 71b9ad4ca1..4b1dbde165 100644 --- a/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp +++ b/opencl/test/unit_test/mem_obj/create_image_format_tests.cpp @@ -21,10 +21,10 @@ using namespace NEO; static const unsigned int testImageDimensions = 32; -template +template class CreateImageFormatTest : public testing::TestWithParam { public: - CreateImageFormatTest() : flags(_flags) { + CreateImageFormatTest() : flags(clMemFlags) { } protected: @@ -36,18 +36,16 @@ class CreateImageFormatTest : public testing::TestWithParam { ASSERT_GT(surfaceFormatTable.size(), indexImageFormat); surfaceFormat = &surfaceFormatTable[indexImageFormat]; - // clang-format off - imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D; - imageDesc.image_width = testImageDimensions; - imageDesc.image_height = testImageDimensions; - imageDesc.image_depth = 1; - imageDesc.image_array_size = 1; - imageDesc.image_row_pitch = 0; + imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D; + imageDesc.image_width = testImageDimensions; + imageDesc.image_height = testImageDimensions; + imageDesc.image_depth = 1; + imageDesc.image_array_size = 1; + imageDesc.image_row_pitch = 0; imageDesc.image_slice_pitch = 0; - imageDesc.num_mip_levels = 0; - imageDesc.num_samples = 0; + imageDesc.num_mip_levels = 0; + imageDesc.num_samples = 0; imageDesc.mem_object = NULL; - // clang-format on } void TearDown() override { diff --git a/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp b/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp index 86cb85de90..696dc06634 100644 --- a/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp +++ b/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp @@ -36,7 +36,7 @@ using namespace NEO; -static const unsigned int g_scTestBufferSizeInBytes = 16; +static const unsigned int testBufferSizeInBytes = 16; TEST(Buffer, WhenValidateHandleTypeThenReturnFalse) { MemoryProperties memoryProperties; @@ -67,7 +67,7 @@ class ExportBufferTests : public ClDeviceFixture, std::unique_ptr context; MemoryManager *contextMemoryManager; cl_mem_flags flags = CL_MEM_READ_WRITE; - unsigned char pHostPtr[g_scTestBufferSizeInBytes]; + unsigned char pHostPtr[testBufferSizeInBytes]; }; struct ValidExportHostPtr @@ -98,7 +98,7 @@ struct ValidExportHostPtr return Buffer::create( context.get(), flags, - g_scTestBufferSizeInBytes, + testBufferSizeInBytes, pHostPtr, retVal); } @@ -109,7 +109,7 @@ struct ValidExportHostPtr TEST_F(ValidExportHostPtr, givenPropertiesWithDmaBufWhenValidateInputAndCreateBufferThenInvalidPropertyIsSet) { cl_mem_properties properties[] = {CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR, 0x1234, 0}; - auto buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), properties, flags, 0, g_scTestBufferSizeInBytes, nullptr, retVal); + auto buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), properties, flags, 0, testBufferSizeInBytes, nullptr, retVal); EXPECT_EQ(retVal, CL_INVALID_PROPERTY); EXPECT_EQ(nullptr, buffer); @@ -120,7 +120,7 @@ TEST_F(ValidExportHostPtr, givenInvalidPropertiesWithNtHandleWhenValidateInputAn osHandle invalidHandle = static_cast(pClExecutionEnvironment->memoryManager.get())->invalidSharedHandle; cl_mem_properties properties[] = {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR, invalidHandle, 0}; - cl_mem buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), properties, flags, 0, g_scTestBufferSizeInBytes, nullptr, retVal); + cl_mem buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), properties, flags, 0, testBufferSizeInBytes, nullptr, retVal); EXPECT_EQ(retVal, CL_INVALID_MEM_OBJECT); EXPECT_EQ(static_cast(pClExecutionEnvironment->memoryManager.get())->capturedSharedHandle, properties[1]); @@ -132,7 +132,7 @@ TEST_F(ValidExportHostPtr, givenInvalidPropertiesWithNtHandleWhenValidateInputAn TEST_F(ValidExportHostPtr, givenPropertiesWithNtHandleWhenValidateInputAndCreateBufferThenCorrectBufferIsSet) { cl_mem_properties properties[] = {CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR, 0x1234, 0}; - cl_mem buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), properties, flags, 0, g_scTestBufferSizeInBytes, nullptr, retVal); + cl_mem buffer = BufferFunctions::validateInputAndCreateBuffer(context.get(), properties, flags, 0, testBufferSizeInBytes, nullptr, retVal); EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_EQ(static_cast(pClExecutionEnvironment->memoryManager.get())->capturedSharedHandle, properties[1]); diff --git a/opencl/test/unit_test/mem_obj/zero_copy_tests.cpp b/opencl/test/unit_test/mem_obj/zero_copy_tests.cpp index 9fdf452147..c0e0e62cfb 100644 --- a/opencl/test/unit_test/mem_obj/zero_copy_tests.cpp +++ b/opencl/test/unit_test/mem_obj/zero_copy_tests.cpp @@ -51,24 +51,22 @@ class ZeroCopyBufferTest : public ClDeviceFixture, bool misalignPointer; }; -static const int Multiplier = 1000; -static const int CacheLinedAlignedSize = MemoryConstants::cacheLineSize * Multiplier; -static const int CacheLinedMisAlignedSize = CacheLinedAlignedSize - 1; -static const int PageAlignSize = MemoryConstants::preferredAlignment * Multiplier; +static const int multiplier = 1000; +static const int cacheLinedAlignedSize = MemoryConstants::cacheLineSize * multiplier; +static const int cacheLinedMisAlignedSize = cacheLinedAlignedSize - 1; +static const int pageAlignSize = MemoryConstants::preferredAlignment * multiplier; -// clang-format off -//flags, size to alloc, alignment, size, ZeroCopy, misalignPointer -std::tuple Inputs[] = {std::make_tuple((cl_mem_flags)CL_MEM_USE_HOST_PTR, CacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, CacheLinedMisAlignedSize, false, true), - std::make_tuple((cl_mem_flags)CL_MEM_USE_HOST_PTR, CacheLinedAlignedSize, MemoryConstants::preferredAlignment, CacheLinedAlignedSize, false, true), - std::make_tuple((cl_mem_flags)CL_MEM_USE_HOST_PTR, CacheLinedAlignedSize, MemoryConstants::preferredAlignment, CacheLinedAlignedSize, true, false), - std::make_tuple((cl_mem_flags)CL_MEM_USE_HOST_PTR, CacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, CacheLinedMisAlignedSize, false, false), - std::make_tuple((cl_mem_flags)CL_MEM_USE_HOST_PTR, PageAlignSize, MemoryConstants::preferredAlignment, PageAlignSize, true, false), - std::make_tuple((cl_mem_flags)CL_MEM_USE_HOST_PTR, CacheLinedMisAlignedSize, MemoryConstants::cacheLineSize, CacheLinedAlignedSize, true, false), - std::make_tuple((cl_mem_flags)CL_MEM_COPY_HOST_PTR, CacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, CacheLinedMisAlignedSize, true, true), - std::make_tuple((cl_mem_flags)CL_MEM_COPY_HOST_PTR, CacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, CacheLinedMisAlignedSize, true, false), - std::make_tuple((cl_mem_flags)NULL, 0, 0, CacheLinedMisAlignedSize, true, false), - std::make_tuple((cl_mem_flags)NULL, 0, 0, CacheLinedAlignedSize, true, true)}; -// clang-format on +// flags, size to alloc, alignment, size, ZeroCopy, misalignPointer +std::tuple inputs[] = {std::make_tuple(static_cast(CL_MEM_USE_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, false, true), + std::make_tuple(static_cast(CL_MEM_USE_HOST_PTR), cacheLinedAlignedSize, MemoryConstants::preferredAlignment, cacheLinedAlignedSize, false, true), + std::make_tuple(static_cast(CL_MEM_USE_HOST_PTR), cacheLinedAlignedSize, MemoryConstants::preferredAlignment, cacheLinedAlignedSize, true, false), + std::make_tuple(static_cast(CL_MEM_USE_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, false, false), + std::make_tuple(static_cast(CL_MEM_USE_HOST_PTR), pageAlignSize, MemoryConstants::preferredAlignment, pageAlignSize, true, false), + std::make_tuple(static_cast(CL_MEM_USE_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::cacheLineSize, cacheLinedAlignedSize, true, false), + std::make_tuple(static_cast(CL_MEM_COPY_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, true, true), + std::make_tuple(static_cast(CL_MEM_COPY_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, true, false), + std::make_tuple(0, 0, 0, cacheLinedMisAlignedSize, true, false), + std::make_tuple(0, 0, 0, cacheLinedAlignedSize, true, true)}; TEST_P(ZeroCopyBufferTest, GivenCacheAlignedPointerWhenCreatingBufferThenZeroCopy) { @@ -101,7 +99,7 @@ TEST_P(ZeroCopyBufferTest, GivenCacheAlignedPointerWhenCreatingBufferThenZeroCop INSTANTIATE_TEST_CASE_P( ZeroCopyBufferTests, ZeroCopyBufferTest, - testing::ValuesIn(Inputs)); + testing::ValuesIn(inputs)); TEST(ZeroCopyWithDebugFlag, GivenInputsThatWouldResultInZeroCopyAndUseHostptrDisableZeroCopyFlagWhenBufferIsCreatedThenNonZeroCopyBufferIsReturned) { DebugManagerStateRestore stateRestore; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 99c0be5ece..009b227dd0 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -2342,7 +2342,7 @@ TEST(ProgramTest, givenImagesSupportedWhenCreatingProgramThenInternalOptionsAreC } } -template +template struct CreateProgramFromBinaryMock : public MockProgram { using MockProgram::MockProgram; @@ -2352,7 +2352,7 @@ struct CreateProgramFromBinaryMock : public MockProgram { this->irBinarySize = binarySize; this->isSpirV = spirv; memcpy_s(this->irBinary.get(), binarySize, pBinary, binarySize); - return ErrCodeToReturn; + return errCodeToReturn; } }; diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_arb_sync_event_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_arb_sync_event_tests.cpp index e1cb7afbbb..e26fd5445f 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_arb_sync_event_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_arb_sync_event_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -49,9 +49,9 @@ TEST(GlArbSyncEvent, whenCreateArbSyncEventNameIsCalledMultipleTimesThenEachCall NEO::destroyArbSyncEventName(name3); } -template +template inline void glArbSyncObjectWaitServerMock(NEO::OSInterface &osInterface, CL_GL_SYNC_INFO &glSyncInfo) { - glSyncInfo.waitCalled = SignalWaited; + glSyncInfo.waitCalled = signalWaited; } struct MockBaseEvent : Event { diff --git a/shared/generate_cpp_array/source/generate_cpp_array.cpp b/shared/generate_cpp_array/source/generate_cpp_array.cpp index 90397cef00..417d50c821 100644 --- a/shared/generate_cpp_array/source/generate_cpp_array.cpp +++ b/shared/generate_cpp_array/source/generate_cpp_array.cpp @@ -11,7 +11,7 @@ #include #include -constexpr int MIN_ARG_COUNT = 7; +constexpr int minArgCount = 7; static void showUsage(std::string name) { std::cerr << "Usage " << name << " - ALL BUT -p, --platform MUST BE SPECIFIED\n" @@ -97,7 +97,7 @@ std::string parseToCharArray(std::unique_ptr &binary, size_t size, st } int main(int argc, char *argv[]) { - if (argc < MIN_ARG_COUNT) { + if (argc < minArgCount) { showUsage(argv[0]); return 1; } diff --git a/shared/offline_compiler/source/offline_compiler_helper.cpp b/shared/offline_compiler/source/offline_compiler_helper.cpp index 15ee2ec24d..efd445ab0e 100644 --- a/shared/offline_compiler/source/offline_compiler_helper.cpp +++ b/shared/offline_compiler/source/offline_compiler_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,12 +10,12 @@ namespace NEO { -template -DebugSettingsManager::DebugSettingsManager(const char *registryPath) { +template +DebugSettingsManager::DebugSettingsManager(const char *registryPath) { } -template -DebugSettingsManager::~DebugSettingsManager() { +template +DebugSettingsManager::~DebugSettingsManager() { readerImpl.reset(); }; diff --git a/shared/source/aub_mem_dump/aub_mem_dump.cpp b/shared/source/aub_mem_dump/aub_mem_dump.cpp index bfa451a4cb..47dac4fbfb 100644 --- a/shared/source/aub_mem_dump/aub_mem_dump.cpp +++ b/shared/source/aub_mem_dump/aub_mem_dump.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,9 +14,9 @@ namespace AubMemDump { -const uint64_t g_pageMask = ~(4096ull - 1); +const uint64_t pageMask = ~(4096ull - 1); -const size_t g_dwordCountMax = 65536; +const size_t dwordCountMax = 65536; // Some page table constants used in virtualizing the page tables. // clang-format off diff --git a/shared/source/aub_mem_dump/aub_mem_dump.h b/shared/source/aub_mem_dump/aub_mem_dump.h index 0c0e7a5b5c..66f57b23ad 100644 --- a/shared/source/aub_mem_dump/aub_mem_dump.h +++ b/shared/source/aub_mem_dump/aub_mem_dump.h @@ -270,7 +270,7 @@ struct AubDump : public std::conditional, AubPageTableHelper64>::type; using Stream = typename Traits::Stream; - typedef union _MiContextDescriptorReg_ { + union MiContextDescriptorReg { struct { uint64_t valid : 1; //[0] uint64_t forcePageDirRestore : 1; //[1] @@ -286,7 +286,7 @@ struct AubDump : public std::conditional void AubDump::addMemoryWrite(typename Traits::Stream &stream, uint64_t addr, const void *memory, size_t sizeRemaining, int addressSpace, int hint) { // We can only dump a relatively small amount per CmdServicesMemTraceMemoryWrite auto sizeMemoryWriteHeader = sizeof(CmdServicesMemTraceMemoryWrite) - sizeof(CmdServicesMemTraceMemoryWrite::data); - auto blockSizeMax = g_dwordCountMax * sizeof(uint32_t) - sizeMemoryWriteHeader; + auto blockSizeMax = dwordCountMax * sizeof(uint32_t) - sizeMemoryWriteHeader; if (hint == CmdServicesMemTraceMemoryWrite::DataTypeHintValues::TraceLogicalRingContextRcs || hint == CmdServicesMemTraceMemoryWrite::DataTypeHintValues::TraceLogicalRingContextBcs || @@ -75,8 +75,8 @@ void AubDump::addMemoryWrite(typename Traits::Stream &stream, uint64_t a // Reserve memory in the GGTT. template uint64_t AubDump::reserveAddress(typename Traits::Stream &stream, uint32_t addr, size_t size, unsigned int addressSpace, uint64_t physStart, AubGTTData data) { - auto startPage = addr & g_pageMask; - auto endPage = (addr + size - 1) & g_pageMask; + auto startPage = addr & pageMask; + auto endPage = (addr + size - 1) & pageMask; auto numPages = (uint32_t)(((endPage - startPage) / 4096) + 1); // Can only handle 16 bits of dwordCount. @@ -166,7 +166,7 @@ uint64_t AubPageTableHelper32::reserveAddressPPGTT(typename Traits::Stre addressSpace, hint); auto currPDE = startPDE; - auto physPage = BaseClass::getPTEAddress(startPTE) & g_pageMask; + auto physPage = BaseClass::getPTEAddress(startPTE) & pageMask; while (currPDE <= endPDE) { auto pde = physPage | NEO::AubHelper::getPTEntryBits(additionalBits); @@ -189,7 +189,7 @@ uint64_t AubPageTableHelper32::reserveAddressPPGTT(typename Traits::Stre addressSpace, hint); auto currPTE = startPTE; - auto physPage = physAddress & g_pageMask; + auto physPage = physAddress & pageMask; while (currPTE <= endPTE) { auto pte = physPage | additionalBits; @@ -238,7 +238,7 @@ uint64_t AubPageTableHelper64::reserveAddressPPGTT(typename Traits::Stre addressSpace, hint); auto currPML4 = startPML4; - auto physPage = BaseClass::getPDPAddress(startPDP) & g_pageMask; + auto physPage = BaseClass::getPDPAddress(startPDP) & pageMask; while (currPML4 <= endPML4) { auto pml4 = physPage | NEO::AubHelper::getPTEntryBits(additionalBits); @@ -261,7 +261,7 @@ uint64_t AubPageTableHelper64::reserveAddressPPGTT(typename Traits::Stre addressSpace, hint); auto currPDP = startPDP; - auto physPage = BaseClass::getPDEAddress(startPDE) & g_pageMask; + auto physPage = BaseClass::getPDEAddress(startPDE) & pageMask; while (currPDP <= endPDP) { auto pdp = physPage | NEO::AubHelper::getPTEntryBits(additionalBits); @@ -284,7 +284,7 @@ uint64_t AubPageTableHelper64::reserveAddressPPGTT(typename Traits::Stre addressSpace, hint); auto currPDE = startPDE; - auto physPage = BaseClass::getPTEAddress(startPTE) & g_pageMask; + auto physPage = BaseClass::getPTEAddress(startPTE) & pageMask; while (currPDE <= endPDE) { auto pde = physPage | NEO::AubHelper::getPTEntryBits(additionalBits); @@ -307,7 +307,7 @@ uint64_t AubPageTableHelper64::reserveAddressPPGTT(typename Traits::Stre addressSpace, hint); auto currPTE = startPTE; - auto physPage = physAddress & g_pageMask; + auto physPage = physAddress & pageMask; while (currPTE <= endPTE) { auto pte = physPage | additionalBits; diff --git a/shared/source/command_container/command_encoder.inl b/shared/source/command_container/command_encoder.inl index ec6ad99a72..b59c54e888 100644 --- a/shared/source/command_container/command_encoder.inl +++ b/shared/source/command_container/command_encoder.inl @@ -406,7 +406,7 @@ void EncodeSurfaceState::encodeBuffer(EncodeSurfaceStateArgs &args) { auto surfaceState = reinterpret_cast(args.outMemory); auto bufferSize = alignUp(args.size, getSurfaceBaseAddressAlignment()); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast(bufferSize - 1); surfaceState->setWidth(length.surfaceState.width + 1); diff --git a/shared/source/command_container/encode_surface_state.h b/shared/source/command_container/encode_surface_state.h index 5c5a91547c..655556a376 100644 --- a/shared/source/command_container/encode_surface_state.h +++ b/shared/source/command_container/encode_surface_state.h @@ -22,6 +22,15 @@ struct PipeControlArgs; struct PipelineSelectArgs; struct RootDeviceEnvironment; +union SurfaceStateBufferLength { + uint32_t length; + struct SurfaceState { + uint32_t width : 7; // BITFIELD_RANGE(0, 6) + uint32_t height : 14; // BITFIELD_RANGE(7, 20) + uint32_t depth : 11; // BITFIELD_RANGE(21, 31) + } surfaceState; +}; + template struct EncodeSurfaceState { using R_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE; diff --git a/shared/source/command_stream/aub_command_stream_receiver.cpp b/shared/source/command_stream/aub_command_stream_receiver.cpp index c6a13712e2..4bbaf2ef6f 100644 --- a/shared/source/command_stream/aub_command_stream_receiver.cpp +++ b/shared/source/command_stream/aub_command_stream_receiver.cpp @@ -88,7 +88,7 @@ using CmdServicesMemTraceVersion = AubMemDump::CmdServicesMemTraceVersion; static auto sizeMemoryWriteHeader = sizeof(CmdServicesMemTraceMemoryWrite) - sizeof(CmdServicesMemTraceMemoryWrite::data); -extern const size_t g_dwordCountMax; +extern const size_t dwordCountMax; void AubFileStream::open(const char *filePath) { fileHandle.open(filePath, std::ofstream::binary); @@ -151,7 +151,7 @@ void AubFileStream::writeMemoryWriteHeader(uint64_t physAddress, size_t size, ui CmdServicesMemTraceMemoryWrite header = {}; auto alignedBlockSize = (size + sizeof(uint32_t) - 1) & ~(sizeof(uint32_t) - 1); auto dwordCount = (sizeMemoryWriteHeader + alignedBlockSize) / sizeof(uint32_t); - DEBUG_BREAK_IF(dwordCount > AubMemDump::g_dwordCountMax); + DEBUG_BREAK_IF(dwordCount > AubMemDump::dwordCountMax); header.setHeader(); header.dwordCount = static_cast(dwordCount - 1); @@ -237,7 +237,7 @@ void AubFileStream::expectMemory(uint64_t physAddress, const void *memory, size_ header.addressSpace = addressSpace; auto headerSize = sizeof(CmdServicesMemTraceMemoryCompare) - sizeof(CmdServicesMemTraceMemoryCompare::data); - auto blockSizeMax = g_dwordCountMax * sizeof(uint32_t) - headerSize; + auto blockSizeMax = dwordCountMax * sizeof(uint32_t) - headerSize; // We have to decompose memory into chunks that can be streamed per iteration while (sizeRemaining > 0) { diff --git a/shared/source/debug_settings/debug_settings_manager.cpp b/shared/source/debug_settings/debug_settings_manager.cpp index 51a588f753..38d2e7e92b 100644 --- a/shared/source/debug_settings/debug_settings_manager.cpp +++ b/shared/source/debug_settings/debug_settings_manager.cpp @@ -32,8 +32,8 @@ static std::string toString(const T &arg) { } } -template -DebugSettingsManager::DebugSettingsManager(const char *registryPath) { +template +DebugSettingsManager::DebugSettingsManager(const char *registryPath) { readerImpl = SettingsReaderCreator::create(std::string(registryPath)); ApiSpecificConfig::initPrefixes(); injectSettingsFromReader(); @@ -44,13 +44,13 @@ DebugSettingsManager::DebugSettingsManager(const char *registryPath) ; } -template -DebugSettingsManager::~DebugSettingsManager() { +template +DebugSettingsManager::~DebugSettingsManager() { readerImpl.reset(); }; -template -void DebugSettingsManager::getHardwareInfoOverride(std::string &hwInfoConfig) { +template +void DebugSettingsManager::getHardwareInfoOverride(std::string &hwInfoConfig) { std::string str = flags.HardwareInfoOverride.get(); if (str[0] == '\"') { str.pop_back(); @@ -72,17 +72,17 @@ static const char *convPrefixToString(DebugVarPrefix prefix) { } } -template +template template -void DebugSettingsManager::dumpNonDefaultFlag(const char *variableName, const DataType &variableValue, const DataType &defaultValue, std::ostringstream &ostring) { +void DebugSettingsManager::dumpNonDefaultFlag(const char *variableName, const DataType &variableValue, const DataType &defaultValue, std::ostringstream &ostring) { if (variableValue != defaultValue) { const auto variableStringValue = toString(variableValue); ostring << "Non-default value of debug variable: " << variableName << " = " << variableStringValue.c_str() << '\n'; } } -template -void DebugSettingsManager::getStringWithFlags(std::string &allFlags, std::string &changedFlags) const { +template +void DebugSettingsManager::getStringWithFlags(std::string &allFlags, std::string &changedFlags) const { std::ostringstream allFlagsStream; allFlagsStream.str(""); @@ -115,8 +115,8 @@ void DebugSettingsManager::getStringWithFlags(std::string &allFlags, changedFlags = changedFlagsStream.str(); } -template -void DebugSettingsManager::dumpFlags() const { +template +void DebugSettingsManager::dumpFlags() const { if (flags.PrintDebugSettings.get() == false) { return; } @@ -133,8 +133,8 @@ void DebugSettingsManager::dumpFlags() const { settingsDumpFile << allFlags; } -template -void DebugSettingsManager::injectSettingsFromReader() { +template +void DebugSettingsManager::injectSettingsFromReader() { #undef DECLARE_DEBUG_VARIABLE #define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ { \ diff --git a/shared/source/debug_settings/debug_settings_manager.h b/shared/source/debug_settings/debug_settings_manager.h index 903c738d8b..11cdfef9c9 100644 --- a/shared/source/debug_settings/debug_settings_manager.h +++ b/shared/source/debug_settings/debug_settings_manager.h @@ -32,7 +32,7 @@ constexpr DebugFunctionalityLevel globalDebugFunctionalityLevel = DebugFunctiona NEO::printDebugString(flag, __VA_ARGS__); namespace NEO { -template +template class FileLogger; extern FileLogger &fileLoggerInstance(); @@ -113,7 +113,7 @@ struct DebugVariables { // NOLINT(clang-analyzer #undef DECLARE_DEBUG_VARIABLE }; -template +template class DebugSettingsManager { public: DebugSettingsManager(const char *registryPath); @@ -123,11 +123,11 @@ class DebugSettingsManager { DebugSettingsManager &operator=(const DebugSettingsManager &) = delete; static constexpr bool registryReadAvailable() { - return (DebugLevel == DebugFunctionalityLevel::Full) || (DebugLevel == DebugFunctionalityLevel::RegKeys); + return (debugLevel == DebugFunctionalityLevel::Full) || (debugLevel == DebugFunctionalityLevel::RegKeys); } static constexpr bool disabled() { - return DebugLevel == DebugFunctionalityLevel::None; + return debugLevel == DebugFunctionalityLevel::None; } void getHardwareInfoOverride(std::string &hwInfoConfig); @@ -207,6 +207,6 @@ extern DebugSettingsManager DebugManager; PRINT_DEBUGGER_LOG(stdout, "\nINFO: " STR, __VA_ARGS__) \ } -template -const char *DebugSettingsManager::settingsDumpFileName = "igdrcl_dumped.config"; +template +const char *DebugSettingsManager::settingsDumpFileName = "igdrcl_dumped.config"; }; // namespace NEO diff --git a/shared/source/device_binary_format/elf/elf.h b/shared/source/device_binary_format/elf/elf.h index 6127435c5e..36d7e75ff0 100644 --- a/shared/source/device_binary_format/elf/elf.h +++ b/shared/source/device_binary_format/elf/elf.h @@ -153,7 +153,7 @@ struct ElfFileHeaderIdentity { }; static_assert(sizeof(ElfFileHeaderIdentity) == 16, ""); -template +template struct ElfProgramHeaderTypes; template <> @@ -180,7 +180,7 @@ struct ElfProgramHeaderTypes { using Align = uint64_t; }; -template +template struct ElfProgramHeader; template <> @@ -210,7 +210,7 @@ struct ElfProgramHeader { static_assert(sizeof(ElfProgramHeader) == 0x20, ""); static_assert(sizeof(ElfProgramHeader) == 0x38, ""); -template +template struct ElfSectionHeaderTypes; template <> @@ -241,24 +241,24 @@ struct ElfSectionHeaderTypes { using EntSize = uint64_t; }; -template +template struct ElfSectionHeader { - typename ElfSectionHeaderTypes::Name name = 0U; // offset to string in string section names - typename ElfSectionHeaderTypes::Type type = SHT_NULL; // section type - typename ElfSectionHeaderTypes::Flags flags = SHF_NONE; // section flags - typename ElfSectionHeaderTypes::Addr addr = 0U; // VA of section in memory - typename ElfSectionHeaderTypes::Offset offset = 0U; // absolute offset of section data in file - typename ElfSectionHeaderTypes::Size size = 0U; // size of section's data - typename ElfSectionHeaderTypes::Link link = SHN_UNDEF; // index of associated section - typename ElfSectionHeaderTypes::Info info = 0U; // extra information - typename ElfSectionHeaderTypes::AddrAlign addralign = 0U; // section alignment - typename ElfSectionHeaderTypes::EntSize entsize = 0U; // section's entries size + typename ElfSectionHeaderTypes::Name name = 0U; // offset to string in string section names + typename ElfSectionHeaderTypes::Type type = SHT_NULL; // section type + typename ElfSectionHeaderTypes::Flags flags = SHF_NONE; // section flags + typename ElfSectionHeaderTypes::Addr addr = 0U; // VA of section in memory + typename ElfSectionHeaderTypes::Offset offset = 0U; // absolute offset of section data in file + typename ElfSectionHeaderTypes::Size size = 0U; // size of section's data + typename ElfSectionHeaderTypes::Link link = SHN_UNDEF; // index of associated section + typename ElfSectionHeaderTypes::Info info = 0U; // extra information + typename ElfSectionHeaderTypes::AddrAlign addralign = 0U; // section alignment + typename ElfSectionHeaderTypes::EntSize entsize = 0U; // section's entries size }; static_assert(sizeof(ElfSectionHeader) == 0x28, ""); static_assert(sizeof(ElfSectionHeader) == 0x40, ""); -template +template struct ElfFileHeaderTypes; template <> @@ -295,22 +295,22 @@ struct ElfFileHeaderTypes { using ShStrNdx = uint16_t; }; -template +template struct ElfFileHeader { - ElfFileHeaderIdentity identity = ElfFileHeaderIdentity(NumBits); // elf file identity - typename ElfFileHeaderTypes::Type type = ET_NONE; // elf file type - typename ElfFileHeaderTypes::Machine machine = EM_NONE; // target machine - typename ElfFileHeaderTypes::Version version = 1U; // elf file version - typename ElfFileHeaderTypes::Entry entry = 0U; // entry point (start address) - typename ElfFileHeaderTypes::PhOff phOff = 0U; // absolute offset to program header table in file - typename ElfFileHeaderTypes::ShOff shOff = 0U; // absolute offset to section header table in file - typename ElfFileHeaderTypes::Flags flags = 0U; // target-dependent flags - typename ElfFileHeaderTypes::EhSize ehSize = sizeof(ElfFileHeader); // header size - typename ElfFileHeaderTypes::PhEntSize phEntSize = sizeof(ElfProgramHeader); // size of entries in program header table - typename ElfFileHeaderTypes::PhNum phNum = 0U; // number of entries in pogram header table - typename ElfFileHeaderTypes::ShEntSize shEntSize = sizeof(ElfSectionHeader); // size of entries section header table - typename ElfFileHeaderTypes::ShNum shNum = 0U; // number of entries in section header table - typename ElfFileHeaderTypes::ShStrNdx shStrNdx = SHN_UNDEF; // index of section header table with section names + ElfFileHeaderIdentity identity = ElfFileHeaderIdentity(numBits); // elf file identity + typename ElfFileHeaderTypes::Type type = ET_NONE; // elf file type + typename ElfFileHeaderTypes::Machine machine = EM_NONE; // target machine + typename ElfFileHeaderTypes::Version version = 1U; // elf file version + typename ElfFileHeaderTypes::Entry entry = 0U; // entry point (start address) + typename ElfFileHeaderTypes::PhOff phOff = 0U; // absolute offset to program header table in file + typename ElfFileHeaderTypes::ShOff shOff = 0U; // absolute offset to section header table in file + typename ElfFileHeaderTypes::Flags flags = 0U; // target-dependent flags + typename ElfFileHeaderTypes::EhSize ehSize = sizeof(ElfFileHeader); // header size + typename ElfFileHeaderTypes::PhEntSize phEntSize = sizeof(ElfProgramHeader); // size of entries in program header table + typename ElfFileHeaderTypes::PhNum phNum = 0U; // number of entries in pogram header table + typename ElfFileHeaderTypes::ShEntSize shEntSize = sizeof(ElfSectionHeader); // size of entries section header table + typename ElfFileHeaderTypes::ShNum shNum = 0U; // number of entries in section header table + typename ElfFileHeaderTypes::ShStrNdx shStrNdx = SHN_UNDEF; // index of section header table with section names }; static_assert(sizeof(ElfFileHeader) == 0x34, ""); @@ -323,7 +323,7 @@ struct ElfNoteSection { }; static_assert(sizeof(ElfNoteSection) == 0xC, ""); -template +template struct ElfSymbolEntryTypes; template <> @@ -346,7 +346,7 @@ struct ElfSymbolEntryTypes { using Size = uint64_t; }; -template +template struct ElfSymbolEntry; template <> @@ -431,7 +431,7 @@ struct ElfSymbolEntry { }; static_assert(sizeof(ElfSymbolEntry) == 0x18, ""); -template +template struct ElfRelocationEntryTypes; template <> @@ -506,10 +506,10 @@ constexpr ElfRelocationEntryTypes::Info setRelocationType(ElfReloca } } // namespace RelocationFuncs -template +template struct ElfRel { - using Offset = typename ElfRelocationEntryTypes::Offset; - using Info = typename ElfRelocationEntryTypes::Info; + using Offset = typename ElfRelocationEntryTypes::Offset; + using Info = typename ElfRelocationEntryTypes::Info; Offset offset = 0U; Info info = 0U; @@ -533,11 +533,11 @@ struct ElfRel { static_assert(sizeof(ElfRel) == 0x8, ""); static_assert(sizeof(ElfRel) == 0x10, ""); -template +template struct ElfRela { - using Offset = typename ElfRelocationEntryTypes::Offset; - using Info = typename ElfRelocationEntryTypes::Info; - using Addend = typename ElfRelocationEntryTypes::Addend; + using Offset = typename ElfRelocationEntryTypes::Offset; + using Info = typename ElfRelocationEntryTypes::Info; + using Addend = typename ElfRelocationEntryTypes::Addend; Offset offset = 0U; Info info = 0U; Addend addend = 0U; diff --git a/shared/source/device_binary_format/elf/elf_decoder.cpp b/shared/source/device_binary_format/elf/elf_decoder.cpp index 7c44a53d27..db2f8ddcf9 100644 --- a/shared/source/device_binary_format/elf/elf_decoder.cpp +++ b/shared/source/device_binary_format/elf/elf_decoder.cpp @@ -16,18 +16,18 @@ namespace NEO { namespace Elf { -template -const ElfFileHeader *decodeElfFileHeader(const ArrayRef binary) { - if (binary.size() < sizeof(ElfFileHeader)) { +template +const ElfFileHeader *decodeElfFileHeader(const ArrayRef binary) { + if (binary.size() < sizeof(ElfFileHeader)) { return nullptr; } - const ElfFileHeader *header = reinterpret_cast *>(binary.begin()); + const ElfFileHeader *header = reinterpret_cast *>(binary.begin()); bool validHeader = (header->identity.magic[0] == elfMagic[0]); validHeader &= (header->identity.magic[1] == elfMagic[1]); validHeader &= (header->identity.magic[2] == elfMagic[2]); validHeader &= (header->identity.magic[3] == elfMagic[3]); - validHeader &= (header->identity.eClass == NumBits); + validHeader &= (header->identity.eClass == numBits); return validHeader ? header : nullptr; } @@ -35,10 +35,10 @@ const ElfFileHeader *decodeElfFileHeader(const ArrayRef template const ElfFileHeader *decodeElfFileHeader(const ArrayRef); template const ElfFileHeader *decodeElfFileHeader(const ArrayRef); -template -Elf decodeElf(const ArrayRef binary, std::string &outErrReason, std::string &outWarning) { - Elf ret = {}; - ret.elfFileHeader = decodeElfFileHeader(binary); +template +Elf decodeElf(const ArrayRef binary, std::string &outErrReason, std::string &outWarning) { + Elf ret = {}; + ret.elfFileHeader = decodeElfFileHeader(binary); if (nullptr == ret.elfFileHeader) { outErrReason = "Invalid or missing ELF header"; return {}; @@ -54,7 +54,7 @@ Elf decodeElf(const ArrayRef binary, std::string &outErr return {}; } - const ElfProgramHeader *programHeader = reinterpret_cast *>(binary.begin() + ret.elfFileHeader->phOff); + const ElfProgramHeader *programHeader = reinterpret_cast *>(binary.begin() + ret.elfFileHeader->phOff); for (decltype(ret.elfFileHeader->phNum) i = 0; i < ret.elfFileHeader->phNum; ++i) { if (programHeader->offset + programHeader->fileSz > binary.size()) { outErrReason = "Out of bounds program header offset/filesz, program header idx : " + std::to_string(i); @@ -65,7 +65,7 @@ Elf decodeElf(const ArrayRef binary, std::string &outErr programHeader = ptrOffset(programHeader, ret.elfFileHeader->phEntSize); } - const ElfSectionHeader *sectionHeader = reinterpret_cast *>(binary.begin() + ret.elfFileHeader->shOff); + const ElfSectionHeader *sectionHeader = reinterpret_cast *>(binary.begin() + ret.elfFileHeader->shOff); for (decltype(ret.elfFileHeader->shNum) i = 0; i < ret.elfFileHeader->shNum; ++i) { ArrayRef data; if (SHT_NOBITS != sectionHeader->type) { @@ -86,16 +86,16 @@ Elf decodeElf(const ArrayRef binary, std::string &outErr return ret; } -template -bool Elf::decodeSymTab(SectionHeaderAndData §ionHeaderData, std::string &outError) { +template +bool Elf::decodeSymTab(SectionHeaderAndData §ionHeaderData, std::string &outError) { if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_SYMTAB) { - auto symSize = sizeof(ElfSymbolEntry); + auto symSize = sizeof(ElfSymbolEntry); if (symSize != sectionHeaderData.header->entsize) { outError.append("Invalid symbol table entries size - expected : " + std::to_string(symSize) + ", got : " + std::to_string(sectionHeaderData.header->entsize) + "\n"); return false; } auto numberOfSymbols = static_cast(sectionHeaderData.header->size / sectionHeaderData.header->entsize); - auto symbol = reinterpret_cast *>(sectionHeaderData.data.begin()); + auto symbol = reinterpret_cast *>(sectionHeaderData.data.begin()); symbolTable.resize(numberOfSymbols); for (size_t i = 0; i < numberOfSymbols; i++) { @@ -106,10 +106,10 @@ bool Elf::decodeSymTab(SectionHeaderAndData §ionHeaderData, std::st return true; } -template -bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, std::string &outError) { +template +bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, std::string &outError) { if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_RELA) { - auto relaSize = sizeof(ElfRela); + auto relaSize = sizeof(ElfRela); if (relaSize != sectionHeaderData.header->entsize) { outError.append("Invalid rela entries size - expected : " + std::to_string(relaSize) + ", got : " + std::to_string(sectionHeaderData.header->entsize) + "\n"); return false; @@ -121,7 +121,7 @@ bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, st auto debugDataRelocation = isDebugDataRelocation(ConstStringRef(sectionName.c_str())); Relocations &relocs = debugDataRelocation ? debugInfoRelocations : relocations; - auto rela = reinterpret_cast *>(sectionHeaderData.data.begin()); + auto rela = reinterpret_cast *>(sectionHeaderData.data.begin()); // there may be multiple rela sections, reserve additional size auto previousEntries = relocations.size(); @@ -130,8 +130,8 @@ bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, st for (auto i = previousEntries; i < allEntries; i++) { - int symbolIndex = extractSymbolIndex>(*rela); - auto relocType = extractRelocType>(*rela); + int symbolIndex = extractSymbolIndex>(*rela); + auto relocType = extractRelocType>(*rela); int symbolSectionIndex = symbolTable[symbolIndex].shndx; std::string name = std::string(reinterpret_cast(sectionHeaderNamesData.begin()) + symbolTable[symbolIndex].name); @@ -143,7 +143,7 @@ bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, st } if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_REL) { - auto relSize = sizeof(ElfRel); + auto relSize = sizeof(ElfRel); if (relSize != sectionHeaderData.header->entsize) { outError.append("Invalid rel entries size - expected : " + std::to_string(relSize) + ", got : " + std::to_string(sectionHeaderData.header->entsize) + "\n"); return false; @@ -156,7 +156,7 @@ bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, st auto debugDataRelocation = isDebugDataRelocation(ConstStringRef(sectionName.c_str())); Relocations &relocs = debugDataRelocation ? debugInfoRelocations : relocations; - auto reloc = reinterpret_cast *>(sectionHeaderData.data.begin()); + auto reloc = reinterpret_cast *>(sectionHeaderData.data.begin()); // there may be multiple rel sections, reserve additional size auto previousEntries = relocations.size(); @@ -164,8 +164,8 @@ bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, st relocs.reserve(allEntries); for (auto i = previousEntries; i < allEntries; i++) { - int symbolIndex = extractSymbolIndex>(*reloc); - auto relocType = extractRelocType>(*reloc); + int symbolIndex = extractSymbolIndex>(*reloc); + auto relocType = extractRelocType>(*reloc); int symbolSectionIndex = symbolTable[symbolIndex].shndx; std::string name = std::string(reinterpret_cast(sectionHeaderNamesData.begin()) + symbolTable[symbolIndex].name); @@ -179,8 +179,8 @@ bool Elf::decodeRelocations(SectionHeaderAndData §ionHeaderData, st return true; } -template -bool Elf::decodeSections(std::string &outError) { +template +bool Elf::decodeSections(std::string &outError) { bool success = true; for (size_t i = 0; i < sectionHeaders.size(); i++) { success &= decodeSymTab(sectionHeaders[i], outError); @@ -194,8 +194,8 @@ bool Elf::decodeSections(std::string &outError) { return success; } -template -bool Elf::isDebugDataRelocation(ConstStringRef sectionName) { +template +bool Elf::isDebugDataRelocation(ConstStringRef sectionName) { if (sectionName.startsWith(NEO::Elf::SpecialSectionNames::debug.data())) { return true; } diff --git a/shared/source/device_binary_format/elf/elf_decoder.h b/shared/source/device_binary_format/elf/elf_decoder.h index cabb45c991..981130f04f 100644 --- a/shared/source/device_binary_format/elf/elf_decoder.h +++ b/shared/source/device_binary_format/elf/elf_decoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,15 +22,15 @@ enum class RELOCATION_X8664_TYPE : uint32_t { R_X8664_32 = 0xa }; -template +template struct Elf { struct ProgramHeaderAndData { - const ElfProgramHeader *header = nullptr; + const ElfProgramHeader *header = nullptr; ArrayRef data; }; struct SectionHeaderAndData { - const ElfSectionHeader *header; + const ElfSectionHeader *header; ArrayRef data; }; @@ -44,7 +44,7 @@ struct Elf { std::string symbolName; }; using Relocations = std::vector; - using SymbolsTable = std::vector>; + using SymbolsTable = std::vector>; bool decodeSections(std::string &outError); @@ -73,11 +73,11 @@ struct Elf { return std::string(reinterpret_cast(sectionHeaderNamesData.begin()) + nameOffset); } - decltype(ElfSymbolEntry::value) getSymbolValue(uint32_t idx) const { + decltype(ElfSymbolEntry::value) getSymbolValue(uint32_t idx) const { return symbolTable[idx].value; } - decltype(ElfSectionHeader::offset) getSectionOffset(uint32_t idx) const { + decltype(ElfSectionHeader::offset) getSectionOffset(uint32_t idx) const { return sectionHeaders[idx].header->offset; } @@ -93,7 +93,7 @@ struct Elf { return symbolTable; } - const ElfFileHeader *elfFileHeader = nullptr; + const ElfFileHeader *elfFileHeader = nullptr; StackVec programHeaders; StackVec sectionHeaders; @@ -107,19 +107,19 @@ struct Elf { Relocations debugInfoRelocations; }; -template -const ElfFileHeader *decodeElfFileHeader(const ArrayRef binary); +template +const ElfFileHeader *decodeElfFileHeader(const ArrayRef binary); extern template const ElfFileHeader *decodeElfFileHeader(const ArrayRef); extern template const ElfFileHeader *decodeElfFileHeader(const ArrayRef); -template -Elf decodeElf(const ArrayRef binary, std::string &outErrReason, std::string &outWarning); +template +Elf decodeElf(const ArrayRef binary, std::string &outErrReason, std::string &outWarning); extern template Elf decodeElf(const ArrayRef, std::string &, std::string &); extern template Elf decodeElf(const ArrayRef, std::string &, std::string &); -template +template inline bool isElf(const ArrayRef binary) { - return (nullptr != decodeElfFileHeader(binary)); + return (nullptr != decodeElfFileHeader(binary)); } inline bool isElf(const ArrayRef binary) { diff --git a/shared/source/device_binary_format/elf/elf_encoder.cpp b/shared/source/device_binary_format/elf/elf_encoder.cpp index b231cf7c73..9f60bd8c55 100644 --- a/shared/source/device_binary_format/elf/elf_encoder.cpp +++ b/shared/source/device_binary_format/elf/elf_encoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,21 +15,21 @@ namespace NEO { namespace Elf { -template -ElfEncoder::ElfEncoder(bool addUndefSectionHeader, bool addHeaderSectionNamesSection, typename ElfSectionHeaderTypes::AddrAlign defaultDataAlignemnt) +template +ElfEncoder::ElfEncoder(bool addUndefSectionHeader, bool addHeaderSectionNamesSection, typename ElfSectionHeaderTypes::AddrAlign defaultDataAlignemnt) : addUndefSectionHeader(addUndefSectionHeader), addHeaderSectionNamesSection(addHeaderSectionNamesSection), defaultDataAlignment(defaultDataAlignemnt) { // add special strings UNRECOVERABLE_IF(defaultDataAlignment == 0); shStrTabNameOffset = this->appendSectionName(SpecialSectionNames::shStrTab); if (addUndefSectionHeader) { - ElfSectionHeader undefSection; + ElfSectionHeader undefSection; sectionHeaders.push_back(undefSection); } } -template -void ElfEncoder::appendSection(const ElfSectionHeader §ionHeader, const ArrayRef sectionData) { +template +void ElfEncoder::appendSection(const ElfSectionHeader §ionHeader, const ArrayRef sectionData) { sectionHeaders.push_back(sectionHeader); if ((SHT_NOBITS != sectionHeader.type) && (false == sectionData.empty())) { auto sectionDataAlignment = std::min(defaultDataAlignment, 8U); @@ -44,8 +44,8 @@ void ElfEncoder::appendSection(const ElfSectionHeader §ion } } -template -void ElfEncoder::appendSegment(const ElfProgramHeader &programHeader, const ArrayRef segmentData) { +template +void ElfEncoder::appendSegment(const ElfProgramHeader &programHeader, const ArrayRef segmentData) { maxDataAlignmentNeeded = std::max(maxDataAlignmentNeeded, static_cast(programHeader.align)); programHeaders.push_back(programHeader); if (false == segmentData.empty()) { @@ -61,16 +61,16 @@ void ElfEncoder::appendSegment(const ElfProgramHeader &program } } -template -uint32_t ElfEncoder::getSectionHeaderIndex(const ElfSectionHeader §ionHeader) { +template +uint32_t ElfEncoder::getSectionHeaderIndex(const ElfSectionHeader §ionHeader) { UNRECOVERABLE_IF(§ionHeader < sectionHeaders.begin()); UNRECOVERABLE_IF(§ionHeader >= sectionHeaders.begin() + sectionHeaders.size()); return static_cast(§ionHeader - &*sectionHeaders.begin()); } -template -ElfSectionHeader &ElfEncoder::appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef sectionData) { - ElfSectionHeader section = {}; +template +ElfSectionHeader &ElfEncoder::appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef sectionData) { + ElfSectionHeader section = {}; section.type = static_cast(sectionType); section.flags = static_cast(SHF_NONE); section.offset = 0U; @@ -78,13 +78,13 @@ ElfSectionHeader &ElfEncoder::appendSection(SECTION_HEADER_TYP section.addralign = defaultDataAlignment; switch (sectionType) { case SHT_REL: - section.entsize = sizeof(ElfRel); + section.entsize = sizeof(ElfRel); break; case SHT_RELA: - section.entsize = sizeof(ElfRela); + section.entsize = sizeof(ElfRela); break; case SHT_SYMTAB: - section.entsize = sizeof(ElfSymbolEntry); + section.entsize = sizeof(ElfSymbolEntry); break; default: break; @@ -93,9 +93,9 @@ ElfSectionHeader &ElfEncoder::appendSection(SECTION_HEADER_TYP return *sectionHeaders.rbegin(); } -template -ElfProgramHeader &ElfEncoder::appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef segmentData) { - ElfProgramHeader segment = {}; +template +ElfProgramHeader &ElfEncoder::appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef segmentData) { + ElfProgramHeader segment = {}; segment.type = static_cast(segmentType); segment.flags = static_cast(PF_NONE); segment.offset = 0U; @@ -104,33 +104,33 @@ ElfProgramHeader &ElfEncoder::appendSegment(PROGRAM_HEADER_TYP return *programHeaders.rbegin(); } -template -void ElfEncoder::appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize) { +template +void ElfEncoder::appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize) { programSectionLookupTable.push_back({programHeaders.size(), sectionId}); auto &programHeader = appendSegment(PROGRAM_HEADER_TYPE::PT_LOAD, {}); programHeader.vAddr = static_cast(vAddr); programHeader.memSz = static_cast(segSize); } -template -uint32_t ElfEncoder::appendSectionName(ConstStringRef str) { +template +uint32_t ElfEncoder::appendSectionName(ConstStringRef str) { if (false == addHeaderSectionNamesSection) { return strSecBuilder.undef(); } return strSecBuilder.appendString(str); } -template -std::vector ElfEncoder::encode() const { - ElfFileHeader elfFileHeader = this->elfFileHeader; - StackVec, 32> programHeaders = this->programHeaders; - StackVec, 32> sectionHeaders = this->sectionHeaders; +template +std::vector ElfEncoder::encode() const { + ElfFileHeader elfFileHeader = this->elfFileHeader; + StackVec, 32> programHeaders = this->programHeaders; + StackVec, 32> sectionHeaders = this->sectionHeaders; if (addUndefSectionHeader && (1U == sectionHeaders.size())) { sectionHeaders.clear(); } - ElfSectionHeader sectionHeaderNamesSection; + ElfSectionHeader sectionHeaderNamesSection; size_t alignedSectionNamesDataSize = 0U; size_t dataPaddingBeforeSectionNames = 0U; if ((false == sectionHeaders.empty()) && addHeaderSectionNamesSection) { diff --git a/shared/source/device_binary_format/elf/elf_encoder.h b/shared/source/device_binary_format/elf/elf_encoder.h index a58ca2c631..95e9860670 100644 --- a/shared/source/device_binary_format/elf/elf_encoder.h +++ b/shared/source/device_binary_format/elf/elf_encoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -49,26 +49,26 @@ struct StringSectionBuilder { uint32_t undefStringIdx; }; -template +template struct ElfEncoder { ElfEncoder(bool addUndefSectionHeader = true, bool addHeaderSectionNamesSection = true, - typename ElfSectionHeaderTypes::AddrAlign defaultDataAlignment = 8U); + typename ElfSectionHeaderTypes::AddrAlign defaultDataAlignment = 8U); - void appendSection(const ElfSectionHeader §ionHeader, const ArrayRef sectionData); - void appendSegment(const ElfProgramHeader &programHeader, const ArrayRef segmentData); + void appendSection(const ElfSectionHeader §ionHeader, const ArrayRef sectionData); + void appendSegment(const ElfProgramHeader &programHeader, const ArrayRef segmentData); - ElfSectionHeader &appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef sectionData); - ElfProgramHeader &appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef segmentData); - uint32_t getSectionHeaderIndex(const ElfSectionHeader §ionHeader); + ElfSectionHeader &appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef sectionData); + ElfProgramHeader &appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef segmentData); + uint32_t getSectionHeaderIndex(const ElfSectionHeader §ionHeader); void appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize); template - ElfSectionHeader &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const ArrayRef sectionData) { + ElfSectionHeader &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const ArrayRef sectionData) { return appendSection(static_cast(sectionType), sectionLabel, sectionData); } template - ElfSectionHeader &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const std::string §ionData) { + ElfSectionHeader &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const std::string §ionData) { return appendSection(static_cast(sectionType), sectionLabel, ArrayRef(reinterpret_cast(sectionData.c_str()), sectionData.size() + 1)); } @@ -77,18 +77,18 @@ struct ElfEncoder { std::vector encode() const; - ElfFileHeader &getElfFileHeader() { + ElfFileHeader &getElfFileHeader() { return elfFileHeader; } protected: bool addUndefSectionHeader = false; bool addHeaderSectionNamesSection = false; - typename ElfSectionHeaderTypes::AddrAlign defaultDataAlignment = 8U; + typename ElfSectionHeaderTypes::AddrAlign defaultDataAlignment = 8U; uint64_t maxDataAlignmentNeeded = 1U; - ElfFileHeader elfFileHeader; - StackVec, 32> programHeaders; - StackVec, 32> sectionHeaders; + ElfFileHeader elfFileHeader; + StackVec, 32> programHeaders; + StackVec, 32> sectionHeaders; std::vector data; StringSectionBuilder strSecBuilder; struct ProgramSectionID { diff --git a/shared/source/device_binary_format/patchtokens_decoder.cpp b/shared/source/device_binary_format/patchtokens_decoder.cpp index b8763b4009..434c25d05f 100644 --- a/shared/source/device_binary_format/patchtokens_decoder.cpp +++ b/shared/source/device_binary_format/patchtokens_decoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -126,10 +126,10 @@ inline void assignToken(StackVecStrings &stringVec, const SPatchItemHeader *src) stringVec[stringToken->Index] = stringToken; } -template -inline void assignTokenInArray(const SPatchDataParameterBuffer *(&tokensArray)[S], const SPatchDataParameterBuffer *src, StackVecUnhandledTokens &unhandledTokens) { +template +inline void assignTokenInArray(const SPatchDataParameterBuffer *(&tokensArray)[s], const SPatchDataParameterBuffer *src, StackVecUnhandledTokens &unhandledTokens) { auto sourceIndex = src->SourceOffset >> 2; - if (sourceIndex >= S) { + if (sourceIndex >= s) { DBG_LOG(LogPatchTokens, "\n .Type", "Unhandled sourceIndex ", sourceIndex); DEBUG_BREAK_IF(true); unhandledTokens.push_back(src); @@ -138,8 +138,8 @@ inline void assignTokenInArray(const SPatchDataParameterBuffer *(&tokensArray)[S assignToken(tokensArray[sourceIndex], src); } -template -inline void addTok(StackVec &tokensVec, const SPatchItemHeader *src) { +template +inline void addTok(StackVec &tokensVec, const SPatchItemHeader *src) { tokensVec.push_back(reinterpret_cast(src)); } diff --git a/shared/source/device_binary_format/patchtokens_dumper.cpp b/shared/source/device_binary_format/patchtokens_dumper.cpp index 7cc45cefce..fa61291d95 100644 --- a/shared/source/device_binary_format/patchtokens_dumper.cpp +++ b/shared/source/device_binary_format/patchtokens_dumper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -669,17 +669,17 @@ void dumpOrNullObjArg(const T *value, std::stringstream &out, const std::string } } -template -void dumpOrNullArrayIfNotEmpty(T (&value)[Size], const std::string &arrayName, std::stringstream &out, const std::string &indent) { +template +void dumpOrNullArrayIfNotEmpty(T (&value)[size], const std::string &arrayName, std::stringstream &out, const std::string &indent) { bool allEmpty = true; - for (size_t i = 0; i < Size; ++i) { + for (size_t i = 0; i < size; ++i) { allEmpty = allEmpty && (value[i] == nullptr); } if (allEmpty) { return; } - out << indent << arrayName << " [" << Size << "] :\n"; - for (size_t i = 0; i < Size; ++i) { + out << indent << arrayName << " [" << size << "] :\n"; + for (size_t i = 0; i < size; ++i) { if (value[i] == nullptr) { continue; } diff --git a/shared/source/device_binary_format/zebin/zeinfo.h b/shared/source/device_binary_format/zebin/zeinfo.h index fdf9a48851..adb86045f3 100644 --- a/shared/source/device_binary_format/zebin/zeinfo.h +++ b/shared/source/device_binary_format/zebin/zeinfo.h @@ -253,8 +253,8 @@ inline constexpr ConstStringRef normalized("normalized"); namespace AddrMode { inline constexpr ConstStringRef none("none"); inline constexpr ConstStringRef repeat("repeat"); -inline constexpr ConstStringRef clamp_edge("clamp_edge"); -inline constexpr ConstStringRef clamp_border("clamp_border"); +inline constexpr ConstStringRef clampEdge("clamp_edge"); +inline constexpr ConstStringRef clampBorder("clamp_border"); inline constexpr ConstStringRef mirror("mirror"); } // namespace AddrMode diff --git a/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp b/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp index 3064e94d08..717bd6157a 100644 --- a/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp +++ b/shared/source/device_binary_format/zebin/zeinfo_decoder.cpp @@ -129,8 +129,8 @@ bool readZeInfoValueChecked(const NEO::Yaml::YamlParser &parser, const NEO::Yaml return false; } -template -bool readZeInfoValueCollectionCheckedArr(std::array &vec, const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) { +template +bool readZeInfoValueCollectionCheckedArr(std::array &vec, const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) { auto collectionNodes = parser.createChildrenRange(node); size_t index = 0U; bool isValid = true; @@ -139,16 +139,16 @@ bool readZeInfoValueCollectionCheckedArr(std::array &vec, con isValid &= readZeInfoValueChecked(parser, elementNd, vec[index++], context, outErrReason); } - if (index != Len) { - outErrReason.append("DeviceBinaryFormat::Zebin::.ze_info : wrong size of collection " + parser.readKey(node).str() + " in context of : " + context.str() + ". Got : " + std::to_string(index) + " expected : " + std::to_string(Len) + "\n"); + if (index != len) { + outErrReason.append("DeviceBinaryFormat::Zebin::.ze_info : wrong size of collection " + parser.readKey(node).str() + " in context of : " + context.str() + ". Got : " + std::to_string(index) + " expected : " + std::to_string(len) + "\n"); isValid = false; } return isValid; } -template -bool readZeInfoValueCollectionChecked(DestinationT (&vec)[Len], const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) { - auto &array = reinterpret_cast &>(vec); +template +bool readZeInfoValueCollectionChecked(DestinationT (&vec)[len], const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) { + auto &array = reinterpret_cast &>(vec); return readZeInfoValueCollectionCheckedArr(array, parser, node, context, outErrReason); } @@ -198,8 +198,8 @@ DecodeError readZeInfoGlobalHostAceessTable(const NEO::Yaml::YamlParser &parser, return validTable ? DecodeError::Success : DecodeError::InvalidBinary; } -template -bool setVecArgIndicesBasedOnSize(CrossThreadDataOffset (&vec)[Len], size_t vecSize, CrossThreadDataOffset baseOffset) { +template +bool setVecArgIndicesBasedOnSize(CrossThreadDataOffset (&vec)[len], size_t vecSize, CrossThreadDataOffset baseOffset) { switch (vecSize) { default: return false; diff --git a/shared/source/device_binary_format/zebin/zeinfo_enum_lookup.h b/shared/source/device_binary_format/zebin/zeinfo_enum_lookup.h index fdaae00611..967d4da20e 100644 --- a/shared/source/device_binary_format/zebin/zeinfo_enum_lookup.h +++ b/shared/source/device_binary_format/zebin/zeinfo_enum_lookup.h @@ -179,8 +179,8 @@ using AddrMode = Types::Kernel::InlineSamplers::AddrMode; inline constexpr ConstStringRef name = "inline sampler addressing mode"; inline constexpr LookupArray lookup({{{none, AddrMode::None}, {repeat, AddrMode::Repeat}, - {clamp_edge, AddrMode::ClampEdge}, - {clamp_border, AddrMode::ClampBorder}, + {clampEdge, AddrMode::ClampEdge}, + {clampBorder, AddrMode::ClampBorder}, {mirror, AddrMode::Mirror}}}); static_assert(lookup.size() == static_cast(AddrMode::Max) - 1, "Every enum field must be present"); } // namespace InlineSamplerAddrMode diff --git a/shared/source/gen11/aub_mapper.h b/shared/source/gen11/aub_mapper.h index 3a05efa3f8..30740955ea 100644 --- a/shared/source/gen11/aub_mapper.h +++ b/shared/source/gen11/aub_mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ template <> struct AUBFamilyMapper { enum { device = AubMemDump::DeviceValues::Icllp }; - using AubTraits = AubMemDump::Traits; + using AubTraits = AubMemDump::Traits; static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES]; diff --git a/shared/source/gen12lp/aub_mapper.h b/shared/source/gen12lp/aub_mapper.h index 58ddda70c5..ddf252b836 100644 --- a/shared/source/gen12lp/aub_mapper.h +++ b/shared/source/gen12lp/aub_mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ template <> struct AUBFamilyMapper { enum { device = AubMemDump::DeviceValues::Tgllp }; - using AubTraits = AubMemDump::Traits; + using AubTraits = AubMemDump::Traits; static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES]; diff --git a/shared/source/gen8/aub_mapper.h b/shared/source/gen8/aub_mapper.h index f1d1727298..7659c6c161 100644 --- a/shared/source/gen8/aub_mapper.h +++ b/shared/source/gen8/aub_mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ template <> struct AUBFamilyMapper { enum { device = AubMemDump::DeviceValues::Bdw }; - using AubTraits = AubMemDump::Traits; + using AubTraits = AubMemDump::Traits; static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES]; diff --git a/shared/source/gen9/aub_mapper.h b/shared/source/gen9/aub_mapper.h index 498688f7d6..8935a91c25 100644 --- a/shared/source/gen9/aub_mapper.h +++ b/shared/source/gen9/aub_mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ template <> struct AUBFamilyMapper { enum { device = AubMemDump::DeviceValues::Skl }; - using AubTraits = AubMemDump::Traits; + using AubTraits = AubMemDump::Traits; static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES]; diff --git a/shared/source/helpers/app_resource_defines.h b/shared/source/helpers/app_resource_defines.h index db97c7248d..dfcfaed793 100644 --- a/shared/source/helpers/app_resource_defines.h +++ b/shared/source/helpers/app_resource_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,17 +11,17 @@ namespace NEO { namespace AppResourceDefines { template -static constexpr bool has_ResourceTag = false; +static constexpr bool hasResourceTag = false; #if defined(_DEBUG) || (_RELEASE_INTERNAL) template -static constexpr bool has_ResourceTag = true; +static constexpr bool hasResourceTag = true; constexpr bool resourceTagSupport = true; #else constexpr bool resourceTagSupport = false; template -static constexpr bool has_ResourceTag = false; +static constexpr bool hasResourceTag = false; #endif constexpr uint32_t maxStrLen = 8u; diff --git a/shared/source/helpers/basic_math.h b/shared/source/helpers/basic_math.h index 3f7e47d600..b64339f584 100644 --- a/shared/source/helpers/basic_math.h +++ b/shared/source/helpers/basic_math.h @@ -93,11 +93,8 @@ union FloatConversion { float f; }; -// clang-format off -static const FloatConversion PosInfinity = {0x7f800000}; -static const FloatConversion NegInfinity = {0xff800000}; -static const FloatConversion Nan = {0x7fc00000}; -// clang-format on +static const FloatConversion posInfinity = {0x7f800000}; +static const FloatConversion negInfinity = {0xff800000}; inline uint16_t float2Half(float f) { FloatConversion u; @@ -106,7 +103,7 @@ inline uint16_t float2Half(float f) { uint32_t fsign = (u.u >> 16) & 0x8000; float x = std::fabs(f); - // Nan + // nan if (x != x) { u.u >>= (24 - 11); u.u &= 0x7fff; @@ -116,7 +113,7 @@ inline uint16_t float2Half(float f) { // overflow if (x >= std::ldexp(1.0f, 16)) { - if (x == PosInfinity.f) + if (x == posInfinity.f) return 0x7c00 | fsign; return 0x7bff | fsign; diff --git a/shared/source/helpers/constants.h b/shared/source/helpers/constants.h index 0aedee99e5..ce2177eebe 100644 --- a/shared/source/helpers/constants.h +++ b/shared/source/helpers/constants.h @@ -52,7 +52,7 @@ inline constexpr uint64_t max36BitAddress = (maxNBitValue(36)); inline constexpr uint64_t max48BitAddress = maxNBitValue(48); inline constexpr uintptr_t page4kEntryMask = std::numeric_limits::max() & ~MemoryConstants::pageMask; inline constexpr uintptr_t page64kEntryMask = std::numeric_limits::max() & ~MemoryConstants::page64kMask; -inline constexpr int GfxAddressBits = is64bit ? 48 : 32; +inline constexpr int gfxAddressBits = is64bit ? 48 : 32; inline constexpr uint64_t maxSvmAddress = is64bit ? maxNBitValue(47) : maxNBitValue(32); inline constexpr size_t chunkThreshold = MemoryConstants::pageSize64k; diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index 711851a9dd..cd7ccc9519 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -7,7 +7,6 @@ #pragma once #include "shared/source/built_ins/sip_kernel_type.h" -#include "shared/source/commands/bxml_generator_glue.h" #include "shared/source/helpers/definitions/engine_group_types.h" #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/helpers/options.h" @@ -450,13 +449,4 @@ struct MemorySynchronizationCommands { static void setBarrierExtraProperties(void *barrierCmd, PipeControlArgs &args); }; -union SURFACE_STATE_BUFFER_LENGTH { - uint32_t length; - struct SurfaceState { - uint32_t width : BITFIELD_RANGE(0, 6); - uint32_t height : BITFIELD_RANGE(7, 20); - uint32_t depth : BITFIELD_RANGE(21, 31); - } surfaceState; -}; - } // namespace NEO diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 2084bad10a..27d5d7333d 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -106,7 +106,7 @@ void GfxCoreHelperHw::setRenderSurfaceStateForScratchResource(const Root RENDER_SURFACE_STATE state = Family::cmdInitRenderSurfaceState; auto surfaceSize = alignUp(bufferSize, 4); - SURFACE_STATE_BUFFER_LENGTH length = {0}; + SurfaceStateBufferLength length = {0}; length.length = static_cast(surfaceSize - 1); state.setWidth(length.surfaceState.width + 1); diff --git a/shared/source/helpers/local_work_size.cpp b/shared/source/helpers/local_work_size.cpp index 98964362fb..4052e87b94 100644 --- a/shared/source/helpers/local_work_size.cpp +++ b/shared/source/helpers/local_work_size.cpp @@ -52,7 +52,7 @@ static const uint32_t primeNumbers[] = { 19, 17, 13, 11, 7, 5, 3, 2}; -static const size_t MAX_PRIMES = sizeof(primeNumbers) / sizeof(primeNumbers[0]); +static const size_t maxPrimes = sizeof(primeNumbers) / sizeof(primeNumbers[0]); // Recursive template function to test prime factors template @@ -220,7 +220,7 @@ void computeWorkgroupSize1D(uint32_t maxWorkGroupSize, size_t workGroupSize[3], workSize = std::min(workSize, maxWorkGroupSize); // Try all primes as potential factors - workSize = factor(items, workSize, maxWorkGroupSize); + workSize = factor(items, workSize, maxWorkGroupSize); workGroupSize[0] = workSize; workGroupSize[1] = 1; diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index 0c5cd20467..4da8ab5c85 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -1513,9 +1513,9 @@ bool WddmMemoryManager::isStatelessAccessRequired(AllocationType type) { return false; } -template +template void WddmMemoryManager::adjustGpuPtrToHostAddressSpace(WddmAllocation &wddmAllocation, void *&requiredGpuVa) { - if constexpr (Is32Bit) { + if constexpr (is32Bit) { auto rootDeviceIndex = wddmAllocation.getRootDeviceIndex(); if (executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->isFullRangeSvm()) { if (isStatelessAccessRequired(wddmAllocation.getAllocationType())) { diff --git a/shared/source/os_interface/windows/wddm_memory_manager.h b/shared/source/os_interface/windows/wddm_memory_manager.h index b10ae1fc28..63b36a576e 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.h +++ b/shared/source/os_interface/windows/wddm_memory_manager.h @@ -112,7 +112,7 @@ class WddmMemoryManager : public MemoryManager { bool mapGpuVaForOneHandleAllocation(WddmAllocation *graphicsAllocation, const void *requiredGpuPtr); bool mapMultiHandleAllocationWithRetry(WddmAllocation *allocation, const void *requiredGpuPtr); bool createGpuAllocationsWithRetry(WddmAllocation *graphicsAllocation); - template + template void adjustGpuPtrToHostAddressSpace(WddmAllocation &wddmAllocation, void *&requiredGpuVa); bool isStatelessAccessRequired(AllocationType type); AlignedMallocRestrictions mallocRestrictions; diff --git a/shared/source/program/kernel_info.h b/shared/source/program/kernel_info.h index 02765c54c1..b23021760c 100644 --- a/shared/source/program/kernel_info.h +++ b/shared/source/program/kernel_info.h @@ -30,7 +30,7 @@ struct KernelArgumentType; class GraphicsAllocation; class MemoryManager; -static const float YTilingRatioValue = 1.3862943611198906188344642429164f; +static const float yTilingRatioValue = 1.3862943611198906188344642429164f; struct DeviceInfoKernelPayloadConstants { void *slmWindow = nullptr; diff --git a/shared/source/program/work_size_info.cpp b/shared/source/program/work_size_info.cpp index 5e2d674b63..9fcd8b157b 100644 --- a/shared/source/program/work_size_info.cpp +++ b/shared/source/program/work_size_info.cpp @@ -68,7 +68,7 @@ void WorkSizeInfo::checkRatio(const size_t workItems[3]) { useStrictRatio = false; } else if (yTiledSurfaces == true) { useRatio = true; - targetRatio = YTilingRatioValue; + targetRatio = yTilingRatioValue; useStrictRatio = true; } } diff --git a/shared/source/utilities/arrayref.h b/shared/source/utilities/arrayref.h index 8f5ea68915..b6e8914e0e 100644 --- a/shared/source/utilities/arrayref.h +++ b/shared/source/utilities/arrayref.h @@ -42,9 +42,9 @@ class ArrayRef { : begIt((ctr.size() > 0) ? &*ctr.begin() : nullptr), endIt((ctr.size() > 0) ? (&*(ctr.end() - 1) + 1) : nullptr) { } - template - ArrayRef(DataType (&array)[Size]) - : begIt(&array[0]), endIt(&array[Size]) { + template + ArrayRef(DataType (&array)[size]) + : begIt(&array[0]), endIt(&array[size]) { } ArrayRef() = default; diff --git a/shared/source/utilities/directory.h b/shared/source/utilities/directory.h index 5a5a205767..a834a1c476 100644 --- a/shared/source/utilities/directory.h +++ b/shared/source/utilities/directory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,7 @@ namespace NEO { namespace Directory { -extern bool ReturnEmptyFilesVector; +extern bool returnEmptyFilesVector; std::vector getFiles(const std::string &path); void createDirectory(const std::string &path); diff --git a/shared/source/utilities/idlist.h b/shared/source/utilities/idlist.h index b0e7660699..ed4cdde062 100644 --- a/shared/source/utilities/idlist.h +++ b/shared/source/utilities/idlist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -167,10 +167,10 @@ struct IDNode { NodeObjectType *next; }; -template +template class IDList { public: - using ThisType = IDList; + using ThisType = IDList; IDList() : head(nullptr), tail(nullptr), locked(), spinLockedListener(nullptr) { @@ -251,8 +251,8 @@ class IDList { NodeObjectType *peekTailImpl(NodeObjectType *, void *) { return tail; } - template - typename std::enable_if::type cleanup() { + template + typename std::enable_if::type cleanup() { if (head != nullptr) { head->deleteThisAndAllNext(); } @@ -260,8 +260,8 @@ class IDList { tail = nullptr; } - template - typename std::enable_if::type cleanup() { + template + typename std::enable_if::type cleanup() { ; } @@ -271,8 +271,8 @@ class IDList { } } - template - typename std::enable_if::type processLocked(NodeObjectType *node1 = nullptr, void *data = nullptr) { + template + typename std::enable_if::type processLocked(NodeObjectType *node1 = nullptr, void *data = nullptr) { while (locked.test_and_set(std::memory_order_acquire)) { notifySpinLocked(); } @@ -290,8 +290,8 @@ class IDList { return ret; } - template - typename std::enable_if::type processLocked(NodeObjectType *node1 = nullptr, void *data = nullptr) { + template + typename std::enable_if::type processLocked(NodeObjectType *node1 = nullptr, void *data = nullptr) { std::thread::id currentThreadId = std::this_thread::get_id(); if (lockOwner == currentThreadId) { return (static_cast(this)->*Process)(node1, data); @@ -318,8 +318,8 @@ class IDList { return ret; } - template - typename std::enable_if::type processLocked(NodeObjectType *node = nullptr, void *data = nullptr) { + template + typename std::enable_if::type processLocked(NodeObjectType *node = nullptr, void *data = nullptr) { return (this->*Process)(node, data); } @@ -459,8 +459,8 @@ struct IDNodeRef : IDNode> { NodeObjectType *ref; }; -template -class IDRefList : public IDList, ThreadSafe, OwnsNodes> { +template +class IDRefList : public IDList, threadSafe, ownsNodes> { public: void pushRefFrontOne(NodeObjectType &node) { auto refNode = std::unique_ptr>(new IDNodeRef(&node)); diff --git a/shared/source/utilities/iflist.h b/shared/source/utilities/iflist.h index e5b93a8edd..3f6f317b1f 100644 --- a/shared/source/utilities/iflist.h +++ b/shared/source/utilities/iflist.h @@ -88,7 +88,7 @@ struct IFNode { NodeObjectType *next; }; -template +template class IFList { public: IFList() @@ -106,34 +106,34 @@ class IFList { IFList(const IFList &) = delete; IFList &operator=(const IFList &) = delete; - template - typename std::enable_if::type pushFrontOne(NodeObjectType &node) { + template + typename std::enable_if::type pushFrontOne(NodeObjectType &node) { node.next = head; compareExchangeHead(node.next, &node); } - template - typename std::enable_if::type detachNodes() { + template + typename std::enable_if::type detachNodes() { NodeObjectType *rest = head; compareExchangeHead(rest, nullptr); return rest; } - template - typename std::enable_if::type pushFrontOne(NodeObjectType &node) { + template + typename std::enable_if::type pushFrontOne(NodeObjectType &node) { node.next = head; head = &node; } - template - typename std::enable_if::type detachNodes() { + template + typename std::enable_if::type detachNodes() { NodeObjectType *rest = head; head = nullptr; return rest; } - template - typename std::enable_if::type splice(NodeObjectType &nodes) { + template + typename std::enable_if::type splice(NodeObjectType &nodes) { if (head == nullptr) { head = &nodes; } else { @@ -157,24 +157,24 @@ class IFList { } protected: - template - typename std::enable_if::type cleanup() { + template + typename std::enable_if::type cleanup() { deleteAll(); } - template - typename std::enable_if::type cleanup() { + template + typename std::enable_if::type cleanup() { ; } - template - typename std::enable_if::type compareExchangeHead(NodeObjectType *&expected, NodeObjectType *desired) { + template + typename std::enable_if::type compareExchangeHead(NodeObjectType *&expected, NodeObjectType *desired) { while (!NEO::MultiThreadHelpers::atomicCompareExchangeWeakSpin(head, expected, desired)) { ; } } - PtrType_t head; + PtrType_t head; }; template @@ -185,8 +185,8 @@ struct IFNodeRef : IFNode> { NodeObjectType *ref; }; -template -class IFRefList : public IFList, ThreadSafe, OwnsNodes> { +template +class IFRefList : public IFList, threadSafe, ownsNodes> { public: void pushRefFrontOne(NodeObjectType &node) { auto up = std::unique_ptr>(new IFNodeRef(&node)); diff --git a/shared/source/utilities/logger.cpp b/shared/source/utilities/logger.cpp index 942efd1ae9..d13b03c317 100644 --- a/shared/source/utilities/logger.cpp +++ b/shared/source/utilities/logger.cpp @@ -22,8 +22,8 @@ FileLogger &fileLoggerInstance() { return fileLoggerInstance; } -template -FileLogger::FileLogger(std::string filename, const DebugVariables &flags) { +template +FileLogger::FileLogger(std::string filename, const DebugVariables &flags) { logFileName = std::move(filename); if (enabled()) { std::remove(logFileName.c_str()); @@ -36,11 +36,11 @@ FileLogger::FileLogger(std::string filename, const DebugVariables &f logAllocationStdout = flags.LogAllocationStdout.get(); } -template -FileLogger::~FileLogger() = default; +template +FileLogger::~FileLogger() = default; -template -void FileLogger::writeToFile(std::string filename, const char *str, size_t length, std::ios_base::openmode mode) { +template +void FileLogger::writeToFile(std::string filename, const char *str, size_t length, std::ios_base::openmode mode) { std::lock_guard theLock(mutex); std::ofstream outFile(filename, mode); if (outFile.is_open()) { @@ -49,8 +49,8 @@ void FileLogger::writeToFile(std::string filename, const char *str, } } -template -void FileLogger::logDebugString(bool enableLog, std::string_view debugString) { +template +void FileLogger::logDebugString(bool enableLog, std::string_view debugString) { if (enabled()) { if (enableLog) { writeToFile(logFileName, debugString.data(), debugString.size(), std::ios::app); @@ -58,8 +58,8 @@ void FileLogger::logDebugString(bool enableLog, std::string_view deb } } -template -void FileLogger::dumpKernel(const std::string &name, const std::string &src) { +template +void FileLogger::dumpKernel(const std::string &name, const std::string &src) { if (false == enabled()) { return; } @@ -70,8 +70,8 @@ void FileLogger::dumpKernel(const std::string &name, const std::stri } } -template -void FileLogger::logApiCall(const char *function, bool enter, int32_t errorCode) { +template +void FileLogger::logApiCall(const char *function, bool enter, int32_t errorCode) { if (false == enabled()) { return; } @@ -92,8 +92,8 @@ void FileLogger::logApiCall(const char *function, bool enter, int32_ } } -template -void FileLogger::logAllocation(GraphicsAllocation const *graphicsAllocation) { +template +void FileLogger::logAllocation(GraphicsAllocation const *graphicsAllocation) { if (logAllocationType) { printDebugString(true, stdout, "Created Graphics Allocation of type %s\n", getAllocationTypeString(graphicsAllocation)); } @@ -126,15 +126,15 @@ void FileLogger::logAllocation(GraphicsAllocation const *graphicsAll } } -template -size_t FileLogger::getInput(const size_t *input, int32_t index) { +template +size_t FileLogger::getInput(const size_t *input, int32_t index) { if (enabled() == false) return 0; return input != nullptr ? input[index] : 0; } -template -void FileLogger::dumpBinaryProgram(int32_t numDevices, const size_t *lengths, const unsigned char **binaries) { +template +void FileLogger::dumpBinaryProgram(int32_t numDevices, const size_t *lengths, const unsigned char **binaries) { if (false == enabled()) { return; } diff --git a/shared/source/utilities/logger.h b/shared/source/utilities/logger.h index 361cc50de4..2a5fdd0bd1 100644 --- a/shared/source/utilities/logger.h +++ b/shared/source/utilities/logger.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,7 +20,7 @@ class GraphicsAllocation; const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation); const char *getMemoryPoolString(GraphicsAllocation const *graphicsAllocation); -template +template class FileLogger { public: FileLogger(std::string filename, const DebugVariables &flags); @@ -30,7 +30,7 @@ class FileLogger { FileLogger &operator=(const FileLogger &) = delete; static constexpr bool enabled() { - return DebugLevel == DebugFunctionalityLevel::Full; + return debugLevel == DebugFunctionalityLevel::Full; } void dumpKernel(const std::string &name, const std::string &src); diff --git a/shared/source/utilities/numeric.h b/shared/source/utilities/numeric.h index 5eeea171b2..1f5d30cc5a 100644 --- a/shared/source/utilities/numeric.h +++ b/shared/source/utilities/numeric.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -13,7 +13,7 @@ namespace NEO { -template +template struct StorageType; template <> @@ -36,13 +36,13 @@ struct StorageType<64> { using Type = uint64_t; }; -template +template struct StorageType { - using Type = typename StorageType::Type; + using Type = typename StorageType::Type; }; -template -using StorageTypeT = typename StorageType::Type; +template +using StorageTypeT = typename StorageType::Type; template struct UnsignedFixedPointValue { diff --git a/shared/source/xe_hpc_core/aub_mapper.h b/shared/source/xe_hpc_core/aub_mapper.h index 15f21089cd..2b1cb9dcac 100644 --- a/shared/source/xe_hpc_core/aub_mapper.h +++ b/shared/source/xe_hpc_core/aub_mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ template <> struct AUBFamilyMapper { enum { device = AubMemDump::DeviceValues::Pvc }; - using AubTraits = AubMemDump::Traits; + using AubTraits = AubMemDump::Traits; static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES]; diff --git a/shared/source/xe_hpg_core/aub_mapper.h b/shared/source/xe_hpg_core/aub_mapper.h index 13b160aa82..5f174efd12 100644 --- a/shared/source/xe_hpg_core/aub_mapper.h +++ b/shared/source/xe_hpg_core/aub_mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,7 +19,7 @@ template <> struct AUBFamilyMapper { enum { device = AubMemDump::DeviceValues::Dg2 }; - using AubTraits = AubMemDump::Traits; + using AubTraits = AubMemDump::Traits; static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES]; diff --git a/shared/test/common/debug_settings/debug_settings_manager_fixture.h b/shared/test/common/debug_settings/debug_settings_manager_fixture.h index 5059c09e27..7596337a87 100644 --- a/shared/test/common/debug_settings/debug_settings_manager_fixture.h +++ b/shared/test/common/debug_settings/debug_settings_manager_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -40,15 +40,15 @@ class TestDebugFlagsChecker { } }; -template -class TestDebugSettingsManager : public DebugSettingsManager { +template +class TestDebugSettingsManager : public DebugSettingsManager { public: - using DebugSettingsManager::dumpFlags; - using DebugSettingsManager::settingsDumpFileName; + using DebugSettingsManager::dumpFlags; + using DebugSettingsManager::settingsDumpFileName; - TestDebugSettingsManager() : DebugSettingsManager("") {} + TestDebugSettingsManager() : DebugSettingsManager("") {} SettingsReader *getSettingsReader() { - return DebugSettingsManager::readerImpl.get(); + return DebugSettingsManager::readerImpl.get(); } }; diff --git a/shared/test/common/libult/linux/directory_linux.cpp b/shared/test/common/libult/linux/directory_linux.cpp index 359a16ab70..f3b81b9917 100644 --- a/shared/test/common/libult/linux/directory_linux.cpp +++ b/shared/test/common/libult/linux/directory_linux.cpp @@ -22,7 +22,7 @@ std::map> directoryFilesMap = {}; std::vector Directory::getFiles(const std::string &path) { std::vector files; - if (Directory::ReturnEmptyFilesVector) { + if (Directory::returnEmptyFilesVector) { return files; } diff --git a/shared/test/common/libult/os_interface.cpp b/shared/test/common/libult/os_interface.cpp index 10dad19f97..dfa3303408 100644 --- a/shared/test/common/libult/os_interface.cpp +++ b/shared/test/common/libult/os_interface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,7 @@ namespace NEO { bool OSInterface::osEnableLocalMemory = true; namespace Directory { -bool ReturnEmptyFilesVector = false; +bool returnEmptyFilesVector = false; } } // namespace NEO diff --git a/shared/test/common/mocks/mock_elf.h b/shared/test/common/mocks/mock_elf.h index f1785c36e5..b31fe3e4f4 100644 --- a/shared/test/common/mocks/mock_elf.h +++ b/shared/test/common/mocks/mock_elf.h @@ -11,9 +11,9 @@ #include -template -struct MockElf : public NEO::Elf::Elf { - using BaseClass = NEO::Elf::Elf; +template +struct MockElf : public NEO::Elf::Elf { + using BaseClass = NEO::Elf::Elf; using BaseClass::debugInfoRelocations; using BaseClass::relocations; @@ -23,17 +23,17 @@ struct MockElf : public NEO::Elf::Elf { if (overrideSectionNames) { return sectionNames.find(id)->second; } - return NEO::Elf::Elf::getSectionName(id); + return NEO::Elf::Elf::getSectionName(id); } std::string getSymbolName(uint32_t nameOffset) const override { if (overrideSymbolName) { return std::to_string(nameOffset); } - return NEO::Elf::Elf::getSymbolName(nameOffset); + return NEO::Elf::Elf::getSymbolName(nameOffset); } - using ElfSymT = NEO::Elf::ElfSymbolEntry; + using ElfSymT = NEO::Elf::ElfSymbolEntry; void addSymbol(typename ElfSymT::Name name, typename ElfSymT::Value value, typename ElfSymT::Size size, typename ElfSymT::Shndx shndx, typename ElfSymT::Info type, typename ElfSymT::Info binding) { ElfSymT sym{}; @@ -67,15 +67,15 @@ struct MockElf : public NEO::Elf::Elf { bool overrideSymbolName = false; }; -template -struct MockElfEncoder : public NEO::Elf::ElfEncoder { - using NEO::Elf::ElfEncoder::sectionHeaders; +template +struct MockElfEncoder : public NEO::Elf::ElfEncoder { + using NEO::Elf::ElfEncoder::sectionHeaders; uint32_t getLastSectionHeaderIndex() { return uint32_t(sectionHeaders.size()) - 1; } - NEO::Elf::ElfSectionHeader *getSectionHeader(uint32_t idx) { + NEO::Elf::ElfSectionHeader *getSectionHeader(uint32_t idx) { return sectionHeaders.data() + idx; } diff --git a/shared/test/common/utilities/logger_tests.h b/shared/test/common/utilities/logger_tests.h index b201bbc439..7487fb267b 100644 --- a/shared/test/common/utilities/logger_tests.h +++ b/shared/test/common/utilities/logger_tests.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,13 +14,13 @@ #include -template -class TestFileLogger : public NEO::FileLogger { +template +class TestFileLogger : public NEO::FileLogger { public: - using NEO::FileLogger::FileLogger; + using NEO::FileLogger::FileLogger; ~TestFileLogger() override { - std::remove(NEO::FileLogger::logFileName.c_str()); + std::remove(NEO::FileLogger::logFileName.c_str()); } void useRealFiles(bool value) { @@ -34,7 +34,7 @@ class TestFileLogger : public NEO::FileLogger { savedFiles[filename] << std::string(str, str + length); if (mockFileSystem == false) { - NEO::FileLogger::writeToFile(filename, str, length, mode); + NEO::FileLogger::writeToFile(filename, str, length, mode); } }; diff --git a/shared/test/unit_test/encoders/test_encode_states.cpp b/shared/test/unit_test/encoders/test_encode_states.cpp index 4b77fd3b09..b98225ece2 100644 --- a/shared/test/unit_test/encoders/test_encode_states.cpp +++ b/shared/test/unit_test/encoders/test_encode_states.cpp @@ -272,7 +272,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationPr memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE)); size_t size = 0x1000; - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; void *cpuAddr = reinterpret_cast(0x4000); uint64_t gpuAddr = 0x4000u; @@ -309,7 +309,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationNo memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE)); size_t size = 0x1000; - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; uint64_t gpuAddr = 0; size_t allocSize = size; @@ -343,7 +343,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenGpuCoherency memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE)); size_t size = 0x1000; - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; uint64_t gpuAddr = 0; size_t allocSize = size; diff --git a/shared/test/unit_test/helpers/basic_math_tests.cpp b/shared/test/unit_test/helpers/basic_math_tests.cpp index b60b9d4c6d..f61f4f5d3d 100644 --- a/shared/test/unit_test/helpers/basic_math_tests.cpp +++ b/shared/test/unit_test/helpers/basic_math_tests.cpp @@ -100,16 +100,16 @@ struct Float2HalfParams { uint16_t uintOutput; }; -// clang-format off +static const FloatConversion nanFloat = {0x7fc00000}; + Float2HalfParams float2HalfParams[] = { - {0.0f, 0x0000}, - {1.0f, 0x3c00}, - {PosInfinity.f, 0x7c00}, - {Nan.f, 0x7e00}, - {std::ldexp(1.0f, 16), 0x7bff}, + {0.0f, 0x0000}, + {1.0f, 0x3c00}, + {posInfinity.f, 0x7c00}, + {nanFloat.f, 0x7e00}, + {std::ldexp(1.0f, 16), 0x7bff}, {std::ldexp(1.0f, -25), 0x0000}, {std::ldexp(1.0f, -15), 0x0200}}; -// clang-format on typedef ::testing::TestWithParam Float2HalfTest; diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 0393312722..8e0cfda4fe 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -438,7 +438,7 @@ HWTEST_F(GfxCoreHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvid EXPECT_EQ(sizeof(RENDER_SURFACE_STATE), gfxCoreHelper.getRenderSurfaceStateSize()); size_t size = 0x1000; - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; length.length = static_cast(size - 1); uint64_t addr = 0x2000; size_t offset = 0x1000; @@ -505,7 +505,7 @@ HWTEST_F(GfxCoreHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvided auto &gfxCoreHelper = getHelper(); size_t size = 0x1000; - SURFACE_STATE_BUFFER_LENGTH length; + SurfaceStateBufferLength length; uint64_t addr = 0x2000; uint32_t pitch = 0; diff --git a/shared/test/unit_test/helpers/timestamp_packet_tests.cpp b/shared/test/unit_test/helpers/timestamp_packet_tests.cpp index 7b5baf2702..c6bfa331f1 100644 --- a/shared/test/unit_test/helpers/timestamp_packet_tests.cpp +++ b/shared/test/unit_test/helpers/timestamp_packet_tests.cpp @@ -42,9 +42,9 @@ struct TimestampPacketTests : public ::testing::Test { struct MockTagNode : public TagNode> { using TagNode>::gpuAddress; }; - - template - void verifySemaphore(MI_SEMAPHORE_WAIT *semaphoreCmd, TagNodeBase *timestampPacketNode, uint32_t packetId) { + template + void verifySemaphore(typename FamilyType::MI_SEMAPHORE_WAIT *semaphoreCmd, TagNodeBase *timestampPacketNode, uint32_t packetId) { + using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; EXPECT_NE(nullptr, semaphoreCmd); EXPECT_EQ(semaphoreCmd->getCompareOperation(), MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD); EXPECT_EQ(1u, semaphoreCmd->getSemaphoreDataDword()); @@ -72,7 +72,7 @@ HWTEST_F(TimestampPacketTests, givenTagNodeWhenSemaphoreIsProgrammedThenUseGpuAd HardwareParse hwParser; hwParser.parseCommands(cmdStream, 0); auto it = hwParser.cmdList.begin(); - verifySemaphore(genCmdCast(*it++), &mockNode, 0); + verifySemaphore(genCmdCast(*it++), &mockNode, 0); } HWTEST_F(TimestampPacketTests, givenTagNodeWithPacketsUsed2WhenSemaphoreIsProgrammedThenUseGpuAddress) { @@ -92,7 +92,7 @@ HWTEST_F(TimestampPacketTests, givenTagNodeWithPacketsUsed2WhenSemaphoreIsProgra hwParser.parseCommands(cmdStream, 0); auto it = hwParser.cmdList.begin(); for (uint32_t packetId = 0; packetId < mockNode.getPacketsUsed(); packetId++) { - verifySemaphore(genCmdCast(*it++), &mockNode, packetId); + verifySemaphore(genCmdCast(*it++), &mockNode, packetId); } } diff --git a/shared/test/unit_test/memory_manager/surface_tests.cpp b/shared/test/unit_test/memory_manager/surface_tests.cpp index bc701f94f5..606e767583 100644 --- a/shared/test/unit_test/memory_manager/surface_tests.cpp +++ b/shared/test/unit_test/memory_manager/surface_tests.cpp @@ -27,7 +27,7 @@ using namespace NEO; typedef ::testing::Types SurfaceTypes; namespace createSurface { -template +template Surface *create(char *data, GraphicsAllocation *gfxAllocation); template <> diff --git a/shared/test/unit_test/os_interface/linux/drm_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_tests.cpp index d57ea74ea9..f462696d37 100644 --- a/shared/test/unit_test/os_interface/linux/drm_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_tests.cpp @@ -1453,7 +1453,7 @@ TEST(DrmTest, GivenDrmWhenDiscoveringDevicesThenCloseOnExecFlagIsPassedToFdOpen) EXPECT_NE(0u, SysCalls::openFuncCalled); SysCalls::openFuncCalled = 0; - VariableBackup emptyDir(&NEO::Directory::ReturnEmptyFilesVector, true); + VariableBackup emptyDir(&NEO::Directory::returnEmptyFilesVector, true); devices = Drm::discoverDevices(*executionEnvironment); EXPECT_NE(0u, SysCalls::openFuncCalled); } diff --git a/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index 282f6c3e01..733f65847f 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -41,7 +41,7 @@ using namespace NEO; namespace NEO { namespace Directory { -extern bool ReturnEmptyFilesVector; +extern bool returnEmptyFilesVector; } } // namespace NEO @@ -93,7 +93,7 @@ class WddmMemoryManagerTests : public ::testing::Test { ExecutionEnvironment *executionEnvironment = nullptr; void SetUp() override { - returnEmptyFilesVectorBackup = std::make_unique>(&NEO::Directory::ReturnEmptyFilesVector, true); + returnEmptyFilesVectorBackup = std::make_unique>(&NEO::Directory::returnEmptyFilesVector, true); HardwareInfo *hwInfo = nullptr; executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1); @@ -287,7 +287,7 @@ class WddmMemoryManagerAllocPathTests : public ::testing::Test { ExecutionEnvironment *executionEnvironment = nullptr; void SetUp() override { - returnEmptyFilesVectorBackup = std::make_unique>(&NEO::Directory::ReturnEmptyFilesVector, true); + returnEmptyFilesVectorBackup = std::make_unique>(&NEO::Directory::returnEmptyFilesVector, true); HardwareInfo *hwInfo = nullptr; executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1); @@ -4003,7 +4003,7 @@ TEST(WddmMemoryManagerTest3, givenUsedTagAllocationInWddmMemoryManagerWhenCleanu } TEST(WddmMemoryManagerTest3, givenMultipleRootDeviceWhenMemoryManagerGetsWddmThenWddmIsFromCorrectRootDevice) { - VariableBackup emptyFilesBackup(&NEO::Directory::ReturnEmptyFilesVector, true); + VariableBackup emptyFilesBackup(&NEO::Directory::returnEmptyFilesVector, true); DebugManagerStateRestore restorer; DebugManager.flags.CreateMultipleRootDevices.set(4); VariableBackup backup{&ultHwConfig}; @@ -4020,7 +4020,7 @@ TEST(WddmMemoryManagerTest3, givenMultipleRootDeviceWhenMemoryManagerGetsWddmThe TEST(WddmMemoryManagerTest3, givenMultipleRootDeviceWhenCreateMemoryManagerThenTakeMaxMallocRestrictionAvailable) { uint32_t numRootDevices = 4u; - VariableBackup emptyFilesBackup(&NEO::Directory::ReturnEmptyFilesVector, true); + VariableBackup emptyFilesBackup(&NEO::Directory::returnEmptyFilesVector, true); DebugManagerStateRestore restorer; DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices); VariableBackup backup{&ultHwConfig}; @@ -4038,7 +4038,7 @@ TEST(WddmMemoryManagerTest3, givenMultipleRootDeviceWhenCreateMemoryManagerThenT } TEST(WddmMemoryManagerTest3, givenNoLocalMemoryOnAnyDeviceWhenIsCpuCopyRequiredIsCalledThenFalseIsReturned) { - VariableBackup emptyFilesBackup(&NEO::Directory::ReturnEmptyFilesVector, true); + VariableBackup emptyFilesBackup(&NEO::Directory::returnEmptyFilesVector, true); DebugManagerStateRestore restorer; DebugManager.flags.EnableLocalMemory.set(false); VariableBackup backup{&ultHwConfig}; @@ -4050,7 +4050,7 @@ TEST(WddmMemoryManagerTest3, givenNoLocalMemoryOnAnyDeviceWhenIsCpuCopyRequiredI } TEST(WddmMemoryManagerTest3, givenLocalPointerPassedToIsCpuCopyRequiredThenFalseIsReturned) { - VariableBackup emptyFilesBackup(&NEO::Directory::ReturnEmptyFilesVector, true); + VariableBackup emptyFilesBackup(&NEO::Directory::returnEmptyFilesVector, true); MockExecutionEnvironment executionEnvironment{}; VariableBackup backup{&ultHwConfig}; ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false; diff --git a/shared/test/unit_test/utilities/containers_tests.cpp b/shared/test/unit_test/utilities/containers_tests.cpp index f9fd0b593b..cb5c8c60fc 100644 --- a/shared/test/unit_test/utilities/containers_tests.cpp +++ b/shared/test/unit_test/utilities/containers_tests.cpp @@ -55,8 +55,8 @@ struct DummyDNode : IDNode { uint32_t *destructorsCounter; }; -template -void makeList(NodeType *(&nodes)[ArraySize], uint32_t *destructorsCounter = nullptr) { +template +void makeList(NodeType *(&nodes)[arraySize], uint32_t *destructorsCounter = nullptr) { NodeType *prev = nullptr; for (NodeType *&nd : nodes) { nd = new NodeType(destructorsCounter); @@ -178,9 +178,9 @@ TEST(IFNode, WhenVerifingSequenceThenCorrectValueIsReturned) { } } -template +template void iFListTestPushFrontOne() { - IFList list; + IFList list; ASSERT_TRUE(list.peekIsEmpty()); DummyFNode node1; @@ -234,9 +234,9 @@ TEST(IFList, WhenSplicingAndDeletingAllThenListIsEmpty) { ASSERT_EQ(2 * sizeof(nodes) / sizeof(nodes[0]), destructorCounter); } -template +template void iFListTestDetachNodes() { - IFList list; + IFList list; uint32_t destructorCounter = 0; static const uint32_t maxNodes = 17; @@ -282,11 +282,11 @@ TEST(IFList, WhenExchangingHeadThenResultIsCorrect) { EXPECT_EQ(nullptr, nd2.next); } -template +template void iFRefListTestPushFrontOne() { uint32_t destructorCounter = 0; { - auto list = std::unique_ptr>(new IFRefList()); + auto list = std::unique_ptr>(new IFRefList()); ASSERT_TRUE(list->peekIsEmpty()); DummyFNode node1(&destructorCounter); @@ -502,9 +502,9 @@ TEST(IDNode, WhenVerifyingSequenceThenResultIsCorrect) { } } -template +template void iDListTestPushOne() { - IDList list(nullptr); + IDList list(nullptr); ASSERT_TRUE(list.peekIsEmpty()); ASSERT_EQ(nullptr, list.peekHead()); ASSERT_EQ(nullptr, list.peekTail()); @@ -595,14 +595,14 @@ TEST(IDList, WhenResettingThenListIsEmpty) { ASSERT_EQ(sizeof(nodes) / sizeof(nodes[0]), destructorCounter); } -template +template void iDListSpliceAndDeleteAll() { DummyDNode *nodes[7]; DummyDNode *nodes2[sizeof(nodes) / sizeof(nodes[0])]; uint32_t destructorCounter = 0; makeList(nodes, &destructorCounter); makeList(nodes2, &destructorCounter); - IDList list; + IDList list; list.splice(*nodes[0]); EXPECT_FALSE(list.peekIsEmpty()); EXPECT_EQ(nodes[0], list.peekHead()); @@ -633,9 +633,9 @@ TEST(IDList, GivenNonThreadSafeWhenSplicingAndDeletingAllThenResultIsCorrect) { iDListSpliceAndDeleteAll(); } -template +template void iDListTestDetachNodes() { - IDList list; + IDList list; uint32_t destructorCounter = 0; static const uint32_t maxNodes = 17; @@ -659,9 +659,9 @@ TEST(IDList, GivenNonThreadSafeWhenDetachingNodesThenResultIsCorrect) { iDListTestDetachNodes(); } -template +template void iDListTestRemoveOne() { - IDList list; + IDList list; DummyDNode nodes[3]; @@ -719,9 +719,9 @@ TEST(IDList, GivenNonThreadSafeWhenRemovingOneThenResultIsCorrect) { iDListTestRemoveOne(); } -template +template void iDListTestRemoveFrontOne() { - IDList list; + IDList list; DummyDNode nodes[3]; DummyDNode *head = nullptr; @@ -780,11 +780,11 @@ TEST(IDList, GivenNonThreadSafeWhenRemovingFrontOneThenResultIsCorrect) { iDListTestRemoveFrontOne(); } -template +template void iDListTestDetachSequence() { DummyDNode *nodes[10]; makeList(nodes); - IDList list(nodes[0]); + IDList list(nodes[0]); DummyDNode *detachedNodes = nullptr; detachedNodes = list.detachSequence(*nodes[1], *nodes[3]); @@ -849,9 +849,9 @@ TEST(IDList, GivenNonThreadSafeWhenDetachingSequenceThenResultIsCorrect) { iDListTestDetachSequence(); } -template +template void iDListTestPeekContains() { - IDList list; + IDList list; DummyDNode *node1 = new DummyDNode; EXPECT_FALSE(list.peekContains(*node1)); @@ -892,16 +892,16 @@ TEST(IDList, GivenNonThreadSafeWhenPeekingThenResultIsCorrect) { iDListTestPeekContains(); } -template +template void testIDListSpinlock() { - struct ListMock : IDList { + struct ListMock : IDList { std::atomic_flag &getLockedRef() { return this->locked; } std::atomic &getLockOwnerRef() { return this->lockOwner; } - using ListenerT = void (*)(IDList &list); + using ListenerT = void (*)(IDList &list); ListenerT &getSpinLockedListenerRef() { return this->spinLockedListener; } int32_t lockLoopCount = 0; - static void listener(IDList &list) { + static void listener(IDList &list) { ListMock &l = reinterpret_cast(list); EXPECT_LT(0, l.lockLoopCount); --l.lockLoopCount; @@ -941,11 +941,11 @@ TEST(IDList, GivenLockedIDListWhenProcessLockedIsUsedThenWaitsInSpinlock) { testIDListSpinlock(); } -template +template void testIDListUnlockOnException() { using ExType = std::runtime_error; - struct ListMock : IDList { + struct ListMock : IDList { void throwExFromLock() { this->template processLocked(nullptr, nullptr); } @@ -969,9 +969,9 @@ TEST(IDList, GivenInsideLockWhenExceptionIsThrownThenUnlocksBeforeRethrowingExce testIDListUnlockOnException(); } -template +template void iDRefListTestPushFrontOne() { - auto list = std::unique_ptr>(new IDRefList()); + auto list = std::unique_ptr>(new IDRefList()); ASSERT_TRUE(list->peekIsEmpty()); DummyDNode node1;