Chip
Function
Processor abstraction, which is instantiated and used in the with statement to explicitly model a type of the Ascend AI Processor.
Prototype
1 | class Chip(name, debug_mode=False) |
Parameters
Parameter |
Input Type |
Description |
|---|---|---|
name |
string |
Processor name. Currently, most data is collected based on the . You can run npu-smi info to view the Ascend AI Processor type of the current device. |
debug_mode |
bool |
Whether to enable the debug mode. The default value is False.
NOTE:
After the debug mode is enabled, you can view the instructions that are not properly executed, but no deliverable is generated. |
Members
Member |
Description |
|---|---|
chip.enable_trace() |
Enables the operator simulation pipeline function to generate the pipeline chart file trace.json. |
chip.enable_metrics() |
Enables single instruction and pipeline information, and generates instruction statistics (Instruction_statistic.csv), transfer pipeline statistics (Pipe_statistic.csv), and instruction proportion pie chart (instruction_cycle_consumption.html). |
chip.set_cache_hit_ratio(config) |
Enables manual adjustment of the L2 cache hit ratio. For details about config = {"cache_hit_ratio": 0.6}, see Cache hit ratio. |
chip.set_prof_summary_path("xxx/PipeUtilization.csv") |
PipeUtilization.csv is an example of the msprof result, which is used to compare the theoretical values of the pipeline information with values measured by msprof. For details, see comparison between theoretical values of pipeline information and values measured by msprof. |
Constraints
This class needs to be initialized under the with statement.
Example
1 2 3 4 5 | from mskpp import Chip # For details about how to view the Ascend AI Processor type of the current device, see the following description. with Chip ("Ascendxxxyy") as chip: # Ascendxxxyy needs to be replaced with the actual processor type. chip.enable_trace() # Call this function to enable the operator simulation pipeline function and generate a pipeline chart file. chip.enable_metrics() # Call this function to enable the single instruction and pipeline information, and generate the transfer pipeline statistics, instruction information statistics, and instruction proportion pie chart. |
- Run the npu-smi info command on the server where the Ascend AI Processor is installed to obtain the Chip Name information. The actual value is AscendChip Name. For example, if Chip Name is xxxyy, the actual value is Ascendxxxyy. If Ascendxxxyy is the code sample path, you need to set ascendxxxyy.