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
9 changes: 5 additions & 4 deletions openrknn/src/openrknn_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ int orknn_own_outputs_get(struct orknn_context *ctx, uint32_t n_outputs,
#undef SRC_OFF
#undef USER_OFF
} else {
/* Non-4D (e.g., 2D [1,1001]): direct copy, trim padding.
* Native BO may be padded (e.g., 1024 for 1001 elements).
* Just copy the first n_elems bytes. */
uint32_t copy_size = ti->n_elems;
/* Non-4D (e.g., 2D [1,1001] or 3D [1,1024,768]): direct copy.
* copy_size is the tensor data size in bytes (n_elems × dtype_size).
* For INT8 models n_elems == byte count; for FP16 models
* n_elems is the element count so we need ti->size instead. */
uint32_t copy_size = ti->size;
if (outputs[i].want_float) {
float *fdst = (float *)dst;
float scale = ti->scale;
Expand Down
13 changes: 13 additions & 0 deletions openrknn/src/openrknn_run.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,19 @@ int orknn_own_run(struct orknn_context *ctx, rknn_run_extend *extend)
}
}

/* Dev: dump activation BO after run for layout analysis */
const char *act_dump = getenv("ORKNN_DUMP_ACT");
if (act_dump && ctx->activation_bo.map) {
orknn_bo_sync_from_device(ctx->npu_fd, &ctx->activation_bo);
FILE *af = fopen(act_dump, "wb");
if (af) {
fwrite(ctx->activation_bo.map, 1, ctx->activation_bo.size, af);
fclose(af);
orknn_log(1, "run: dumped act BO (%u bytes) to %s",
ctx->activation_bo.size, act_dump);
}
}

ctx->run_count++;
return RKNN_SUCC;
}
Loading