From 8e2fcc91374d62863336bf8e9063a1a3fd084e87 Mon Sep 17 00:00:00 2001 From: Neil R Spruit Date: Tue, 20 Sep 2022 19:31:44 -0700 Subject: [PATCH] Allow init and execution of L0 without IGC unless it is needed - Allow usage of L0 with IGC unless Debugger, Mid Thread Premption, or SPIRvs need to be compiled from modules. Native Binaries that are already compiled for GENs will be usable. Related-To: LOCI-3430 Signed-off-by: Neil R Spruit --- level_zero/core/source/device/device_imp.cpp | 20 +- level_zero/core/source/module/module.h | 2 +- level_zero/core/source/module/module_imp.cpp | 117 +++++---- level_zero/core/source/module/module_imp.h | 16 +- .../bindless/bindless_kernel_aub_tests.cpp | 5 +- .../aub_tests/debugger/debugger_aub_tests.cpp | 5 +- .../test/unit_tests/fixtures/module_fixture.h | 12 +- .../gen12lp/test_cmdlist_gen12lp.cpp | 16 +- .../mocks/mock_device_for_spirv.cpp | 4 +- .../core/test/unit_tests/mocks/mock_module.h | 8 +- .../sources/cmdlist/test_cmdlist_6.cpp | 8 +- .../sources/cmdlist/test_cmdlist_7.cpp | 6 +- .../test_cmdlist_append_launch_kernel_1.cpp | 4 +- .../debugger/active_debugger_fixture.h | 1 + .../debugger/test_module_with_debug.cpp | 37 +-- .../unit_tests/sources/device/test_device.cpp | 56 +++- .../unit_tests/sources/driver/test_driver.cpp | 15 +- .../unit_tests/sources/kernel/test_kernel.cpp | 18 +- .../unit_tests/sources/memory/test_memory.cpp | 4 +- .../unit_tests/sources/module/test_module.cpp | 247 ++++++++++++------ .../sources/module/test_module_2.cpp | 18 +- .../sources/tracing/test_api_tracing_common.h | 12 +- .../tracing/test_barrier_api_tracing.cpp | 4 +- .../tracing/test_cmdlist_api_tracing.cpp | 16 +- .../tracing/test_cmdqueue_api_tracing.cpp | 8 +- .../sources/tracing/test_copy_api_tracing.cpp | 18 +- .../sources/tracing/test_core_api_tracing.cpp | 14 +- .../tracing/test_device_api_tracing.cpp | 30 +-- .../tracing/test_driver_api_tracing.cpp | 10 +- .../tracing/test_event_api_multi_tracing.cpp | 26 +- .../tracing/test_event_api_tracing.cpp | 30 +-- .../tracing/test_fence_api_tracing.cpp | 20 +- .../tracing/test_global_api_tracing.cpp | 2 +- .../tracing/test_image_api_tracing.cpp | 12 +- .../tracing/test_memory_api_tracing.cpp | 36 +-- .../tracing/test_module_api_multi_tracing.cpp | 6 +- .../tracing/test_module_api_tracing.cpp | 50 ++-- .../tracing/test_residency_api_tracing.cpp | 24 +- .../tracing/test_sampler_api_tracing.cpp | 8 +- .../xe_hpg_core/test_module_xe_hpg_core.cpp | 5 +- 40 files changed, 554 insertions(+), 396 deletions(-) diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 3bcad6b560..23c1f82a9a 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -371,14 +371,14 @@ ze_result_t DeviceImp::createModule(const ze_module_desc_t *desc, ze_module_hand moduleBuildLog = ModuleBuildLog::create(); *buildLog = moduleBuildLog->toHandle(); } - auto modulePtr = Module::create(this, desc, moduleBuildLog, type); - if (modulePtr == nullptr) { - return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + + ze_result_t result = ZE_RESULT_SUCCESS; + auto modulePtr = Module::create(this, desc, moduleBuildLog, type, &result); + if (modulePtr != nullptr) { + *module = modulePtr; } - *module = modulePtr; - - return ZE_RESULT_SUCCESS; + return result; } ze_result_t DeviceImp::getComputeProperties(ze_device_compute_properties_t *pComputeProperties) { @@ -1008,16 +1008,16 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool auto debugSurfaceSize = hwHelper.getSipKernelMaxDbgSurfaceSize(hwInfo); std::vector stateSaveAreaHeader; - if (neoDevice->getCompilerInterface()) { - if (neoDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread || neoDevice->getDebugger()) { + if (neoDevice->getDebugger() || neoDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread) { + if (neoDevice->getCompilerInterface()) { bool ret = NEO::SipKernel::initSipKernel(NEO::SipKernel::getSipKernelType(*neoDevice), *neoDevice); UNRECOVERABLE_IF(!ret); stateSaveAreaHeader = NEO::SipKernel::getSipKernel(*neoDevice).getStateSaveAreaHeader(); debugSurfaceSize = NEO::SipKernel::getSipKernel(*neoDevice).getStateSaveAreaSize(neoDevice); + } else { + *returnValue = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } - } else { - *returnValue = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; } const bool allocateDebugSurface = (device->getL0Debugger() || neoDevice->getDeviceInfo().debuggerActive) && !isSubDevice; diff --git a/level_zero/core/source/module/module.h b/level_zero/core/source/module/module.h index 241afdea8e..e80d2ce0dc 100644 --- a/level_zero/core/source/module/module.h +++ b/level_zero/core/source/module/module.h @@ -26,7 +26,7 @@ enum class ModuleType { struct Module : _ze_module_handle_t { - static Module *create(Device *device, const ze_module_desc_t *desc, ModuleBuildLog *moduleBuildLog, ModuleType type); + static Module *create(Device *device, const ze_module_desc_t *desc, ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result); virtual ~Module() = default; diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index c033a2187d..0b386b35c4 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -173,9 +173,11 @@ bool ModuleTranslationUnit::processSpecConstantInfo(NEO::CompilerInterface *comp return true; } -bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) { +ze_result_t ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) { auto compilerInterface = device->getNEODevice()->getCompilerInterface(); - UNRECOVERABLE_IF(nullptr == compilerInterface); + if (!compilerInterface) { + return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; + } inputArgs.specializedValues = this->specConstantsValues; @@ -192,7 +194,7 @@ bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bo this->updateBuildLog(compilerOuput.backendCompilerLog); if (NEO::TranslationOutput::ErrorCode::Success != compilerErr) { - return false; + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } this->irBinary = std::move(compilerOuput.intermediateRepresentation.mem); @@ -205,17 +207,19 @@ bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bo return processUnpackedBinary(); } -bool ModuleTranslationUnit::staticLinkSpirV(std::vector inputSpirVs, std::vector inputModuleSizes, const char *buildOptions, const char *internalBuildOptions, - std::vector specConstants) { +ze_result_t ModuleTranslationUnit::staticLinkSpirV(std::vector inputSpirVs, std::vector inputModuleSizes, const char *buildOptions, const char *internalBuildOptions, + std::vector specConstants) { auto compilerInterface = device->getNEODevice()->getCompilerInterface(); - UNRECOVERABLE_IF(nullptr == compilerInterface); + if (!compilerInterface) { + return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; + } std::string internalOptions = this->generateCompilerOptions(buildOptions, internalBuildOptions); for (uint32_t i = 0; i < static_cast(specConstants.size()); i++) { auto specConstantResult = this->processSpecConstantInfo(compilerInterface, specConstants[i], inputSpirVs[i], inputModuleSizes[i]); if (!specConstantResult) { - return false; + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } } @@ -229,16 +233,19 @@ bool ModuleTranslationUnit::staticLinkSpirV(std::vector inputSpirV return this->compileGenBinary(linkInputArgs, true); } -bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions, - const ze_module_constants_t *pConstants) { +ze_result_t ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions, + const ze_module_constants_t *pConstants) { auto compilerInterface = device->getNEODevice()->getCompilerInterface(); - UNRECOVERABLE_IF(nullptr == compilerInterface); + if (!compilerInterface) { + return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; + } std::string internalOptions = this->generateCompilerOptions(buildOptions, internalBuildOptions); auto specConstantResult = this->processSpecConstantInfo(compilerInterface, pConstants, input, inputSize); - if (!specConstantResult) - return false; + if (!specConstantResult) { + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + } NEO::TranslationInput inputArgs = {IGC::CodeType::spirV, IGC::CodeType::oclGenBin}; @@ -248,7 +255,7 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize return this->compileGenBinary(inputArgs, false); } -bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inputSize) { +ze_result_t ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inputSize) { UNRECOVERABLE_IF((nullptr == device) || (nullptr == device->getNEODevice())); auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily]; @@ -261,10 +268,9 @@ bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inp if (decodeWarnings.empty() == false) { PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str()); } - if (singleDeviceBinary.intermediateRepresentation.empty() && singleDeviceBinary.deviceBinary.empty()) { PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); - return false; + return ZE_RESULT_ERROR_INVALID_NATIVE_BINARY; } else { this->irBinary = makeCopy(reinterpret_cast(singleDeviceBinary.intermediateRepresentation.begin()), singleDeviceBinary.intermediateRepresentation.size()); this->irBinarySize = singleDeviceBinary.intermediateRepresentation.size(); @@ -300,13 +306,16 @@ bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inp return buildFromSpirV(this->irBinary.get(), static_cast(this->irBinarySize), this->options.c_str(), "", nullptr); } else { - return processUnpackedBinary(); + if (processUnpackedBinary() != ZE_RESULT_SUCCESS) { + return ZE_RESULT_ERROR_INVALID_NATIVE_BINARY; + } + return ZE_RESULT_SUCCESS; } } -bool ModuleTranslationUnit::processUnpackedBinary() { +ze_result_t ModuleTranslationUnit::processUnpackedBinary() { if (0 == unpackedDeviceBinarySize) { - return false; + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } auto blob = ArrayRef(reinterpret_cast(this->unpackedDeviceBinary.get()), this->unpackedDeviceBinarySize); NEO::SingleDeviceBinary binary = {}; @@ -324,7 +333,7 @@ bool ModuleTranslationUnit::processUnpackedBinary() { if (NEO::DecodeError::Success != decodeError) { PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeErrors.c_str()); - return false; + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } processDebugData(); @@ -341,7 +350,7 @@ bool ModuleTranslationUnit::processUnpackedBinary() { } if (slmNeeded > slmAvailable) { - return false; + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } auto svmAllocsManager = device->getDriverHandle()->getSvmAllocsManager(); @@ -358,7 +367,7 @@ bool ModuleTranslationUnit::processUnpackedBinary() { } if (this->packedDeviceBinary != nullptr) { - return true; + return ZE_RESULT_SUCCESS; } NEO::SingleDeviceBinary singleDeviceBinary = {}; @@ -372,12 +381,12 @@ bool ModuleTranslationUnit::processUnpackedBinary() { auto packedDeviceBinary = NEO::packDeviceBinary(singleDeviceBinary, packErrors, packWarnings); if (packedDeviceBinary.empty()) { DEBUG_BREAK_IF(true); - return false; + return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } this->packedDeviceBinary = makeCopy(packedDeviceBinary.data(), packedDeviceBinary.size()); this->packedDeviceBinarySize = packedDeviceBinary.size(); - return true; + return ZE_RESULT_SUCCESS; } void ModuleTranslationUnit::updateBuildLog(const std::string &newLogEntry) { @@ -447,8 +456,9 @@ NEO::Debug::Segments ModuleImp::getZebinSegments() { return NEO::Debug::Segments(translationUnit->globalVarBuffer, translationUnit->globalConstBuffer, strings, kernels); } -bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) { - bool success = true; +ze_result_t ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) { + bool linkageSuccessful = true; + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; std::string buildOptions; std::string internalBuildOptions; @@ -457,7 +467,7 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) const ze_base_desc_t *expDesc = reinterpret_cast(desc->pNext); if (expDesc->stype == ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC) { if (desc->format != ZE_MODULE_FORMAT_IL_SPIRV) { - return false; + return ZE_RESULT_ERROR_INVALID_ENUMERATION; } this->builtFromSPIRv = true; const ze_module_program_exp_desc_t *programExpDesc = @@ -490,20 +500,20 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) } // If the user passed in only 1 SPIRV, then fallback to standard build if (inputSpirVs.size() > 1) { - success = this->translationUnit->staticLinkSpirV(inputSpirVs, - inputModuleSizes, - buildOptions.c_str(), - internalBuildOptions.c_str(), - specConstants); - } else { - success = this->translationUnit->buildFromSpirV(reinterpret_cast(programExpDesc->pInputModules[0]), - inputModuleSizes[0], + result = this->translationUnit->staticLinkSpirV(inputSpirVs, + inputModuleSizes, buildOptions.c_str(), internalBuildOptions.c_str(), - firstSpecConstants); + specConstants); + } else { + result = this->translationUnit->buildFromSpirV(reinterpret_cast(programExpDesc->pInputModules[0]), + inputModuleSizes[0], + buildOptions.c_str(), + internalBuildOptions.c_str(), + firstSpecConstants); } } else { - return false; + return ZE_RESULT_ERROR_INVALID_ARGUMENT; } } else { std::string buildFlagsInput{desc->pBuildFlags != nullptr ? desc->pBuildFlags : ""}; @@ -521,17 +531,17 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) } if (desc->format == ZE_MODULE_FORMAT_NATIVE) { - success = this->translationUnit->createFromNativeBinary( + result = this->translationUnit->createFromNativeBinary( reinterpret_cast(desc->pInputModule), desc->inputSize); } else if (desc->format == ZE_MODULE_FORMAT_IL_SPIRV) { this->builtFromSPIRv = true; - success = this->translationUnit->buildFromSpirV(reinterpret_cast(desc->pInputModule), - static_cast(desc->inputSize), - buildOptions.c_str(), - internalBuildOptions.c_str(), - desc->pConstants); + result = this->translationUnit->buildFromSpirV(reinterpret_cast(desc->pInputModule), + static_cast(desc->inputSize), + buildOptions.c_str(), + internalBuildOptions.c_str(), + desc->pConstants); } else { - return false; + return ZE_RESULT_ERROR_INVALID_ENUMERATION; } } @@ -547,11 +557,11 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(hwInfo); if (failBuildProgram) { - success = false; + result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; } - if (false == success) { - return false; + if (result != ZE_RESULT_SUCCESS) { + return result; } kernelImmDatas.reserve(this->translationUnit->programInfo.kernelInfos.size()); @@ -579,9 +589,9 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) checkIfPrivateMemoryPerDispatchIsNeeded(); - success = this->linkBinary(); + linkageSuccessful = this->linkBinary(); - success &= populateHostGlobalSymbolsMap(this->translationUnit->programInfo.globalsDeviceToHostNameMap); + linkageSuccessful &= populateHostGlobalSymbolsMap(this->translationUnit->programInfo.globalsDeviceToHostNameMap); this->updateBuildLog(neoDevice); if (debugEnabled) { @@ -609,7 +619,10 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice) notifyModuleCreate(); } } - return success; + if (linkageSuccessful == false) { + result = ZE_RESULT_ERROR_MODULE_LINK_FAILURE; + } + return result; } void ModuleImp::createDebugZebin() { @@ -957,11 +970,11 @@ ze_result_t ModuleImp::getGlobalPointer(const char *pGlobalName, size_t *pSize, } Module *Module::create(Device *device, const ze_module_desc_t *desc, - ModuleBuildLog *moduleBuildLog, ModuleType type) { + ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result) { auto module = new ModuleImp(device, moduleBuildLog, type); - bool success = module->initialize(desc, device->getNEODevice()); - if (success == false) { + *result = module->initialize(desc, device->getNEODevice()); + if (*result != ZE_RESULT_SUCCESS) { module->destroy(); return nullptr; } diff --git a/level_zero/core/source/module/module_imp.h b/level_zero/core/source/module/module_imp.h index 6fb43158ad..fd9a737634 100644 --- a/level_zero/core/source/module/module_imp.h +++ b/level_zero/core/source/module/module_imp.h @@ -40,16 +40,16 @@ extern NEO::ConstStringRef optLargeRegisterFile; struct ModuleTranslationUnit { ModuleTranslationUnit(L0::Device *device); virtual ~ModuleTranslationUnit(); - MOCKABLE_VIRTUAL bool buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions, - const ze_module_constants_t *pConstants); - MOCKABLE_VIRTUAL bool staticLinkSpirV(std::vector inputSpirVs, std::vector inputModuleSizes, const char *buildOptions, const char *internalBuildOptions, - std::vector specConstants); - MOCKABLE_VIRTUAL bool createFromNativeBinary(const char *input, size_t inputSize); - MOCKABLE_VIRTUAL bool processUnpackedBinary(); + MOCKABLE_VIRTUAL ze_result_t buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions, + const ze_module_constants_t *pConstants); + MOCKABLE_VIRTUAL ze_result_t staticLinkSpirV(std::vector inputSpirVs, std::vector inputModuleSizes, const char *buildOptions, const char *internalBuildOptions, + std::vector specConstants); + MOCKABLE_VIRTUAL ze_result_t createFromNativeBinary(const char *input, size_t inputSize); + MOCKABLE_VIRTUAL ze_result_t processUnpackedBinary(); std::vector generateElfFromSpirV(std::vector inputSpirVs, std::vector inputModuleSizes); bool processSpecConstantInfo(NEO::CompilerInterface *compilerInterface, const ze_module_constants_t *pConstants, const char *input, uint32_t inputSize); std::string generateCompilerOptions(const char *buildOptions, const char *internalBuildOptions); - MOCKABLE_VIRTUAL bool compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink); + MOCKABLE_VIRTUAL ze_result_t compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink); void updateBuildLog(const std::string &newLogEntry); void processDebugData(); L0::Device *device = nullptr; @@ -122,7 +122,7 @@ struct ModuleImp : public Module { MOCKABLE_VIRTUAL bool linkBinary(); - bool initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice); + ze_result_t initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice); bool isDebugEnabled() const override; diff --git a/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp b/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp index 00f54b44d4..13b6adb164 100644 --- a/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp +++ b/level_zero/core/test/aub_tests/bindless/bindless_kernel_aub_tests.cpp @@ -54,8 +54,9 @@ struct L0BindlessAub : Test { moduleDesc.pBuildFlags = ""; module = new ModuleImp(device, nullptr, ModuleType::User); - bool success = module->initialize(&moduleDesc, device->getNEODevice()); - ASSERT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&moduleDesc, device->getNEODevice()); + ASSERT_EQ(result, ZE_RESULT_SUCCESS); } DebugManagerStateRestore restorer; ModuleImp *module = nullptr; diff --git a/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp b/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp index 0ed3c3cdd3..70751024a1 100644 --- a/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp +++ b/level_zero/core/test/aub_tests/debugger/debugger_aub_tests.cpp @@ -58,8 +58,9 @@ struct DebuggerAub : Test { moduleDesc.pBuildFlags = ""; module = new ModuleImp(device, nullptr, ModuleType::User); - bool success = module->initialize(&moduleDesc, device->getNEODevice()); - ASSERT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&moduleDesc, device->getNEODevice()); + ASSERT_EQ(result, ZE_RESULT_SUCCESS); } DebugManagerStateRestore restorer; ModuleImp *module = nullptr; diff --git a/level_zero/core/test/unit_tests/fixtures/module_fixture.h b/level_zero/core/test/unit_tests/fixtures/module_fixture.h index 6b56ddf8d0..68a332fc3b 100644 --- a/level_zero/core/test/unit_tests/fixtures/module_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/module_fixture.h @@ -179,8 +179,9 @@ struct ModuleImmutableDataFixture : public DeviceFixture { mockKernelImmData); module->type = isInternal ? ModuleType::Builtin : ModuleType::User; - bool result = module->initialize(&moduleDesc, device->getNEODevice()); - EXPECT_TRUE(result); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&moduleDesc, device->getNEODevice()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); } void createKernel(MockKernel *kernel) { @@ -218,8 +219,8 @@ struct ModuleFixture : public DeviceFixture { moduleDesc.inputSize = src.size(); ModuleBuildLog *moduleBuildLog = nullptr; - - module.reset(Module::create(device, &moduleDesc, moduleBuildLog, type)); + ze_result_t result = ZE_RESULT_SUCCESS; + module.reset(Module::create(device, &moduleDesc, moduleBuildLog, type, &result)); } void createKernel() { @@ -261,10 +262,11 @@ struct MultiDeviceModuleFixture : public MultiDeviceFixture { moduleDesc.inputSize = src.size(); ModuleBuildLog *moduleBuildLog = nullptr; + ze_result_t result = ZE_RESULT_SUCCESS; modules[rootDeviceIndex].reset(Module::create(device, &moduleDesc, - moduleBuildLog, ModuleType::User)); + moduleBuildLog, ModuleType::User, &result)); } void createKernel(uint32_t rootDeviceIndex) { diff --git a/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp index 41d630cbb5..712b899681 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp @@ -60,7 +60,7 @@ HWTEST2_F(CommandListCreate, givenAllocationsWhenApplyRangesBarrierThenCheckWhet HWTEST2_F(CommandListCreate, GivenNullptrWaitEventsArrayAndCountGreaterThanZeroWhenAppendingMemoryBarrierThenInvalidArgumentErrorIsReturned, IsDG1) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t pRangeSizes = 1; const char *ranges[pRangeSizes]; @@ -83,7 +83,7 @@ HWTEST2_F(CommandListCreate, GivenNullptrWaitEventsArrayAndCountGreaterThanZeroW HWTEST2_F(CommandListCreate, GivenImmediateListAndExecutionSuccessWhenAppendingMemoryBarrierThenExecuteCommandListImmediateCalledAndSuccessReturned, IsDG1) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t rangeSizes = 1; const char *rangesBuffer[rangeSizes]; @@ -105,7 +105,7 @@ HWTEST2_F(CommandListCreate, GivenImmediateListAndExecutionSuccessWhenAppendingM HWTEST2_F(CommandListCreate, GivenImmediateListAndGpuFailureWhenAppendingMemoryBarrierThenExecuteCommandListImmediateCalledAndDeviceLostReturned, IsDG1) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t rangeSizes = 1; const char *rangesBuffer[rangeSizes]; @@ -127,7 +127,7 @@ HWTEST2_F(CommandListCreate, GivenImmediateListAndGpuFailureWhenAppendingMemoryB HWTEST2_F(CommandListCreate, GivenHostMemoryNotInSvmManagerWhenAppendingMemoryBarrierThenAdditionalCommandsNotAdded, IsDG1) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t pRangeSizes = 1; const char *ranges[pRangeSizes]; @@ -154,7 +154,7 @@ HWTEST2_F(CommandListCreate, GivenHostMemoryNotInSvmManagerWhenAppendingMemoryBa HWTEST2_F(CommandListCreate, GivenHostMemoryInSvmManagerWhenAppendingMemoryBarrierThenL3CommandsAdded, IsDG1) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t pRangeSizes = 1; void *ranges; @@ -213,7 +213,7 @@ HWTEST2_F(CommandListCreate, GivenHostMemoryInSvmManagerWhenAppendingMemoryBarri HWTEST2_F(CommandListCreate, GivenHostMemoryWhenAppendingMemoryBarrierThenAddressMisalignmentCorrected, IsDG1) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t misalignmentFactor = 761; const size_t pRangeSizes = 4096; @@ -279,7 +279,7 @@ HWTEST2_F(CommandListCreate, givenAllocationsWhenApplyRangesBarrierWithInvalidAd using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using L3_CONTROL = typename GfxFamily::L3_CONTROL; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; const size_t pRangeSizes = 4096; void *ranges; ze_device_mem_alloc_desc_t deviceDesc = {}; @@ -312,7 +312,7 @@ HWTEST2_F(CommandListCreate, givenAllocationsWhenApplyRangesBarrierWithInvalidAd using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using L3_CONTROL = typename GfxFamily::L3_CONTROL; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; const size_t pRangeSizes = 4096; void *ranges; ze_device_mem_alloc_desc_t deviceDesc = {}; diff --git a/level_zero/core/test/unit_tests/mocks/mock_device_for_spirv.cpp b/level_zero/core/test/unit_tests/mocks/mock_device_for_spirv.cpp index 99e46cd7bc..25f1dc6308 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_device_for_spirv.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_device_for_spirv.cpp @@ -41,8 +41,8 @@ ze_result_t MockDeviceForSpv::createModule(const moduleDesc.inputSize = size; ModuleBuildLog *moduleBuildLog = nullptr; - - mockModulePtr.reset(Module::create(this, &moduleDesc, moduleBuildLog, ModuleType::Builtin)); + ze_result_t result = ZE_RESULT_SUCCESS; + mockModulePtr.reset(Module::create(this, &moduleDesc, moduleBuildLog, ModuleType::Builtin, &result)); wasModuleCreated = true; useImagesBuiltins_prev = useImagesBuiltins; isStateless_prev = isStateless; diff --git a/level_zero/core/test/unit_tests/mocks/mock_module.h b/level_zero/core/test/unit_tests/mocks/mock_module.h index dc4dd394f7..33bb8fe588 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_module.h +++ b/level_zero/core/test/unit_tests/mocks/mock_module.h @@ -61,13 +61,13 @@ struct MockModuleTranslationUnit : public L0::ModuleTranslationUnit { MockModuleTranslationUnit(L0::Device *device) : L0::ModuleTranslationUnit(device) { } - bool processUnpackedBinary() override { - return true; + ze_result_t processUnpackedBinary() override { + return ZE_RESULT_SUCCESS; } - bool compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) override { + ze_result_t compileGenBinary(NEO::TranslationInput inputArgs, bool staticLink) override { if (unpackedDeviceBinarySize && unpackedDeviceBinary) { - return true; + return ZE_RESULT_SUCCESS; } else { return ModuleTranslationUnit::compileGenBinary(inputArgs, staticLink); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index d73fc05b21..e91529df3d 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -199,7 +199,7 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenRequiredFlushOperationAndN EXPECT_TRUE(NEO::MemorySynchronizationCommands::getDcFlushEnable(true, device->getHwInfo())); - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result)); @@ -236,7 +236,7 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenRequiredFlushOperationAndS EXPECT_TRUE(NEO::MemorySynchronizationCommands::getDcFlushEnable(true, device->getHwInfo())); - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result)); @@ -260,7 +260,7 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenRequiredFlushOperationAndS } HWTEST2_F(CommandListTest, givenImmediateCommandListWhenAppendMemoryRangesBarrierUsingFlushTaskThenExpectCorrectExecuteCall, IsAtLeastSkl) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t rangeSizes = 1; const char *rangesBuffer[rangeSizes]; @@ -280,7 +280,7 @@ HWTEST2_F(CommandListTest, givenImmediateCommandListWhenAppendMemoryRangesBarrie } HWTEST2_F(CommandListTest, givenImmediateCommandListWhenAppendMemoryRangesBarrierNotUsingFlushTaskThenExpectCorrectExecuteCall, IsAtLeastSkl) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numRanges = 1; const size_t rangeSizes = 1; const char *rangesBuffer[rangeSizes]; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp index 3c56a3802b..40ffaf3747 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp @@ -443,7 +443,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendingMemoryCopyWit HWTEST2_F(CommandListCreate, givenCommandListAndHostPointersWhenMemoryCopyCalledThenPipeControlWithDcFlushAdded, IsAtLeastSkl) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList0(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); ASSERT_NE(nullptr, commandList0); @@ -490,7 +490,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, kernel->setGlobalOffsetExp(1, 2, 3); kernel->patchGlobalOffset(); - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; auto commandList = std::make_unique>>(); ASSERT_NE(nullptr, commandList); commandList->isFlushTaskSubmissionEnabled = true; @@ -533,7 +533,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, kernel->setGlobalOffsetExp(1, 2, 3); kernel->patchGlobalOffset(); - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; auto commandList = std::make_unique>>(); ASSERT_NE(nullptr, commandList); commandList->isFlushTaskSubmissionEnabled = true; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index 0349f7ac59..68d36ecd2b 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -386,7 +386,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyTh using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; Mock<::L0::Kernel> kernel; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandListBase(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); EXPECT_EQ(ZE_RESULT_SUCCESS, result); auto usedSpaceBefore = commandListBase->commandContainer.getCommandStream()->getUsed(); @@ -438,7 +438,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyAn using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; Mock<::L0::Kernel> kernel; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); EXPECT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h b/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h index f0c2d1c781..5322940765 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h +++ b/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h @@ -47,6 +47,7 @@ struct ActiveDebuggerFixture { debugger = new MockActiveSourceLevelDebugger(new MockOsLibrary); executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(debugger); executionEnvironment->initializeMemoryManager(); + executionEnvironment->setDebuggingEnabled(); device = NEO::MockDevice::create(executionEnvironment, 0u); device->setDebuggerActive(true); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp index 9ee1e43972..42d13b892e 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp @@ -197,8 +197,9 @@ TEST_F(ModuleWithSLDTest, GivenNoDebugDataWhenInitializingModuleThenRelocatedDeb module->translationUnit->programInfo.kernelInfos.push_back(kernelInfo); EXPECT_EQ(nullptr, module->translationUnit->debugData.get()); - auto result = module->initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(result); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(nullptr, kernelInfo->kernelDescriptor.external.relocatedDebugData); } @@ -245,8 +246,9 @@ TEST_F(ModuleWithSLDTest, GivenDebugDataWithSingleRelocationWhenInitializingModu kernelInfo->kernelDescriptor.external.debugData->genIsa = nullptr; kernelInfo->kernelDescriptor.external.debugData->genIsaSize = 0; - auto result = moduleMock->initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(result); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleMock->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(nullptr, kernelInfo->kernelDescriptor.external.relocatedDebugData); } @@ -290,9 +292,9 @@ TEST_F(ModuleWithSLDTest, GivenDebugDataWithMultipleRelocationsWhenInitializingM kernelInfo->kernelDescriptor.external.debugData->genIsaSize = 0; EXPECT_EQ(nullptr, kernelInfo->kernelDescriptor.external.relocatedDebugData); - - auto result = moduleMock->initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(result); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleMock->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(nullptr, kernelInfo->kernelDescriptor.external.relocatedDebugData); } @@ -461,8 +463,7 @@ HWTEST_F(ModuleWithDebuggerL0MultiTileTest, GivenSubDeviceWhenCreatingModuleThen kernelInfo->kernelDescriptor.external.debugData->vIsa = reinterpret_cast(debugData.data()); kernelInfo->kernelDescriptor.external.debugData->genIsa = nullptr; kernelInfo->kernelDescriptor.external.debugData->genIsaSize = 0; - - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, subDevice0->getNEODevice())); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, subDevice0->getNEODevice()), ZE_RESULT_SUCCESS); auto debuggerL0Hw = static_cast *>(device->getL0Debugger()); EXPECT_EQ(1u, debuggerL0Hw->notifyModuleCreateCount); @@ -508,7 +509,7 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithRelocationsWhenInitializing kernelInfo->kernelDescriptor.external.debugData->genIsaSize = 0; EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); EXPECT_EQ(1u, getMockDebuggerL0Hw()->registerElfCount); EXPECT_EQ(1u, getMockDebuggerL0Hw()->notifyModuleCreateCount); @@ -559,7 +560,7 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenDebugDataWithoutRelocationsWhenInitializ kernelInfo->kernelDescriptor.external.debugData->genIsaSize = 0; EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); EXPECT_EQ(1u, getMockDebuggerL0Hw()->registerElfCount); EXPECT_EQ(1u, getMockDebuggerL0Hw()->notifyModuleCreateCount); @@ -596,7 +597,7 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenNoDebugDataWhenInitializingModuleThenDoN moduleMock->translationUnit->programInfo.kernelInfos.push_back(kernelInfo); EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); EXPECT_EQ(1u, getMockDebuggerL0Hw()->notifyModuleCreateCount); } @@ -636,7 +637,7 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinDebugDataWhenInitializingMo memcpy_s(moduleMock->translationUnit->unpackedDeviceBinary.get(), moduleMock->translationUnit->unpackedDeviceBinarySize, zebin.storage.data(), zebin.storage.size()); EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); EXPECT_EQ(2u, getMockDebuggerL0Hw()->registerElfCount); EXPECT_EQ(1u, getMockDebuggerL0Hw()->notifyModuleCreateCount); } @@ -656,7 +657,7 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinNoDebugDataWhenInitializing moduleMock->translationUnit = std::make_unique(device); EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); EXPECT_EQ(0u, getMockDebuggerL0Hw()->registerElfCount); EXPECT_EQ(0u, getMockDebuggerL0Hw()->notifyModuleCreateCount); } @@ -691,7 +692,7 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinWhenModuleIsInitializedAndD zebin.storage.data(), zebin.storage.size()); getMockDebuggerL0Hw()->moduleHandleToReturn = 6; - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); auto expectedSegmentAllocationCount = 1u; expectedSegmentAllocationCount += moduleMock->translationUnit->globalConstBuffer != nullptr ? 1 : 0; @@ -749,7 +750,7 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenNonZebinBinaryWhenDestroyModuleThenModul kernelInfo->kernelDescriptor.external.debugData->genIsa = nullptr; kernelInfo->kernelDescriptor.external.debugData->genIsaSize = 0; - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); moduleMock->destroy(); moduleMock.release(); EXPECT_EQ(1u, getMockDebuggerL0Hw()->notifyModuleDestroyCount); @@ -783,7 +784,7 @@ HWTEST_F(ModuleWithDebuggerL0Test, GivenNoDebugDataWhenDestroyingModuleThenNotif moduleMock->kernelImmData = &kernelMock.immutableData; moduleMock->translationUnit->programInfo.kernelInfos.push_back(kernelInfo); - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); moduleMock->destroy(); moduleMock.release(); EXPECT_EQ(1u, getMockDebuggerL0Hw()->notifyModuleDestroyCount); @@ -819,7 +820,7 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenModuleDebugHandleZeroWhenInitial zebin.storage.data(), zebin.storage.size()); getMockDebuggerL0Hw()->moduleHandleToReturn = 0u; - EXPECT_TRUE(moduleMock->initialize(&moduleDesc, neoDevice)); + EXPECT_EQ(moduleMock->initialize(&moduleDesc, neoDevice), ZE_RESULT_SUCCESS); EXPECT_EQ(1u, getMockDebuggerL0Hw()->segmentCountWithAttachedModuleHandle); EXPECT_EQ(getMockDebuggerL0Hw()->moduleHandleToReturn, moduleMock->debugModuleHandle); diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index 4949f05477..97e91fa933 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -233,7 +233,7 @@ TEST(L0DeviceTest, givenDisabledPreemptionWhenCreatingDeviceThenSipKernelIsNotIn EXPECT_FALSE(NEO::MockSipData::called); } -TEST(L0DeviceTest, givenDeviceWithoutIGCCompilerLibraryThenInvalidDependencyReturned) { +TEST(L0DeviceTest, givenDeviceWithoutIGCCompilerLibraryThenInvalidDependencyIsNotReturned) { ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr driverHandle(new DriverHandleImp); @@ -243,15 +243,16 @@ TEST(L0DeviceTest, givenDeviceWithoutIGCCompilerLibraryThenInvalidDependencyRetu auto oldIgcDllName = Os::igcDllName; Os::igcDllName = "_invalidIGC"; - + auto mockDevice = reinterpret_cast(neoDevice.get()); + mockDevice->setPreemptionMode(NEO::PreemptionMode::Initial); auto device = std::unique_ptr(Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue)); ASSERT_NE(nullptr, device); - EXPECT_EQ(returnValue, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); Os::igcDllName = oldIgcDllName; } -TEST(L0DeviceTest, givenDeviceWithoutAnyCompilerLibraryThenInvalidDependencyReturned) { +TEST(L0DeviceTest, givenDeviceWithoutAnyCompilerLibraryThenInvalidDependencyIsNotReturned) { ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr driverHandle(new DriverHandleImp); @@ -263,6 +264,51 @@ TEST(L0DeviceTest, givenDeviceWithoutAnyCompilerLibraryThenInvalidDependencyRetu auto oldIgcDllName = Os::igcDllName; Os::frontEndDllName = "_invalidFCL"; Os::igcDllName = "_invalidIGC"; + auto mockDevice = reinterpret_cast(neoDevice.get()); + mockDevice->setPreemptionMode(NEO::PreemptionMode::Initial); + + auto device = std::unique_ptr(Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue)); + ASSERT_NE(nullptr, device); + EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); + + Os::igcDllName = oldIgcDllName; + Os::frontEndDllName = oldFclDllName; +} + +TEST(L0DeviceTest, givenDeviceWithoutIGCCompilerLibraryAndMidThreadPremptionThenInvalidDependencyIsReturned) { + ze_result_t returnValue = ZE_RESULT_SUCCESS; + + std::unique_ptr driverHandle(new DriverHandleImp); + auto hwInfo = *NEO::defaultHwInfo; + + auto neoDevice = std::unique_ptr(NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + auto oldIgcDllName = Os::igcDllName; + Os::igcDllName = "_invalidIGC"; + auto mockDevice = reinterpret_cast(neoDevice.get()); + mockDevice->setPreemptionMode(NEO::PreemptionMode::MidThread); + + auto device = std::unique_ptr(Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue)); + ASSERT_NE(nullptr, device); + EXPECT_EQ(returnValue, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + + Os::igcDllName = oldIgcDllName; +} + +TEST(L0DeviceTest, givenDeviceWithoutAnyCompilerLibraryAndMidThreadPremptionThenInvalidDependencyIsReturned) { + ze_result_t returnValue = ZE_RESULT_SUCCESS; + + std::unique_ptr driverHandle(new DriverHandleImp); + auto hwInfo = *NEO::defaultHwInfo; + + auto neoDevice = std::unique_ptr(NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + auto oldFclDllName = Os::frontEndDllName; + auto oldIgcDllName = Os::igcDllName; + Os::frontEndDllName = "_invalidFCL"; + Os::igcDllName = "_invalidIGC"; + auto mockDevice = reinterpret_cast(neoDevice.get()); + mockDevice->setPreemptionMode(NEO::PreemptionMode::MidThread); auto device = std::unique_ptr(Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue)); ASSERT_NE(nullptr, device); @@ -3229,7 +3275,7 @@ TEST(DevicePropertyFlagDiscreteDeviceTest, givenDiscreteDeviceThenCorrectDeviceP TEST(zeDevice, givenValidImagePropertiesStructWhenGettingImagePropertiesThenSuccessIsReturned) { Mock device; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ze_device_image_properties_t imageProperties; result = zeDeviceGetImageProperties(device.toHandle(), &imageProperties); diff --git a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp index 4ebb930015..96ad625597 100644 --- a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp +++ b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp @@ -398,6 +398,9 @@ TEST(DriverTest, givenProgramDebuggingEnvVarNonZeroWhenCreatingDriverThenEnableP TEST(DriverTest, givenInvalidCompilerEnvironmentThenDependencyUnavailableErrorIsReturned) { NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); hwInfo.capabilityTable.levelZeroSupported = true; + VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); + std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "1"}}; + VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; DriverImp driverImp; @@ -549,7 +552,7 @@ TEST_F(DriverHandleTest, } TEST_F(DriverHandleTest, givenInitializedDriverWhenZeDriverGetIsCalledThenDriverHandleIsObtained) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t count = 0; result = zeDriverGet(&count, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -564,7 +567,7 @@ TEST_F(DriverHandleTest, givenInitializedDriverWhenZeDriverGetIsCalledThenDriver } TEST_F(DriverHandleTest, givenInitializedDriverWhenZeDriverGetIsCalledThenGlobalDriverHandleIsObtained) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t count = 1; ze_driver_handle_t hDriverHandle = reinterpret_cast(&hDriverHandle); @@ -576,7 +579,7 @@ TEST_F(DriverHandleTest, givenInitializedDriverWhenZeDriverGetIsCalledThenGlobal } TEST_F(DriverHandleTest, givenInitializedDriverWhenGetDeviceIsCalledThenOneDeviceIsObtained) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t count = 1; ze_device_handle_t device; @@ -604,7 +607,7 @@ TEST_F(DriverHandleTest, givenValidDriverHandleWhenGetSvmAllocManagerIsCalledThe } TEST(zeDriverHandleGetProperties, whenZeDriverGetPropertiesIsCalledThenGetPropertiesIsCalled) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; Mock driverHandle; ze_driver_properties_t properties; ze_result_t expectedResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; @@ -616,7 +619,7 @@ TEST(zeDriverHandleGetProperties, whenZeDriverGetPropertiesIsCalledThenGetProper } TEST(zeDriverHandleGetApiVersion, whenZeDriverGetApiIsCalledThenGetApiVersionIsCalled) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; Mock driverHandle; ze_api_version_t version; ze_result_t expectedResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; @@ -628,7 +631,7 @@ TEST(zeDriverHandleGetApiVersion, whenZeDriverGetApiIsCalledThenGetApiVersionIsC } TEST(zeDriverGetIpcProperties, whenZeDriverGetIpcPropertiesIsCalledThenGetIPCPropertiesIsCalled) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; Mock driverHandle; ze_driver_ipc_properties_t ipcProperties; ze_result_t expectedResult = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS; diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp index ef3d6aa691..bb169a9976 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp @@ -669,8 +669,9 @@ TEST_F(KernelImmutableDataTests, givenInternalModuleWhenKernelIsCreatedIsaIsNotC moduleMock->kernelImmData = &kernelMock.immutableData; size_t previouscopyMemoryToAllocationCalledTimes = mockMemoryManager->copyMemoryToAllocationCalledTimes; - auto result = moduleMock->initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(result); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleMock->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); size_t expectedPreviouscopyMemoryToAllocationCalledTimes = previouscopyMemoryToAllocationCalledTimes; EXPECT_EQ(expectedPreviouscopyMemoryToAllocationCalledTimes, mockMemoryManager->copyMemoryToAllocationCalledTimes); @@ -708,8 +709,9 @@ TEST_F(KernelImmutableDataTests, givenKernelInitializedWithPrivateMemoryThenCont ModuleType::User, perHwThreadPrivateMemorySizeRequested, mockKernelImmData.get()); - bool result = moduleWithPrivateMemory->initialize(&moduleDesc, device->getNEODevice()); - EXPECT_TRUE(result); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleWithPrivateMemory->initialize(&moduleDesc, device->getNEODevice()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); std::unique_ptr kernelWithPrivateMemory; kernelWithPrivateMemory = std::make_unique(moduleWithPrivateMemory.get()); @@ -726,8 +728,9 @@ TEST_F(KernelImmutableDataTests, givenKernelInitializedWithPrivateMemoryThenCont ModuleType::User, perHwThreadPrivateMemorySizeRequested, mockKernelImmDataForModuleWithoutPrivateMemory.get()); + result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; result = moduleWithoutPrivateMemory->initialize(&moduleDesc, device->getNEODevice()); - EXPECT_TRUE(result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); std::unique_ptr kernelWithoutPrivateMemory; kernelWithoutPrivateMemory = std::make_unique(moduleWithoutPrivateMemory.get()); @@ -748,6 +751,7 @@ TEST_F(KernelImmutableDataTests, givenKernelWithPrivateMemoryBiggerThanGlobalMem moduleDesc.pInputModule = reinterpret_cast(src.data()); moduleDesc.inputSize = src.size(); ModuleBuildLog *moduleBuildLog = nullptr; + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; uint32_t perHwThreadPrivateMemorySizeRequested = std::numeric_limits::max(); std::unique_ptr mockKernelImmData = std::make_unique(perHwThreadPrivateMemorySizeRequested); @@ -756,8 +760,8 @@ TEST_F(KernelImmutableDataTests, givenKernelWithPrivateMemoryBiggerThanGlobalMem ModuleType::User, perHwThreadPrivateMemorySizeRequested, mockKernelImmData.get()); - bool result = module->initialize(&moduleDesc, device->getNEODevice()); - EXPECT_TRUE(result); + result = module->initialize(&moduleDesc, device->getNEODevice()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_TRUE(module->shouldAllocatePrivateMemoryPerDispatch()); std::unique_ptr kernel; diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp index 1c3dc1a599..9c4b337156 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp @@ -2175,8 +2175,8 @@ struct MultipleDevicePeerAllocationTest : public ::testing::Test { moduleDesc.inputSize = src.size(); ModuleBuildLog *moduleBuildLog = nullptr; - - module.reset(Module::create(device, &moduleDesc, moduleBuildLog, type)); + ze_result_t result = ZE_RESULT_SUCCESS; + module.reset(Module::create(device, &moduleDesc, moduleBuildLog, type, &result)); } void SetUp() override { diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index 392515758f..cbedff0901 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/compiler_interface/compiler_options.h" #include "shared/source/compiler_interface/compiler_warnings/compiler_warnings.h" #include "shared/source/device_binary_format/ar/ar_decoder.h" @@ -15,6 +16,7 @@ #include "shared/source/helpers/addressing_mode_helper.h" #include "shared/source/helpers/compiler_hw_info_config.h" #include "shared/source/kernel/implicit_args.h" +#include "shared/source/os_interface/os_inc_base.h" #include "shared/source/program/kernel_info.h" #include "shared/test/common/compiler_interface/linker_mock.h" #include "shared/test/common/device_binary_format/patchtokens_tests.h" @@ -579,13 +581,13 @@ struct ModuleSpecConstantsFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&moduleDesc, neoDevice); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); for (uint32_t i = 0; i < mockCompiler->moduleNumSpecConstants / 2; i++) { EXPECT_EQ(static_cast(module->translationUnit->specConstantsValues[mockCompiler->moduleSpecConstantsIds[2 * i]]), static_cast(mockCompiler->moduleSpecConstantsValuesT2[i])); EXPECT_EQ(static_cast(module->translationUnit->specConstantsValues[mockCompiler->moduleSpecConstantsIds[2 * i + 1]]), static_cast(mockCompiler->moduleSpecConstantsValuesT1[i])); } - EXPECT_TRUE(success); module->destroy(); } @@ -636,13 +638,13 @@ struct ModuleSpecConstantsFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&combinedModuleDesc, neoDevice); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); for (uint32_t i = 0; i < mockCompiler->moduleNumSpecConstants / 2; i++) { EXPECT_EQ(static_cast(module->translationUnit->specConstantsValues[mockCompiler->moduleSpecConstantsIds[2 * i]]), static_cast(mockCompiler->moduleSpecConstantsValuesT2[i])); EXPECT_EQ(static_cast(module->translationUnit->specConstantsValues[mockCompiler->moduleSpecConstantsIds[2 * i + 1]]), static_cast(mockCompiler->moduleSpecConstantsValuesT1[i])); } - EXPECT_TRUE(success); module->destroy(); } @@ -705,9 +707,9 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&moduleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_MODULE_BUILD_FAILURE); module->destroy(); } @@ -741,9 +743,9 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenUserPass auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&moduleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module->initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_MODULE_BUILD_FAILURE); module->destroy(); } @@ -815,9 +817,9 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&combinedModuleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_MODULE_BUILD_FAILURE); module->destroy(); } @@ -880,8 +882,9 @@ struct ModuleStaticLinkFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - bool success = module->initialize(&combinedModuleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_MODULE_BUILD_FAILURE); module->destroy(); } void runSpirvFailureTest() { @@ -897,9 +900,9 @@ struct ModuleStaticLinkFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&combinedModuleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_INVALID_ENUMERATION); module->destroy(); } void runExpDescFailureTest() { @@ -915,9 +918,9 @@ struct ModuleStaticLinkFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&combinedModuleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_INVALID_ARGUMENT); module->destroy(); } void runSprivLinkBuildFlags() { @@ -941,9 +944,9 @@ struct ModuleStaticLinkFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&combinedModuleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); module->destroy(); } void runSprivLinkBuildWithOneModule() { @@ -965,9 +968,9 @@ struct ModuleStaticLinkFixture : public DeviceFixture { auto module = new Module(device, nullptr, ModuleType::User); module->translationUnit.reset(mockTranslationUnit); - - bool success = module->initialize(&combinedModuleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&combinedModuleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); module->destroy(); } std::unique_ptr zebinData; @@ -1049,8 +1052,9 @@ HWTEST_F(ModuleLinkingTest, givenFailureDuringLinkingWhenCreatingModuleThenModul Module module(device, nullptr, ModuleType::User); module.translationUnit.reset(mockTranslationUnit); - bool success = module.initialize(&moduleDesc, neoDevice); - EXPECT_FALSE(success); + ze_result_t result = ZE_RESULT_SUCCESS; + result = module.initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_ERROR_MODULE_LINK_FAILURE); } HWTEST_F(ModuleLinkingTest, givenRemainingUnresolvedSymbolsDuringLinkingWhenCreatingModuleThenModuleIsNotLinkedFully) { @@ -1078,8 +1082,9 @@ HWTEST_F(ModuleLinkingTest, givenRemainingUnresolvedSymbolsDuringLinkingWhenCrea Module module(device, nullptr, ModuleType::User); module.translationUnit.reset(mockTranslationUnit); - bool success = module.initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_FALSE(module.isFullyLinked); } HWTEST_F(ModuleLinkingTest, givenNotFullyLinkedModuleWhenCreatingKernelThenErrorIsReturned) { @@ -1678,7 +1683,6 @@ TEST_F(ModuleDynamicLinkTest, givenUnresolvedSymbolsWhenModuleIsCreatedThenIsaAl linkerInput->traits.requiresPatchingOfGlobalVariablesBuffer = true; module->unresolvedExternalsInfo.push_back({unresolvedRelocation}); module->translationUnit->programInfo.linkerInput = std::move(linkerInput); - module->initialize(&moduleDesc, neoDevice); for (auto &ki : module->getKernelImmutableDataVector()) { @@ -1958,17 +1962,22 @@ using ModuleTranslationUnitTest = Test; struct MockModuleTU : public L0::ModuleTranslationUnit { MockModuleTU(L0::Device *device) : L0::ModuleTranslationUnit(device) {} - bool buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions, - const ze_module_constants_t *pConstants) override { + ze_result_t buildFromSpirV(const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions, + const ze_module_constants_t *pConstants) override { wasBuildFromSpirVCalled = true; - return true; + if (callRealBuildFromSpirv) { + return L0::ModuleTranslationUnit::buildFromSpirV(input, inputSize, buildOptions, internalBuildOptions, pConstants); + } else { + return ZE_RESULT_SUCCESS; + } } - bool createFromNativeBinary(const char *input, size_t inputSize) override { + ze_result_t createFromNativeBinary(const char *input, size_t inputSize) override { wasCreateFromNativeBinaryCalled = true; return L0::ModuleTranslationUnit::createFromNativeBinary(input, inputSize); } + bool callRealBuildFromSpirv = false; bool wasBuildFromSpirVCalled = false; bool wasCreateFromNativeBinaryCalled = false; }; @@ -1989,8 +1998,9 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildPrecompiledKernelsFlagAndFileWit MockModuleTU *tu = new MockModuleTU(device); module.translationUnit.reset(tu); - bool success = module.initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_TRUE(tu->wasCreateFromNativeBinaryCalled); EXPECT_FALSE(tu->wasBuildFromSpirVCalled); } @@ -2011,8 +2021,9 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildPrecompiledKernelsFlagAndFileWit MockModuleTU *tu = new MockModuleTU(device); module.translationUnit.reset(tu); - bool success = module.initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_TRUE(tu->wasCreateFromNativeBinaryCalled); EXPECT_EQ(tu->irBinarySize != 0, tu->wasBuildFromSpirVCalled); } @@ -2036,8 +2047,9 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildFlagWhenCreatingModuleFromNative MockModuleTU *tu = new MockModuleTU(device); module.translationUnit.reset(tu); - bool success = module.initialize(&moduleDesc, neoDevice); - ASSERT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + ASSERT_EQ(result, ZE_RESULT_SUCCESS); size_t buildLogSize{}; const auto querySizeResult{moduleBuildLog->getString(&buildLogSize, nullptr)}; @@ -2071,8 +2083,9 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildFlagWhenCreatingModuleFromNative MockModuleTU *tu = new MockModuleTU(device); module.translationUnit.reset(tu); - bool success = module.initialize(&moduleDesc, neoDevice); - ASSERT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + ASSERT_EQ(result, ZE_RESULT_SUCCESS); size_t buildLogSize{}; const auto querySizeResult{moduleBuildLog->getString(&buildLogSize, nullptr)}; @@ -2093,14 +2106,15 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpRequir emptyProgram.elfHeader->machine = hwInfo.platform.eProductFamily; L0::ModuleTranslationUnit moduleTuValid(this->device); - bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast(emptyProgram.storage.data()), emptyProgram.storage.size()); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTuValid.createFromNativeBinary(reinterpret_cast(emptyProgram.storage.data()), emptyProgram.storage.size()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); emptyProgram.elfHeader->machine = hwInfo.platform.eProductFamily; ++emptyProgram.elfHeader->machine; L0::ModuleTranslationUnit moduleTuInvalid(this->device); - success = moduleTuInvalid.createFromNativeBinary(reinterpret_cast(emptyProgram.storage.data()), emptyProgram.storage.size()); - EXPECT_FALSE(success); + result = moduleTuInvalid.createFromNativeBinary(reinterpret_cast(emptyProgram.storage.data()), emptyProgram.storage.size()); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_NATIVE_BINARY, result); } HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPackedTargetDeviceBinary) { @@ -2129,8 +2143,9 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked auto arData = encoder.encode(); L0::ModuleTranslationUnit moduleTuValid(this->device); - bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast(arData.data()), arData.size()); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTuValid.createFromNativeBinary(reinterpret_cast(arData.data()), arData.size()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(moduleTuValid.packedDeviceBinarySize, arData.size()); } @@ -2141,8 +2156,9 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromZebinThenAppendAllowZebinFla zebin.elfHeader->machine = hwInfo.platform.eProductFamily; L0::ModuleTranslationUnit moduleTu(this->device); - bool success = moduleTu.createFromNativeBinary(reinterpret_cast(zebin.storage.data()), zebin.storage.size()); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.createFromNativeBinary(reinterpret_cast(zebin.storage.data()), zebin.storage.size()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); auto expectedOptions = " " + NEO::CompilerOptions::allowZebin.str(); EXPECT_STREQ(expectedOptions.c_str(), moduleTu.options.c_str()); @@ -2167,8 +2183,9 @@ kernels: zebin.elfHeader->machine = device->getNEODevice()->getHardwareInfo().platform.eProductFamily; L0::ModuleTranslationUnit moduleTuValid(this->device); - bool success = moduleTuValid.createFromNativeBinary(reinterpret_cast(zebin.storage.data()), zebin.storage.size()); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTuValid.createFromNativeBinary(reinterpret_cast(zebin.storage.data()), zebin.storage.size()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(nullptr, moduleTuValid.programInfo.linkerInput.get()); } @@ -2211,7 +2228,7 @@ kernels: memcpy_s(moduleTu.unpackedDeviceBinary.get(), moduleTu.unpackedDeviceBinarySize, zebin.data(), zebin.size()); auto retVal = moduleTu.processUnpackedBinary(); - EXPECT_TRUE(retVal); + EXPECT_EQ(retVal, ZE_RESULT_SUCCESS); EXPECT_EQ(AllocationType::BUFFER, moduleTu.globalConstBuffer->getAllocationType()); EXPECT_EQ(AllocationType::BUFFER, moduleTu.globalVarBuffer->getAllocationType()); @@ -2222,6 +2239,64 @@ kernels: EXPECT_EQ(DEVICE_UNIFIED_MEMORY, globalVarBufferAllocType); } +HWTEST_F(ModuleTranslationUnitTest, WithNoCompilerWhenCallingBuildFromSpirvThenFailureReturned) { + auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; + rootDeviceEnvironment->compilerInterface.reset(nullptr); + auto oldFclDllName = Os::frontEndDllName; + auto oldIgcDllName = Os::igcDllName; + Os::frontEndDllName = "_invalidFCL"; + Os::igcDllName = "_invalidIGC"; + + L0::ModuleTranslationUnit moduleTu(this->device); + moduleTu.options = "abcd"; + + ze_result_t result = ZE_RESULT_SUCCESS; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + Os::igcDllName = oldIgcDllName; + Os::frontEndDllName = oldFclDllName; +} + +HWTEST_F(ModuleTranslationUnitTest, WithNoCompilerWhenCallingCompileGenBinaryThenFailureReturned) { + auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; + rootDeviceEnvironment->compilerInterface.reset(nullptr); + auto oldFclDllName = Os::frontEndDllName; + auto oldIgcDllName = Os::igcDllName; + Os::frontEndDllName = "_invalidFCL"; + Os::igcDllName = "_invalidIGC"; + + L0::ModuleTranslationUnit moduleTu(this->device); + moduleTu.options = "abcd"; + + ze_result_t result = ZE_RESULT_SUCCESS; + TranslationInput inputArgs = {IGC::CodeType::spirV, IGC::CodeType::oclGenBin}; + result = moduleTu.compileGenBinary(inputArgs, false); + EXPECT_EQ(result, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + Os::igcDllName = oldIgcDllName; + Os::frontEndDllName = oldFclDllName; +} + +HWTEST_F(ModuleTranslationUnitTest, WithNoCompilerWhenCallingStaticLinkSpirVThenFailureReturned) { + auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; + rootDeviceEnvironment->compilerInterface.reset(nullptr); + auto oldFclDllName = Os::frontEndDllName; + auto oldIgcDllName = Os::igcDllName; + Os::frontEndDllName = "_invalidFCL"; + Os::igcDllName = "_invalidIGC"; + + L0::ModuleTranslationUnit moduleTu(this->device); + moduleTu.options = "abcd"; + + ze_result_t result = ZE_RESULT_SUCCESS; + std::vector inputSpirVs; + std::vector inputModuleSizes; + std::vector specConstants; + result = moduleTu.staticLinkSpirV(inputSpirVs, inputModuleSizes, "", "", specConstants); + EXPECT_EQ(result, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + Os::igcDllName = oldIgcDllName; + Os::frontEndDllName = oldFclDllName; +} + HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOptions) { auto *pMockCompilerInterface = new MockCompilerInterface; @@ -2232,8 +2307,9 @@ HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOpti moduleTu.options = "abcd"; pMockCompilerInterface->failBuild = true; - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_FALSE(ret); + ze_result_t result = ZE_RESULT_SUCCESS; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_NE(result, ZE_RESULT_SUCCESS); EXPECT_STREQ("abcd", moduleTu.options.c_str()); EXPECT_STREQ("abcd", pMockCompilerInterface->receivedApiOptions.c_str()); } @@ -2247,8 +2323,9 @@ HWTEST_F(ModuleTranslationUnitTest, WhenBuildOptionsAreNullThenReuseExistingOpti DebugManager.flags.DisableStatelessToStatefulOptimization.set(1); MockModuleTranslationUnit moduleTu(this->device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_TRUE(ret); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("cl-intel-greater-than-4GB-buffer-required"), std::string::npos); } @@ -2257,9 +2334,10 @@ HWTEST_F(ModuleTranslationUnitTest, givenInternalOptionsThenLSCCachePolicyIsSet) auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface); MockModuleTranslationUnit moduleTu(this->device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - EXPECT_TRUE(ret); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(false); if (expectedPolicy != nullptr) { EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find(expectedPolicy), std::string::npos); @@ -2276,8 +2354,9 @@ HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetToWbWhenGetInternalOptions auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface); MockModuleTranslationUnit moduleTu(this->device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_TRUE(ret); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos); } @@ -2289,8 +2368,9 @@ HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetForceAllResourcesUncachedW auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface); MockModuleTranslationUnit moduleTu(this->device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_TRUE(ret); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=1 -cl-load-cache-default=1"), std::string::npos); } @@ -2299,8 +2379,9 @@ HWTEST2_F(ModuleTranslationUnitTest, givenAtLeastXeHpgCoreWhenGetInternalOptions auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface); MockModuleTranslationUnit moduleTu(this->device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_TRUE(ret); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos); } @@ -2310,8 +2391,9 @@ HWTEST_F(ModuleTranslationUnitTest, givenForceToStatelessRequiredWhenBuildingMod rootDeviceEnvironment->compilerInterface.reset(mockCompilerInterface); MockModuleTranslationUnit moduleTu(device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_TRUE(ret); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); if (compilerHwInfoConfig.isForceToStatelessRequired()) { @@ -2372,8 +2454,8 @@ HWTEST_F(PrintfModuleTest, GivenModuleWithPrintfWhenKernelIsCreatedThenPrintfAll moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; moduleDesc.pInputModule = reinterpret_cast(src.data()); moduleDesc.inputSize = src.size(); - - auto module = std::unique_ptr(Module::create(device, &moduleDesc, nullptr, ModuleType::User)); + ze_result_t result = ZE_RESULT_SUCCESS; + auto module = std::unique_ptr(Module::create(device, &moduleDesc, nullptr, ModuleType::User, &result)); auto kernel = std::make_unique>(); ASSERT_NE(nullptr, kernel); @@ -2644,7 +2726,7 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu class MyMockModuleTU : public MockModuleTU { public: using MockModuleTU::MockModuleTU; - bool createFromNativeBinary(const char *input, size_t inputSize) override { return true; } + ze_result_t createFromNativeBinary(const char *input, size_t inputSize) override { return ZE_RESULT_SUCCESS; } }; const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); @@ -2660,12 +2742,12 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu moduleDesc.pInputModule = reinterpret_cast(src.data()); moduleDesc.inputSize = src.size(); - std::array, 5> testParams = {{ - {true, false, ModuleType::Builtin, -1}, - {true, true, ModuleType::Builtin, 0}, - {true, true, ModuleType::User, 0}, - {true, true, ModuleType::Builtin, 1}, - {false, true, ModuleType::User, 1}, + std::array, 5> testParams = {{ + {ZE_RESULT_SUCCESS, false, ModuleType::Builtin, -1}, + {ZE_RESULT_SUCCESS, true, ModuleType::Builtin, 0}, + {ZE_RESULT_SUCCESS, true, ModuleType::User, 0}, + {ZE_RESULT_SUCCESS, true, ModuleType::Builtin, 1}, + {ZE_RESULT_ERROR_MODULE_BUILD_FAILURE, true, ModuleType::User, 1}, }}; for (auto &[expectedResult, isStateful, moduleType, debugKey] : testParams) { @@ -3167,8 +3249,9 @@ HWTEST_F(ModuleWithZebinTest, givenZebinWithKernelCallingExternalFunctionThenUpd auto module = std::unique_ptr(new L0::ModuleImp(device, moduleBuildLog, ModuleType::User)); ASSERT_NE(nullptr, module.get()); - auto moduleInitSuccess = module->initialize(&moduleDesc, device->getNEODevice()); - EXPECT_TRUE(moduleInitSuccess); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module->initialize(&moduleDesc, device->getNEODevice()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); const auto &kernImmData = module->getKernelImmutableData("kernel"); ASSERT_NE(nullptr, kernImmData); diff --git a/level_zero/core/test/unit_tests/sources/module/test_module_2.cpp b/level_zero/core/test/unit_tests/sources/module/test_module_2.cpp index 6d91519ab9..89cdaefd65 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module_2.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module_2.cpp @@ -31,8 +31,8 @@ class ModuleOnlineCompiled : public DeviceFixture, public testing::Test { modDesc.format = ZE_MODULE_FORMAT_NATIVE; modDesc.inputSize = static_cast(src.size()); modDesc.pInputModule = reinterpret_cast(src.data()); - - module.reset(whiteboxCast(Module::create(device, &modDesc, nullptr, ModuleType::User))); + ze_result_t result = ZE_RESULT_SUCCESS; + module.reset(whiteboxCast(Module::create(device, &modDesc, nullptr, ModuleType::User, &result))); ASSERT_NE(nullptr, module); } @@ -172,8 +172,8 @@ TEST_F(ModuleOnlineCompiled, WhenCreatingFromNativeBinaryThenGenBinaryIsReturned modDesc.format = ZE_MODULE_FORMAT_NATIVE; modDesc.inputSize = binarySize; modDesc.pInputModule = reinterpret_cast(storage.get()); - - L0::Module *moduleFromNativeBinary = Module::create(device, &modDesc, nullptr, ModuleType::User); + ze_result_t initResult = ZE_RESULT_SUCCESS; + L0::Module *moduleFromNativeBinary = Module::create(device, &modDesc, nullptr, ModuleType::User, &initResult); EXPECT_NE(nullptr, moduleFromNativeBinary); delete moduleFromNativeBinary; @@ -291,8 +291,9 @@ TEST_F(ModuleTests, givenLargeGrfFlagSetWhenCreatingModuleThenOverrideInternalFl module.translationUnit.reset(mockTranslationUnit); - bool success = module.initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-256-GRF-per-thread"), std::string::npos); EXPECT_EQ(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-128-GRF-per-thread"), std::string::npos); @@ -319,8 +320,9 @@ TEST_F(ModuleTests, givenDefaultGrfFlagSetWhenCreatingModuleThenOverrideInternal module.translationUnit.reset(mockTranslationUnit); - bool success = module.initialize(&moduleDesc, neoDevice); - EXPECT_TRUE(success); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = module.initialize(&moduleDesc, neoDevice); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-256-GRF-per-thread"), std::string::npos); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-128-GRF-per-thread"), std::string::npos); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_api_tracing_common.h b/level_zero/core/test/unit_tests/sources/tracing/test_api_tracing_common.h index 4fb1140b81..23aad2ee00 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_api_tracing_common.h +++ b/level_zero/core/test/unit_tests/sources/tracing/test_api_tracing_common.h @@ -74,7 +74,7 @@ class ZeApiTracingRuntimeTests : public ZeAPITracingCoreTestsFixture, public ::t void *userData; void SetUp() override { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ZeAPITracingCoreTestsFixture::setUp(); userData = &defaultUserData; @@ -85,7 +85,7 @@ class ZeApiTracingRuntimeTests : public ZeAPITracingCoreTestsFixture, public ::t } void TearDown() override { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; result = zetTracerExpSetEnabled(apiTracerHandle, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -95,7 +95,7 @@ class ZeApiTracingRuntimeTests : public ZeAPITracingCoreTestsFixture, public ::t } void setTracerCallbacksAndEnableTracer() { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; result = zetTracerExpSetPrologues(apiTracerHandle, &prologCbs); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -134,7 +134,7 @@ class ZeApiTracingRuntimeMultipleArgumentsTests : public ZeAPITracingCoreTestsFi void *pUserData3; void SetUp() override { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ZeAPITracingCoreTestsFixture::setUp(); @@ -164,7 +164,7 @@ class ZeApiTracingRuntimeMultipleArgumentsTests : public ZeAPITracingCoreTestsFi } void TearDown() override { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; result = zetTracerExpSetEnabled(apiTracerHandle0, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); result = zetTracerExpDestroy(apiTracerHandle0); @@ -189,7 +189,7 @@ class ZeApiTracingRuntimeMultipleArgumentsTests : public ZeAPITracingCoreTestsFi } void setTracerCallbacksAndEnableTracer() { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; /* Both prolog and epilog, pass instance data from prolog to epilog */ result = zetTracerExpSetPrologues(apiTracerHandle0, &prologCbs0); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_barrier_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_barrier_api_tracing.cpp index 480b6202f9..a5fd41b356 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_barrier_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_barrier_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendBarrierTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendBarrier = [](ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) { return ZE_RESULT_SUCCESS; }; @@ -29,7 +29,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendBarrierTracingWrapp } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryRangesBarrierTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryRangesBarrier = [](ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t *pRangeSizes, const void **pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) { return ZE_RESULT_SUCCESS; }; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_cmdlist_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_cmdlist_api_tracing.cpp index 1deae4fe1f..2050309504 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_cmdlist_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_cmdlist_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnCreate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, @@ -31,7 +31,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListCreateTracingWrapperWithO } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListCreateImmediateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnCreateImmediate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, @@ -51,7 +51,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListCreateImmediateTracingWra } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnDestroy = [](ze_command_list_handle_t hCommandList) { return ZE_RESULT_SUCCESS; }; prologCbs.CommandList.pfnDestroyCb = genericPrologCallbackPtr; @@ -65,7 +65,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListDestroyTracingWrapperWith } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListResetTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnReset = [](ze_command_list_handle_t hCommandList) { return ZE_RESULT_SUCCESS; }; prologCbs.CommandList.pfnResetCb = genericPrologCallbackPtr; @@ -79,7 +79,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListResetTracingWrapperWithOn } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryPrefetchTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryPrefetch = [](ze_command_list_handle_t hCommandList, const void *ptr, size_t size) { return ZE_RESULT_SUCCESS; }; prologCbs.CommandList.pfnAppendMemoryPrefetchCb = genericPrologCallbackPtr; @@ -93,7 +93,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryPrefetchTraci } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListCloseTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnClose = [](ze_command_list_handle_t hCommandList) { return ZE_RESULT_SUCCESS; }; prologCbs.CommandList.pfnCloseCb = genericPrologCallbackPtr; @@ -107,7 +107,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListCloseTracingWrapperWithOn } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendQueryKernelTimestampsTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendQueryKernelTimestamps = [](ze_command_list_handle_t hCommandList, @@ -130,7 +130,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendQueryKernelTimestam } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendWriteGlobalTimestampTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendWriteGlobalTimestamp = [](ze_command_list_handle_t hCommandList, uint64_t *dstptr, diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_cmdqueue_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_cmdqueue_api_tracing.cpp index 62a5095a4c..3e74fb73d0 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_cmdqueue_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_cmdqueue_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandQueue.pfnCreate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, @@ -31,7 +31,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueCreateTracingWrapperWith } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandQueue.pfnDestroy = [](ze_command_queue_handle_t hCommandQueue) { return ZE_RESULT_SUCCESS; }; prologCbs.CommandQueue.pfnDestroyCb = genericPrologCallbackPtr; @@ -45,7 +45,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueDestroyTracingWrapperWit } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueExecuteCommandListsTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; uint32_t numCommandList = 0; ze_command_list_handle_t phCommandLists = {}; @@ -66,7 +66,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueExecuteCommandListsTraci } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandQueueSynchronizeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandQueue.pfnSynchronize = [](ze_command_queue_handle_t hCommandQueue, uint64_t timeout) { return ZE_RESULT_SUCCESS; }; uint64_t timeout = 100; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_copy_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_copy_api_tracing.cpp index f9d49467b7..f0353143f5 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_copy_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_copy_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryCopyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopy = [](ze_command_list_handle_t hCommandList, @@ -40,7 +40,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryCopyTracingWr } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryFillTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryFill = [](ze_command_list_handle_t hCommandList, void *ptr, @@ -68,7 +68,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryFillTracingWr } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryCopyRegionTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopyRegion = [](ze_command_list_handle_t hCommandList, void *dstptr, @@ -115,7 +115,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryCopyRegionTra } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopy = [](ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, @@ -141,7 +141,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyTracingWra } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyRegionTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopyRegion = [](ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, @@ -169,7 +169,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyRegionTrac } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyToMemoryTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopyToMemory = [](ze_command_list_handle_t hCommandList, void *dstptr, @@ -196,7 +196,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyToMemoryTr } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyFromMemoryTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopyFromMemory = [](ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, @@ -223,7 +223,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendImageCopyFromMemory } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemAdviseTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemAdvise = [](ze_command_list_handle_t hCommandList, ze_device_handle_t hDevice, @@ -248,7 +248,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemAdviseTracingWra } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendMemoryCopyFromContextTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopyFromContext = [](ze_command_list_handle_t hCommandList, void *dstptr, diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_core_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_core_api_tracing.cpp index a1b1221981..fedc9b77f3 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_core_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_core_api_tracing.cpp @@ -145,7 +145,7 @@ void onExitCommandListCloseWithoutUserDataAndReadInstanceData( } TEST(ZeApiTracingCoreTestsNoSetup, WhenCreateTracerAndNoZetInitThenReturnFailure) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; zet_tracer_exp_handle_t apiTracerHandle; zet_tracer_exp_desc_t tracerDesc = {}; @@ -155,7 +155,7 @@ TEST(ZeApiTracingCoreTestsNoSetup, WhenCreateTracerAndNoZetInitThenReturnFailure } TEST_F(ZeApiTracingCoreTests, WhenCreateTracerAndsetCallbacksAndEnableTracingAndDisableTracingAndDestroyTracerThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; zet_tracer_exp_handle_t apiTracerHandle; zet_tracer_exp_desc_t tracerDesc = {}; @@ -189,7 +189,7 @@ TEST_F(ZeApiTracingCoreTests, WhenCreateTracerAndsetCallbacksAndEnableTracingAnd TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOnePrologAndNoEpilogWithUserDataAndUserDataMatchingInPrologThenReturnSuccess) { MockCommandList commandList; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; int userData = 5; ze_command_list_close_params_t tracerParams; zet_core_callbacks_t prologCbs = {}; @@ -213,7 +213,7 @@ TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOnePrologAndNoEpilogWi TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsWithUserDataAndUserDataMatchingInPrologAndEpilogThenReturnSuccess) { MockCommandList commandList; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; int userData = 5; ze_command_list_close_params_t tracerParams; zet_core_callbacks_t prologCbs = {}; @@ -243,7 +243,7 @@ TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsW TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsWithUserDataAndInstanceDataUserDataMatchingInPrologAndEpilogThenReturnSuccess) { MockCommandList commandList; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; int userData = 5; ze_command_list_close_params_t tracerParams; zet_core_callbacks_t prologCbs = {}; @@ -273,7 +273,7 @@ TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsW TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsWithInstanceDataThenReturnSuccess) { MockCommandList commandList; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ze_command_list_close_params_t tracerParams; zet_core_callbacks_t prologCbs = {}; zet_core_callbacks_t epilogCbs = {}; @@ -302,7 +302,7 @@ TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsW TEST_F(ZeApiTracingCoreTests, WhenCallingTracerWrapperWithOneSetOfPrologEpilogsWithRecursionHandledThenSuccessIsReturned) { MockCommandList commandList; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; int userData = 5; ze_command_list_close_params_t tracerParams; zet_core_callbacks_t prologCbs = {}; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_device_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_device_api_tracing.cpp index 3450b8decb..1e81d76f48 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_device_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_device_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGet = [](ze_driver_handle_t hDriver, uint32_t *pCount, ze_device_handle_t *phDevices) { return ZE_RESULT_SUCCESS; }; @@ -26,7 +26,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetTracingWrapperWithOneSetOfP } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetProperties = [](ze_device_handle_t hDevice, ze_device_properties_t *pDeviceProperties) { return ZE_RESULT_SUCCESS; }; @@ -41,7 +41,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetPropertiesTracingWrapperWit } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetComputePropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetComputeProperties = [](ze_device_handle_t hDevice, ze_device_compute_properties_t *pComputeProperties) { return ZE_RESULT_SUCCESS; }; @@ -56,7 +56,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetComputePropertiesTracingWra } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetMemoryPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetMemoryProperties = [](ze_device_handle_t hDevice, uint32_t *pCount, ze_device_memory_properties_t *pMemProperties) { return ZE_RESULT_SUCCESS; }; @@ -71,7 +71,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetMemoryPropertiesTracingWrap } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetCachePropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetCacheProperties = [](ze_device_handle_t hDevice, uint32_t *pCount, @@ -88,7 +88,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetCachePropertiesTracingWrapp } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetImagePropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetImageProperties = [](ze_device_handle_t hDevice, ze_device_image_properties_t *pImageProperties) { return ZE_RESULT_SUCCESS; }; @@ -104,7 +104,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetImagePropertiesTracingWrapp } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetSubDevicesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetSubDevices = [](ze_device_handle_t hDevice, uint32_t *pCount, @@ -123,7 +123,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetSubDevicesTracingWrapperWit } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetP2PPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetP2PProperties = [](ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, @@ -142,7 +142,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetP2PPropertiesTracingWrapper } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceCanAccessPeerTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnCanAccessPeer = [](ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, @@ -161,7 +161,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceCanAccessPeerTracingWrapperWit } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetCacheConfigTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnSetCacheConfig = [](ze_kernel_handle_t hKernel, ze_cache_config_flags_t flags) { return ZE_RESULT_SUCCESS; }; @@ -179,7 +179,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetCacheConfigTracingWrapperWi } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetModulePropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetModuleProperties = [](ze_device_handle_t hDevice, ze_device_module_properties_t *pModuleProperties) { return ZE_RESULT_SUCCESS; }; @@ -195,7 +195,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetModulePropertiesTracingWrap } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetMemoryAccessPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetMemoryAccessProperties = [](ze_device_handle_t hDevice, ze_device_memory_access_properties_t *pMemAccessProperties) { return ZE_RESULT_SUCCESS; }; @@ -211,7 +211,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetMemoryAccessPropertiesTraci } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetCommandQueueGroupPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetCommandQueueGroupProperties = [](ze_device_handle_t hDevice, uint32_t *pCount, ze_command_queue_group_properties_t *pCommandQueueGroupProperties) { return ZE_RESULT_SUCCESS; }; @@ -226,7 +226,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetCommandQueueGroupProperties } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetExternalMemoryPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetExternalMemoryProperties = [](ze_device_handle_t hDevice, ze_device_external_memory_properties_t *pExternalMemoryProperties) { return ZE_RESULT_SUCCESS; }; @@ -241,7 +241,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetExternalMemoryPropertiesTra } TEST_F(ZeApiTracingRuntimeTests, WhenCallingDeviceGetStatusTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Device.pfnGetStatus = [](ze_device_handle_t hDevice) { return ZE_RESULT_SUCCESS; }; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_driver_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_driver_api_tracing.cpp index 30f9137dff..89f9e226bd 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_driver_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_driver_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Driver.pfnGet = [](uint32_t *pCount, ze_driver_handle_t *phDrivers) { return ZE_RESULT_SUCCESS; }; @@ -26,7 +26,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetTracingWrapperWithOneSetO } TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Driver.pfnGetProperties = [](ze_driver_handle_t hDriver, ze_driver_properties_t *properties) { return ZE_RESULT_SUCCESS; }; @@ -40,7 +40,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetPropertiesTracingWrapperW } TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetApiVersionTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Driver.pfnGetApiVersion = [](ze_driver_handle_t hDrivers, ze_api_version_t *version) { return ZE_RESULT_SUCCESS; }; @@ -55,7 +55,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetApiVersionTracingWrapperW } TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetIpcPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Driver.pfnGetIpcProperties = [](ze_driver_handle_t hDrivers, ze_driver_ipc_properties_t *pIpcProperties) { return ZE_RESULT_SUCCESS; }; @@ -71,7 +71,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetIpcPropertiesTracingWrapp } TEST_F(ZeApiTracingRuntimeTests, WhenCallingzeDriverGetExtensionPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionProperties = [](ze_driver_handle_t hDrivers, uint32_t *pCount, diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_event_api_multi_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_event_api_multi_tracing.cpp index a17853aa8c..aa7848c2f4 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_event_api_multi_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_event_api_multi_tracing.cpp @@ -25,7 +25,7 @@ struct { } event_create_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventCreateTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_create_args.hEventPool0 = generateRandomHandle(); @@ -259,7 +259,7 @@ struct { } event_destroy_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventDestroyTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_destroy_args.hEvent0 = generateRandomHandle(); @@ -388,7 +388,7 @@ struct { } event_host_signal_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventHostSignalTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_host_signal_args.hEvent0 = generateRandomHandle(); @@ -519,7 +519,7 @@ struct { } event_host_synchronize_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventHostSynchronizeTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_host_synchronize_args.hEvent0 = generateRandomHandle(); @@ -658,7 +658,7 @@ struct { } event_query_status_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventQueryStatusTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_query_status_args.hEvent0 = generateRandomHandle(); @@ -787,7 +787,7 @@ struct { } event_reset_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventHostResetTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_reset_args.hEvent0 = generateRandomHandle(); @@ -930,7 +930,7 @@ struct { } event_pool_create_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventPoolCreateTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_pool_create_args.hContext0 = generateRandomHandle(); @@ -1217,7 +1217,7 @@ struct { } event_pool_destroy_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventPoolDestroyTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_pool_destroy_args.hEventPool0 = generateRandomHandle(); @@ -1366,7 +1366,7 @@ static bool eventPoolGetIpcHandlesCompare(ze_ipc_event_pool_handle_t *phIpc0, ze } TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventPoolGetIpcHandleTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_pool_get_ipc_handle_args.hEventPool0 = generateRandomHandle(); @@ -1530,7 +1530,7 @@ static bool eventPoolOpenIpcHandlesCompare(ze_ipc_event_pool_handle_t *phIpc0, z } TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventPoolOpenIpcHandleTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_pool_open_ipc_handle_args.hContext0 = generateRandomHandle(); @@ -1769,7 +1769,7 @@ struct { } event_pool_close_ipc_handle_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingEventPoolCloseIpcHandleTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set event_pool_close_ipc_handle_args.hEventPool0 = generateRandomHandle(); @@ -1902,7 +1902,7 @@ struct { } command_list_append_signal_event_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingCommandListAppendSignalEventTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set command_list_append_signal_event_args.hCommandList0 = generateRandomHandle(); @@ -2043,7 +2043,7 @@ struct { } command_list_append_wait_on_events_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingCommandListAppendWaitOnEventsTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set command_list_append_wait_on_events_args.hCommandList0 = generateRandomHandle(); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_event_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_event_api_tracing.cpp index 71afb94614..4f5475bdde 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_event_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_event_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnCreate = [](ze_event_pool_handle_t hEventPool, const ze_event_desc_t *desc, ze_event_handle_t *phEvent) { return ZE_RESULT_SUCCESS; }; ze_event_handle_t event = {}; @@ -28,7 +28,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventCreateTracingWrapperWithOneSetO } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnDestroy = [](ze_event_handle_t hEvent) { return ZE_RESULT_SUCCESS; }; @@ -43,7 +43,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventDestroyTracingWrapperWithOneSet } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventHostSignalTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnHostSignal = [](ze_event_handle_t hEvent) { return ZE_RESULT_SUCCESS; }; prologCbs.Event.pfnHostSignalCb = genericPrologCallbackPtr; @@ -57,7 +57,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventHostSignalTracingWrapperWithOne } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventHostSynchronizeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnHostSynchronize = [](ze_event_handle_t hEvent, uint64_t timeout) { return ZE_RESULT_SUCCESS; }; prologCbs.Event.pfnHostSynchronizeCb = genericPrologCallbackPtr; @@ -71,7 +71,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventHostSynchronizeTracingWrapperWi } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventQueryStatusTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnQueryStatus = [](ze_event_handle_t hEvent) { return ZE_RESULT_SUCCESS; }; prologCbs.Event.pfnQueryStatusCb = genericPrologCallbackPtr; @@ -85,7 +85,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventQueryStatusTracingWrapperWithOn } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventHostResetTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnHostReset = [](ze_event_handle_t hEvent) { return ZE_RESULT_SUCCESS; }; prologCbs.Event.pfnHostResetCb = genericPrologCallbackPtr; @@ -99,7 +99,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventHostResetTracingWrapperWithOneS } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.EventPool.pfnCreate = [](ze_context_handle_t hContext, const ze_event_pool_desc_t *desc, @@ -117,7 +117,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolCreateTracingWrapperWithOne } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.EventPool.pfnDestroy = [](ze_event_pool_handle_t hEventPool) { return ZE_RESULT_SUCCESS; }; prologCbs.EventPool.pfnDestroyCb = genericPrologCallbackPtr; @@ -131,7 +131,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolDestroyTracingWrapperWithOn } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolGetIpcHandleTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.EventPool.pfnGetIpcHandle = [](ze_event_pool_handle_t hEventPool, ze_ipc_event_pool_handle_t *phIpc) { return ZE_RESULT_SUCCESS; }; ze_ipc_event_pool_handle_t phIpc; @@ -147,7 +147,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolGetIpcHandleTracingWrapperW } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolOpenIpcHandleTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.EventPool.pfnOpenIpcHandle = [](ze_context_handle_t hDriver, ze_ipc_event_pool_handle_t hIpc, @@ -166,7 +166,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolOpenIpcHandleTracingWrapper } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolCloseIpcHandleTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.EventPool.pfnCloseIpcHandle = [](ze_event_pool_handle_t hEventPool) { return ZE_RESULT_SUCCESS; }; prologCbs.EventPool.pfnCloseIpcHandleCb = genericPrologCallbackPtr; @@ -182,7 +182,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventPoolCloseIpcHandleTracingWrappe // Command List API with Events TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendSignalEventTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendSignalEvent = [](ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent) { return ZE_RESULT_SUCCESS; }; prologCbs.CommandList.pfnAppendSignalEventCb = genericPrologCallbackPtr; @@ -196,7 +196,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendSignalEventTracingW } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendWaitOnEventsTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendWaitOnEvents = [](ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t *phEvents) { return ZE_RESULT_SUCCESS; }; @@ -213,7 +213,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendWaitOnEventsTracing } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendEventResetTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendEventReset = [](ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent) { return ZE_RESULT_SUCCESS; }; @@ -228,7 +228,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendEventResetTracingWr } TEST_F(ZeApiTracingRuntimeTests, WhenCallingEventQueryKernelTimestampTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Event.pfnQueryKernelTimestamp = [](ze_event_handle_t hEvent, ze_kernel_timestamp_result_t *dstptr) { return ZE_RESULT_SUCCESS; }; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_fence_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_fence_api_tracing.cpp index 1afe5adc72..b11e8c9a68 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_fence_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_fence_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Fence.pfnCreate = [](ze_command_queue_handle_t hCommandQueue, const ze_fence_desc_t *desc, ze_fence_handle_t *phFence) { return ZE_RESULT_SUCCESS; }; ze_fence_handle_t fence = {}; @@ -28,7 +28,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceCreateTracingWrapperWithOneSetO } TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Fence.pfnDestroy = [](ze_fence_handle_t hFence) { return ZE_RESULT_SUCCESS; }; @@ -43,7 +43,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceDestroyTracingWrapperWithOneSet } TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceHostSynchronizeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Fence.pfnHostSynchronize = [](ze_fence_handle_t hFence, uint64_t timeout) { return ZE_RESULT_SUCCESS; }; prologCbs.Fence.pfnHostSynchronizeCb = genericPrologCallbackPtr; @@ -57,7 +57,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceHostSynchronizeTracingWrapperWi } TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceQueryStatusTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Fence.pfnQueryStatus = [](ze_fence_handle_t hFence) { return ZE_RESULT_SUCCESS; }; prologCbs.Fence.pfnQueryStatusCb = genericPrologCallbackPtr; @@ -71,7 +71,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceQueryStatusTracingWrapperWithOn } TEST_F(ZeApiTracingRuntimeTests, WhenCallingFenceResetTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Fence.pfnReset = [](ze_fence_handle_t hFence) { return ZE_RESULT_SUCCESS; }; prologCbs.Fence.pfnResetCb = genericPrologCallbackPtr; @@ -97,7 +97,7 @@ struct { } fence_create_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingFenceCreateTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set fence_create_args.hCommandQueue0 = generateRandomHandle(); @@ -333,7 +333,7 @@ struct { } fence_destroy_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingFenceDestroyTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set fence_destroy_args.hFence0 = generateRandomHandle(); @@ -464,7 +464,7 @@ struct { } fence_host_synchronize_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingFenceHostSynchronizeTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set fence_host_synchronize_args.hFence0 = generateRandomHandle(); @@ -603,7 +603,7 @@ struct { } fence_query_status_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingFenceQueryStatusTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set fence_query_status_args.hFence0 = generateRandomHandle(); @@ -732,7 +732,7 @@ struct { } fence_reset_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingFenceResetTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set fence_reset_args.hFence0 = generateRandomHandle(); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_global_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_global_api_tracing.cpp index 448ece1af9..d1a32b4d9f 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_global_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_global_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingInitTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Global.pfnInit = [](ze_init_flags_t flags) { return ZE_RESULT_SUCCESS; }; prologCbs.Global.pfnInitCb = genericPrologCallbackPtr; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_image_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_image_api_tracing.cpp index 04aa6afcee..4aa0eece44 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_image_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_image_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingImageGetPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Image.pfnGetProperties = [](ze_device_handle_t hDevice, const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) { return ZE_RESULT_SUCCESS; }; const ze_image_desc_t desc = {}; @@ -28,7 +28,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingImageGetPropertiesTracingWrapperWith } TEST_F(ZeApiTracingRuntimeTests, WhenCallingImageCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Image.pfnCreate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t *desc, ze_image_handle_t *phImage) { return ZE_RESULT_SUCCESS; }; const ze_image_desc_t desc = {}; @@ -45,7 +45,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingImageCreateTracingWrapperWithOneSetO } TEST_F(ZeApiTracingRuntimeTests, WhenCallingImageDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Image.pfnDestroy = [](ze_image_handle_t hImage) { return ZE_RESULT_SUCCESS; }; prologCbs.Image.pfnDestroyCb = genericPrologCallbackPtr; @@ -72,7 +72,7 @@ struct { } ImageGetProperties_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingImageGetPropertiesTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set ImageGetProperties_args.hDevice0 = generateRandomHandle(); @@ -224,7 +224,7 @@ struct { } ImageCreate_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingImageCreateTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set ImageCreate_args.hContext0 = generateRandomHandle(); @@ -478,7 +478,7 @@ struct { } ImageDestroy_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingImageDestroyTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set ImageDestroy_args.hImage0 = generateRandomHandle(); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_memory_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_memory_api_tracing.cpp index 1c60b56268..1f9c2d61ac 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_memory_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_memory_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemAllocSharedTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Mem.pfnAllocShared = [](ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t *deviceDesc, const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment, ze_device_handle_t hDevice, void **pptr) { return ZE_RESULT_SUCCESS; }; @@ -32,7 +32,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemAllocSharedTracingWrapperWithOneS } TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemAllocDeviceTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Mem.pfnAllocDevice = [](ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t *deviceDesc, size_t size, size_t alignment, ze_device_handle_t hDevice, void **pptr) { return ZE_RESULT_SUCCESS; }; @@ -54,7 +54,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemAllocDeviceTracingWrapperWithOneS TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemAllocHostTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnAllocHost = [](ze_context_handle_t hContext, const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment, void **pptr) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; size_t size = 1024; size_t alignment = 4096; ze_host_mem_alloc_desc_t hostDesc = {}; @@ -73,7 +73,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemAllocHostTracingWrapperWithOneSet TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemFreeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnFree = [](ze_context_handle_t hContext, void *ptr) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.Mem.pfnFreeCb = genericPrologCallbackPtr; epilogCbs.Mem.pfnFreeCb = genericEpilogCallbackPtr; @@ -88,7 +88,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemFreeTracingWrapperWithOneSetOfPro TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemGetAllocPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnGetAllocProperties = [](ze_context_handle_t hContext, const void *ptr, ze_memory_allocation_properties_t *pMemAllocProperties, ze_device_handle_t *phDevice) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.Mem.pfnGetAllocPropertiesCb = genericPrologCallbackPtr; epilogCbs.Mem.pfnGetAllocPropertiesCb = genericEpilogCallbackPtr; @@ -103,7 +103,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemGetAllocPropertiesTracingWrapperW TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemGetAddressRangeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnGetAddressRange = [](ze_context_handle_t hContext, const void *ptr, void **pBase, size_t *pSize) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.Mem.pfnGetAddressRangeCb = genericPrologCallbackPtr; epilogCbs.Mem.pfnGetAddressRangeCb = genericEpilogCallbackPtr; @@ -118,7 +118,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemGetAddressRangeTracingWrapperWith TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemGetIpcHandleTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnGetIpcHandle = [](ze_context_handle_t hContext, const void *ptr, ze_ipc_mem_handle_t *pIpcHandle) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.Mem.pfnGetIpcHandleCb = genericPrologCallbackPtr; epilogCbs.Mem.pfnGetIpcHandleCb = genericEpilogCallbackPtr; @@ -133,7 +133,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemGetIpcHandleTracingWrapperWithOne TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemOpenIpcHandleTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnOpenIpcHandle = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_ipc_mem_handle_t handle, ze_ipc_memory_flags_t flags, void **pptr) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; ze_ipc_mem_handle_t ipchandle = {}; @@ -150,7 +150,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemOpenIpcHandleTracingWrapperWithOn TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemCloseIpcHandleTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.Mem.pfnCloseIpcHandle = [](ze_context_handle_t hContext, const void *ptr) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.Mem.pfnCloseIpcHandleCb = genericPrologCallbackPtr; epilogCbs.Mem.pfnCloseIpcHandleCb = genericEpilogCallbackPtr; @@ -165,7 +165,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingMemCloseIpcHandleTracingWrapperWithO TEST_F(ZeApiTracingRuntimeTests, WhenCallingPhysicalMemCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.PhysicalMem.pfnCreate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_physical_mem_desc_t *desc, ze_physical_mem_handle_t *phPhysicalMemory) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.PhysicalMem.pfnCreateCb = genericPrologCallbackPtr; epilogCbs.PhysicalMem.pfnCreateCb = genericEpilogCallbackPtr; @@ -181,7 +181,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingPhysicalMemCreateTracingWrapperWithO TEST_F(ZeApiTracingRuntimeTests, WhenCallingPhysicalMemDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.PhysicalMem.pfnDestroy = [](ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMemory) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.PhysicalMem.pfnDestroyCb = genericPrologCallbackPtr; epilogCbs.PhysicalMem.pfnDestroyCb = genericEpilogCallbackPtr; @@ -197,7 +197,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingPhysicalMemDestroyTracingWrapperWith TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemFreeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnFree = [](ze_context_handle_t hContext, const void *ptr, size_t size) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnFreeCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnFreeCb = genericEpilogCallbackPtr; @@ -213,7 +213,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemFreeTracingWrapperWithOneS TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemGetAccessAttributeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnGetAccessAttribute = [](ze_context_handle_t hContext, const void *ptr, size_t size, ze_memory_access_attribute_t *access, size_t *outSize) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnGetAccessAttributeCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnGetAccessAttributeCb = genericEpilogCallbackPtr; @@ -229,7 +229,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemGetAccessAttributeTracingW TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemMapTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnMap = [](ze_context_handle_t hContext, const void *ptr, size_t size, ze_physical_mem_handle_t hPhysicalMemory, size_t offset, ze_memory_access_attribute_t access) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnMapCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnMapCb = genericEpilogCallbackPtr; @@ -245,7 +245,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemMapTracingWrapperWithOneSe TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemQueryPageSizeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnQueryPageSize = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t size, size_t *pagesize) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnQueryPageSizeCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnQueryPageSizeCb = genericEpilogCallbackPtr; @@ -261,7 +261,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemQueryPageSizeTracingWrappe TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemReserveTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnReserve = [](ze_context_handle_t hContext, const void *pStart, size_t size, void **pptr) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnReserveCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnReserveCb = genericEpilogCallbackPtr; @@ -277,7 +277,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemReserveTracingWrapperWithO TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemSetAccessAttributeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnSetAccessAttribute = [](ze_context_handle_t hContext, const void *ptr, size_t size, ze_memory_access_attribute_t access) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnSetAccessAttributeCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnSetAccessAttributeCb = genericEpilogCallbackPtr; @@ -293,7 +293,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemSetAccessAttributeTracingW TEST_F(ZeApiTracingRuntimeTests, WhenCallingVirtualMemUnmapTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { driver_ddiTable.core_ddiTable.VirtualMem.pfnUnmap = [](ze_context_handle_t hContext, const void *ptr, size_t size) { return ZE_RESULT_SUCCESS; }; - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; prologCbs.VirtualMem.pfnUnmapCb = genericPrologCallbackPtr; epilogCbs.VirtualMem.pfnUnmapCb = genericEpilogCallbackPtr; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_module_api_multi_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_module_api_multi_tracing.cpp index 7d80b7a3fc..c6ecbdbb95 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_module_api_multi_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_module_api_multi_tracing.cpp @@ -47,7 +47,7 @@ static bool moduleCreateDescCompare(const ze_module_desc_t *phIpc0, const ze_mod } TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingModuleCreateTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set module_create_args.hContext0 = generateRandomHandle(); @@ -386,7 +386,7 @@ struct { } module_destroy_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingModuleDestroyTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set module_destroy_args.hModule0 = generateRandomHandle(); @@ -539,7 +539,7 @@ static bool moduleGetNativeBinaryNativeBinaryCompare(uint8_t *binary0, uint8_t * } TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingModuleGetNativeBinaryTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set module_get_native_binary_args.hModule0 = generateRandomHandle(); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_module_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_module_api_tracing.cpp index c27c08b683..5f07153f23 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_module_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_module_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnCreate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_module_desc_t *pDesc, ze_module_handle_t *phModule, ze_module_build_log_handle_t *phBuildLog) { return ZE_RESULT_SUCCESS; }; ze_module_desc_t desc = {}; @@ -29,7 +29,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleCreateTracingWrapperWithOneSet } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnDestroy = [](ze_module_handle_t hModule) { return ZE_RESULT_SUCCESS; }; @@ -44,7 +44,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleDestroyTracingWrapperWithOneSe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleBuildLogDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.ModuleBuildLog.pfnDestroy = [](ze_module_build_log_handle_t hModuleBuildLog) { return ZE_RESULT_SUCCESS; }; @@ -59,7 +59,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleBuildLogDestroyTracingWrapperW } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleBuildLogGetStringTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.ModuleBuildLog.pfnGetString = [](ze_module_build_log_handle_t hModuleBuildLog, size_t *pSize, char *pBuildLog) { return ZE_RESULT_SUCCESS; }; @@ -77,7 +77,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleBuildLogGetStringTracingWrappe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetNativeBinaryTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnGetNativeBinary = [](ze_module_handle_t hModule, size_t *pSize, uint8_t *pModuleNativeBinary) { return ZE_RESULT_SUCCESS; }; size_t pSize = {}; @@ -94,7 +94,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetNativeBinaryTracingWrapperW } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetGlobalPointerTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnGetGlobalPointer = [](ze_module_handle_t hModule, const char *pGlobalName, size_t *pSize, void **pPtr) { return ZE_RESULT_SUCCESS; }; const char pGlobalName = {}; @@ -112,7 +112,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetGlobalPointerTracingWrapper } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnCreate = [](ze_module_handle_t hModule, const ze_kernel_desc_t *pDesc, ze_kernel_handle_t *phKernel) { return ZE_RESULT_SUCCESS; }; const ze_kernel_desc_t desc = {}; @@ -129,7 +129,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelCreateTracingWrapperWithOneSet } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnDestroy = [](ze_kernel_handle_t hKernel) { return ZE_RESULT_SUCCESS; }; @@ -144,7 +144,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelDestroyTracingWrapperWithOneSe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetFunctionPointerTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnGetFunctionPointer = [](ze_module_handle_t hModule, const char *pKernelName, void **pfnFunction) { return ZE_RESULT_SUCCESS; }; const char pKernelName = {}; @@ -161,7 +161,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetFunctionPointerTracingWrapp } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetGroupSizeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnSetGroupSize = [](ze_kernel_handle_t hKernel, uint32_t groupSizeX, uint32_t groupSizeY, uint32_t groupSizeZ) { return ZE_RESULT_SUCCESS; }; uint32_t groupSizeX = {}; @@ -179,7 +179,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetGroupSizeTracingWrapperWith } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSuggestGroupSizeTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnSuggestGroupSize = [](ze_kernel_handle_t hKernel, uint32_t globalSizeX, uint32_t globalSizeY, uint32_t globalSizeZ, uint32_t *groupSizeX, uint32_t *groupSizeY, uint32_t *groupSizeZ) { return ZE_RESULT_SUCCESS; }; uint32_t globalSizeX = {}; @@ -200,7 +200,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSuggestGroupSizeTracingWrapper } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetArgumentValueTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnSetArgumentValue = [](ze_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize, const void *pArgValue) { return ZE_RESULT_SUCCESS; }; uint32_t argIndex = {}; @@ -218,7 +218,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetArgumentValueTracingWrapper } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnGetProperties = [](ze_kernel_handle_t hKernel, ze_kernel_properties_t *pKernelProperties) { return ZE_RESULT_SUCCESS; }; @@ -233,7 +233,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetPropertiesTracingWrapperWit } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchKernelTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendLaunchKernel = [](ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t *pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) { return ZE_RESULT_SUCCESS; }; @@ -253,7 +253,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchKernelTracing } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchKernelIndirectTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendLaunchKernelIndirect = [](ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t *pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) { return ZE_RESULT_SUCCESS; }; @@ -273,7 +273,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchKernelIndirec } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchMultipleKernelsIndirectTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendLaunchMultipleKernelsIndirect = [](ze_command_list_handle_t hCommandList, uint32_t numKernels, ze_kernel_handle_t *phKernels, const uint32_t *pNumLaunchArguments, const ze_group_count_t *pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, @@ -297,7 +297,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchMultipleKerne } TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchCooperativeKernelTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.CommandList.pfnAppendLaunchCooperativeKernel = [](ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t *pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) { return ZE_RESULT_SUCCESS; }; @@ -312,7 +312,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingCommandListAppendLaunchCooperativeKe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetKernelNamesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnGetKernelNames = [](ze_module_handle_t hDevice, uint32_t *pCount, const char **pNames) { return ZE_RESULT_SUCCESS; }; @@ -327,7 +327,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetKernelNamesTracingWrapperWi } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSuggestMaxCooperativeGroupCountTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnSuggestMaxCooperativeGroupCount = [](ze_kernel_handle_t hKernel, uint32_t *totalGroupCount) { return ZE_RESULT_SUCCESS; }; @@ -342,7 +342,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSuggestMaxCooperativeGroupCoun } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetIndirectAccessTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnGetIndirectAccess = [](ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t *pFlags) { return ZE_RESULT_SUCCESS; }; @@ -357,7 +357,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetIndirectAccessTracingWrappe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetNameTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnGetName = [](ze_kernel_handle_t hKernel, size_t *pSize, char *pName) { return ZE_RESULT_SUCCESS; }; @@ -372,7 +372,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetNameTracingWrapperWithOneSe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetSourceAttributesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnGetSourceAttributes = [](ze_kernel_handle_t hKernel, uint32_t *pSize, char **pString) { return ZE_RESULT_SUCCESS; }; @@ -387,7 +387,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelGetSourceAttributesTracingWrap } TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetIndirectAccessTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Kernel.pfnSetIndirectAccess = [](ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t flags) { return ZE_RESULT_SUCCESS; }; @@ -402,7 +402,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingKernelSetIndirectAccessTracingWrappe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleDynamicLinkTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnDynamicLink = [](uint32_t numModules, ze_module_handle_t *phModules, ze_module_build_log_handle_t *phLinkLog) { return ZE_RESULT_SUCCESS; }; @@ -417,7 +417,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleDynamicLinkTracingWrapperWithO } TEST_F(ZeApiTracingRuntimeTests, WhenCallingModuleGetPropertiesTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Module.pfnGetProperties = [](ze_module_handle_t hModule, ze_module_properties_t *pModuleProperties) { return ZE_RESULT_SUCCESS; }; diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_residency_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_residency_api_tracing.cpp index 8606269b2f..9b08a68d2d 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_residency_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_residency_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnCreate = [](ze_driver_handle_t hContext, const ze_context_desc_t *desc, ze_context_handle_t *phContext) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnCreateCb = genericPrologCallbackPtr; @@ -25,7 +25,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextCreateTracingWrapperWithOneSe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnDestroy = [](ze_context_handle_t hContext) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnDestroyCb = genericPrologCallbackPtr; @@ -39,7 +39,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextDestroyTracingWrapperWithOneS } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextGetStatusTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnGetStatus = [](ze_context_handle_t hContext) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnGetStatusCb = genericPrologCallbackPtr; @@ -53,7 +53,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextGetStatusTracingWrapperWithOn } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextSystemBarrierTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnSystemBarrier = [](ze_context_handle_t hContext, ze_device_handle_t hDevice) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnSystemBarrierCb = genericPrologCallbackPtr; @@ -67,7 +67,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextSystemBarrierTracingWrapperWi } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextMakeMemoryResidentTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnMakeMemoryResident = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, void *ptr, size_t size) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnMakeMemoryResidentCb = genericPrologCallbackPtr; @@ -81,7 +81,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextMakeMemoryResidentTracingWrap } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextEvictMemoryTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnEvictMemory = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, void *ptr, size_t size) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnEvictMemoryCb = genericPrologCallbackPtr; @@ -95,7 +95,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextEvictMemoryTracingWrapperWith } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextMakeImageResidentTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnMakeImageResident = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnMakeImageResidentCb = genericPrologCallbackPtr; @@ -109,7 +109,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextMakeImageResidentTracingWrapp } TEST_F(ZeApiTracingRuntimeTests, WhenCallingContextEvictImageTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Context.pfnEvictImage = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage) { return ZE_RESULT_SUCCESS; }; prologCbs.Context.pfnEvictImageCb = genericPrologCallbackPtr; @@ -137,7 +137,7 @@ struct { TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingContextMakeMemoryResidentTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set MakeMemoryResident_args.hContext0 = generateRandomHandle(); @@ -303,7 +303,7 @@ struct { } EvictMemory_args; TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingContextEvictMemoryTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set EvictMemory_args.hContext0 = generateRandomHandle(); @@ -465,7 +465,7 @@ struct { TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingContextMakeImageResidentTracingWrapperWithMultiplePrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set MakeImageResident_args.hContext0 = generateRandomHandle(); @@ -620,7 +620,7 @@ struct { TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingContextMakeImageResidentTracingWrapperWithMultiplefPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set EvictImage_args.hContext0 = generateRandomHandle(); diff --git a/level_zero/core/test/unit_tests/sources/tracing/test_sampler_api_tracing.cpp b/level_zero/core/test/unit_tests/sources/tracing/test_sampler_api_tracing.cpp index 21d5973c0a..d0c5b75fe0 100644 --- a/level_zero/core/test/unit_tests/sources/tracing/test_sampler_api_tracing.cpp +++ b/level_zero/core/test/unit_tests/sources/tracing/test_sampler_api_tracing.cpp @@ -11,7 +11,7 @@ namespace L0 { namespace ult { TEST_F(ZeApiTracingRuntimeTests, WhenCallingSamplerCreateTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Sampler.pfnCreate = [](ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t *pDesc, ze_sampler_handle_t *phSampler) { return ZE_RESULT_SUCCESS; }; prologCbs.Sampler.pfnCreateCb = genericPrologCallbackPtr; @@ -25,7 +25,7 @@ TEST_F(ZeApiTracingRuntimeTests, WhenCallingSamplerCreateTracingWrapperWithOneSe } TEST_F(ZeApiTracingRuntimeTests, WhenCallingSamplerDestroyTracingWrapperWithOneSetOfPrologEpilogsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; driver_ddiTable.core_ddiTable.Sampler.pfnDestroy = [](ze_sampler_handle_t hSampler) { return ZE_RESULT_SUCCESS; }; prologCbs.Sampler.pfnDestroyCb = genericPrologCallbackPtr; @@ -54,7 +54,7 @@ struct { TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingSamplerCreateTracingWrapperWithTwoSetsOfPrologEpilogsCheckArgumentsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set sampler_create_args.hContext0 = generateRandomHandle(); @@ -301,7 +301,7 @@ struct { TEST_F(ZeApiTracingRuntimeMultipleArgumentsTests, WhenCallingSamplerDestroyTracingWrapperWithTwoSetsOfPrologEpilogsCheckArgumentsThenReturnSuccess) { - ze_result_t result; + ze_result_t result = ZE_RESULT_SUCCESS; // initialize initial argument set sampler_destroy_args.hSampler0 = generateRandomHandle(); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp index d7ac7228c3..b0217b2d9c 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp @@ -51,8 +51,9 @@ HWTEST2_F(KernelPropertyTest, givenDG2WhenGetInternalOptionsThenWriteBackBuildOp auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface); MockModuleTranslationUnit moduleTu(this->device); - auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); - EXPECT_TRUE(ret); + ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE; + result = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos); }