* Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
* \file kernel_bundle_packer.h
* \brief Packs the TLV segments into a single .pyptokb bundle.
*/
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace npu::tile_fwk::bundle {
class KernelBundlePacker {
public:
void SetAicoreKernel(std::vector<uint8_t> o) { aicoreKernel_ = std::move(o); }
void SetAicpuSo(std::vector<uint8_t> so) { aicpuSo_ = std::move(so); }
void SetDevProgram(std::vector<uint8_t> prog) { devProgram_ = std::move(prog); }
void SetCtrlFlowCache(std::vector<uint8_t> cache) { ctrlFlowCache_ = std::move(cache); }
void SetSymbolMeta(std::vector<uint8_t> meta) { symbolMeta_ = std::move(meta); }
bool Pack(const std::string& outPath) const;
std::vector<uint8_t> Build() const;
private:
std::vector<uint8_t> aicoreKernel_;
std::vector<uint8_t> aicpuSo_;
std::vector<uint8_t> devProgram_;
std::vector<uint8_t> ctrlFlowCache_;
std::vector<uint8_t> symbolMeta_;
};
}