format
This commit is contained in:
parent
f62e353f4a
commit
aa75fdae47
6 changed files with 39 additions and 34 deletions
|
|
@ -697,8 +697,8 @@ static const unsigned int shaders_glsl_logisticregression_comp_spv_len = 4920;
|
|||
}
|
||||
#endif // define SHADEROP_SHADERLOGISTICREGRESSION_HPP
|
||||
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
#define KP_MAX_DIM_SIZE 1
|
||||
|
||||
|
|
@ -1361,10 +1361,8 @@ class Manager
|
|||
{
|
||||
SPDLOG_DEBUG("Kompute Manager evalOp Default triggered");
|
||||
this->mCurrentSequenceIndex++;
|
||||
this->evalOp<T>(tensors,
|
||||
KP_DEFAULT_SESSION +
|
||||
std::to_string(this->mCurrentSequenceIndex),
|
||||
std::forward<TArgs>(params)...);
|
||||
this->evalOp<T>(
|
||||
tensors, KP_DEFAULT_SESSION, std::forward<TArgs>(params)...);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1414,10 +1412,8 @@ class Manager
|
|||
{
|
||||
SPDLOG_DEBUG("Kompute Manager evalOpAsyncDefault triggered");
|
||||
this->mCurrentSequenceIndex++;
|
||||
this->evalOpAsync<T>(tensors,
|
||||
KP_DEFAULT_SESSION +
|
||||
std::to_string(this->mCurrentSequenceIndex),
|
||||
std::forward<TArgs>(params)...);
|
||||
this->evalOpAsync<T>(
|
||||
tensors, KP_DEFAULT_SESSION, std::forward<TArgs>(params)...);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1458,9 +1454,7 @@ class Manager
|
|||
void evalOpAwaitDefault(uint64_t waitFor = UINT64_MAX)
|
||||
{
|
||||
SPDLOG_DEBUG("Kompute Manager evalOpAwaitDefault triggered");
|
||||
this->evalOpAwait(KP_DEFAULT_SESSION +
|
||||
std::to_string(this->mCurrentSequenceIndex),
|
||||
waitFor);
|
||||
this->evalOpAwait(KP_DEFAULT_SESSION, waitFor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1493,7 +1487,10 @@ class Manager
|
|||
}
|
||||
|
||||
/**
|
||||
* Function that simplifies the common workflow of tensor initialisation. It will take the constructor parameters for a Tensor and will will us it to create a new Tensor. The tensor memory will then be managed and owned by the manager.
|
||||
* Function that simplifies the common workflow of tensor initialisation. It
|
||||
* will take the constructor parameters for a Tensor and will will us it to
|
||||
* create a new Tensor. The tensor memory will then be managed and owned by
|
||||
* the manager.
|
||||
*
|
||||
* @param data The data to initialize the tensor with
|
||||
* @param tensorType The type of tensor to initialize
|
||||
|
|
@ -1513,7 +1510,8 @@ class Manager
|
|||
tensor->mapDataIntoHostMemory();
|
||||
}
|
||||
|
||||
std::set<std::shared_ptr<Tensor>>::iterator it = this->mManagedTensors.find(tensor);
|
||||
std::set<std::shared_ptr<Tensor>>::iterator it =
|
||||
this->mManagedTensors.find(tensor);
|
||||
if (it == this->mManagedTensors.end()) {
|
||||
this->mManagedTensors.insert(tensor);
|
||||
}
|
||||
|
|
|
|||
6
src/Manager.cpp
Executable file → Normal file
6
src/Manager.cpp
Executable file → Normal file
|
|
@ -62,7 +62,8 @@ Manager::~Manager()
|
|||
SPDLOG_DEBUG("Kompute Manager explicitly freeing tensors");
|
||||
for (const std::shared_ptr<Tensor>& tensor : this->mManagedTensors) {
|
||||
if (!tensor->isInit()) {
|
||||
SPDLOG_ERROR("Kompute Manager attempted to free managed tensor but not tensor is not initialised");
|
||||
SPDLOG_ERROR("Kompute Manager attempted to free managed tensor "
|
||||
"but not tensor is not initialised");
|
||||
}
|
||||
tensor->freeMemoryDestroyGPUResources();
|
||||
}
|
||||
|
|
@ -142,8 +143,7 @@ Manager::createManagedSequence(std::string sequenceName, uint32_t queueIndex)
|
|||
|
||||
if (sequenceName.empty()) {
|
||||
this->mCurrentSequenceIndex++;
|
||||
this->mManagedSequences.insert(
|
||||
{ KP_DEFAULT_SESSION, sq });
|
||||
this->mManagedSequences.insert({ KP_DEFAULT_SESSION, sq });
|
||||
} else {
|
||||
// TODO: Check if sequence doesn't already exist
|
||||
this->mManagedSequences.insert({ sequenceName, sq });
|
||||
|
|
|
|||
|
|
@ -232,7 +232,8 @@ Tensor::mapDataFromHostMemory()
|
|||
} else if (this->mTensorType == TensorTypes::eDevice) {
|
||||
hostVisibleMemory = this->mStagingMemory;
|
||||
} else {
|
||||
SPDLOG_WARN("Kompute Tensor mapping data not supported on storage tensor");
|
||||
SPDLOG_WARN(
|
||||
"Kompute Tensor mapping data not supported on storage tensor");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +259,8 @@ Tensor::mapDataIntoHostMemory()
|
|||
} else if (this->mTensorType == TensorTypes::eDevice) {
|
||||
hostVisibleMemory = this->mStagingMemory;
|
||||
} else {
|
||||
SPDLOG_WARN("Kompute Tensor mapping data not supported on storage tensor");
|
||||
SPDLOG_WARN(
|
||||
"Kompute Tensor mapping data not supported on storage tensor");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "kompute/Core.hpp"
|
||||
|
||||
|
|
@ -125,9 +125,8 @@ class Manager
|
|||
{
|
||||
SPDLOG_DEBUG("Kompute Manager evalOp Default triggered");
|
||||
this->mCurrentSequenceIndex++;
|
||||
this->evalOp<T>(tensors,
|
||||
KP_DEFAULT_SESSION,
|
||||
std::forward<TArgs>(params)...);
|
||||
this->evalOp<T>(
|
||||
tensors, KP_DEFAULT_SESSION, std::forward<TArgs>(params)...);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -177,9 +176,8 @@ class Manager
|
|||
{
|
||||
SPDLOG_DEBUG("Kompute Manager evalOpAsyncDefault triggered");
|
||||
this->mCurrentSequenceIndex++;
|
||||
this->evalOpAsync<T>(tensors,
|
||||
KP_DEFAULT_SESSION,
|
||||
std::forward<TArgs>(params)...);
|
||||
this->evalOpAsync<T>(
|
||||
tensors, KP_DEFAULT_SESSION, std::forward<TArgs>(params)...);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -220,8 +218,7 @@ class Manager
|
|||
void evalOpAwaitDefault(uint64_t waitFor = UINT64_MAX)
|
||||
{
|
||||
SPDLOG_DEBUG("Kompute Manager evalOpAwaitDefault triggered");
|
||||
this->evalOpAwait(KP_DEFAULT_SESSION,
|
||||
waitFor);
|
||||
this->evalOpAwait(KP_DEFAULT_SESSION, waitFor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -254,7 +251,10 @@ class Manager
|
|||
}
|
||||
|
||||
/**
|
||||
* Function that simplifies the common workflow of tensor initialisation. It will take the constructor parameters for a Tensor and will will us it to create a new Tensor. The tensor memory will then be managed and owned by the manager.
|
||||
* Function that simplifies the common workflow of tensor initialisation. It
|
||||
* will take the constructor parameters for a Tensor and will will us it to
|
||||
* create a new Tensor. The tensor memory will then be managed and owned by
|
||||
* the manager.
|
||||
*
|
||||
* @param data The data to initialize the tensor with
|
||||
* @param tensorType The type of tensor to initialize
|
||||
|
|
@ -274,7 +274,8 @@ class Manager
|
|||
tensor->mapDataIntoHostMemory();
|
||||
}
|
||||
|
||||
std::set<std::shared_ptr<Tensor>>::iterator it = this->mManagedTensors.find(tensor);
|
||||
std::set<std::shared_ptr<Tensor>>::iterator it =
|
||||
this->mManagedTensors.find(tensor);
|
||||
if (it == this->mManagedTensors.end()) {
|
||||
this->mManagedTensors.insert(tensor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ TEST(TestManager, EndToEndOpMultFlow)
|
|||
|
||||
mgr.rebuildTensors({ tensorOutput });
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>(
|
||||
{ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
mgr.evalOpDefault<kp::OpMult>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
|
|
@ -105,7 +106,8 @@ TEST(TestManager, TestMultipleTensorsAtOnce)
|
|||
|
||||
sq->begin();
|
||||
|
||||
sq->record<kp::OpTensorSyncDevice>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
sq->record<kp::OpTensorSyncDevice>(
|
||||
{ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
sq->record<kp::OpMult>({ tensorLHS, tensorRHS, tensorOutput });
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ TEST(TestMultipleAlgoExecutions, ManagerEvalMultSourceStrOpCreate)
|
|||
|
||||
mgr.rebuildTensors({ tensorInA, tensorInB, tensorOut });
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorInA, tensorInB, tensorOut });
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>(
|
||||
{ tensorInA, tensorInB, tensorOut });
|
||||
|
||||
std::string shader(R"(
|
||||
// The version to use
|
||||
|
|
@ -306,7 +307,8 @@ TEST(TestMultipleAlgoExecutions, ManagerEvalMultSourceStrMgrCreate)
|
|||
}
|
||||
)");
|
||||
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>({ tensorInA, tensorInB, tensorOut });
|
||||
mgr.evalOpDefault<kp::OpTensorSyncDevice>(
|
||||
{ tensorInA, tensorInB, tensorOut });
|
||||
|
||||
mgr.evalOpDefault<kp::OpAlgoBase>(
|
||||
{ tensorInA, tensorInB, tensorOut },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue