Skip to content

XLinkIn lazy buffer allocation #1362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "147d0fe4e861c7b71a77a8d39e3c8e7ddcaca9ea")
set(DEPTHAI_DEVICE_SIDE_COMMIT "5ddab18ae6996cb8eb50954a86a7ca9a44f7f05b")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,7 @@ dai_set_test_labels(camera_test ondevice rvc2_all rvc4 ci)
# VideoEncoder test
dai_add_test(video_encoder_test src/ondevice_tests/video_encoder_test.cpp)
dai_set_test_labels(video_encoder_test ondevice rvc2_all rvc4 ci)

# XLinkIn test
dai_add_test(xlink_test src/ondevice_tests/xlink_tests.cpp)
dai_set_test_labels(xlink_test ondevice rvc2_all ci)
35 changes: 35 additions & 0 deletions tests/src/ondevice_tests/xlink_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <catch2/catch_all.hpp>
#include <catch2/catch_test_macros.hpp>
#include <depthai/depthai.hpp>
#include <depthai/pipeline/node/internal/XLinkIn.hpp>

#include <thread>
#include <chrono>
using namespace std::chrono_literals;

TEST_CASE("XLinkIn lazy allocation test") {
dai::Pipeline p;
auto manip = p.create<dai::node::ImageManip>()->build();

auto xLinkInImage = p.create<dai::node::internal::XLinkIn>();
auto xLinkInConfig = p.create<dai::node::internal::XLinkIn>();

xLinkInImage->setMaxDataSize(1024 * 1024 * 1024); // 1GB per frame
xLinkInImage->setNumFrames(64);

xLinkInConfig->setMaxDataSize(1024 * 1024 * 1024); // 1GB per frame
xLinkInConfig->setNumFrames(64);

xLinkInImage->out.link(manip->inputImage);
xLinkInConfig->out.link(manip->inputConfig);

auto run = [&]() {
p.start();
std::this_thread::sleep_for(1s);
};

// Without lazy allocation, this will throw as all the above XLinkIn nodes
// would allocate all the frames at once.
REQUIRE_NOTHROW(p.build());
REQUIRE_NOTHROW(run());
}
Loading