mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
refactor: simplify conditions and add unit tests for mcl
- remove always true conditions - move experimental code to experimental implementations - add missing unit tests - extend existing unit tests Related-To: NEO-10492 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
94bbf13b28
commit
c1ec5db4fc
@@ -26,6 +26,36 @@
|
||||
namespace L0 {
|
||||
namespace MCL {
|
||||
|
||||
ze_result_t MutableCommandListImp::getVariable(const InterfaceVariableDescriptor *varDesc, Variable **outVariable) {
|
||||
*outVariable = nullptr;
|
||||
|
||||
std::string varName = varDesc->name == nullptr ? "" : std::string(varDesc->name);
|
||||
|
||||
if (false == varName.empty()) {
|
||||
auto it = variableMap.find(varName);
|
||||
if (it != variableMap.end()) {
|
||||
*outVariable = it->second;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
auto var = std::unique_ptr<Variable>(Variable::create(this->base, varDesc));
|
||||
if (false == varName.empty()) {
|
||||
variableMap.insert(std::make_pair(varName, var.get()));
|
||||
}
|
||||
|
||||
if (var->getDesc().isTemporary) {
|
||||
tempMem.variables.push_back(var.get());
|
||||
}
|
||||
|
||||
*outVariable = var.get();
|
||||
variableStorage.push_back(std::move(var));
|
||||
|
||||
this->hasStageCommitVariables |= varDesc->isStageCommit;
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t MutableCommandListImp::getVariablesList(uint32_t *pVarCount, Variable **outVariables) {
|
||||
*pVarCount = static_cast<uint32_t>(variableStorage.size());
|
||||
if (outVariables != nullptr) {
|
||||
|
||||
@@ -19,13 +19,14 @@ namespace L0::MCL {
|
||||
using State = VariableDescriptor::State;
|
||||
|
||||
Variable *Variable::createFromInfo(ze_command_list_handle_t hCmdList, Program::Decoder::VarInfo &varInfo) {
|
||||
auto var = new Variable(MutableCommandList::fromHandle(hCmdList), varInfo.name);
|
||||
auto var = new Variable(MutableCommandList::fromHandle(hCmdList));
|
||||
|
||||
auto &desc = var->getDesc();
|
||||
desc.type = varInfo.type;
|
||||
desc.size = varInfo.size;
|
||||
desc.isTemporary = varInfo.tmp;
|
||||
desc.isScalable = varInfo.scalable;
|
||||
desc.name = varInfo.name;
|
||||
if (varInfo.type == VariableType::buffer) {
|
||||
var->setBufferUsages(std::move(varInfo.bufferUsages));
|
||||
} else if (varInfo.type == VariableType::value) {
|
||||
@@ -180,4 +181,18 @@ ze_result_t Variable::selectImmediateAddKernelArgUsageHandler(const NEO::ArgDesc
|
||||
}
|
||||
}
|
||||
|
||||
void Variable::setDescExperimentalValues(const InterfaceVariableDescriptor *ifaceVarDesc) {
|
||||
desc.name = ifaceVarDesc->name == nullptr ? "" : std::string(ifaceVarDesc->name);
|
||||
|
||||
if (ifaceVarDesc->isTemporary) {
|
||||
desc.isTemporary = true;
|
||||
if (ifaceVarDesc->isConstSize) {
|
||||
desc.size = ifaceVarDesc->size;
|
||||
} else if (ifaceVarDesc->isScalable) {
|
||||
desc.isScalable = true;
|
||||
desc.eleSize = ifaceVarDesc->size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace L0::MCL
|
||||
|
||||
Reference in New Issue
Block a user