refactor: correct variable namings

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-11-23 17:09:04 +00:00
committed by Compute-Runtime-Automation
parent 9e3a8bdf1b
commit 36194c4e7d
126 changed files with 872 additions and 894 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -40,7 +40,7 @@
namespace L0 {
struct DriverHandleImp *GlobalDriver;
struct DriverHandleImp *globalDriver;
DriverHandleImp::DriverHandleImp() = default;
@@ -289,7 +289,7 @@ DriverHandle *DriverHandle::create(std::vector<std::unique_ptr<NEO::Device>> dev
return nullptr;
}
GlobalDriver = driverHandle;
globalDriver = driverHandle;
driverHandle->getMemoryManager()->setForceNonSvmForExternalHostPtr(true);

View File

@@ -175,6 +175,6 @@ struct DriverHandleImp : public DriverHandle {
ze_result_t clearErrorDescription() override;
};
extern struct DriverHandleImp *GlobalDriver;
extern struct DriverHandleImp *globalDriver;
} // namespace L0

View File

@@ -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

View File

@@ -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<NEO::OsLibrary> loaderLibrary = std::unique_ptr<NEO::OsLibrary>{NEO::OsLibrary::load(loaderLibraryName)};
if (loaderLibrary) {

View File

@@ -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;

View File

@@ -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);

View File

@@ -576,7 +576,7 @@ void CommandQueueThreadArbitrationPolicyFixture::setUp() {
void CommandQueueThreadArbitrationPolicyFixture::tearDown() {
commandList->destroy();
commandQueue->destroy();
L0::GlobalDriver = nullptr;
L0::globalDriver = nullptr;
}
} // namespace ult

View File

@@ -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 <typename HelperType>
HelperType &getHelper() const;
VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&GlobalDriverHandle};
VariableBackup<_ze_driver_handle_t *> globalDriverHandleBackup{&globalDriverHandle};
VariableBackup<uint32_t> 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<uint32_t> driverCountBackup{&driverCount};
};

View File

@@ -19,37 +19,37 @@ namespace L0 {
namespace ult {
TEST(GlobalTearDownCallbackTests, givenL0LoaderThenGlobalTeardownCallbackIsCalled) {
L0::LevelZeroDriverInitialized = true;
L0::levelZeroDriverInitialized = true;
std::unique_ptr<NEO::OsLibrary> loaderLibrary = std::unique_ptr<NEO::OsLibrary>{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<NEO::OsLibrary> loaderLibrary = std::unique_ptr<NEO::OsLibrary>{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

View File

@@ -192,7 +192,6 @@ HWTEST2_F(CommandListCreate, givenHostAllocInMapWhenGetHostPtrAllocCalledThenCor
commandList->hostPtrMap.clear();
}
template <NEO::AllocationType AllocType>
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<DeviceHostPtrFailMock<NEO::AllocationType::INTERNAL_HOST_MEMORY>>(device->getNEODevice(), execEnv);
auto failDevice = std::make_unique<DeviceHostPtrFailMock>(device->getNEODevice(), execEnv);
failDevice->neoDevice = device->getNEODevice();
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(failDevice.get(), NEO::EngineGroupType::Copy, 0u);
@@ -1429,13 +1428,13 @@ HWTEST2_F(CommandListCreate, givenNonEmptyCommandsToPatchWhenClearCommandsToPatc
EXPECT_TRUE(pCommandList->commandsToPatch.empty());
}
template <NEO::AllocationType AllocType>
template <NEO::AllocationType allocType>
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<NEO::MockGraphicsAllocation>(const_cast<void *>(buffer), reinterpret_cast<uintptr_t>(buffer), size);
alloc->allocationType = AllocType;
alloc->allocationType = allocType;
return alloc.release();
}
const NEO::HardwareInfo &getHwInfo() const override {

View File

@@ -296,8 +296,9 @@ struct PauseOnGpuFixture : public Test<ModuleFixture> {
commandListHandle = commandList->toHandle();
}
template <typename MI_SEMAPHORE_WAIT>
template <typename FamilyType>
bool verifySemaphore(const GenCmdList::iterator &iterator, uint64_t debugPauseStateAddress, DebugPauseState requiredDebugPauseState) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
auto semaphoreCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(*iterator);
if ((static_cast<uint32_t>(requiredDebugPauseState) == semaphoreCmd->getSemaphoreDataDword()) &&
@@ -344,16 +345,17 @@ struct PauseOnGpuFixture : public Test<ModuleFixture> {
return false;
}
template <typename MI_SEMAPHORE_WAIT>
template <typename FamilyType>
void findSemaphores(GenCmdList &cmdList) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
auto semaphore = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
while (semaphore != cmdList.end()) {
if (verifySemaphore<MI_SEMAPHORE_WAIT>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) {
if (verifySemaphore<FamilyType>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) {
semaphoreBeforeWalkerFound++;
}
if (verifySemaphore<MI_SEMAPHORE_WAIT>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) {
if (verifySemaphore<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(cmdList);
@@ -534,7 +536,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToAfterOnlyWhenDispatchingThenInsertP
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter));
findSemaphores<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(cmdList);
@@ -610,7 +612,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseOnEnqueueFlagSetWhen
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter));
findSemaphores<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(cmdList);
@@ -693,7 +695,7 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToAfterOnlyWh
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter));
findSemaphores<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(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<MI_SEMAPHORE_WAIT>(cmdList);
findSemaphores<FamilyType>(cmdList);
findPipeControls<FamilyType>(cmdList);

View File

@@ -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<RENDER_SURFACE_STATE *>(ssh->getCpuBase());
auto debugSurface = static_cast<L0::DeviceImp *>(device)->getDebugSurface();
SURFACE_STATE_BUFFER_LENGTH length;
SurfaceStateBufferLength length;
length.length = static_cast<uint32_t>(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<uint32_t>(debugSurface->getUnderlyingBufferSize() - 1);
EXPECT_EQ(length.surfaceState.depth + 1u, debugSurfaceState->getDepth());

View File

@@ -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<uint32_t> 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::DriverHandleImp *>(L0::GlobalDriverHandle);
L0::DriverHandleImp *driverHandleImp = reinterpret_cast<L0::DriverHandleImp *>(L0::globalDriverHandle);
auto &gfxCoreHelper = driverHandleImp->memoryManager->peekExecutionEnvironment().rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
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::DriverHandleImp *>(L0::GlobalDriverHandle);
L0::DriverHandleImp *driverHandleImp = reinterpret_cast<L0::DriverHandleImp *>(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::DriverHandleImp *>(L0::GlobalDriverHandle);
L0::DriverHandleImp *driverHandleImp = reinterpret_cast<L0::DriverHandleImp *>(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::DriverHandleImp *>(L0::GlobalDriverHandle);
L0::DriverHandleImp *driverHandleImp = reinterpret_cast<L0::DriverHandleImp *>(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<uint32_t> driverCountBackup{&driverCount};
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.levelZeroSupported = true;
@@ -631,18 +631,18 @@ TEST_F(DriverImpTest, givenEnabledProgramDebuggingAndEnabledExperimentalOpenCLWh
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "1"}};
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
VariableBackup<decltype(L0::GlobalDriverHandle)> mockableDriverHandle(&L0::GlobalDriverHandle);
VariableBackup<decltype(L0::GlobalDriver)> mockableDriver(&L0::GlobalDriver);
VariableBackup<decltype(L0::globalDriverHandle)> mockableDriverHandle(&L0::globalDriverHandle);
VariableBackup<decltype(L0::globalDriver)> 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<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}};
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
VariableBackup<decltype(L0::GlobalDriverHandle)> mockableDriverHandle(&L0::GlobalDriverHandle);
VariableBackup<decltype(L0::GlobalDriver)> mockableDriver(&L0::GlobalDriver);
VariableBackup<decltype(L0::globalDriverHandle)> mockableDriverHandle(&L0::globalDriverHandle);
VariableBackup<decltype(L0::globalDriver)> 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<uint32_t> 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) {

View File

@@ -406,7 +406,7 @@ HWTEST_F(ModuleTest, givenBufferWhenOffsetIsNotPatchedThenSizeIsDecereasedByOffs
auto argInfo = kernelImp->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[argIndex].as<NEO::ArgDescPointer>();
auto surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful);
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = static_cast<uint32_t>((gpuAlloc->getUnderlyingBufferSize() - offset) - 1);
EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast<uint32_t>(length.surfaceState.width + 1));
EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast<uint32_t>(length.surfaceState.height + 1));
@@ -447,7 +447,7 @@ HWTEST_F(ModuleTest, givenUnalignedHostBufferWhenSurfaceStateProgrammedThenUnali
auto argInfo = kernelImp->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[argIndex].as<NEO::ArgDescPointer>();
auto surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful);
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = alignUp(static_cast<uint32_t>((mockGa.getUnderlyingBufferSize() + allocationOffset)), alignment) - 1;
EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast<uint32_t>(length.surfaceState.width + 1));
EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast<uint32_t>(length.surfaceState.height + 1));
@@ -2462,7 +2462,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest,
auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as<NEO::ArgDescPointer>();
auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful);
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = static_cast<uint32_t>((baseAlloc->getUnderlyingBufferSize() + offsetAlloc->getUnderlyingBufferSize()) - 1);
EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast<uint32_t>(length.surfaceState.width + 1));
EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast<uint32_t>(length.surfaceState.height + 1));
@@ -2534,7 +2534,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest,
auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as<NEO::ArgDescPointer>();
auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful);
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = static_cast<uint32_t>(offsetAlloc->getUnderlyingBufferSize() - 1);
EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast<uint32_t>(length.surfaceState.width + 1));
EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast<uint32_t>(length.surfaceState.height + 1));
@@ -2596,7 +2596,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest,
auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as<NEO::ArgDescPointer>();
auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful);
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = static_cast<uint32_t>(baseAlloc->getUnderlyingBufferSize() - 1);
EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast<uint32_t>(length.surfaceState.width + 1));
EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast<uint32_t>(length.surfaceState.height + 1));
@@ -2673,7 +2673,7 @@ HWTEST_F(MultiDeviceModuleSetArgBufferTest,
auto argInfo = kernel->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[0].as<NEO::ArgDescPointer>();
auto surfaceStateAddressRaw = ptrOffset(kernel->getSurfaceStateHeapData(), argInfo.bindful);
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = static_cast<uint32_t>((MemoryConstants::gigaByte * 4) - 1);
EXPECT_EQ(surfaceStateAddress->getWidth(), static_cast<uint32_t>(length.surfaceState.width + 1));
EXPECT_EQ(surfaceStateAddress->getHeight(), static_cast<uint32_t>(length.surfaceState.height + 1));

View File

@@ -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<LinuxSysmanDriverImp *>(GlobalSysmanDriver->pOsSysmanDriver);
auto pLinuxSysmanDriverImp = static_cast<LinuxSysmanDriverImp *>(globalSysmanDriver->pOsSysmanDriver);
if (pLinuxSysmanDriverImp == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"%s", "Os Sysman driver not initialized\n");

View File

@@ -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()) {

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
}

