When writing library code, never hard-terminate or silently ignore failures. Always (1) validate inputs/shape compatibility correctly (including pack/elempack and dynamic dims), (2) signal errors with consistent return codes, and (3) propagate error statuses from lower-level operations to the caller.

Apply these rules:

Example: propagate and handle submit errors

// Bad: ignoring status
cmd.submit_and_wait();
return 0;

// Good: propagate to caller
return cmd.submit_and_wait();

Example: avoid assert(0) in library code

switch (impl_type) {
    case 1: /* ... */ break;
    case 2: /* ... */ break;
    // ...
    default:
        return -1; // invalid impl_type
}