DebugMode could log an optimization warning if an Op does not reuse previous output memory
The perform (or c_code, or thunk) method of an Op is entitled to always allocate new memory for its outputs.
However, when called twice with the same input value, it would be good if it reused the output storage.
An optimization warning would be indicated (as when an inplace Op does not work inplace), because it is legal, just probably inefficient.
It could be done easily when 'previous' is in DebugMode.check_preallocated_output.
However, when called twice with the same input value, it would be good if it reused the output storage.
An optimization warning would be indicated (as when an inplace Op does not work inplace), because it is legal, just probably inefficient.
It could be done easily when 'previous' is in DebugMode.check_preallocated_output.
Leave a comment