Skip to content
Merged
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
73 changes: 73 additions & 0 deletions runtime/onert/backend/trix/ops/BulkPipelineLayer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2026 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "BulkPipelineLayer.h"

#include <iostream>
#include <memory>

namespace onert::backend::trix::ops
{

BulkPipelineLayer::BulkPipelineLayer() : _inputs(), _outputs()
{
// DO NOTHING
}

BulkPipelineLayer::~BulkPipelineLayer()
{
// DO NOTHING - _pipeline_manager will be automatically cleaned up by unique_ptr
}

void BulkPipelineLayer::configure(const std::vector<const IPortableTensor *> &inputs,
std::vector<IPortableTensor *> &outputs,
const std::vector<std::string> &binary_path)
{
_inputs = inputs;
_outputs = outputs;

// Configure BulkPipeLineManager
BulkPipelineManager::PipelineConfig config;
config.model_paths = binary_path;
config.device_id = 0; // default device id = 0

_pipeline_manager = std::make_unique<BulkPipelineManager>(config);

if (!_pipeline_manager->initialize())
{
throw std::runtime_error("Failed to initialize BulkPipelineManager");
}
}

void BulkPipelineLayer::run()
{
try
{
_pipeline_manager->execute(_inputs, _outputs);
}
catch (const std::exception &e)
{
std::cerr << "BulkPipelineLayer execution failed: " << e.what() << std::endl;
throw;
}
}

void BulkPipelineLayer::prepare()
{
// DO NOTHING
}

} // namespace onert::backend::trix::ops
53 changes: 53 additions & 0 deletions runtime/onert/backend/trix/ops/BulkPipelineLayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2026 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __ONERT_BACKEND_TRIX_OPS_BULK_PIPELINE_LAYER_H__
#define __ONERT_BACKEND_TRIX_OPS_BULK_PIPELINE_LAYER_H__

#include <backend/IPortableTensor.h>
#include "../DevContext.h"
#include <exec/IFunction.h>
#include "BulkPipelineManager.h"

namespace onert::backend::trix::ops
{

class BulkPipelineLayer : public ::onert::exec::IFunction
{
public:
BulkPipelineLayer();
~BulkPipelineLayer() override;

public:
void configure(const std::vector<const IPortableTensor *> &inputs,
std::vector<IPortableTensor *> &outputs,
const std::vector<std::string> &binary_path);

void run() override;

void prepare() override;

private:
std::vector<const IPortableTensor *> _inputs;
std::vector<IPortableTensor *> _outputs;

// Pipeline manager
std::unique_ptr<BulkPipelineManager> _pipeline_manager;
};

} // namespace onert::backend::trix::ops

#endif // __ONERT_BACKEND_TRIX_OPS_BULK_PIPELINE_LAYER_H__