Added an explicit OOM status for kernel ops and routed it as out‑of‑model
This commit is contained in:
parent
3333b577ff
commit
7c19c04dc4
|
|
@ -24,6 +24,8 @@ enum {
|
|||
};
|
||||
|
||||
enum {
|
||||
AMDUAT_PEL_KERNEL_STATUS_OOM = 0x00000001u,
|
||||
AMDUAT_PEL_KERNEL_STATUS_INTERNAL = 0x00000002u,
|
||||
AMDUAT_PEL_KERNEL_STATUS_CONCAT_TYPE_TAG_MISMATCH = 0x00010001u,
|
||||
AMDUAT_PEL_KERNEL_STATUS_SLICE_RANGE_OUT_OF_BOUNDS = 0x00020001u
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
enum { AMDUAT_PEL_KERNEL_STATUS_INTERNAL = 1 };
|
||||
|
||||
static bool amduat_name_eq(amduat_octets_t name, const char *literal) {
|
||||
size_t len = strlen(literal);
|
||||
if (name.len != len) {
|
||||
|
|
@ -175,7 +173,7 @@ static bool amduat_kernel_concat(const amduat_artifact_t *inputs,
|
|||
buffer = (uint8_t *)malloc(total_len);
|
||||
if (buffer == NULL) {
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -194,7 +192,7 @@ static bool amduat_kernel_concat(const amduat_artifact_t *inputs,
|
|||
if (!amduat_alloc_outputs(1, out_outputs)) {
|
||||
free(buffer);
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -254,7 +252,7 @@ static bool amduat_kernel_slice(const amduat_artifact_t *inputs,
|
|||
buffer = (uint8_t *)malloc((size_t)length);
|
||||
if (buffer == NULL) {
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -271,7 +269,7 @@ static bool amduat_kernel_slice(const amduat_artifact_t *inputs,
|
|||
if (!amduat_alloc_outputs(1, out_outputs)) {
|
||||
free(buffer);
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -314,7 +312,7 @@ static bool amduat_kernel_const(const amduat_pel_kernel_const_params_t *params,
|
|||
buffer = (uint8_t *)malloc(params->bytes.len);
|
||||
if (buffer == NULL) {
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -326,7 +324,7 @@ static bool amduat_kernel_const(const amduat_pel_kernel_const_params_t *params,
|
|||
if (!amduat_alloc_outputs(1, out_outputs)) {
|
||||
free(buffer);
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -384,7 +382,7 @@ static bool amduat_kernel_hash(const amduat_artifact_t *inputs,
|
|||
buffer = (uint8_t *)malloc(desc->digest_len);
|
||||
if (buffer == NULL) {
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -401,7 +399,7 @@ static bool amduat_kernel_hash(const amduat_artifact_t *inputs,
|
|||
if (!amduat_alloc_outputs(1, out_outputs)) {
|
||||
free(buffer);
|
||||
if (out_status_code) {
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_INTERNAL;
|
||||
*out_status_code = AMDUAT_PEL_KERNEL_STATUS_OOM;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,6 +596,10 @@ static bool amduat_pel_program_dag_exec_internal(
|
|||
prepared.ops[node_index], resolved_inputs, node->inputs_len,
|
||||
&prepared.params[node_index], &node_results[node_index].outputs,
|
||||
&node_results[node_index].outputs_len, &status_code)) {
|
||||
if (status_code == AMDUAT_PEL_KERNEL_STATUS_OOM) {
|
||||
free(resolved_inputs);
|
||||
goto oom_finish;
|
||||
}
|
||||
if (status_code == 2 || status_code == 3 || status_code == 0) {
|
||||
status_code = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue