TIK Container Management
Class TIK Constructor
Description
Creates a TIK DSL container by passing a tik.Dprofile instance.
Prototype
__init__(profiling, disable_debug=False, err_msg_level=0)
Parameters
Parameter |
Input/Output |
Description |
---|---|---|
profiling |
Input |
Configuration information of the Ascend AI processor. Dprofile is supported. |
disable_debug |
Input |
An optional bool for disabling the debug function. Defaults to False (debug enabled). |
err_msg_level |
Input |
An optional int for specifying the level of error messages to be printed. Defaults to 0.
|
Restrictions
- If the build time is strictly limited, the debug function can be used during operator development. After the code is submitted, you can manually set the disable_debug parameter to True when constructing a TIK instance to disable the debug function. This reduces the build time.
- If disable_debug is set to True and the debug API is called after BuildCCE is complete, the program exits abnormally and the debugging fails.
Returns
Instance of class TIK
Examples
The following is an example of enabling the debug function.
from te import tik tik_instance = tik.Tik() Alternatively, tik_instance = tik.Tik(disable_debug=False)
The following is an example of disabling the debug function.
from te import tik tik_instance = tik.Tik(disable_debug=True)
The following is an example of setting err_msg_level to the developer level.
from te import tik tik_instance = tik.Tik(err_msg_level=1)
BuildCCE
Description
Generates DSL defined on the target machine and builds the DSL into a binary that is executable on the Ascend AI Processor and corresponding configuration files.
Prototype
BuildCCE(kernel_name, inputs, outputs, output_files_path=None, enable_l2=False, config=None, flowtable=None)
Parameters
Parameter |
Input/Output |
Description |
---|---|---|
kernel_name |
Input |
|
inputs |
Input |
|
outputs |
Input |
|
output_files_path |
Input |
A string specifying the path of the generated files after build. Defaults to None, indicating the path ./kernel_meta in the current directory. |
enable_l2 |
Input |
A bool specifying whether to enable L2 buffer enable. Defaults to False. This argument does not take effect. |
config |
Input |
A dictionary including a key string and its value, used to configure the operator build properties. Format: config = {"key" : value} The following keys are supported: double_buffer_non_reuse: If set to True, the ping and pong variables in double_buffer are not reused. Example: config = {"double_buffer_non_reuse" : True} |
flowtable |
Input |
A list or tuple of InputScalars. A flow table of tiling parameters (computed by the operator selector in the dynamic-shape scenario). The flowtable length and inputs length adds up to less than or equal to 64. |
Restrictions
- inputs and outputs must not have the same tensor. Otherwise, the TIK reports an error.
- All non-workspace tensors with the scope of scope_gm must be in inputs or outputs. Otherwise, a build error is reported.
- When there is no output, BuildCCE specifies an array whose length is 1 and data is 0, that is, outputs=[]. The return value is [[0]].
- In inputs, tensors must be placed before InputScalars.
Returns
None
Example
from te import tik tik_instance = tik.Tik() data_A = tik_instance.Tensor("float16", (128,), name="data_A", scope=tik.scope_gm) data_B = tik_instance.Tensor("float16", (128,), name="data_B", scope=tik.scope_gm) data_C = tik_instance.Tensor("float16", (128,), name="data_C", scope=tik.scope_gm) tik_instance.BuildCCE(kernel_name="simple_add",inputs=[data_A,data_B],outputs=[data_C])