MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / _setup_kernel

Method _setup_kernel

src/include/npu_utils/npu_utils.hpp:106–127  ·  view source on GitHub ↗

@brief Setup the kernel @note The function will create an elf file from the ctrl_seq @note The function will also update the module, elf, and kernel

Source from the content-addressed store, hash-verified

104 ///@note The function will create an elf file from the ctrl_seq
105 ///@note The function will also update the module, elf, and kernel
106 void _setup_kernel(){
107 char* elf_buf;
108 this->kernel.reset();
109 this->module.reset();
110 this->elf.reset();
111 std::pair<uint32_t*, size_t> data = this->ctrl_seq->dump();
112 assert(data.first != nullptr);
113 assert(data.second > 0);
114 uint32_t elf_buf_size = this->_gen_elf(&elf_buf, data);
115 if (this->module_valid){
116 this->module.reset();
117 this->elf.reset();
118 this->kernel.reset();
119 }
120 this->elf = std::make_unique<xrt::elf>(elf_buf, elf_buf_size);
121 this->module = std::make_unique<xrt::module>(*this->elf);
122 this->kernel = std::make_unique<xrt::ext::kernel>(*this->context, *this->module, this->kernel_name);
123 this->module_valid = true;
124 this->module_version = this->ctrl_seq->sequence_version();
125
126 free((void*)elf_buf);
127 }
128
129public:
130 // enum ert_cmd_state {

Callers 5

update_ctrl_seqMethod · 0.95
store_elfMethod · 0.95
operator()Method · 0.95
safe_runMethod · 0.95
create_runMethod · 0.95

Calls 4

_gen_elfMethod · 0.95
sequence_versionMethod · 0.80
resetMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected