Revert "Check for context in appendMemoryCopy"

This reverts commit 32bab85f7e.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-12-21 04:39:44 +01:00
committed by Compute-Runtime-Automation
parent 1292ea26f5
commit 429755e0f4
54 changed files with 214 additions and 445 deletions

View File

@@ -229,7 +229,7 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
moduleDesc.format = builtinCode.type == BuiltInCodeType::Binary ? ZE_MODULE_FORMAT_NATIVE : ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = reinterpret_cast<uint8_t *>(&builtinCode.resource[0]);
moduleDesc.inputSize = builtinCode.resource.size();
res = device->createModule(nullptr, &moduleDesc, &moduleHandle, nullptr, ModuleType::Builtin);
res = device->createModule(&moduleDesc, &moduleHandle, nullptr, ModuleType::Builtin);
UNRECOVERABLE_IF(res != ZE_RESULT_SUCCESS);
module.reset(Module::fromHandle(moduleHandle));

View File

@@ -12,7 +12,6 @@
#include "shared/source/memory_manager/prefetch_manager.h"
#include "shared/source/unified_memory/unified_memory.h"
#include "level_zero/core/source/context/context.h"
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
@@ -27,7 +26,6 @@ struct EventPool;
struct Event;
struct Kernel;
struct CommandQueue;
struct Context;
struct CmdListKernelLaunchParams {
bool isIndirect = false;
@@ -297,7 +295,7 @@ struct CommandList : _ze_command_list_handle_t {
return this->isTbxMode && !this->isSyncModeQueue;
}
Context *context = nullptr;
ze_context_handle_t hContext = nullptr;
std::vector<Kernel *> printfKernelContainer;
CommandQueue *cmdQImmediate = nullptr;
NEO::CommandStreamReceiver *csr = nullptr;

View File

@@ -12,7 +12,6 @@
#include "shared/source/helpers/vec.h"
#include "shared/source/kernel/kernel_arg_descriptor.h"
#include "shared/source/memory_manager/memory_pool.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "level_zero/core/source/builtin/builtin_functions_lib.h"
#include "level_zero/core/source/cmdlist/cmdlist_imp.h"
@@ -41,7 +40,6 @@ struct AlignedAllocationData {
size_t offset = 0u;
NEO::GraphicsAllocation *alloc = nullptr;
bool needsFlush = false;
NEO::SvmAllocationData *allocData = nullptr;
};
struct CmdListFillKernelArguments {

View File

@@ -1198,13 +1198,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}
if ((dstAllocationStruct.allocData && dstAllocationStruct.allocData->context != this->context) ||
(srcAllocationStruct.allocData && srcAllocationStruct.allocData->context != this->context)) {
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"Destination and source pointers need to be part of the same context as the list %s\n", "");
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
if (size >= 4ull * MemoryConstants::gigaByte) {
isStateless = true;
}
@@ -1963,7 +1956,7 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
}
}
return {alignedPtr, offset, alloc, hostPointerNeedsFlush, allocData};
return {alignedPtr, offset, alloc, hostPointerNeedsFlush};
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -90,8 +90,7 @@ ze_result_t ContextImp::allocHostMem(const ze_host_mem_alloc_desc_t *hostDesc,
}
auto usmPtr = this->driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size,
unifiedMemoryProperties,
this);
unifiedMemoryProperties);
if (usmPtr == nullptr) {
return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
}
@@ -188,7 +187,7 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice,
}
void *usmPtr =
this->driverHandle->svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, this);
this->driverHandle->svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
if (usmPtr == nullptr) {
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}
@@ -289,8 +288,7 @@ ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice,
auto usmPtr = this->driverHandle->svmAllocsManager->createSharedUnifiedMemoryAllocation(size,
unifiedMemoryProperties,
static_cast<void *>(neoDevice->getSpecializedDevice<L0::Device>()),
this);
static_cast<void *>(neoDevice->getSpecializedDevice<L0::Device>()));
if (usmPtr == nullptr) {
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}
@@ -513,10 +511,6 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice,
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(*ptr);
UNRECOVERABLE_IF(alloc == nullptr);
alloc->context = static_cast<void *>(this);
return ZE_RESULT_SUCCESS;
}
@@ -543,10 +537,6 @@ ze_result_t ContextImp::openIpcMemHandles(ze_device_handle_t hDevice,
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(*pptr);
UNRECOVERABLE_IF(alloc == nullptr);
alloc->context = static_cast<void *>(this);
return ZE_RESULT_SUCCESS;
}
@@ -759,7 +749,7 @@ ze_result_t ContextImp::createModule(ze_device_handle_t hDevice,
const ze_module_desc_t *desc,
ze_module_handle_t *phModule,
ze_module_build_log_handle_t *phBuildLog) {
return L0::Device::fromHandle(hDevice)->createModule(this, desc, phModule, phBuildLog, ModuleType::User);
return L0::Device::fromHandle(hDevice)->createModule(desc, phModule, phBuildLog, ModuleType::User);
}
ze_result_t ContextImp::createSampler(ze_device_handle_t hDevice,
@@ -779,7 +769,7 @@ ze_result_t ContextImp::createCommandList(ze_device_handle_t hDevice,
ze_command_list_handle_t *commandList) {
auto ret = L0::Device::fromHandle(hDevice)->createCommandList(desc, commandList);
if (*commandList) {
L0::CommandList::fromHandle(*commandList)->context = this;
L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle();
}
return ret;
}
@@ -789,7 +779,7 @@ ze_result_t ContextImp::createCommandListImmediate(ze_device_handle_t hDevice,
ze_command_list_handle_t *commandList) {
auto ret = L0::Device::fromHandle(hDevice)->createCommandListImmediate(desc, commandList);
if (*commandList) {
L0::CommandList::fromHandle(*commandList)->context = this;
L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle();
}
return ret;
}

View File

@@ -65,7 +65,7 @@ struct BcsSplit {
cmdList->appendEventForProfilingAllWalkers(Event::fromHandle(hSignalEvent), true, true);
}
auto markerEventIndex = this->events.obtainForSplit(cmdList->context, MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate<gfxCoreFamily>::GfxFamily::TimestampPacketType));
auto markerEventIndex = this->events.obtainForSplit(Context::fromHandle(cmdList->hContext), MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate<gfxCoreFamily>::GfxFamily::TimestampPacketType));
auto subcopyEventIndex = markerEventIndex * this->cmdQs.size();
StackVec<ze_event_handle_t, 4> eventHandles;