View File

@@ -31,7 +31,7 @@ struct SysmanDriverHandleImp : SysmanDriverHandle {
struct OsSysmanDriver *pOsSysmanDriver = nullptr;
};
extern struct SysmanDriverHandleImp *GlobalSysmanDriver;
extern struct SysmanDriverHandleImp *globalSysmanDriver;
} // namespace Sysman
} // namespace L0

View File

@@ -10,7 +10,7 @@
namespace L0 {
namespace Sysman {
SysmanProductHelperCreateFunctionType SysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {};
SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT] = {};
}
} // namespace L0

View File

@@ -21,12 +21,12 @@ class SysmanProductHelper;
class LinuxSysmanImp;
using SysmanProductHelperCreateFunctionType = std::unique_ptr<SysmanProductHelper> (*)();
extern SysmanProductHelperCreateFunctionType SysmanProductHelperFactory[IGFX_MAX_PRODUCT];
extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT];
class SysmanProductHelper {
public:
static std::unique_ptr<SysmanProductHelper> create(PRODUCT_FAMILY product) {
auto productHelperCreateFunction = SysmanProductHelperFactory[product];
auto productHelperCreateFunction = sysmanProductHelperFactory[product];
if (productHelperCreateFunction == nullptr) {
return nullptr;
}

View File

@@ -32,7 +32,7 @@ template <PRODUCT_FAMILY gfxProduct>
struct EnableSysmanProductHelper {
EnableSysmanProductHelper() {
auto sysmanProductHelperCreateFunction = SysmanProductHelperHw<gfxProduct>::create;
SysmanProductHelperFactory[gfxProduct] = sysmanProductHelperCreateFunction;
sysmanProductHelperFactory[gfxProduct] = sysmanProductHelperCreateFunction;
}
};

View File

@@ -73,7 +73,7 @@ class SysmanDeviceFixture : public ::testing::Test {
driverHandle = std::make_unique<L0::Sysman::SysmanDriverHandleImp>();
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;
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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 <uint32_t driverType, typename DebugSessionType>
struct DebugSessionLinuxPopulateFactory {
DebugSessionLinuxPopulateFactory() {
DebugSessionLinuxFactory[driverType] = DebugSessionType::createLinuxSession;
debugSessionLinuxFactory[driverType] = DebugSessionType::createLinuxSession;
}
};

View File

@@ -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<ze_device_handle_t>();
auto subDevices = std::vector<ze_device_handle_t>();

View File

@@ -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<LinuxSysmanDriverImp *>(GlobalOsSysmanDriver)->eventRegister(events, pLinuxSysmanImp->getSysmanDeviceImp());
static_cast<LinuxSysmanDriverImp *>(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<LinuxSysmanDriverImp *>(GlobalOsSysmanDriver)->getUdevLibHandle();
pUdevLib = static_cast<LinuxSysmanDriverImp *>(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) {

View File

@@ -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()) {

View File

@@ -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;
}
}

View File

@@ -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<DriverHandleImp *>(driverHandle)->enableSysman && !isSubDevice) {
@@ -47,8 +47,8 @@ SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t coreDevice) {
static_cast<DeviceImp *>(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) {

View File

@@ -98,7 +98,7 @@ struct SysmanDevice : _ze_device_handle_t {
virtual ~SysmanDevice() = default;
};
extern struct OsSysmanDriver *GlobalOsSysmanDriver;
extern struct OsSysmanDriver *globalOsSysmanDriver;
class SysmanDeviceHandleContext {
public:

View File

@@ -14,7 +14,7 @@
#include <level_zero/zet_api.h>
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<OaMetricSourceImp>();
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<OaMetricSourceImp>();
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() {

View File

@@ -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

View File

@@ -19,7 +19,7 @@
#include <level_zero/zet_api.h>
namespace L0 {
extern _ze_driver_handle_t *GlobalDriverHandle;
extern _ze_driver_handle_t *globalDriverHandle;
namespace ult {

View File

@@ -17,7 +17,7 @@
#include <level_zero/zet_api.h>
namespace L0 {
extern _ze_driver_handle_t *GlobalDriverHandle;
extern _ze_driver_handle_t *globalDriverHandle;
namespace ult {

View File

@@ -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<MetricContextFixture>;
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;

View File

@@ -125,8 +125,8 @@ TEST_F(SysmanEventsFixture, GivenValidSysmanHandleWhenEventsAreClearedThenDevice
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -166,8 +166,8 @@ TEST_F(SysmanEventsFixture, GivenPollSystemCallReturnsFailureWhenlisteningForRes
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -210,8 +210,8 @@ TEST_F(SysmanEventsFixture, GivenPipeSystemCallReturnsFailureWhenlisteningForRes
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -258,8 +258,8 @@ TEST_F(SysmanEventsFixture, GivenPollSystemCallReturnsOnAllFdsWhenlisteningForRe
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -308,8 +308,8 @@ TEST_F(SysmanEventsFixture, GivenPollSystemCallReturnsOnPipeFdWhenlisteningForRe
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -337,8 +337,8 @@ TEST_F(SysmanEventsFixture, GivenValidSysmanHandleWhenDeviceEventListenIsInvoked
TEST_F(SysmanEventsFixture, GivenLibUdevNotFoundWhenListeningForEventsThenEventListenIsNotSuccess) {
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -401,8 +401,8 @@ TEST_F(SysmanEventsFixture, GivenNoEventsAreRegisteredWhenListeningForEventsThen
}
TEST_F(SysmanEventsFixture, GivenOsSysmanDriverAsNullWhenListeningForEventsThenVerifyEventListenIsNotSuccess) {
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = nullptr;
VariableBackup<L0::OsSysmanDriver *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = nullptr;
VariableBackup<L0::OsSysmanDriver *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = nullptr;
VariableBackup<L0::OsSysmanDriver *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -521,8 +521,8 @@ TEST_F(SysmanEventsFixture,
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -562,8 +562,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleAndListeningEventsWhenNullEven
pUdevLibLocal->getEventTypeResult = nullptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -608,8 +608,8 @@ TEST_F(SysmanEventsFixture,
pUdevLibLocal->getEventGenerationSourceDeviceResult = 10;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -656,8 +656,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForResetRequiredE
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -681,8 +681,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForResetRequiredE
TEST_F(SysmanDeviceFixture, GivenValidDeviceHandleWhenEventRegisterIsCalledThenSuccessIsReturned) {
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -848,8 +848,8 @@ TEST_F(SysmanEventsFixture, GivenInvalidEventTypeWhenListeningForFabricHealthEve
pUdevLibLocal->getEventTypeResult = "Invalid";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -899,8 +899,8 @@ TEST_F(SysmanEventsFixture, GivenRealPathSystemCallFailsWhenListeningForFabricHe
pUdevLibLocal->getEventGenerationSourceDeviceResult = 20;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -950,8 +950,8 @@ TEST_F(SysmanEventsFixture, GivenRealPathSystemCallReturnsInvalidDeviceWhenListe
pUdevLibLocal->getEventGenerationSourceDeviceResult = 20;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1000,8 +1000,8 @@ TEST_F(SysmanEventsFixture, GivenEventPropertyForTypeKeyIsNullPtrWhenListeningFo
pUdevLibLocal->eventPropertyValueTypeResult = "";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1050,8 +1050,8 @@ TEST_F(SysmanEventsFixture, GivenEventPropertyForTypeKeyInvalidWhenListeningForF
pUdevLibLocal->eventPropertyValueTypeResult = "Invalid";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1074,8 +1074,8 @@ TEST_F(SysmanEventsFixture, GivenEventPropertyForTypeKeyInvalidWhenListeningForF
TEST_F(SysmanEventsFixture, GivenEventsAreRegisteredWhenEventRegisterIsCalledAgainThenSuccessIsReturned) {
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
auto pLinuxEventsImp = new PublicLinuxEventsUtil();
auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil;
@@ -1100,8 +1100,8 @@ TEST_F(SysmanEventsFixture, GivenWriteSystemCallReturnsFailureWhenEventRegisterI
});
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
auto pLinuxEventsImp = new PublicLinuxEventsUtil();
auto pLinuxEventsUtilOld = pPublicLinuxSysmanDriverImp->pLinuxEventsUtil;
@@ -1145,8 +1145,8 @@ TEST_F(SysmanEventsFixture,
pUdevLibLocal->getEventPropertyValueResult = "0";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1245,8 +1245,8 @@ TEST_F(SysmanEventsFixture,
pUdevLibLocal->getEventPropertyValueResult.clear();
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1327,8 +1327,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForDeviceDetachEv
pUdevLibLocal->getEventTypeResult = "remove";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1417,8 +1417,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForDeviceAttachEv
pUdevLibLocal->getEventTypeResult = "add";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1507,8 +1507,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForDeviceAttachEv
pUdevLibLocal->getEventTypeResult = "add";
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;
@@ -1551,8 +1551,8 @@ TEST_F(SysmanEventsFixture, GivenValidDeviceHandleWhenListeningForMemHealthEvent
pUdevLibLocal->allocateDeviceToReceiveDataResult = ptr;
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> 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<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
VariableBackup<L0::UdevLib *> udevBackup(&pPublicLinuxSysmanDriverImp->pUdevLib);
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLibLocal;

View File

@@ -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();

View File

@@ -787,9 +787,9 @@ TEST_F(SysmanDeviceFixture, GivenValidEnumeratedHandlesWhenReleaseIsCalledThenHa
}
TEST_F(SysmanDeviceFixture, GivenDriverEventsUtilAsNullWhenSysmanDriverDestructorIsCalledThenVerifyNoExceptionOccured) {
VariableBackup<L0::OsSysmanDriver *> driverBackup(&GlobalOsSysmanDriver);
VariableBackup<L0::OsSysmanDriver *> driverBackup(&globalOsSysmanDriver);
auto pPublicLinuxSysmanDriverImp = new PublicLinuxSysmanDriverImp();
GlobalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
globalOsSysmanDriver = static_cast<L0::OsSysmanDriver *>(pPublicLinuxSysmanDriverImp);
auto pUdevLib = new UdevLibMock();
pPublicLinuxSysmanDriverImp->pUdevLib = pUdevLib;

View File

@@ -30,8 +30,8 @@ void SysmanDeviceFixture::SetUp() {
pOsSysman = pSysmanDeviceImp->pOsSysman;
pWddmSysmanImp = static_cast<PublicWddmSysmanImp *>(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();

View File

@@ -103,12 +103,12 @@ class ClDevice : public BaseObject<_cl_device_id> {
size_t &retSize);
// This helper template is meant to simplify getDeviceInfo
template <cl_device_info Param>
template <cl_device_info param>
void getCap(const void *&src,
size_t &size,
size_t &retSize);
template <cl_device_info Param>
template <cl_device_info param>
void getStr(const void *&src,
size_t &size,
size_t &retSize);

View File

@@ -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 <cl_device_info Param>
template <cl_device_info param>
inline void ClDevice::getCap(const void *&src,
size_t &size,
size_t &retSize) {
src = &ClDeviceInfoTable::Map<Param>::getValue(*this);
retSize = size = ClDeviceInfoTable::Map<Param>::size;
src = &ClDeviceInfoTable::Map<param>::getValue(*this);
retSize = size = ClDeviceInfoTable::Map<param>::size;
}
} // namespace NEO

View File

@@ -29,12 +29,12 @@ namespace NEO {
using ClDeviceInfoTable::Map;
template <cl_device_info Param>
template <cl_device_info param>
inline void ClDevice::getStr(const void *&src,
size_t &size,
size_t &retSize) {
src = Map<Param>::getValue(*this);
retSize = size = strlen(Map<Param>::getValue(*this)) + 1;
src = Map<param>::getValue(*this);
retSize = size = strlen(Map<param>::getValue(*this)) + 1;
}
template <>

View File

@@ -19,9 +19,9 @@ namespace NEO {
namespace ClDeviceInfoTable {
template <cl_device_info Param, typename _Type, _Type ClDeviceInfo::*val>
template <cl_device_info clDeviceInfoParam, typename _Type, _Type ClDeviceInfo::*val>
struct ClMapBase {
enum { param = Param };
enum { param = clDeviceInfoParam };
typedef _Type Type;
enum { size = sizeof(Type) };
@@ -30,9 +30,9 @@ struct ClMapBase {
}
};
template <cl_device_info Param, typename _Type, _Type DeviceInfo::*val>
template <cl_device_info clDeviceInfoParam, typename _Type, _Type DeviceInfo::*val>
struct MapBase {
enum { param = Param };
enum { param = clDeviceInfoParam };
typedef _Type Type;
enum { size = sizeof(Type) };
@@ -41,15 +41,15 @@ struct MapBase {
}
};
template <cl_device_info Param>
template <cl_device_info param>
struct Map {};
//////////////////////////////////////////////////////
// DeviceInfo mapping table
// Map<Param>::param - i.e. CL_DEVICE_ADDRESS_BITS
// Map<Param>::Type - i.e. cl_uint
// Map<Param>::size - ie. sizeof( cl_uint )
// Map<Param>::getValue - ie. return deviceInfo.AddressBits
// Map<param>::param - i.e. CL_DEVICE_ADDRESS_BITS
// Map<param>::Type - i.e. cl_uint
// Map<param>::size - ie. sizeof( cl_uint )
// Map<param>::getValue - ie. return deviceInfo.AddressBits
//////////////////////////////////////////////////////
// clang-format off
// please keep alphabetical order

View File

@@ -19,19 +19,19 @@
#include <string>
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<size_t>(envReader.getSetting(NeoCacheMaxSize.c_str(), static_cast<int64_t>(MemoryConstants::gigaByte)));
ret.cacheSize = static_cast<size_t>(envReader.getSetting(neoCacheMaxSize.c_str(), static_cast<int64_t>(MemoryConstants::gigaByte)));
if (ret.cacheSize == 0u) {
ret.cacheSize = std::numeric_limits<size_t>::max();
@@ -56,7 +56,7 @@ CompilerCacheConfig getDefaultCompilerCacheConfig() {
return ret;
}
ret.cacheDir = envReader.getSetting(ClCacheDir.c_str(), static_cast<std::string>(CL_CACHE_LOCATION));
ret.cacheDir = envReader.getSetting(clCacheDir.c_str(), static_cast<std::string>(CL_CACHE_LOCATION));
if (NEO::SysCalls::pathExists(ret.cacheDir)) {
ret.enabled = true;

View File

@@ -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<int> sequenceCount(1);
@@ -53,13 +53,13 @@ void gtpinNotifyContextCreate(cl_context context) {
auto &gtpinHelper = pDevice->getGTPinGfxCoreHelper();
gtpinPlatformInfo.gen_version = (gtpin::GTPIN_GEN_VERSION)gtpinHelper.getGenVersion();
gtpinPlatformInfo.device_id = static_cast<uint32_t>(pDevice->getHardwareInfo().platform.usDeviceID);
(*GTPinCallbacks.onContextCreate)((context_handle_t)context, &gtpinPlatformInfo, &pIgcInit);
(*gtpinCallbacks.onContextCreate)((context_handle_t)context, &gtpinPlatformInfo, &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<uint32_t>(pMultiDeviceKernel->getProgram()->getDebugDataSize(rootDeviceIndex));
}
instrument_params_out_t paramsOut = {0};
(*GTPinCallbacks.onKernelCreate)((context_handle_t)(cl_context)context, &paramsIn, &paramsOut);
(*gtpinCallbacks.onKernelCreate)((context_handle_t)(cl_context)context, &paramsIn, &paramsOut);
// 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--;

View File

@@ -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;

View File

@@ -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 <typename GfxFamily>
void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation,
bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {

View File

@@ -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 <typename GfxFamily>
void ImageHw<GfxFamily>::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<GfxFamily>::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<uint32_t>(getImageDesc().image_width - 1);
depth = static_cast<uint32_t>(length.surfaceState.depth + 1);

View File

@@ -17,8 +17,8 @@
namespace NEO {
template <DebugFunctionalityLevel DebugLevel>
ClFileLogger<DebugLevel>::ClFileLogger(FileLogger<DebugLevel> &baseLoggerIn, const DebugVariables &flags) : baseLogger(baseLoggerIn) {
template <DebugFunctionalityLevel debugLevel>
ClFileLogger<debugLevel>::ClFileLogger(FileLogger<debugLevel> &baseLoggerIn, const DebugVariables &flags) : baseLogger(baseLoggerIn) {
dumpKernelArgsEnabled = flags.DumpKernelArgs.get();
}
@@ -27,8 +27,8 @@ ClFileLogger<globalDebugFunctionalityLevel> &getClFileLogger() {
return clFileLoggerInstance;
}
template <DebugFunctionalityLevel DebugLevel>
void ClFileLogger<DebugLevel>::dumpKernelArgs(const MultiDispatchInfo *multiDispatchInfo) {
template <DebugFunctionalityLevel debugLevel>
void ClFileLogger<debugLevel>::dumpKernelArgs(const MultiDispatchInfo *multiDispatchInfo) {
if (false == baseLogger.enabled()) {
return;
}
@@ -100,8 +100,8 @@ void ClFileLogger<DebugLevel>::dumpKernelArgs(const MultiDispatchInfo *multiDisp
}
}
template <DebugFunctionalityLevel DebugLevel>
const std::string ClFileLogger<DebugLevel>::getEvents(const uintptr_t *input, uint32_t numOfEvents) {
template <DebugFunctionalityLevel debugLevel>
const std::string ClFileLogger<debugLevel>::getEvents(const uintptr_t *input, uint32_t numOfEvents) {
if (false == baseLogger.enabled()) {
return "";
}
@@ -116,8 +116,8 @@ const std::string ClFileLogger<DebugLevel>::getEvents(const uintptr_t *input, ui
return os.str();
}
template <DebugFunctionalityLevel DebugLevel>
const std::string ClFileLogger<DebugLevel>::getMemObjects(const uintptr_t *input, uint32_t numOfObjects) {
template <DebugFunctionalityLevel debugLevel>
const std::string ClFileLogger<debugLevel>::getMemObjects(const uintptr_t *input, uint32_t numOfObjects) {
if (false == baseLogger.enabled()) {
return "";
}

View File

@@ -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 <DebugFunctionalityLevel DebugLevel>
template <DebugFunctionalityLevel debugLevel>
class ClFileLogger : public NonCopyableOrMovableClass {
public:
ClFileLogger(FileLogger<DebugLevel> &baseLoggerInm, const DebugVariables &flags);
ClFileLogger(FileLogger<debugLevel> &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<DebugLevel> &baseLogger;
FileLogger<debugLevel> &baseLogger;
};
ClFileLogger<globalDebugFunctionalityLevel> &getClFileLogger();

View File

@@ -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<gtpinkexec_t> 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;

View File

@@ -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;

View File

@@ -873,8 +873,9 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithNoTimestampPacketTests, givenNoTimestampPacket
}
struct BlitEnqueueWithDebugCapabilityTests : public BlitEnqueueTests<0> {
template <typename MI_SEMAPHORE_WAIT>
template <typename FamilyType>
void findSemaphores(GenCmdList &cmdList) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
auto semaphore = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
while (semaphore != cmdList.end()) {
@@ -901,8 +902,9 @@ struct BlitEnqueueWithDebugCapabilityTests : public BlitEnqueueTests<0> {
}
}
template <typename MI_FLUSH_DW>
template <typename FamilyType>
void findMiFlushes(GenCmdList &cmdList) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
auto miFlush = find<MI_FLUSH_DW *>(cmdList.begin(), cmdList.end());
while (miFlush != cmdList.end()) {
@@ -956,12 +958,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenDis
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(ultBcsCsr->commandStream);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, semaphoreBeforeCopyFound);
EXPECT_EQ(1u, semaphoreAfterCopyFound);
findMiFlushes<MI_FLUSH_DW>(hwParser.cmdList);
findMiFlushes<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, miFlushBeforeCopyFound);
EXPECT_EQ(1u, miFlushAfterCopyFound);
@@ -1000,12 +1002,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetToMinus
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(ultBcsCsr->commandStream);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
EXPECT_EQ(2u, semaphoreBeforeCopyFound);
EXPECT_EQ(2u, semaphoreAfterCopyFound);
findMiFlushes<MI_FLUSH_DW>(hwParser.cmdList);
findMiFlushes<FamilyType>(hwParser.cmdList);
EXPECT_EQ(2u, miFlushBeforeCopyFound);
EXPECT_EQ(2u, miFlushAfterCopyFound);
@@ -1030,12 +1032,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenPauseModeSetToBefor
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(ultBcsCsr->commandStream);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, semaphoreBeforeCopyFound);
EXPECT_EQ(0u, semaphoreAfterCopyFound);
findMiFlushes<MI_FLUSH_DW>(hwParser.cmdList);
findMiFlushes<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, miFlushBeforeCopyFound);
EXPECT_EQ(0u, miFlushAfterCopyFound);
@@ -1060,12 +1062,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenPauseModeSetToAfter
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(ultBcsCsr->commandStream);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
EXPECT_EQ(0u, semaphoreBeforeCopyFound);
EXPECT_EQ(1u, semaphoreAfterCopyFound);
findMiFlushes<MI_FLUSH_DW>(hwParser.cmdList);
findMiFlushes<FamilyType>(hwParser.cmdList);
EXPECT_EQ(0u, miFlushBeforeCopyFound);
EXPECT_EQ(1u, miFlushAfterCopyFound);
@@ -1090,12 +1092,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenPauseModeSetToBefor
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(ultBcsCsr->commandStream);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, semaphoreBeforeCopyFound);
EXPECT_EQ(1u, semaphoreAfterCopyFound);
findMiFlushes<MI_FLUSH_DW>(hwParser.cmdList);
findMiFlushes<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, miFlushBeforeCopyFound);
EXPECT_EQ(1u, miFlushAfterCopyFound);

View File

@@ -1728,8 +1728,9 @@ struct PauseOnGpuTests : public EnqueueKernelTest {
debugPauseStateAddress = csr.getDebugPauseStateGPUAddress();
}
template <typename MI_SEMAPHORE_WAIT>
template <typename FamilyType>
bool verifySemaphore(const GenCmdList::iterator &iterator, uint64_t debugPauseStateAddress, DebugPauseState requiredDebugPauseState) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
auto semaphoreCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(*iterator);
if ((static_cast<uint32_t>(requiredDebugPauseState) == semaphoreCmd->getSemaphoreDataDword()) &&
@@ -1780,16 +1781,17 @@ struct PauseOnGpuTests : public EnqueueKernelTest {
return false;
}
template <typename MI_SEMAPHORE_WAIT>
template <typename FamilyType>
void findSemaphores(GenCmdList &cmdList) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
auto semaphore = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
while (semaphore != cmdList.end()) {
if (verifySemaphore<MI_SEMAPHORE_WAIT>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) {
if (verifySemaphore<FamilyType>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserStartConfirmation)) {
semaphoreBeforeWalkerFound++;
}
if (verifySemaphore<MI_SEMAPHORE_WAIT>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) {
if (verifySemaphore<FamilyType>(semaphore, debugPauseStateAddress, DebugPauseState::hasUserEndConfirmation)) {
semaphoreAfterWalkerFound++;
}
@@ -1857,7 +1859,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenInser
ClHardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*pCmdQ);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
EXPECT_EQ(1u, semaphoreBeforeWalkerFound);
EXPECT_EQ(1u, semaphoreAfterWalkerFound);
@@ -1882,7 +1884,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetToMinusTwoWhenDispatchWalker
ClHardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*pCmdQ);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
findPipeControls<FamilyType>(hwParser.cmdList);
@@ -1906,7 +1908,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeOnlyWhenDispatchingThenInsert
ClHardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*pCmdQ);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
findPipeControls<FamilyType>(hwParser.cmdList);
@@ -1930,7 +1932,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToAfterOnlyWhenDispatchingThenInsertP
ClHardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*pCmdQ);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
findPipeControls<FamilyType>(hwParser.cmdList);
@@ -1954,7 +1956,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeAndAfterWhenDispatchingThenIn
ClHardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*pCmdQ);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
findPipeControls<FamilyType>(hwParser.cmdList);
@@ -1979,7 +1981,7 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenDontI
ClHardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*pCmdQ);
findSemaphores<MI_SEMAPHORE_WAIT>(hwParser.cmdList);
findSemaphores<FamilyType>(hwParser.cmdList);
findPipeControls<FamilyType>(hwParser.cmdList);

View File

@@ -81,8 +81,8 @@ struct EnqueueKernelTypeTest : public HelloWorldFixture<HelloWorldFixtureFactory
localWorkSize[2] = 1;
};
template <typename FamilyType, bool ParseCommands>
typename std::enable_if<false == ParseCommands, void>::type enqueueKernel(Kernel *inputKernel = nullptr) {
template <typename FamilyType, bool parseCommands>
typename std::enable_if<false == parseCommands, void>::type enqueueKernel(Kernel *inputKernel = nullptr) {
cl_uint workDim = 1;
size_t globalWorkOffset[3] = {0, 0, 0};
@@ -111,11 +111,11 @@ struct EnqueueKernelTypeTest : public HelloWorldFixture<HelloWorldFixtureFactory
ASSERT_EQ(CL_SUCCESS, retVal);
}
template <typename FamilyType, bool ParseCommands>
typename std::enable_if<ParseCommands, void>::type enqueueKernel(Kernel *inputKernel = nullptr) {
template <typename FamilyType, bool parseCommands>
typename std::enable_if<parseCommands, void>::type enqueueKernel(Kernel *inputKernel = nullptr) {
enqueueKernel<FamilyType, false>(inputKernel);
parseCommands<FamilyType>(*pCmdQ);
this->template parseCommands<FamilyType>(*pCmdQ);
}
template <typename FamilyType>

View File

@@ -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<uint32_t>(computeUnits - 1);
EXPECT_EQ(length.surfaceState.depth + 1u, scratchState->getDepth());
EXPECT_EQ(length.surfaceState.width + 1u, scratchState->getWidth());

View File

@@ -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<MockGTPinTestContext *>(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);
}

View File

@@ -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<const DXGI_FORMAT>(DXGIformats);
availableFormats = ArrayRef<const DXGI_FORMAT>(dxgiFormats);
retrievedFormats.assign(availableFormats.size(), DXGI_FORMAT_UNKNOWN);
}
void TearDown() override {

View File

@@ -72,12 +72,12 @@ class DispatchInfoBuilderFixture : public ContextFixture, public ClDeviceFixture
typedef Test<DispatchInfoBuilderFixture> DispatchInfoBuilderTest;
template <SplitDispatch::Dim Dim, SplitDispatch::SplitMode Mode>
class DispatchInfoBuilderMock : DispatchInfoBuilder<Dim, Mode> {
template <SplitDispatch::Dim dim, SplitDispatch::SplitMode mode>
class DispatchInfoBuilderMock : DispatchInfoBuilder<dim, mode> {
public:
using DispatchInfoBuilder<Dim, Mode>::DispatchInfoBuilder;
using DispatchInfoBuilder<dim, mode>::DispatchInfoBuilder;
void pushSplit(const DispatchInfo &dispatchInfo, MultiDispatchInfo &outMdi) {
DispatchInfoBuilder<Dim, Mode>::pushSplit(dispatchInfo, outMdi);
DispatchInfoBuilder<dim, mode>::pushSplit(dispatchInfo, outMdi);
}
};

View File

@@ -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<MockContext> 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<std::tuple<size
size_t hostPtrSize;
};
/* origin, region, rowPitch, slicePitch, hostPtrSize*/
static std::tuple<size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t> Inputs[] = {std::make_tuple(0, 0, 0, 1, 1, 1, 10, 1, 1),
static std::tuple<size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t, size_t> 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;

View File

@@ -21,10 +21,10 @@ using namespace NEO;
static const unsigned int testImageDimensions = 32;
template <cl_mem_flags _flags>
template <cl_mem_flags clMemFlags>
class CreateImageFormatTest : public testing::TestWithParam<size_t> {
public:
CreateImageFormatTest() : flags(_flags) {
CreateImageFormatTest() : flags(clMemFlags) {
}
protected:
@@ -36,18 +36,16 @@ class CreateImageFormatTest : public testing::TestWithParam<size_t> {
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 {

View File

@@ -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<MockContext> 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<MockMemoryManager *>(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<MockMemoryManager *>(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<MockMemoryManager *>(pClExecutionEnvironment->memoryManager.get())->capturedSharedHandle, properties[1]);

View File

@@ -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<uint64_t , size_t, size_t, int, bool, bool> 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<uint64_t, size_t, size_t, int, bool, bool> inputs[] = {std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, false, true),
std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), cacheLinedAlignedSize, MemoryConstants::preferredAlignment, cacheLinedAlignedSize, false, true),
std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), cacheLinedAlignedSize, MemoryConstants::preferredAlignment, cacheLinedAlignedSize, true, false),
std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, false, false),
std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), pageAlignSize, MemoryConstants::preferredAlignment, pageAlignSize, true, false),
std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_USE_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::cacheLineSize, cacheLinedAlignedSize, true, false),
std::make_tuple(static_cast<cl_mem_flags>(CL_MEM_COPY_HOST_PTR), cacheLinedMisAlignedSize, MemoryConstants::preferredAlignment, cacheLinedMisAlignedSize, true, true),
std::make_tuple(static_cast<cl_mem_flags>(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;

View File

@@ -2342,7 +2342,7 @@ TEST(ProgramTest, givenImagesSupportedWhenCreatingProgramThenInternalOptionsAreC
}
}
template <int32_t ErrCodeToReturn, bool spirv = true>
template <int32_t errCodeToReturn, bool spirv = true>
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;
}
};

View File

@@ -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 <bool SignalWaited>
template <bool signalWaited>
inline void glArbSyncObjectWaitServerMock(NEO::OSInterface &osInterface, CL_GL_SYNC_INFO &glSyncInfo) {
glSyncInfo.waitCalled = SignalWaited;
glSyncInfo.waitCalled = signalWaited;
}
struct MockBaseEvent : Event {

View File

@@ -11,7 +11,7 @@
#include <memory>
#include <sstream>
constexpr int MIN_ARG_COUNT = 7;
constexpr int minArgCount = 7;
static void showUsage(std::string name) {
std::cerr << "Usage " << name << "<option(s)> - ALL BUT -p, --platform MUST BE SPECIFIED\n"
@@ -97,7 +97,7 @@ std::string parseToCharArray(std::unique_ptr<uint8_t[]> &binary, size_t size, st
}
int main(int argc, char *argv[]) {
if (argc < MIN_ARG_COUNT) {
if (argc < minArgCount) {
showUsage(argv[0]);
return 1;
}

View File

@@ -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 <DebugFunctionalityLevel DebugLevel>
DebugSettingsManager<DebugLevel>::DebugSettingsManager(const char *registryPath) {
template <DebugFunctionalityLevel debugLevel>
DebugSettingsManager<debugLevel>::DebugSettingsManager(const char *registryPath) {
}
template <DebugFunctionalityLevel DebugLevel>
DebugSettingsManager<DebugLevel>::~DebugSettingsManager() {
template <DebugFunctionalityLevel debugLevel>
DebugSettingsManager<debugLevel>::~DebugSettingsManager() {
readerImpl.reset();
};

View File

@@ -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

View File

@@ -270,7 +270,7 @@ struct AubDump : public std::conditional<TraitsIn::addressingBits == 32, AubPage
using BaseHelper = typename std::conditional<Traits::addressingBits == 32, AubPageTableHelper32<Traits>, AubPageTableHelper64<Traits>>::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<TraitsIn::addressingBits == 32, AubPage
} sData;
uint32_t ulData[2];
uint64_t qwordData[2 / 2];
} MiContextDescriptorReg, *pMiContextDescriptorReg;
};
// Write a block of memory to a given address space using an optional hint
static void addMemoryWrite(Stream &stream, uint64_t addr, const void *memory, size_t blockSize, int addressSpace, int hint = DataTypeHintValues::TraceNotype);
@@ -410,6 +410,6 @@ struct LrcaHelperCccs : public LrcaHelper {
}
};
extern const uint64_t g_pageMask;
extern const size_t g_dwordCountMax;
extern const uint64_t pageMask;
extern const size_t dwordCountMax;
} // namespace AubMemDump

View File

@@ -49,7 +49,7 @@ template <typename Traits>
void AubDump<Traits>::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<Traits>::addMemoryWrite(typename Traits::Stream &stream, uint64_t a
// Reserve memory in the GGTT.
template <typename Traits>
uint64_t AubDump<Traits>::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<Traits>::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<Traits>::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<Traits>::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<Traits>::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<Traits>::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<Traits>::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;

View File

@@ -406,7 +406,7 @@ void EncodeSurfaceState<Family>::encodeBuffer(EncodeSurfaceStateArgs &args) {
auto surfaceState = reinterpret_cast<R_SURFACE_STATE *>(args.outMemory);
auto bufferSize = alignUp(args.size, getSurfaceBaseAddressAlignment());
SURFACE_STATE_BUFFER_LENGTH length = {0};
SurfaceStateBufferLength length = {0};
length.length = static_cast<uint32_t>(bufferSize - 1);
surfaceState->setWidth(length.surfaceState.width + 1);

View File

@@ -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 <typename GfxFamily>
struct EncodeSurfaceState {
using R_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE;

View File

@@ -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<uint32_t>(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) {

View File

@@ -32,8 +32,8 @@ static std::string toString(const T &arg) {
}
}
template <DebugFunctionalityLevel DebugLevel>
DebugSettingsManager<DebugLevel>::DebugSettingsManager(const char *registryPath) {
template <DebugFunctionalityLevel debugLevel>
DebugSettingsManager<debugLevel>::DebugSettingsManager(const char *registryPath) {
readerImpl = SettingsReaderCreator::create(std::string(registryPath));
ApiSpecificConfig::initPrefixes();
injectSettingsFromReader();
@@ -44,13 +44,13 @@ DebugSettingsManager<DebugLevel>::DebugSettingsManager(const char *registryPath)
;
}
template <DebugFunctionalityLevel DebugLevel>
DebugSettingsManager<DebugLevel>::~DebugSettingsManager() {
template <DebugFunctionalityLevel debugLevel>
DebugSettingsManager<debugLevel>::~DebugSettingsManager() {
readerImpl.reset();
};
template <DebugFunctionalityLevel DebugLevel>
void DebugSettingsManager<DebugLevel>::getHardwareInfoOverride(std::string &hwInfoConfig) {
template <DebugFunctionalityLevel debugLevel>
void DebugSettingsManager<debugLevel>::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 <DebugFunctionalityLevel DebugLevel>
template <DebugFunctionalityLevel debugLevel>
template <typename DataType>
void DebugSettingsManager<DebugLevel>::dumpNonDefaultFlag(const char *variableName, const DataType &variableValue, const DataType &defaultValue, std::ostringstream &ostring) {
void DebugSettingsManager<debugLevel>::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 <DebugFunctionalityLevel DebugLevel>
void DebugSettingsManager<DebugLevel>::getStringWithFlags(std::string &allFlags, std::string &changedFlags) const {
template <DebugFunctionalityLevel debugLevel>
void DebugSettingsManager<debugLevel>::getStringWithFlags(std::string &allFlags, std::string &changedFlags) const {
std::ostringstream allFlagsStream;
allFlagsStream.str("");
@@ -115,8 +115,8 @@ void DebugSettingsManager<DebugLevel>::getStringWithFlags(std::string &allFlags,
changedFlags = changedFlagsStream.str();
}
template <DebugFunctionalityLevel DebugLevel>
void DebugSettingsManager<DebugLevel>::dumpFlags() const {
template <DebugFunctionalityLevel debugLevel>
void DebugSettingsManager<debugLevel>::dumpFlags() const {
if (flags.PrintDebugSettings.get() == false) {
return;
}
@@ -133,8 +133,8 @@ void DebugSettingsManager<DebugLevel>::dumpFlags() const {
settingsDumpFile << allFlags;
}
template <DebugFunctionalityLevel DebugLevel>
void DebugSettingsManager<DebugLevel>::injectSettingsFromReader() {
template <DebugFunctionalityLevel debugLevel>
void DebugSettingsManager<debugLevel>::injectSettingsFromReader() {
#undef DECLARE_DEBUG_VARIABLE
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \
{ \

View File

@@ -32,7 +32,7 @@ constexpr DebugFunctionalityLevel globalDebugFunctionalityLevel = DebugFunctiona
NEO::printDebugString(flag, __VA_ARGS__);
namespace NEO {
template <DebugFunctionalityLevel DebugLevel>
template <DebugFunctionalityLevel debugLevel>
class FileLogger;
extern FileLogger<globalDebugFunctionalityLevel> &fileLoggerInstance();
@@ -113,7 +113,7 @@ struct DebugVariables { // NOLINT(clang-analyzer
#undef DECLARE_DEBUG_VARIABLE
};
template <DebugFunctionalityLevel DebugLevel>
template <DebugFunctionalityLevel debugLevel>
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<globalDebugFunctionalityLevel> DebugManager;
PRINT_DEBUGGER_LOG(stdout, "\nINFO: " STR, __VA_ARGS__) \
}
template <DebugFunctionalityLevel DebugLevel>
const char *DebugSettingsManager<DebugLevel>::settingsDumpFileName = "igdrcl_dumped.config";
template <DebugFunctionalityLevel debugLevel>
const char *DebugSettingsManager<debugLevel>::settingsDumpFileName = "igdrcl_dumped.config";
}; // namespace NEO

View File

@@ -153,7 +153,7 @@ struct ElfFileHeaderIdentity {
};
static_assert(sizeof(ElfFileHeaderIdentity) == 16, "");
template <int NumBits>
template <int numBits>
struct ElfProgramHeaderTypes;
template <>
@@ -180,7 +180,7 @@ struct ElfProgramHeaderTypes<EI_CLASS_64> {
using Align = uint64_t;
};
template <int NumBits>
template <int numBits>
struct ElfProgramHeader;
template <>
@@ -210,7 +210,7 @@ struct ElfProgramHeader<EI_CLASS_64> {
static_assert(sizeof(ElfProgramHeader<EI_CLASS_32>) == 0x20, "");
static_assert(sizeof(ElfProgramHeader<EI_CLASS_64>) == 0x38, "");
template <int NumBits>
template <int numBits>
struct ElfSectionHeaderTypes;
template <>
@@ -241,24 +241,24 @@ struct ElfSectionHeaderTypes<EI_CLASS_64> {
using EntSize = uint64_t;
};
template <int NumBits>
template <int numBits>
struct ElfSectionHeader {
typename ElfSectionHeaderTypes<NumBits>::Name name = 0U; // offset to string in string section names
typename ElfSectionHeaderTypes<NumBits>::Type type = SHT_NULL; // section type
typename ElfSectionHeaderTypes<NumBits>::Flags flags = SHF_NONE; // section flags
typename ElfSectionHeaderTypes<NumBits>::Addr addr = 0U; // VA of section in memory
typename ElfSectionHeaderTypes<NumBits>::Offset offset = 0U; // absolute offset of section data in file
typename ElfSectionHeaderTypes<NumBits>::Size size = 0U; // size of section's data
typename ElfSectionHeaderTypes<NumBits>::Link link = SHN_UNDEF; // index of associated section
typename ElfSectionHeaderTypes<NumBits>::Info info = 0U; // extra information
typename ElfSectionHeaderTypes<NumBits>::AddrAlign addralign = 0U; // section alignment
typename ElfSectionHeaderTypes<NumBits>::EntSize entsize = 0U; // section's entries size
typename ElfSectionHeaderTypes<numBits>::Name name = 0U; // offset to string in string section names
typename ElfSectionHeaderTypes<numBits>::Type type = SHT_NULL; // section type
typename ElfSectionHeaderTypes<numBits>::Flags flags = SHF_NONE; // section flags
typename ElfSectionHeaderTypes<numBits>::Addr addr = 0U; // VA of section in memory
typename ElfSectionHeaderTypes<numBits>::Offset offset = 0U; // absolute offset of section data in file
typename ElfSectionHeaderTypes<numBits>::Size size = 0U; // size of section's data
typename ElfSectionHeaderTypes<numBits>::Link link = SHN_UNDEF; // index of associated section
typename ElfSectionHeaderTypes<numBits>::Info info = 0U; // extra information
typename ElfSectionHeaderTypes<numBits>::AddrAlign addralign = 0U; // section alignment
typename ElfSectionHeaderTypes<numBits>::EntSize entsize = 0U; // section's entries size
};
static_assert(sizeof(ElfSectionHeader<EI_CLASS_32>) == 0x28, "");
static_assert(sizeof(ElfSectionHeader<EI_CLASS_64>) == 0x40, "");
template <ELF_IDENTIFIER_CLASS NumBits>
template <ELF_IDENTIFIER_CLASS numBits>
struct ElfFileHeaderTypes;
template <>
@@ -295,22 +295,22 @@ struct ElfFileHeaderTypes<EI_CLASS_64> {
using ShStrNdx = uint16_t;
};
template <ELF_IDENTIFIER_CLASS NumBits>
template <ELF_IDENTIFIER_CLASS numBits>
struct ElfFileHeader {
ElfFileHeaderIdentity identity = ElfFileHeaderIdentity(NumBits); // elf file identity
typename ElfFileHeaderTypes<NumBits>::Type type = ET_NONE; // elf file type
typename ElfFileHeaderTypes<NumBits>::Machine machine = EM_NONE; // target machine
typename ElfFileHeaderTypes<NumBits>::Version version = 1U; // elf file version
typename ElfFileHeaderTypes<NumBits>::Entry entry = 0U; // entry point (start address)
typename ElfFileHeaderTypes<NumBits>::PhOff phOff = 0U; // absolute offset to program header table in file
typename ElfFileHeaderTypes<NumBits>::ShOff shOff = 0U; // absolute offset to section header table in file
typename ElfFileHeaderTypes<NumBits>::Flags flags = 0U; // target-dependent flags
typename ElfFileHeaderTypes<NumBits>::EhSize ehSize = sizeof(ElfFileHeader<NumBits>); // header size
typename ElfFileHeaderTypes<NumBits>::PhEntSize phEntSize = sizeof(ElfProgramHeader<NumBits>); // size of entries in program header table
typename ElfFileHeaderTypes<NumBits>::PhNum phNum = 0U; // number of entries in pogram header table
typename ElfFileHeaderTypes<NumBits>::ShEntSize shEntSize = sizeof(ElfSectionHeader<NumBits>); // size of entries section header table
typename ElfFileHeaderTypes<NumBits>::ShNum shNum = 0U; // number of entries in section header table
typename ElfFileHeaderTypes<NumBits>::ShStrNdx shStrNdx = SHN_UNDEF; // index of section header table with section names
ElfFileHeaderIdentity identity = ElfFileHeaderIdentity(numBits); // elf file identity
typename ElfFileHeaderTypes<numBits>::Type type = ET_NONE; // elf file type
typename ElfFileHeaderTypes<numBits>::Machine machine = EM_NONE; // target machine
typename ElfFileHeaderTypes<numBits>::Version version = 1U; // elf file version
typename ElfFileHeaderTypes<numBits>::Entry entry = 0U; // entry point (start address)
typename ElfFileHeaderTypes<numBits>::PhOff phOff = 0U; // absolute offset to program header table in file
typename ElfFileHeaderTypes<numBits>::ShOff shOff = 0U; // absolute offset to section header table in file
typename ElfFileHeaderTypes<numBits>::Flags flags = 0U; // target-dependent flags
typename ElfFileHeaderTypes<numBits>::EhSize ehSize = sizeof(ElfFileHeader<numBits>); // header size
typename ElfFileHeaderTypes<numBits>::PhEntSize phEntSize = sizeof(ElfProgramHeader<numBits>); // size of entries in program header table
typename ElfFileHeaderTypes<numBits>::PhNum phNum = 0U; // number of entries in pogram header table
typename ElfFileHeaderTypes<numBits>::ShEntSize shEntSize = sizeof(ElfSectionHeader<numBits>); // size of entries section header table
typename ElfFileHeaderTypes<numBits>::ShNum shNum = 0U; // number of entries in section header table
typename ElfFileHeaderTypes<numBits>::ShStrNdx shStrNdx = SHN_UNDEF; // index of section header table with section names
};
static_assert(sizeof(ElfFileHeader<EI_CLASS_32>) == 0x34, "");
@@ -323,7 +323,7 @@ struct ElfNoteSection {
};
static_assert(sizeof(ElfNoteSection) == 0xC, "");
template <int NumBits>
template <int numBits>
struct ElfSymbolEntryTypes;
template <>
@@ -346,7 +346,7 @@ struct ElfSymbolEntryTypes<EI_CLASS_64> {
using Size = uint64_t;
};
template <ELF_IDENTIFIER_CLASS NumBits>
template <ELF_IDENTIFIER_CLASS numBits>
struct ElfSymbolEntry;
template <>
@@ -431,7 +431,7 @@ struct ElfSymbolEntry<EI_CLASS_64> {
};
static_assert(sizeof(ElfSymbolEntry<EI_CLASS_64>) == 0x18, "");
template <int NumBits>
template <int numBits>
struct ElfRelocationEntryTypes;
template <>
@@ -506,10 +506,10 @@ constexpr ElfRelocationEntryTypes<EI_CLASS_64>::Info setRelocationType(ElfReloca
}
} // namespace RelocationFuncs
template <ELF_IDENTIFIER_CLASS NumBits>
template <ELF_IDENTIFIER_CLASS numBits>
struct ElfRel {
using Offset = typename ElfRelocationEntryTypes<NumBits>::Offset;
using Info = typename ElfRelocationEntryTypes<NumBits>::Info;
using Offset = typename ElfRelocationEntryTypes<numBits>::Offset;
using Info = typename ElfRelocationEntryTypes<numBits>::Info;
Offset offset = 0U;
Info info = 0U;
@@ -533,11 +533,11 @@ struct ElfRel {
static_assert(sizeof(ElfRel<EI_CLASS_32>) == 0x8, "");
static_assert(sizeof(ElfRel<EI_CLASS_64>) == 0x10, "");
template <int NumBits>
template <int numBits>
struct ElfRela {
using Offset = typename ElfRelocationEntryTypes<NumBits>::Offset;
using Info = typename ElfRelocationEntryTypes<NumBits>::Info;
using Addend = typename ElfRelocationEntryTypes<NumBits>::Addend;
using Offset = typename ElfRelocationEntryTypes<numBits>::Offset;
using Info = typename ElfRelocationEntryTypes<numBits>::Info;
using Addend = typename ElfRelocationEntryTypes<numBits>::Addend;
Offset offset = 0U;
Info info = 0U;
Addend addend = 0U;

View File

@@ -16,18 +16,18 @@ namespace NEO {
namespace Elf {
template <ELF_IDENTIFIER_CLASS NumBits>
const ElfFileHeader<NumBits> *decodeElfFileHeader(const ArrayRef<const uint8_t> binary) {
if (binary.size() < sizeof(ElfFileHeader<NumBits>)) {
template <ELF_IDENTIFIER_CLASS numBits>
const ElfFileHeader<numBits> *decodeElfFileHeader(const ArrayRef<const uint8_t> binary) {
if (binary.size() < sizeof(ElfFileHeader<numBits>)) {
return nullptr;
}
const ElfFileHeader<NumBits> *header = reinterpret_cast<const ElfFileHeader<NumBits> *>(binary.begin());
const ElfFileHeader<numBits> *header = reinterpret_cast<const ElfFileHeader<numBits> *>(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<NumBits> *decodeElfFileHeader(const ArrayRef<const uint8_t>
template const ElfFileHeader<EI_CLASS_32> *decodeElfFileHeader<EI_CLASS_32>(const ArrayRef<const uint8_t>);
template const ElfFileHeader<EI_CLASS_64> *decodeElfFileHeader<EI_CLASS_64>(const ArrayRef<const uint8_t>);
template <ELF_IDENTIFIER_CLASS NumBits>
Elf<NumBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErrReason, std::string &outWarning) {
Elf<NumBits> ret = {};
ret.elfFileHeader = decodeElfFileHeader<NumBits>(binary);
template <ELF_IDENTIFIER_CLASS numBits>
Elf<numBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErrReason, std::string &outWarning) {
Elf<numBits> ret = {};
ret.elfFileHeader = decodeElfFileHeader<numBits>(binary);
if (nullptr == ret.elfFileHeader) {
outErrReason = "Invalid or missing ELF header";
return {};
@@ -54,7 +54,7 @@ Elf<NumBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErr
return {};
}
const ElfProgramHeader<NumBits> *programHeader = reinterpret_cast<const ElfProgramHeader<NumBits> *>(binary.begin() + ret.elfFileHeader->phOff);
const ElfProgramHeader<numBits> *programHeader = reinterpret_cast<const ElfProgramHeader<numBits> *>(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<NumBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErr
programHeader = ptrOffset(programHeader, ret.elfFileHeader->phEntSize);
}
const ElfSectionHeader<NumBits> *sectionHeader = reinterpret_cast<const ElfSectionHeader<NumBits> *>(binary.begin() + ret.elfFileHeader->shOff);
const ElfSectionHeader<numBits> *sectionHeader = reinterpret_cast<const ElfSectionHeader<numBits> *>(binary.begin() + ret.elfFileHeader->shOff);
for (decltype(ret.elfFileHeader->shNum) i = 0; i < ret.elfFileHeader->shNum; ++i) {
ArrayRef<const uint8_t> data;
if (SHT_NOBITS != sectionHeader->type) {
@@ -86,16 +86,16 @@ Elf<NumBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErr
return ret;
}
template <ELF_IDENTIFIER_CLASS NumBits>
bool Elf<NumBits>::decodeSymTab(SectionHeaderAndData &sectionHeaderData, std::string &outError) {
template <ELF_IDENTIFIER_CLASS numBits>
bool Elf<numBits>::decodeSymTab(SectionHeaderAndData &sectionHeaderData, std::string &outError) {
if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_SYMTAB) {
auto symSize = sizeof(ElfSymbolEntry<NumBits>);
auto symSize = sizeof(ElfSymbolEntry<numBits>);
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<size_t>(sectionHeaderData.header->size / sectionHeaderData.header->entsize);
auto symbol = reinterpret_cast<const ElfSymbolEntry<NumBits> *>(sectionHeaderData.data.begin());
auto symbol = reinterpret_cast<const ElfSymbolEntry<numBits> *>(sectionHeaderData.data.begin());
symbolTable.resize(numberOfSymbols);
for (size_t i = 0; i < numberOfSymbols; i++) {
@@ -106,10 +106,10 @@ bool Elf<NumBits>::decodeSymTab(SectionHeaderAndData &sectionHeaderData, std::st
return true;
}
template <ELF_IDENTIFIER_CLASS NumBits>
bool Elf<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, std::string &outError) {
template <ELF_IDENTIFIER_CLASS numBits>
bool Elf<numBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, std::string &outError) {
if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_RELA) {
auto relaSize = sizeof(ElfRela<NumBits>);
auto relaSize = sizeof(ElfRela<numBits>);
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<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
auto debugDataRelocation = isDebugDataRelocation(ConstStringRef(sectionName.c_str()));
Relocations &relocs = debugDataRelocation ? debugInfoRelocations : relocations;
auto rela = reinterpret_cast<const ElfRela<NumBits> *>(sectionHeaderData.data.begin());
auto rela = reinterpret_cast<const ElfRela<numBits> *>(sectionHeaderData.data.begin());
// there may be multiple rela sections, reserve additional size
auto previousEntries = relocations.size();
@@ -130,8 +130,8 @@ bool Elf<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
for (auto i = previousEntries; i < allEntries; i++) {
int symbolIndex = extractSymbolIndex<ElfRela<NumBits>>(*rela);
auto relocType = extractRelocType<ElfRela<NumBits>>(*rela);
int symbolIndex = extractSymbolIndex<ElfRela<numBits>>(*rela);
auto relocType = extractRelocType<ElfRela<numBits>>(*rela);
int symbolSectionIndex = symbolTable[symbolIndex].shndx;
std::string name = std::string(reinterpret_cast<const char *>(sectionHeaderNamesData.begin()) + symbolTable[symbolIndex].name);
@@ -143,7 +143,7 @@ bool Elf<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
}
if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_REL) {
auto relSize = sizeof(ElfRel<NumBits>);
auto relSize = sizeof(ElfRel<numBits>);
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<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
auto debugDataRelocation = isDebugDataRelocation(ConstStringRef(sectionName.c_str()));
Relocations &relocs = debugDataRelocation ? debugInfoRelocations : relocations;
auto reloc = reinterpret_cast<const ElfRel<NumBits> *>(sectionHeaderData.data.begin());
auto reloc = reinterpret_cast<const ElfRel<numBits> *>(sectionHeaderData.data.begin());
// there may be multiple rel sections, reserve additional size
auto previousEntries = relocations.size();
@@ -164,8 +164,8 @@ bool Elf<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
relocs.reserve(allEntries);
for (auto i = previousEntries; i < allEntries; i++) {
int symbolIndex = extractSymbolIndex<ElfRel<NumBits>>(*reloc);
auto relocType = extractRelocType<ElfRel<NumBits>>(*reloc);
int symbolIndex = extractSymbolIndex<ElfRel<numBits>>(*reloc);
auto relocType = extractRelocType<ElfRel<numBits>>(*reloc);
int symbolSectionIndex = symbolTable[symbolIndex].shndx;
std::string name = std::string(reinterpret_cast<const char *>(sectionHeaderNamesData.begin()) + symbolTable[symbolIndex].name);
@@ -179,8 +179,8 @@ bool Elf<NumBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
return true;
}
template <ELF_IDENTIFIER_CLASS NumBits>
bool Elf<NumBits>::decodeSections(std::string &outError) {
template <ELF_IDENTIFIER_CLASS numBits>
bool Elf<numBits>::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<NumBits>::decodeSections(std::string &outError) {
return success;
}
template <ELF_IDENTIFIER_CLASS NumBits>
bool Elf<NumBits>::isDebugDataRelocation(ConstStringRef sectionName) {
template <ELF_IDENTIFIER_CLASS numBits>
bool Elf<numBits>::isDebugDataRelocation(ConstStringRef sectionName) {
if (sectionName.startsWith(NEO::Elf::SpecialSectionNames::debug.data())) {
return true;
}

View File

@@ -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 <ELF_IDENTIFIER_CLASS NumBits = EI_CLASS_64>
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
struct Elf {
struct ProgramHeaderAndData {
const ElfProgramHeader<NumBits> *header = nullptr;
const ElfProgramHeader<numBits> *header = nullptr;
ArrayRef<const uint8_t> data;
};
struct SectionHeaderAndData {
const ElfSectionHeader<NumBits> *header;
const ElfSectionHeader<numBits> *header;
ArrayRef<const uint8_t> data;
};
@@ -44,7 +44,7 @@ struct Elf {
std::string symbolName;
};
using Relocations = std::vector<RelocationInfo>;
using SymbolsTable = std::vector<ElfSymbolEntry<NumBits>>;
using SymbolsTable = std::vector<ElfSymbolEntry<numBits>>;
bool decodeSections(std::string &outError);
@@ -73,11 +73,11 @@ struct Elf {
return std::string(reinterpret_cast<const char *>(sectionHeaderNamesData.begin()) + nameOffset);
}
decltype(ElfSymbolEntry<NumBits>::value) getSymbolValue(uint32_t idx) const {
decltype(ElfSymbolEntry<numBits>::value) getSymbolValue(uint32_t idx) const {
return symbolTable[idx].value;
}
decltype(ElfSectionHeader<NumBits>::offset) getSectionOffset(uint32_t idx) const {
decltype(ElfSectionHeader<numBits>::offset) getSectionOffset(uint32_t idx) const {
return sectionHeaders[idx].header->offset;
}
@@ -93,7 +93,7 @@ struct Elf {
return symbolTable;
}
const ElfFileHeader<NumBits> *elfFileHeader = nullptr;
const ElfFileHeader<numBits> *elfFileHeader = nullptr;
StackVec<ProgramHeaderAndData, 32> programHeaders;
StackVec<SectionHeaderAndData, 32> sectionHeaders;
@@ -107,19 +107,19 @@ struct Elf {
Relocations debugInfoRelocations;
};
template <ELF_IDENTIFIER_CLASS NumBits = EI_CLASS_64>
const ElfFileHeader<NumBits> *decodeElfFileHeader(const ArrayRef<const uint8_t> binary);
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
const ElfFileHeader<numBits> *decodeElfFileHeader(const ArrayRef<const uint8_t> binary);
extern template const ElfFileHeader<EI_CLASS_32> *decodeElfFileHeader<EI_CLASS_32>(const ArrayRef<const uint8_t>);
extern template const ElfFileHeader<EI_CLASS_64> *decodeElfFileHeader<EI_CLASS_64>(const ArrayRef<const uint8_t>);
template <ELF_IDENTIFIER_CLASS NumBits = EI_CLASS_64>
Elf<NumBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErrReason, std::string &outWarning);
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
Elf<numBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErrReason, std::string &outWarning);
extern template Elf<EI_CLASS_32> decodeElf<EI_CLASS_32>(const ArrayRef<const uint8_t>, std::string &, std::string &);
extern template Elf<EI_CLASS_64> decodeElf<EI_CLASS_64>(const ArrayRef<const uint8_t>, std::string &, std::string &);
template <ELF_IDENTIFIER_CLASS NumBits>
template <ELF_IDENTIFIER_CLASS numBits>
inline bool isElf(const ArrayRef<const uint8_t> binary) {
return (nullptr != decodeElfFileHeader<NumBits>(binary));
return (nullptr != decodeElfFileHeader<numBits>(binary));
}
inline bool isElf(const ArrayRef<const uint8_t> binary) {

View File

@@ -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 <ELF_IDENTIFIER_CLASS NumBits>
ElfEncoder<NumBits>::ElfEncoder(bool addUndefSectionHeader, bool addHeaderSectionNamesSection, typename ElfSectionHeaderTypes<NumBits>::AddrAlign defaultDataAlignemnt)
template <ELF_IDENTIFIER_CLASS numBits>
ElfEncoder<numBits>::ElfEncoder(bool addUndefSectionHeader, bool addHeaderSectionNamesSection, typename ElfSectionHeaderTypes<numBits>::AddrAlign defaultDataAlignemnt)
: addUndefSectionHeader(addUndefSectionHeader), addHeaderSectionNamesSection(addHeaderSectionNamesSection), defaultDataAlignment(defaultDataAlignemnt) {
// add special strings
UNRECOVERABLE_IF(defaultDataAlignment == 0);
shStrTabNameOffset = this->appendSectionName(SpecialSectionNames::shStrTab);
if (addUndefSectionHeader) {
ElfSectionHeader<NumBits> undefSection;
ElfSectionHeader<numBits> undefSection;
sectionHeaders.push_back(undefSection);
}
}
template <ELF_IDENTIFIER_CLASS NumBits>
void ElfEncoder<NumBits>::appendSection(const ElfSectionHeader<NumBits> &sectionHeader, const ArrayRef<const uint8_t> sectionData) {
template <ELF_IDENTIFIER_CLASS numBits>
void ElfEncoder<numBits>::appendSection(const ElfSectionHeader<numBits> &sectionHeader, const ArrayRef<const uint8_t> sectionData) {
sectionHeaders.push_back(sectionHeader);
if ((SHT_NOBITS != sectionHeader.type) && (false == sectionData.empty())) {
auto sectionDataAlignment = std::min<uint64_t>(defaultDataAlignment, 8U);
@@ -44,8 +44,8 @@ void ElfEncoder<NumBits>::appendSection(const ElfSectionHeader<NumBits> &section
}
}
template <ELF_IDENTIFIER_CLASS NumBits>
void ElfEncoder<NumBits>::appendSegment(const ElfProgramHeader<NumBits> &programHeader, const ArrayRef<const uint8_t> segmentData) {
template <ELF_IDENTIFIER_CLASS numBits>
void ElfEncoder<numBits>::appendSegment(const ElfProgramHeader<numBits> &programHeader, const ArrayRef<const uint8_t> segmentData) {
maxDataAlignmentNeeded = std::max<uint64_t>(maxDataAlignmentNeeded, static_cast<uint64_t>(programHeader.align));
programHeaders.push_back(programHeader);
if (false == segmentData.empty()) {
@@ -61,16 +61,16 @@ void ElfEncoder<NumBits>::appendSegment(const ElfProgramHeader<NumBits> &program
}
}
template <ELF_IDENTIFIER_CLASS NumBits>
uint32_t ElfEncoder<NumBits>::getSectionHeaderIndex(const ElfSectionHeader<NumBits> &sectionHeader) {
template <ELF_IDENTIFIER_CLASS numBits>
uint32_t ElfEncoder<numBits>::getSectionHeaderIndex(const ElfSectionHeader<numBits> &sectionHeader) {
UNRECOVERABLE_IF(&sectionHeader < sectionHeaders.begin());
UNRECOVERABLE_IF(&sectionHeader >= sectionHeaders.begin() + sectionHeaders.size());
return static_cast<uint32_t>(&sectionHeader - &*sectionHeaders.begin());
}
template <ELF_IDENTIFIER_CLASS NumBits>
ElfSectionHeader<NumBits> &ElfEncoder<NumBits>::appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
ElfSectionHeader<NumBits> section = {};
template <ELF_IDENTIFIER_CLASS numBits>
ElfSectionHeader<numBits> &ElfEncoder<numBits>::appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
ElfSectionHeader<numBits> section = {};
section.type = static_cast<decltype(section.type)>(sectionType);
section.flags = static_cast<decltype(section.flags)>(SHF_NONE);
section.offset = 0U;
@@ -78,13 +78,13 @@ ElfSectionHeader<NumBits> &ElfEncoder<NumBits>::appendSection(SECTION_HEADER_TYP
section.addralign = defaultDataAlignment;
switch (sectionType) {
case SHT_REL:
section.entsize = sizeof(ElfRel<NumBits>);
section.entsize = sizeof(ElfRel<numBits>);
break;
case SHT_RELA:
section.entsize = sizeof(ElfRela<NumBits>);
section.entsize = sizeof(ElfRela<numBits>);
break;
case SHT_SYMTAB:
section.entsize = sizeof(ElfSymbolEntry<NumBits>);
section.entsize = sizeof(ElfSymbolEntry<numBits>);
break;
default:
break;
@@ -93,9 +93,9 @@ ElfSectionHeader<NumBits> &ElfEncoder<NumBits>::appendSection(SECTION_HEADER_TYP
return *sectionHeaders.rbegin();
}
template <ELF_IDENTIFIER_CLASS NumBits>
ElfProgramHeader<NumBits> &ElfEncoder<NumBits>::appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef<const uint8_t> segmentData) {
ElfProgramHeader<NumBits> segment = {};
template <ELF_IDENTIFIER_CLASS numBits>
ElfProgramHeader<numBits> &ElfEncoder<numBits>::appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef<const uint8_t> segmentData) {
ElfProgramHeader<numBits> segment = {};
segment.type = static_cast<decltype(segment.type)>(segmentType);
segment.flags = static_cast<decltype(segment.flags)>(PF_NONE);
segment.offset = 0U;
@@ -104,33 +104,33 @@ ElfProgramHeader<NumBits> &ElfEncoder<NumBits>::appendSegment(PROGRAM_HEADER_TYP
return *programHeaders.rbegin();
}
template <ELF_IDENTIFIER_CLASS NumBits>
void ElfEncoder<NumBits>::appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize) {
template <ELF_IDENTIFIER_CLASS numBits>
void ElfEncoder<numBits>::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<decltype(programHeader.vAddr)>(vAddr);
programHeader.memSz = static_cast<decltype(programHeader.memSz)>(segSize);
}
template <ELF_IDENTIFIER_CLASS NumBits>
uint32_t ElfEncoder<NumBits>::appendSectionName(ConstStringRef str) {
template <ELF_IDENTIFIER_CLASS numBits>
uint32_t ElfEncoder<numBits>::appendSectionName(ConstStringRef str) {
if (false == addHeaderSectionNamesSection) {
return strSecBuilder.undef();
}
return strSecBuilder.appendString(str);
}
template <ELF_IDENTIFIER_CLASS NumBits>
std::vector<uint8_t> ElfEncoder<NumBits>::encode() const {
ElfFileHeader<NumBits> elfFileHeader = this->elfFileHeader;
StackVec<ElfProgramHeader<NumBits>, 32> programHeaders = this->programHeaders;
StackVec<ElfSectionHeader<NumBits>, 32> sectionHeaders = this->sectionHeaders;
template <ELF_IDENTIFIER_CLASS numBits>
std::vector<uint8_t> ElfEncoder<numBits>::encode() const {
ElfFileHeader<numBits> elfFileHeader = this->elfFileHeader;
StackVec<ElfProgramHeader<numBits>, 32> programHeaders = this->programHeaders;
StackVec<ElfSectionHeader<numBits>, 32> sectionHeaders = this->sectionHeaders;
if (addUndefSectionHeader && (1U == sectionHeaders.size())) {
sectionHeaders.clear();
}
ElfSectionHeader<NumBits> sectionHeaderNamesSection;
ElfSectionHeader<numBits> sectionHeaderNamesSection;
size_t alignedSectionNamesDataSize = 0U;
size_t dataPaddingBeforeSectionNames = 0U;
if ((false == sectionHeaders.empty()) && addHeaderSectionNamesSection) {

View File

@@ -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 <ELF_IDENTIFIER_CLASS NumBits = EI_CLASS_64>
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
struct ElfEncoder {
ElfEncoder(bool addUndefSectionHeader = true, bool addHeaderSectionNamesSection = true,
typename ElfSectionHeaderTypes<NumBits>::AddrAlign defaultDataAlignment = 8U);
typename ElfSectionHeaderTypes<numBits>::AddrAlign defaultDataAlignment = 8U);
void appendSection(const ElfSectionHeader<NumBits> &sectionHeader, const ArrayRef<const uint8_t> sectionData);
void appendSegment(const ElfProgramHeader<NumBits> &programHeader, const ArrayRef<const uint8_t> segmentData);
void appendSection(const ElfSectionHeader<numBits> &sectionHeader, const ArrayRef<const uint8_t> sectionData);
void appendSegment(const ElfProgramHeader<numBits> &programHeader, const ArrayRef<const uint8_t> segmentData);
ElfSectionHeader<NumBits> &appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
ElfProgramHeader<NumBits> &appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef<const uint8_t> segmentData);
uint32_t getSectionHeaderIndex(const ElfSectionHeader<NumBits> &sectionHeader);
ElfSectionHeader<numBits> &appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
ElfProgramHeader<numBits> &appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef<const uint8_t> segmentData);
uint32_t getSectionHeaderIndex(const ElfSectionHeader<numBits> &sectionHeader);
void appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize);
template <typename SectionHeaderEnumT>
ElfSectionHeader<NumBits> &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
ElfSectionHeader<numBits> &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
return appendSection(static_cast<SECTION_HEADER_TYPE>(sectionType), sectionLabel, sectionData);
}
template <typename SectionHeaderEnumT>
ElfSectionHeader<NumBits> &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const std::string &sectionData) {
ElfSectionHeader<numBits> &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const std::string &sectionData) {
return appendSection(static_cast<SECTION_HEADER_TYPE>(sectionType), sectionLabel,
ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(sectionData.c_str()), sectionData.size() + 1));
}
@@ -77,18 +77,18 @@ struct ElfEncoder {
std::vector<uint8_t> encode() const;
ElfFileHeader<NumBits> &getElfFileHeader() {
ElfFileHeader<numBits> &getElfFileHeader() {
return elfFileHeader;
}
protected:
bool addUndefSectionHeader = false;
bool addHeaderSectionNamesSection = false;
typename ElfSectionHeaderTypes<NumBits>::AddrAlign defaultDataAlignment = 8U;
typename ElfSectionHeaderTypes<numBits>::AddrAlign defaultDataAlignment = 8U;
uint64_t maxDataAlignmentNeeded = 1U;
ElfFileHeader<NumBits> elfFileHeader;
StackVec<ElfProgramHeader<NumBits>, 32> programHeaders;
StackVec<ElfSectionHeader<NumBits>, 32> sectionHeaders;
ElfFileHeader<numBits> elfFileHeader;
StackVec<ElfProgramHeader<numBits>, 32> programHeaders;
StackVec<ElfSectionHeader<numBits>, 32> sectionHeaders;
std::vector<uint8_t> data;
StringSectionBuilder strSecBuilder;
struct ProgramSectionID {

View File

@@ -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 <size_t S>
inline void assignTokenInArray(const SPatchDataParameterBuffer *(&tokensArray)[S], const SPatchDataParameterBuffer *src, StackVecUnhandledTokens &unhandledTokens) {
template <size_t s>
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 <typename PatchT, size_t NumInlineEl>
inline void addTok(StackVec<const PatchT *, NumInlineEl> &tokensVec, const SPatchItemHeader *src) {
template <typename PatchT, size_t numInlineEl>
inline void addTok(StackVec<const PatchT *, numInlineEl> &tokensVec, const SPatchItemHeader *src) {
tokensVec.push_back(reinterpret_cast<const PatchT *>(src));
}

View File

@@ -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 <typename T, size_t Size>
void dumpOrNullArrayIfNotEmpty(T (&value)[Size], const std::string &arrayName, std::stringstream &out, const std::string &indent) {
template <typename T, size_t size>
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;
}

View File

@@ -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

View File

@@ -129,8 +129,8 @@ bool readZeInfoValueChecked(const NEO::Yaml::YamlParser &parser, const NEO::Yaml
return false;
}
template <typename DestinationT, size_t Len>
bool readZeInfoValueCollectionCheckedArr(std::array<DestinationT, Len> &vec, const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) {
template <typename DestinationT, size_t len>
bool readZeInfoValueCollectionCheckedArr(std::array<DestinationT, len> &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<DestinationT, Len> &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 <typename DestinationT, size_t Len>
bool readZeInfoValueCollectionChecked(DestinationT (&vec)[Len], const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) {
auto &array = reinterpret_cast<std::array<DestinationT, Len> &>(vec);
template <typename DestinationT, size_t len>
bool readZeInfoValueCollectionChecked(DestinationT (&vec)[len], const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, ConstStringRef context, std::string &outErrReason) {
auto &array = reinterpret_cast<std::array<DestinationT, len> &>(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 <typename ElSize, size_t Len>
bool setVecArgIndicesBasedOnSize(CrossThreadDataOffset (&vec)[Len], size_t vecSize, CrossThreadDataOffset baseOffset) {
template <typename ElSize, size_t len>
bool setVecArgIndicesBasedOnSize(CrossThreadDataOffset (&vec)[len], size_t vecSize, CrossThreadDataOffset baseOffset) {
switch (vecSize) {
default:
return false;

View File

@@ -179,8 +179,8 @@ using AddrMode = Types::Kernel::InlineSamplers::AddrMode;
inline constexpr ConstStringRef name = "inline sampler addressing mode";
inline constexpr LookupArray<ConstStringRef, AddrMode, 5> 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<size_t>(AddrMode::Max) - 1, "Every enum field must be present");
} // namespace InlineSamplerAddrMode

View File

@@ -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<Gen11Family> {
enum { device = AubMemDump::DeviceValues::Icllp };
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
using AubTraits = AubMemDump::Traits<device, MemoryConstants::gfxAddressBits>;
static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES];

View File

@@ -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<Gen12LpFamily> {
enum { device = AubMemDump::DeviceValues::Tgllp };
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
using AubTraits = AubMemDump::Traits<device, MemoryConstants::gfxAddressBits>;
static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES];

View File

@@ -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<Gen8Family> {
enum { device = AubMemDump::DeviceValues::Bdw };
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
using AubTraits = AubMemDump::Traits<device, MemoryConstants::gfxAddressBits>;
static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES];

View File

@@ -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<Gen9Family> {
enum { device = AubMemDump::DeviceValues::Skl };
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
using AubTraits = AubMemDump::Traits<device, MemoryConstants::gfxAddressBits>;
static const AubMemDump::LrcaHelper *const csTraits[aub_stream::NUM_ENGINES];

View File

@@ -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 <typename TMemberSource, typename = int>
static constexpr bool has_ResourceTag = false;
static constexpr bool hasResourceTag = false;
#if defined(_DEBUG) || (_RELEASE_INTERNAL)
template <typename TMemberSource>
static constexpr bool has_ResourceTag<TMemberSource, decltype((void)TMemberSource::ResourceTag, int{})> = true;
static constexpr bool hasResourceTag<TMemberSource, decltype((void)TMemberSource::ResourceTag, int{})> = true;
constexpr bool resourceTagSupport = true;
#else
constexpr bool resourceTagSupport = false;
template <typename TMemberSource>
static constexpr bool has_ResourceTag<TMemberSource, decltype((void)TMemberSource::ResourceTag, int{})> = false;
static constexpr bool hasResourceTag<TMemberSource, decltype((void)TMemberSource::ResourceTag, int{})> = false;
#endif
constexpr uint32_t maxStrLen = 8u;

View File

@@ -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;

View File

@@ -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<uintptr_t>::max() & ~MemoryConstants::pageMask;
inline constexpr uintptr_t page64kEntryMask = std::numeric_limits<uintptr_t>::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;

View File

@@ -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

View File

@@ -106,7 +106,7 @@ void GfxCoreHelperHw<Family>::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<uint32_t>(surfaceSize - 1);
state.setWidth(length.surfaceState.width + 1);

View File

@@ -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 <uint32_t primeIndex>
@@ -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<MAX_PRIMES - 1>(items, workSize, maxWorkGroupSize);
workSize = factor<maxPrimes - 1>(items, workSize, maxWorkGroupSize);
workGroupSize[0] = workSize;
workGroupSize[1] = 1;

Some files were not shown because too many files have changed in this diff Show More