tft_register_clean_handler

Function

Registers the callback function for clearing residual operator executions during recovery.

For MindSpeed-LLM, the callback function has been adapted by MindIO TFT. For other frameworks, you need to ensure the security of the callback function.

Format

mindio_ttp.framework_ttp.tft_register_clean_handler(func: Callable, ctx = None)

Parameters

Parameter

Mandatory/Optional

Description

Value

func

Mandatory

Callback function for clearing residual operator executions and underlying faults.

The callback function cannot be empty. For details about the input parameters of the callback function, see Table 1.

The return value of the callback function is as follows:

  • 0: success
  • 1: failure
  • 2: UCE scenario where the model optimizer does not need to be rebuilt.

ctx

Optional

Callback function context.

This parameter is left empty by default.

Table 1 Parameters of the callback function

Parameter

Mandatory/Optional

Description

Value

is_uce_error

-

Indicates whether a UCE occurs on the NPU.

  • False: no
  • True: yes

args

-

Parameter set by tft_set_step_args.

Determined by the registration party.

ctx

-

Callback function context.

Determined by the registration party.

Return Value

No return value. If an error occurs, an error log is recorded and an exception is thrown.