View File

@@ -11,7 +11,6 @@
#include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "level_zero/core/source/context/context.h"
#include <level_zero/ze_api.h>
#include <level_zero/zet_api.h>
@@ -35,7 +34,6 @@ struct ExecutionEnvironment;
class MetricDeviceContext;
struct SysmanDevice;
struct DebugSession;
struct Context;
enum class ModuleType;
@@ -59,7 +57,7 @@ struct Device : _ze_device_handle_t {
virtual ze_result_t createImage(const ze_image_desc_t *desc, ze_image_handle_t *phImage) = 0;
virtual ze_result_t createModule(Context *context, const ze_module_desc_t *desc, ze_module_handle_t *module,
virtual ze_result_t createModule(const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) = 0;
virtual ze_result_t createSampler(const ze_sampler_desc_t *pDesc,
ze_sampler_handle_t *phSampler) = 0;

View File

@@ -119,7 +119,6 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
contextImp->allocDeviceMem(this->toHandle(), &deviceDesc, 8, 1, &memory);
contextImp->allocDeviceMem(hPeerDevice, &peerDeviceDesc, 8, 1, &peerMemory);
L0::CommandList::fromHandle(commandList)->context = contextImp;
auto ret = L0::CommandList::fromHandle(commandList)->appendMemoryCopy(peerMemory, memory, 8, nullptr, 0, nullptr);
L0::CommandList::fromHandle(commandList)->close();
@@ -398,7 +397,7 @@ ze_result_t DeviceImp::createSampler(const ze_sampler_desc_t *desc,
}
}
ze_result_t DeviceImp::createModule(Context *context, const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_result_t DeviceImp::createModule(const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) {
ModuleBuildLog *moduleBuildLog = nullptr;
@@ -408,7 +407,7 @@ ze_result_t DeviceImp::createModule(Context *context, const ze_module_desc_t *de
}
ze_result_t result = ZE_RESULT_SUCCESS;
auto modulePtr = Module::create(context, this, desc, moduleBuildLog, type, &result);
auto modulePtr = Module::create(this, desc, moduleBuildLog, type, &result);
if (modulePtr != nullptr) {
*module = modulePtr;
}

View File

@@ -12,7 +12,6 @@
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
#include "level_zero/core/source/context/context_imp.h"
#include "level_zero/core/source/device/bcs_split.h"
#include "level_zero/core/source/device/device.h"
@@ -28,7 +27,6 @@ namespace L0 {
struct SysmanDevice;
struct FabricVertex;
class CacheReservation;
struct Context;
struct DeviceImp : public Device {
DeviceImp();
@@ -42,7 +40,7 @@ struct DeviceImp : public Device {
ze_result_t createCommandQueue(const ze_command_queue_desc_t *desc,
ze_command_queue_handle_t *commandQueue) override;
ze_result_t createImage(const ze_image_desc_t *desc, ze_image_handle_t *phImage) override;
ze_result_t createModule(Context *context, const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_result_t createModule(const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override;
ze_result_t createSampler(const ze_sampler_desc_t *pDesc,
ze_sampler_handle_t *phSampler) override;

View File

@@ -70,8 +70,7 @@ ze_result_t DriverHandleImp::createContext(const ze_context_desc_t *desc,
}
} else {
for (uint32_t i = 0; i < numDevices; i++) {
DeviceImp *device = static_cast<DeviceImp *>(Device::fromHandle(phDevices[i]));
auto neoDevice = device->getNEODevice();
auto neoDevice = Device::fromHandle(phDevices[i])->getNEODevice();
context->getDevices().insert(std::make_pair(neoDevice->getRootDeviceIndex(), phDevices[i]));
context->rootDeviceIndices.push_back(neoDevice->getRootDeviceIndex());
context->deviceBitfields.insert({neoDevice->getRootDeviceIndex(),

View File

@@ -7,7 +7,6 @@
#pragma once
#include "level_zero/core/source/context/context.h"
#include <level_zero/ze_api.h>
#include <memory>
@@ -20,7 +19,6 @@ namespace L0 {
struct Device;
struct ModuleBuildLog;
struct KernelImmutableData;
struct Context;
enum class ModuleType {
Builtin,
@@ -29,7 +27,7 @@ enum class ModuleType {
struct Module : _ze_module_handle_t {
static Module *create(Context *context, Device *device, const ze_module_desc_t *desc, ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result);
static Module *create(Device *device, const ze_module_desc_t *desc, ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result);
virtual ~Module() = default;
@@ -65,16 +63,6 @@ struct Module : _ze_module_handle_t {
static Module *fromHandle(ze_module_handle_t handle) { return static_cast<Module *>(handle); }
inline ze_module_handle_t toHandle() { return this; }
void setContext(Context *context) {
this->context = context;
}
Context *getContext() {
return this->context;
}
Context *context = nullptr;
};
} // namespace L0

View File

@@ -375,18 +375,13 @@ ze_result_t ModuleTranslationUnit::processUnpackedBinary() {
return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
}
Context *context = nullptr;
if (module) {
context = module->getContext();
}
auto svmAllocsManager = device->getDriverHandle()->getSvmAllocsManager();
if (programInfo.globalConstants.size != 0) {
this->globalConstBuffer = NEO::allocateGlobalsSurface(svmAllocsManager, *device->getNEODevice(), programInfo.globalConstants.size, true, programInfo.linkerInput.get(), programInfo.globalConstants.initData, context);
this->globalConstBuffer = NEO::allocateGlobalsSurface(svmAllocsManager, *device->getNEODevice(), programInfo.globalConstants.size, true, programInfo.linkerInput.get(), programInfo.globalConstants.initData);
}
if (programInfo.globalVariables.size != 0) {
this->globalVarBuffer = NEO::allocateGlobalsSurface(svmAllocsManager, *device->getNEODevice(), programInfo.globalVariables.size, false, programInfo.linkerInput.get(), programInfo.globalVariables.initData, context);
this->globalVarBuffer = NEO::allocateGlobalsSurface(svmAllocsManager, *device->getNEODevice(), programInfo.globalVariables.size, false, programInfo.linkerInput.get(), programInfo.globalVariables.initData);
}
for (auto &kernelInfo : this->programInfo.kernelInfos) {
@@ -468,7 +463,6 @@ ModuleImp::ModuleImp(Device *device, ModuleBuildLog *moduleBuildLog, ModuleType
: device(device), translationUnit(std::make_unique<ModuleTranslationUnit>(device)),
moduleBuildLog(moduleBuildLog), type(type) {
productFamily = device->getHwInfo().platform.eProductFamily;
translationUnit->module = this;
}
ModuleImp::~ModuleImp() {
@@ -1028,12 +1022,10 @@ ze_result_t ModuleImp::getGlobalPointer(const char *pGlobalName, size_t *pSize,
return ZE_RESULT_SUCCESS;
}
Module *Module::create(Context *context, Device *device, const ze_module_desc_t *desc,
Module *Module::create(Device *device, const ze_module_desc_t *desc,
ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result) {
auto module = new ModuleImp(device, moduleBuildLog, type);
module->setContext(context);
*result = module->initialize(desc, device->getNEODevice());
if (*result != ZE_RESULT_SUCCESS) {
module->destroy();

View File

@@ -25,7 +25,6 @@ struct Segments;
}
} // namespace NEO
namespace L0 {
struct Module;
namespace BuildOptions {
extern NEO::ConstStringRef optDisable;
@@ -57,7 +56,6 @@ struct ModuleTranslationUnit {
void updateBuildLog(const std::string &newLogEntry);
void processDebugData();
L0::Device *device = nullptr;
L0::Module *module = nullptr;
NEO::GraphicsAllocation *globalConstBuffer = nullptr;
NEO::GraphicsAllocation *globalVarBuffer = nullptr;

View File

@@ -27,8 +27,8 @@ TEST_F(AUBHelloWorldL0, whenAppendMemoryCopyIsCalledThenMemoryIsProperlyCopied)
context->rootDeviceIndices,
context->deviceBitfields);
auto srcMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
auto dstMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
auto srcMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
auto dstMemory = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
memset(srcMemory, val, size);
commandList->appendMemoryCopy(dstMemory, srcMemory, size, 0, 0, nullptr);

View File

@@ -73,10 +73,10 @@ HWTEST_F(L0BindlessAub, DISABLED_GivenBindlessKernelWhenExecutedThenOutputIsCorr
context->rootDeviceIndices,
context->deviceBitfields);
auto bufferSrc = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr);
auto bufferSrc = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties);
memset(bufferSrc, 55, bufferSize);
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr);
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties);
memset(bufferDst, 0, bufferSize);
auto simulatedCsr = AUBFixtureL0::getSimulatedCsr<FamilyType>();

View File

@@ -60,9 +60,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGlobalWorkSizeIsPr
context->rootDeviceIndices,
context->deviceBitfields);
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr);
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties);
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
memset(outBuffer, 0, size);
@@ -104,9 +104,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenGroupCountIsProper
context->rootDeviceIndices,
context->deviceBitfields);
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr);
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties);
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
memset(outBuffer, 0, size);
@@ -179,9 +179,9 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyP
uint8_t size = sizeof(uint32_t);
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties, nullptr);
auto pDispatchTraits = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(sizeof(ze_group_count_t), unifiedMemoryProperties);
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
auto outBuffer = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(size, unifiedMemoryProperties);
memset(outBuffer, 0, size);

View File

@@ -91,7 +91,7 @@ HWTEST2_F(DebuggerSingleAddressSpaceAub, GivenSingleAddressSpaceWhenCmdListIsExe
context->rootDeviceIndices,
context->deviceBitfields);
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties, nullptr);
auto bufferDst = driverHandle->svmAllocsManager->createHostUnifiedMemoryAllocation(bufferSize, unifiedMemoryProperties);
memset(bufferDst, 0, bufferSize);
auto simulatedCsr = AUBFixtureL0::getSimulatedCsr<FamilyType>();

View File

@@ -110,12 +110,10 @@ void ModuleImmutableDataFixture::tearDown() {
DeviceFixture::tearDown();
}
Module *ModuleFixture::ProxyModuleImp::create(L0::Context *context, L0::Device *device, const ze_module_desc_t *desc,
Module *ModuleFixture::ProxyModuleImp::create(L0::Device *device, const ze_module_desc_t *desc,
ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result) {
auto module = new ProxyModuleImp(device, moduleBuildLog, type);
module->setContext(context);
*result = module->initialize(desc, device->getNEODevice());
if (*result != ZE_RESULT_SUCCESS) {
module->destroy();
@@ -142,7 +140,7 @@ void ModuleFixture::createModuleFromMockBinary(ModuleType type) {
ModuleBuildLog *moduleBuildLog = nullptr;
ze_result_t result = ZE_RESULT_SUCCESS;
module.reset(ProxyModuleImp::create(context, device, &moduleDesc, moduleBuildLog, type, &result));
module.reset(ProxyModuleImp::create(device, &moduleDesc, moduleBuildLog, type, &result));
}
void ModuleFixture::createKernel() {
@@ -188,8 +186,7 @@ void MultiDeviceModuleFixture::createModuleFromMockBinary(uint32_t rootDeviceInd
ModuleBuildLog *moduleBuildLog = nullptr;
ze_result_t result = ZE_RESULT_SUCCESS;
modules[rootDeviceIndex].reset(Module::create(context,
device,
modules[rootDeviceIndex].reset(Module::create(device,
&moduleDesc,
moduleBuildLog, ModuleType::User, &result));
}

View File

@@ -122,7 +122,7 @@ struct ModuleFixture : public DeviceFixture {
return kernelImmDatas;
}
static Module *create(L0::Context *context, L0::Device *device, const ze_module_desc_t *desc,
static Module *create(L0::Device *device, const ze_module_desc_t *desc,
ModuleBuildLog *moduleBuildLog, ModuleType type, ze_result_t *result);
};

View File

@@ -63,7 +63,7 @@ struct MockBuiltinFunctionsLibImplTimestamps : BuiltinFunctionsLibImpl {
moduleDesc.format = builtInCode.type == BuiltInCodeType::Binary ? ZE_MODULE_FORMAT_NATIVE : ZE_MODULE_FORMAT_IL_SPIRV;
moduleDesc.pInputModule = reinterpret_cast<uint8_t *>(&builtInCode.resource[0]);
moduleDesc.inputSize = builtInCode.resource.size();
res = device->createModule(nullptr, &moduleDesc, &moduleHandle, nullptr, ModuleType::Builtin);
res = device->createModule(&moduleDesc, &moduleHandle, nullptr, ModuleType::Builtin);
UNRECOVERABLE_IF(res != ZE_RESULT_SUCCESS);
module.reset(Module::fromHandle(moduleHandle));

View File

@@ -36,7 +36,7 @@ struct Mock<Device> : public Device {
ADDMETHOD_NOBASE(createCommandListImmediate, ze_result_t, ZE_RESULT_SUCCESS, (const ze_command_queue_desc_t *desc, ze_command_list_handle_t *commandList));
ADDMETHOD_NOBASE(createCommandQueue, ze_result_t, ZE_RESULT_SUCCESS, (const ze_command_queue_desc_t *desc, ze_command_queue_handle_t *commandQueue));
ADDMETHOD_NOBASE(createImage, ze_result_t, ZE_RESULT_SUCCESS, (const ze_image_desc_t *desc, ze_image_handle_t *phImage));
ADDMETHOD_NOBASE(createModule, ze_result_t, ZE_RESULT_SUCCESS, (Context * context, const ze_module_desc_t *desc, ze_module_handle_t *module, ze_module_build_log_handle_t *buildLog, ModuleType type));
ADDMETHOD_NOBASE(createModule, ze_result_t, ZE_RESULT_SUCCESS, (const ze_module_desc_t *desc, ze_module_handle_t *module, ze_module_build_log_handle_t *buildLog, ModuleType type));
ADDMETHOD_NOBASE(createSampler, ze_result_t, ZE_RESULT_SUCCESS, (const ze_sampler_desc_t *pDesc, ze_sampler_handle_t *phSampler));
ADDMETHOD_NOBASE(getComputeProperties, ze_result_t, ZE_RESULT_SUCCESS, (ze_device_compute_properties_t * pComputeProperties));
ADDMETHOD_NOBASE(getP2PProperties, ze_result_t, ZE_RESULT_SUCCESS, (ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t *pP2PProperties));

View File

@@ -17,7 +17,7 @@
namespace L0 {
namespace ult {
template <bool useImagesBuiltins, bool isStateless>
ze_result_t MockDeviceForSpv<useImagesBuiltins, isStateless>::createModule(Context *context, const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_result_t MockDeviceForSpv<useImagesBuiltins, isStateless>::createModule(const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) {
const std::string builtinCopyfill("builtin_copyfill");
const std::string builtinImages("builtin_images");
@@ -42,7 +42,7 @@ ze_result_t MockDeviceForSpv<useImagesBuiltins, isStateless>::createModule(Conte
ModuleBuildLog *moduleBuildLog = nullptr;
ze_result_t result = ZE_RESULT_SUCCESS;
mockModulePtr.reset(Module::create(context, this, &moduleDesc, moduleBuildLog, ModuleType::Builtin, &result));
mockModulePtr.reset(Module::create(this, &moduleDesc, moduleBuildLog, ModuleType::Builtin, &result));
wasModuleCreated = true;
useImagesBuiltins_prev = useImagesBuiltins;
isStateless_prev = isStateless;

View File

@@ -27,7 +27,7 @@ class MockDeviceForSpv : public Mock<DeviceImp> {
this->driverHandle = driverHandle;
wasModuleCreated = false;
}
ze_result_t createModule(Context *context, const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_result_t createModule(const ze_module_desc_t *desc, ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override;
~MockDeviceForSpv() override {
}

View File

@@ -30,8 +30,7 @@ struct MockDeviceForRebuildBuilins : public Mock<DeviceImp> {
MockDeviceForRebuildBuilins(NEO::Device *device) : Mock(device, device->getExecutionEnvironment()) {
}
ze_result_t createModule(Context *context,
const ze_module_desc_t *desc,
ze_result_t createModule(const ze_module_desc_t *desc,
ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override {

View File

@@ -47,7 +47,7 @@ ze_result_t Mock<DriverHandle>::allocDeviceMem(ze_device_handle_t hDevice, const
size_t size, size_t alignment, void **ptr) {
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties, nullptr);
auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
if (allocation == nullptr) {
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;

View File

@@ -39,7 +39,7 @@ class BuiltinFunctionsLibFixture : public DeviceFixture {
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
moduleDesc.pInputModule = nullptr;
moduleDesc.inputSize = 0u;
res = device->createModule(nullptr, &moduleDesc, &moduleHandle, nullptr, ModuleType::Builtin);
res = device->createModule(&moduleDesc, &moduleHandle, nullptr, ModuleType::Builtin);
UNRECOVERABLE_IF(res != ZE_RESULT_SUCCESS);
module.reset(Module::fromHandle(moduleHandle));
@@ -211,8 +211,7 @@ HWTEST_F(TestBuiltinFunctionsLibImplDefault, givenRebuildPrecompiledKernelsDebug
builtins = BuiltinFunctionsLib::create(this, neoDevice->getBuiltIns());
}
ze_result_t createModule(Context *context,
const ze_module_desc_t *desc,
ze_result_t createModule(const ze_module_desc_t *desc,
ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override {
EXPECT_EQ(desc->format, ZE_MODULE_FORMAT_IL_SPIRV);
@@ -246,8 +245,7 @@ HWTEST_F(TestBuiltinFunctionsLibImplDefault, givenNotToRebuildPrecompiledKernels
builtins = BuiltinFunctionsLib::create(this, neoDevice->getBuiltIns());
}
ze_result_t createModule(Context *context,
const ze_module_desc_t *desc,
ze_result_t createModule(const ze_module_desc_t *desc,
ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override {
EXPECT_EQ(desc->format, ZE_MODULE_FORMAT_NATIVE);
@@ -255,7 +253,7 @@ HWTEST_F(TestBuiltinFunctionsLibImplDefault, givenNotToRebuildPrecompiledKernels
EXPECT_NE(desc->pInputModule, nullptr);
createModuleCalled = true;
return DeviceImp::createModule(context, desc, module, buildLog, type);
return DeviceImp::createModule(desc, module, buildLog, type);
}
bool createModuleCalled = false;
@@ -280,15 +278,14 @@ HWTEST_F(TestBuiltinFunctionsLibImplDefault, GivenBuiltinsWhenInitializingFuncti
builtins = BuiltinFunctionsLib::create(this, neoDevice->getBuiltIns());
}
ze_result_t createModule(Context *context,
const ze_module_desc_t *desc,
ze_result_t createModule(const ze_module_desc_t *desc,
ze_module_handle_t *module,
ze_module_build_log_handle_t *buildLog, ModuleType type) override {
typeCreated = type;
EXPECT_EQ(ModuleType::Builtin, type);
return DeviceImp::createModule(context, desc, module, buildLog, type);
return DeviceImp::createModule(desc, module, buildLog, type);
}
ModuleType typeCreated = ModuleType::User;

View File

@@ -29,35 +29,15 @@ namespace ult {
using ContextCommandListCreate = Test<DeviceFixture>;
TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextWithWrongOrdinalThenErrorIsReturned) {
ze_command_list_desc_t desc = {};
ze_command_list_handle_t hCommandList = {};
desc.commandQueueGroupOrdinal = std::numeric_limits<uint32_t>::max();
ze_result_t result = context->createCommandList(device, &desc, &hCommandList);
EXPECT_NE(ZE_RESULT_SUCCESS, result);
}
TEST_F(ContextCommandListCreate, whenCreatingImmediateCommandListFromContextWithWrongOrdinalThenErrorIsReturned) {
ze_command_queue_desc_t desc = {};
ze_command_list_handle_t hCommandList = {};
desc.ordinal = std::numeric_limits<uint32_t>::max();
ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList);
EXPECT_NE(ZE_RESULT_SUCCESS, result);
}
TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextThenSuccessIsReturned) {
ze_command_list_desc_t desc = {};
ze_command_list_handle_t hCommandList = {};
ze_result_t result = context->createCommandList(device, &desc, &hCommandList);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(CommandList::fromHandle(hCommandList)->context, context);
EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context);
L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList);
EXPECT_NE(commandList->context, nullptr);
commandList->destroy();
}
@@ -77,11 +57,9 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListImmediateFromContextThen
ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(CommandList::fromHandle(hCommandList)->context, context);
EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context);
L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList);
EXPECT_NE(commandList->context, nullptr);
commandList->destroy();
}

View File

@@ -616,7 +616,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInExternalHostAl
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocationThenBuiltinFlagAndDestinationAllocSystemIsSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
commandList->context = context;
constexpr size_t allocSize = 4096;
void *dstBuffer = nullptr;
@@ -637,7 +636,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocat
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAllocationThenBuiltinFlagIsSetAndDestinationAllocSystemNotSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
commandList->context = context;
constexpr size_t size = 4096u;
constexpr size_t alignment = 4096u;
@@ -648,9 +646,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAlloc
&deviceDesc,
size, alignment, &dstBuffer);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(dstBuffer);
EXPECT_NE(alloc, nullptr);
EXPECT_EQ(alloc->context, context);
void *srcPtr = reinterpret_cast<void *>(0x1234);
@@ -662,62 +657,6 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAlloc
context->freeMem(dstBuffer);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmDeviceAllocationWithDifferentContextThanCommandListThenInvalidArgumentIsReturned, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
std::unique_ptr<L0::ContextImp> context1 = std::make_unique<L0::ContextImp>(driverHandle.get());
commandList->context = context1.get();
constexpr size_t size = 4096u;
constexpr size_t alignment = 4096u;
void *dstBuffer = nullptr;
ze_device_mem_alloc_desc_t deviceDesc = {};
auto result = context->allocDeviceMem(device->toHandle(),
&deviceDesc,
size, alignment, &dstBuffer);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(dstBuffer);
EXPECT_NE(alloc, nullptr);
EXPECT_EQ(alloc->context, context);
void *srcPtr = reinterpret_cast<void *>(0x1234);
ze_result_t res = commandList->appendMemoryCopy(dstBuffer, srcPtr, 8, nullptr, 0, nullptr);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
res = commandList->appendMemoryCopy(srcPtr, dstBuffer, 8, nullptr, 0, nullptr);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
context->freeMem(dstBuffer);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryCopyInUsmHostAllocationWithDifferentContextThanCommandListThenInvalidArgumentIsReturned, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
std::unique_ptr<L0::ContextImp> context1 = std::make_unique<L0::ContextImp>(driverHandle.get());
commandList->context = context1.get();
constexpr size_t size = 4096u;
constexpr size_t alignment = 4096u;
void *dstBuffer = nullptr;
ze_host_mem_alloc_desc_t hostDesc = {};
auto result = context->allocHostMem(&hostDesc,
size, alignment, &dstBuffer);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
void *srcPtr = reinterpret_cast<void *>(0x1234);
ze_result_t res = commandList->appendMemoryCopy(dstBuffer, srcPtr, 8, nullptr, 0, nullptr);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
res = commandList->appendMemoryCopy(srcPtr, dstBuffer, 8, nullptr, 0, nullptr);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_ARGUMENT);
context->freeMem(dstBuffer);
}
HWTEST2_F(CommandListTest, givenComputeCommandListWhenMemoryFillInUsmHostThenBuiltinFlagAndDestinationAllocSystemIsSet, IsAtLeastSkl) {
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u);

View File

@@ -2241,7 +2241,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW
void *usmSrcPtr;
ze_host_mem_alloc_desc_t hostDesc = {};
context->allocHostMem(&hostDesc, 1024, 1u, &usmSrcPtr);
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, usmSrcPtr, 1024, nullptr, 0, nullptr);
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
context->freeMem(usmSrcPtr);
@@ -2253,7 +2253,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmDstHostPtrW
void *usmHostDstPtr;
ze_host_mem_alloc_desc_t hostDesc = {};
context->allocHostMem(&hostDesc, 1024, 1u, &usmHostDstPtr);
cmdList.context = context;
cmdList.appendMemoryCopy(usmHostDstPtr, nonUsmHostPtr, 1024, nullptr, 0, nullptr);
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
context->freeMem(usmHostDstPtr);
@@ -2265,7 +2265,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW
void *usmHostSrcPtr;
ze_host_mem_alloc_desc_t hostDesc = {};
context->allocHostMem(&hostDesc, 1024, 1u, &usmHostSrcPtr);
cmdList.context = context;
cmdList.appendMemoryCopy(nonUsmHostPtr, usmHostSrcPtr, 1024, nullptr, 0, nullptr);
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
context->freeMem(usmHostSrcPtr);
@@ -2274,7 +2274,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndUsmSrcHostPtrW
HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmSrcHostPtrWhenSizeTooLargeThenUseGpuMemcpy, IsAtLeastSkl) {
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 3 * MemoryConstants::megaByte, nullptr, 0, nullptr);
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
}
@@ -2282,7 +2281,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmSrcHostP
HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndNonUsmDstHostPtrWhenSizeTooLargeThenUseGpuMemcpy, IsAtLeastSkl) {
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.context = context;
cmdList.appendMemoryCopy(nonUsmHostPtr, devicePtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr);
EXPECT_GE(cmdList.appendMemoryCopyKernelWithGACalled, 1u);
}
@@ -2292,7 +2290,7 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndD2HCopyWhenSiz
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver;
cmdList.context = context;
cmdList.appendMemoryCopy(nonUsmHostPtr, devicePtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr);
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalled, 0u);
}
@@ -2302,7 +2300,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndH2DCopyWhenSiz
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver;
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 3 * MemoryConstants::megaByte, nullptr, 0, nullptr);
EXPECT_EQ(cmdList.appendMemoryCopyKernelWithGACalled, 0u);
}
@@ -2322,7 +2319,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndCpuMemcpyWithD
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
auto phEvent = event->toHandle();
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, nullptr, 1, &phEvent);
EXPECT_EQ(cmdList.appendBarrierCalled, 1u);
}
@@ -2331,7 +2327,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndCpuMemcpyWitho
MockAppendMemoryLockedCopyTestImmediateCmdList<gfxCoreFamily> cmdList;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.csr = device->getNEODevice()->getInternalEngine().commandStreamReceiver;
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, nullptr, 0, nullptr);
EXPECT_EQ(cmdList.appendBarrierCalled, 0u);
}
@@ -2355,7 +2350,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndTimestampFlagS
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
auto phEvent = event->toHandle();
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, phEvent, 0, nullptr);
ze_kernel_timestamp_result_t resultTimestamp = {};
auto result = event->queryKernelTimestamp(&resultTimestamp);
@@ -2388,7 +2382,6 @@ HWTEST2_F(AppendMemoryLockedCopyTest, givenImmediateCommandListAndTimestampFlagN
auto event = std::unique_ptr<Event>(Event::create<uint32_t>(eventPool.get(), &eventDesc, device));
auto phEvent = event->toHandle();
cmdList.context = context;
cmdList.appendMemoryCopy(devicePtr, nonUsmHostPtr, 2 * MemoryConstants::kiloByte, phEvent, 0, nullptr);
ze_kernel_timestamp_result_t resultTimestamp = {};
auto result = event->queryKernelTimestamp(&resultTimestamp);

View File

@@ -151,13 +151,13 @@ TEST_F(MultiDeviceContextTests,
struct SVMAllocsManagerContextMock : public NEO::SVMAllocsManager {
SVMAllocsManagerContextMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
void *createHostUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties, void *context) override {
void *createHostUnifiedMemoryAllocation(size_t size, const UnifiedMemoryProperties &memoryProperties) override {
EXPECT_EQ(expectedRootDeviceIndexes.size(), memoryProperties.rootDeviceIndices.size());
EXPECT_NE(std::find(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end(), expectedRootDeviceIndexes[0]),
memoryProperties.rootDeviceIndices.end());
EXPECT_NE(std::find(memoryProperties.rootDeviceIndices.begin(), memoryProperties.rootDeviceIndices.end(), expectedRootDeviceIndexes[1]),
memoryProperties.rootDeviceIndices.end());
return NEO::SVMAllocsManager::createHostUnifiedMemoryAllocation(size, memoryProperties, context);
return NEO::SVMAllocsManager::createHostUnifiedMemoryAllocation(size, memoryProperties);
}
std::vector<uint32_t> expectedRootDeviceIndexes;
@@ -747,7 +747,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests,
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device, nullptr);
auto sharedPtr = svmManager->createSharedUnifiedMemoryAllocation(4096u, unifiedMemoryProperties, device);
EXPECT_NE(nullptr, sharedPtr);
auto allocation = svmManager->getSVMAlloc(sharedPtr);

View File

@@ -810,15 +810,13 @@ TEST_F(MemoryTest, whenAllocatingDeviceMemoryAsRayTracingAllocationAddressIsIn48
struct SVMAllocsManagerSharedAllocZexPointerMock : public NEO::SVMAllocsManager {
SVMAllocsManagerSharedAllocZexPointerMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
void *createHostUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &memoryProperties,
void *context) override {
const UnifiedMemoryProperties &memoryProperties) override {
hostUnifiedMemoryAllocationTimes++;
return alignedMalloc(4096u, 4096u);
}
void *createSharedUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &svmProperties,
void *cmdQ,
void *context) override {
void *cmdQ) override {
sharedUnifiedMemoryAllocationTimes++;
return alignedMalloc(4096u, 4096u);
@@ -1076,8 +1074,7 @@ TEST_F(FreeExtTests,
struct SVMAllocsManagerOutOFMemoryMock : public NEO::SVMAllocsManager {
SVMAllocsManagerOutOFMemoryMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
void *createUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &svmProperties,
void *context) override {
const UnifiedMemoryProperties &svmProperties) override {
return nullptr;
}
};
@@ -1133,23 +1130,19 @@ TEST_F(OutOfMemoryTests,
struct SVMAllocsManagerRelaxedSizeMock : public NEO::SVMAllocsManager {
SVMAllocsManagerRelaxedSizeMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
void *createUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &svmProperties,
void *context) override {
const UnifiedMemoryProperties &svmProperties) override {
return alignedMalloc(4096u, 4096u);
}
void *createSharedUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &svmProperties,
void *cmdQ,
void *context) override {
void *cmdQ) override {
return alignedMalloc(4096u, 4096u);
}
void *createHostUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &memoryProperties,
void *context) override {
const UnifiedMemoryProperties &memoryProperties) override {
return alignedMalloc(4096u, 4096u);
}
};
@@ -2283,7 +2276,7 @@ struct MultipleDevicePeerAllocationTest : public ::testing::Test {
ModuleBuildLog *moduleBuildLog = nullptr;
ze_result_t result = ZE_RESULT_SUCCESS;
module.reset(Module::create(static_cast<L0::Context *>(context.get()), device, &moduleDesc, moduleBuildLog, type, &result));
module.reset(Module::create(device, &moduleDesc, moduleBuildLog, type, &result));
}
void SetUp() override {
@@ -3823,8 +3816,7 @@ struct SVMAllocsManagerSharedAllocFailMock : public NEO::SVMAllocsManager {
SVMAllocsManagerSharedAllocFailMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
void *createSharedUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &svmProperties,
void *cmdQ,
void *context) override {
void *cmdQ) override {
return nullptr;
}
};
@@ -3877,8 +3869,7 @@ TEST_F(SharedAllocFailTests, whenAllocatinSharedMemoryAndAllocationFailsThenOutO
struct SVMAllocsManagerSharedAllocMultiDeviceMock : public NEO::SVMAllocsManager {
SVMAllocsManagerSharedAllocMultiDeviceMock(MemoryManager *memoryManager) : NEO::SVMAllocsManager(memoryManager, false) {}
void *createHostUnifiedMemoryAllocation(size_t size,
const UnifiedMemoryProperties &memoryProperties,
void *context) override {
const UnifiedMemoryProperties &memoryProperties) override {
createHostUnifiedMemoryAllocationTimes++;
return alignedMalloc(4096u, 4096u);
}

View File

@@ -2151,9 +2151,7 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildPrecompiledKernelsFlagAndFileWit
moduleDesc.inputSize = src.size();
Module module(device, nullptr, ModuleType::User);
module.setContext(context);
MockModuleTU *tu = new MockModuleTU(device);
tu->module = &module;
module.translationUnit.reset(tu);
ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
@@ -2300,19 +2298,9 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromNativeBinaryThenSetsUpPacked
target.stepping = programTokens.header->SteppingId;
target.maxPointerSizeInBytes = programTokens.header->GPUPointerSizeInBytes;
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
const auto &src = zebinData->storage;
ze_module_desc_t moduleDesc = {};
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.data());
moduleDesc.inputSize = src.size();
ze_result_t result = ZE_RESULT_SUCCESS;
auto module = std::unique_ptr<L0::Module>(Module::create(context, device, &moduleDesc, nullptr, ModuleType::User, &result));
auto arData = encoder.encode();
L0::ModuleTranslationUnit moduleTuValid(this->device);
moduleTuValid.module = module.get();
result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
result = moduleTuValid.createFromNativeBinary(reinterpret_cast<const char *>(arData.data()), arData.size());
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
EXPECT_NE(moduleTuValid.packedDeviceBinarySize, arData.size());
@@ -2714,7 +2702,7 @@ HWTEST_F(PrintfModuleTest, GivenModuleWithPrintfWhenKernelIsCreatedThenPrintfAll
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.data());
moduleDesc.inputSize = src.size();
ze_result_t result = ZE_RESULT_SUCCESS;
auto module = std::unique_ptr<L0::Module>(Module::create(context, device, &moduleDesc, nullptr, ModuleType::User, &result));
auto module = std::unique_ptr<L0::Module>(Module::create(device, &moduleDesc, nullptr, ModuleType::User, &result));
auto kernel = std::make_unique<Mock<Kernel>>();
ASSERT_NE(nullptr, kernel);

View File

@@ -32,7 +32,7 @@ class ModuleOnlineCompiled : public DeviceFixture, public testing::Test {
modDesc.inputSize = static_cast<uint32_t>(src.size());
modDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.data());
ze_result_t result = ZE_RESULT_SUCCESS;
module.reset(whiteboxCast(Module::create(context, device, &modDesc, nullptr, ModuleType::User, &result)));
module.reset(whiteboxCast(Module::create(device, &modDesc, nullptr, ModuleType::User, &result)));
ASSERT_NE(nullptr, module);
}
@@ -184,7 +184,7 @@ TEST_F(ModuleOnlineCompiled, WhenCreatingFromNativeBinaryThenGenBinaryIsReturned
modDesc.inputSize = binarySize;
modDesc.pInputModule = reinterpret_cast<const uint8_t *>(storage.get());
ze_result_t initResult = ZE_RESULT_SUCCESS;
L0::Module *moduleFromNativeBinary = Module::create(context, device, &modDesc, nullptr, ModuleType::User, &initResult);
L0::Module *moduleFromNativeBinary = Module::create(device, &modDesc, nullptr, ModuleType::User, &initResult);
EXPECT_NE(nullptr, moduleFromNativeBinary);
delete moduleFromNativeBinary;

View File

@@ -409,7 +409,6 @@ HWTEST2_F(CommandListStatePrefetchXeHpcCore, givenAppendMemoryPrefetchForKmdMigr
ze_command_list_handle_t commandListHandle = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)->toHandle();
auto commandList = CommandList::fromHandle(commandListHandle);
commandList->context = context;
auto commandQueue = CommandQueue::create(productFamily, device, neoDevice->getDefaultEngine().commandStreamReceiver, &queueDesc, commandList->isCopyOnly(), false, returnValue);
ze_event_pool_desc_t eventPoolDesc = {};
@@ -944,7 +943,6 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpcCore,
ze_group_count_t groupCount{8, 1, 1};
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
result = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
commandList->context = context;
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
CmdListKernelLaunchParams launchParams = {};
@@ -1080,7 +1078,6 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule
constexpr size_t offset = 32;
void *copyPtr = reinterpret_cast<uint8_t *>(ptr) + offset;
commandList->context = input.context;
result = commandList->appendMemoryCopy(copyPtr, srcPtr, size - offset, event.get(), 0, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -1141,7 +1138,6 @@ struct CommandListAppendLaunchMultiKernelEventFixture : public LocalMemoryModule
constexpr size_t offset = 32;
void *copyPtr = reinterpret_cast<uint8_t *>(ptr) + offset;
commandList->context = input.context;
result = commandList->appendMemoryCopy(copyPtr, srcPtr, size - offset, event.get(), 0, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);

View File

@@ -301,7 +301,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -353,7 +352,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -403,7 +401,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -421,6 +418,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
context->allocDeviceMem(device->toHandle(),
&deviceDesc,
size, alignment, &dstPtr);
auto result = commandList0->appendMemoryCopy(dstPtr, srcPtr, size, nullptr, 0, nullptr);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
@@ -455,7 +453,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -505,7 +502,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -558,7 +554,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -628,7 +623,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -640,21 +634,21 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 0u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 4u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 5u);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 2u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 8u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 10u);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 2u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 3u);
@@ -685,7 +679,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
@@ -697,14 +690,14 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 0u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(commandList0->context, 10);
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 10);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker.size(), 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.subcopy.size(), 4u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 5u);
auto ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(commandList0->context, 10);
auto ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 10);
EXPECT_EQ(ret, 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
@@ -714,7 +707,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.marker[1]->hostSignal();
ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(commandList0->context, 10);
ret = static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 10);
EXPECT_EQ(ret, 1u);
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.events.pools.size(), 1u);
@@ -746,7 +739,6 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe
NEO::EngineGroupType::Copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
commandList0->context = context;
EXPECT_EQ(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs.size(), 4u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);