Skip to content

Commit

Permalink
split KPU time from EXTCALL
Browse files Browse the repository at this point in the history
  • Loading branch information
curioyang committed Jan 3, 2025
1 parent 05d16ab commit 1b5d688
Showing 1 changed file with 47 additions and 7 deletions.
54 changes: 47 additions & 7 deletions src/Native/src/runtime/stackvm/runtime_function.run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,65 @@ stackvm_runtime_function::run(gsl::span<const gsl::byte> text) noexcept {
while (!reader_.empty()) {
pc_ = reader_.tell();
opcode_t opcode = reader_.read<opcode_t>();
auto new_pc = reader_.tell();
if (opcode != opcode_t::TENSOR) {
if (opcode == opcode_t::EXTCALL)
{
auto op = op_reader<opcode_t::EXTCALL>()(reader_);
reader_.seek(new_pc);

if(op.is_prim_func)
{
op_profile p("KPU", (uint8_t)opcode);
switch (opcode) {
#include "ops/control.inl"
#include "ops/conversion.inl"
#include "ops/loadstore.inl"
#include "ops/scalar.inl"
#include "ops/stack.inl"
default:
return err(nncase_errc::stackvm_illegal_target);
break;
}
}
else{
switch (opcode) {
#include "ops/control.inl"
#include "ops/conversion.inl"
#include "ops/loadstore.inl"
#include "ops/scalar.inl"
#include "ops/stack.inl"
default:
return err(nncase_errc::stackvm_illegal_target);
break;
}
}
}
else
{
#ifdef ENABLE_OP_PROFILE
op_profile p(to_string(opcode), (uint8_t)opcode);
op_profile p(to_string(opcode), (uint8_t)opcode);
#endif
switch (opcode) {
switch (opcode) {
#include "ops/control.inl"
#include "ops/conversion.inl"
#include "ops/loadstore.inl"
#include "ops/scalar.inl"
#include "ops/stack.inl"
default:
return err(nncase_errc::stackvm_illegal_target);
break;
default:
return err(nncase_errc::stackvm_illegal_target);
break;
}
}
} else {
auto tensor_func = reader_.read_unaligned<tensor_function_t>();
}
else {
auto tensor_func = reader_.read_unaligned<tensor_function_t>();
// if (to_string(tensor_func) != "EXTCALL")
// {
#ifdef ENABLE_OP_PROFILE
op_profile p(to_string(tensor_func), (uint8_t)opcode);
#endif
// }
try_(visit(tensor_func, reader_))
}
}
Expand Down

0 comments on commit 1b5d688

Please sign in to comment.