Reformatted
This commit is contained in:
parent
4b8c1c49f0
commit
46cee7767b
3 changed files with 82 additions and 88 deletions
|
|
@ -31,8 +31,7 @@ Sequence::~Sequence()
|
||||||
SPDLOG_INFO("Kompute Sequence destructor called but sequence is not "
|
SPDLOG_INFO("Kompute Sequence destructor called but sequence is not "
|
||||||
"initialized so no need to removing GPU resources.");
|
"initialized so no need to removing GPU resources.");
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this->freeMemoryDestroyGPUResources();
|
this->freeMemoryDestroyGPUResources();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -206,13 +205,14 @@ Sequence::freeMemoryDestroyGPUResources()
|
||||||
{
|
{
|
||||||
if (!this->mIsInit) {
|
if (!this->mIsInit) {
|
||||||
SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called "
|
SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called "
|
||||||
"but Sequence is not initialized so there's no relevant GPU resources.");
|
"but Sequence is not initialized so there's no relevant "
|
||||||
|
"GPU resources.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->mDevice) {
|
if (!this->mDevice) {
|
||||||
SPDLOG_ERROR(
|
SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called "
|
||||||
"Kompute Sequence freeMemoryDestroyGPUResources called with null Device pointer");
|
"with null Device pointer");
|
||||||
this->mIsInit = false;
|
this->mIsInit = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -220,8 +220,9 @@ Sequence::freeMemoryDestroyGPUResources()
|
||||||
if (this->mFreeCommandBuffer) {
|
if (this->mFreeCommandBuffer) {
|
||||||
SPDLOG_INFO("Freeing CommandBuffer");
|
SPDLOG_INFO("Freeing CommandBuffer");
|
||||||
if (!this->mCommandBuffer) {
|
if (!this->mCommandBuffer) {
|
||||||
SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called with null "
|
SPDLOG_ERROR(
|
||||||
"CommandPool pointer");
|
"Kompute Sequence freeMemoryDestroyGPUResources called with null "
|
||||||
|
"CommandPool pointer");
|
||||||
this->mIsInit = false;
|
this->mIsInit = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -233,8 +234,9 @@ Sequence::freeMemoryDestroyGPUResources()
|
||||||
if (this->mFreeCommandPool) {
|
if (this->mFreeCommandPool) {
|
||||||
SPDLOG_INFO("Destroying CommandPool");
|
SPDLOG_INFO("Destroying CommandPool");
|
||||||
if (this->mCommandPool == nullptr) {
|
if (this->mCommandPool == nullptr) {
|
||||||
SPDLOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called with null "
|
SPDLOG_ERROR(
|
||||||
"CommandPool pointer");
|
"Kompute Sequence freeMemoryDestroyGPUResources called with null "
|
||||||
|
"CommandPool pointer");
|
||||||
this->mIsInit = false;
|
this->mIsInit = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +252,6 @@ Sequence::freeMemoryDestroyGPUResources()
|
||||||
}
|
}
|
||||||
|
|
||||||
this->mIsInit = false;
|
this->mIsInit = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -33,75 +33,70 @@ static const char* KOMPUTE_LOG_TAG = "KomputeLog";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(KOMPUTE_BUILD_PYTHON)
|
#if defined(KOMPUTE_BUILD_PYTHON)
|
||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
//from python/src/main.cpp
|
// from python/src/main.cpp
|
||||||
extern py::object kp_debug, kp_info, kp_warning, kp_error;
|
extern py::object kp_debug, kp_info, kp_warning, kp_error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef KOMPUTE_LOG_OVERRIDE
|
#ifndef KOMPUTE_LOG_OVERRIDE
|
||||||
#if KOMPUTE_ENABLE_SPDLOG
|
#if KOMPUTE_ENABLE_SPDLOG
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#else
|
#else
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if SPDLOG_ACTIVE_LEVEL > 1
|
#if SPDLOG_ACTIVE_LEVEL > 1
|
||||||
#define SPDLOG_DEBUG(message, ...)
|
#define SPDLOG_DEBUG(message, ...)
|
||||||
#else
|
#else
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
#define SPDLOG_DEBUG(message, ...) \
|
#define SPDLOG_DEBUG(message, ...) \
|
||||||
((void)__android_log_print(ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, message))
|
((void)__android_log_print(ANDROID_LOG_DEBUG, KOMPUTE_LOG_TAG, message))
|
||||||
#elif defined(KOMPUTE_BUILD_PYTHON)
|
#elif defined(KOMPUTE_BUILD_PYTHON)
|
||||||
#define SPDLOG_DEBUG(message, ...) \
|
#define SPDLOG_DEBUG(message, ...) kp_debug(message);
|
||||||
kp_debug(message);
|
#else
|
||||||
#else
|
#define SPDLOG_DEBUG(message, ...) \
|
||||||
#define SPDLOG_DEBUG(message, ...) \
|
std::cout << "DEBUG: " << message << std::endl
|
||||||
std::cout << "DEBUG: " << message << std::endl
|
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
||||||
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
#endif // SPDLOG_ACTIVE_LEVEL > 1
|
||||||
#endif // SPDLOG_ACTIVE_LEVEL > 1
|
|
||||||
|
#if SPDLOG_ACTIVE_LEVEL > 2
|
||||||
#if SPDLOG_ACTIVE_LEVEL > 2
|
#define SPDLOG_INFO(message, ...)
|
||||||
#define SPDLOG_INFO(message, ...)
|
#else
|
||||||
#else
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#define SPDLOG_INFO(message, ...) \
|
||||||
#define SPDLOG_INFO(message, ...) \
|
((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message))
|
||||||
((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message))
|
#elif defined(KOMPUTE_BUILD_PYTHON)
|
||||||
#elif defined(KOMPUTE_BUILD_PYTHON)
|
#define SPDLOG_INFO(message, ...) kp_info(message);
|
||||||
#define SPDLOG_INFO(message, ...) \
|
#else
|
||||||
kp_info(message);
|
#define SPDLOG_INFO(message, ...) std::cout << "INFO: " << message << std::endl
|
||||||
#else
|
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
||||||
#define SPDLOG_INFO(message, ...) std::cout << "INFO: " << message << std::endl
|
#endif // SPDLOG_ACTIVE_LEVEL > 2
|
||||||
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
|
||||||
#endif // SPDLOG_ACTIVE_LEVEL > 2
|
#if SPDLOG_ACTIVE_LEVEL > 3
|
||||||
|
#define SPDLOG_WARN(message, ...)
|
||||||
#if SPDLOG_ACTIVE_LEVEL > 3
|
#else
|
||||||
#define SPDLOG_WARN(message, ...)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
#else
|
#define SPDLOG_WARN(message, ...) \
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message))
|
||||||
#define SPDLOG_WARN(message, ...) \
|
#elif defined(KOMPUTE_BUILD_PYTHON)
|
||||||
((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message))
|
#define SPDLOG_WARN(message, ...) kp_warning(message);
|
||||||
#elif defined(KOMPUTE_BUILD_PYTHON)
|
#else
|
||||||
#define SPDLOG_WARN(message, ...) \
|
#define SPDLOG_WARN(message, ...) \
|
||||||
kp_warning(message);
|
std::cout << "WARNING: " << message << std::endl
|
||||||
#else
|
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
||||||
#define SPDLOG_WARN(message, ...) \
|
#endif // SPDLOG_ACTIVE_LEVEL > 3
|
||||||
std::cout << "WARNING: " << message << std::endl
|
|
||||||
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
#if SPDLOG_ACTIVE_LEVEL > 4
|
||||||
#endif // SPDLOG_ACTIVE_LEVEL > 3
|
#define SPDLOG_ERROR(message, ...)
|
||||||
|
#else
|
||||||
#if SPDLOG_ACTIVE_LEVEL > 4
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
#define SPDLOG_ERROR(message, ...)
|
#define SPDLOG_ERROR(message, ...) \
|
||||||
#else
|
((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message))
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#elif defined(KOMPUTE_BUILD_PYTHON)
|
||||||
#define SPDLOG_ERROR(message, ...) \
|
#define SPDLOG_ERROR(message, ...) kp_error(message);
|
||||||
((void)__android_log_print(ANDROID_LOG_INFO, KOMPUTE_LOG_TAG, message))
|
#else
|
||||||
#elif defined(KOMPUTE_BUILD_PYTHON)
|
#define SPDLOG_ERROR(message, ...) \
|
||||||
#define SPDLOG_ERROR(message, ...) \
|
std::cout << "ERROR: " << message << std::endl
|
||||||
kp_error(message);
|
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
||||||
#else
|
#endif // SPDLOG_ACTIVE_LEVEL > 4
|
||||||
#define SPDLOG_ERROR(message, ...) \
|
#endif // KOMPUTE_SPDLOG_ENABLED
|
||||||
std::cout << "ERROR: " << message << std::endl
|
|
||||||
#endif // VK_USE_PLATFORM_ANDROID_KHR
|
|
||||||
#endif // SPDLOG_ACTIVE_LEVEL > 4
|
|
||||||
#endif // KOMPUTE_SPDLOG_ENABLED
|
|
||||||
#endif // KOMPUTE_LOG_OVERRIDE
|
#endif // KOMPUTE_LOG_OVERRIDE
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,7 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression)
|
||||||
std::vector<char>(
|
std::vector<char>(
|
||||||
kp::shader_data::shaders_glsl_logisticregression_comp_spv,
|
kp::shader_data::shaders_glsl_logisticregression_comp_spv,
|
||||||
kp::shader_data::shaders_glsl_logisticregression_comp_spv +
|
kp::shader_data::shaders_glsl_logisticregression_comp_spv +
|
||||||
kp::shader_data::
|
kp::shader_data::shaders_glsl_logisticregression_comp_spv_len));
|
||||||
shaders_glsl_logisticregression_comp_spv_len));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sq->record<kp::OpTensorSyncLocal>({ wOutI, wOutJ, bOut, lOut });
|
sq->record<kp::OpTensorSyncLocal>({ wOutI, wOutJ, bOut, lOut });
|
||||||
|
|
@ -86,9 +85,9 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegression)
|
||||||
EXPECT_LT(bIn->data()[0], 0.0);
|
EXPECT_LT(bIn->data()[0], 0.0);
|
||||||
|
|
||||||
SPDLOG_WARN("Result wIn i: {}, wIn j: {}, bIn: {}",
|
SPDLOG_WARN("Result wIn i: {}, wIn j: {}, bIn: {}",
|
||||||
wIn->data()[0],
|
wIn->data()[0],
|
||||||
wIn->data()[1],
|
wIn->data()[1],
|
||||||
bIn->data()[0]);
|
bIn->data()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy)
|
TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy)
|
||||||
|
|
@ -144,8 +143,7 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy)
|
||||||
std::vector<char>(
|
std::vector<char>(
|
||||||
kp::shader_data::shaders_glsl_logisticregression_comp_spv,
|
kp::shader_data::shaders_glsl_logisticregression_comp_spv,
|
||||||
kp::shader_data::shaders_glsl_logisticregression_comp_spv +
|
kp::shader_data::shaders_glsl_logisticregression_comp_spv +
|
||||||
kp::shader_data::
|
kp::shader_data::shaders_glsl_logisticregression_comp_spv_len));
|
||||||
shaders_glsl_logisticregression_comp_spv_len));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sq->record<kp::OpTensorSyncLocal>({ wOutI, wOutJ, bOut, lOut });
|
sq->record<kp::OpTensorSyncLocal>({ wOutI, wOutJ, bOut, lOut });
|
||||||
|
|
@ -177,7 +175,7 @@ TEST(TestLogisticRegressionAlgorithm, TestMainLogisticRegressionManualCopy)
|
||||||
EXPECT_LT(bIn->data()[0], 0.0);
|
EXPECT_LT(bIn->data()[0], 0.0);
|
||||||
|
|
||||||
SPDLOG_WARN("Result wIn i: {}, wIn j: {}, bIn: {}",
|
SPDLOG_WARN("Result wIn i: {}, wIn j: {}, bIn: {}",
|
||||||
wIn->data()[0],
|
wIn->data()[0],
|
||||||
wIn->data()[1],
|
wIn->data()[1],
|
||||||
bIn->data()[0]);
|
bIn->data()[0]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue