msProf JSON Configuration File Description

Write the JSON definition file of operators. For details about the configuration parameters, see Table 1 and Table 2.

For example, the JSON configuration file is named add_test.json. Developers can modify test data and other configuration parameters based on this template.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  "kernel_name": "add_custom",
  "kernel_path": "./add_custom.o",
  
  "blockdim": 8,
  "mode": "ca",
  "device_id": 0,
  "magic": "RT_DEV_BINARY_MAGIC_ELF_AIVEC",
  "test_cases": [
    {
      "case_name": "Test_AddCustom_001",
      "param_desc": [
        {
          "param_type": "input",
          "type": "float16",
          "shape": [
            8,
            2048
          ],
          "data_path": "./input_x.bin",
          "name": "x"
        },
        {
          "param_type": "input",
          "type": "float16",
          "shape": [
            8,
            2048
          ],
          "data_path": "./input_y.bin",
          "name": "y"
        },
        {
          "param_type": "output",
          "type": "float16",
          "shape": [
            8,
            2048
          ],
          "name": "z"
        },
        {
          "param_type": "workspace",
          "user_workspace_size": 4096
        },
        {
          "param_type": "tiling",
          "tiling_data_size": 8,
          "tiling_data_path": "./tiling.bin"
        }
      ]
    }
  ]
}
Table 1 JSON file field description

Parameter

Description

Type

Mandatory (Yes/No)

kernel_name

Kernel function name.

string

Yes

kernel_path

Path of the binary .o file of the kernel function. The value of can be an absolute path or a relative path.

string

Yes

blockdim

Number of cores required for running the kernel function. The default value is 1.

int

No

mode

Test mode.

  • Onboard: onboard
  • Performance simulation: ca

string

Yes

device_id

ID of the Ascend AI Processor used during running. The default value is 0.

int

No

tiling_key

Tiling key of the current dynamic operator.

NOTE:

This parameter applies only to dynamic operators.

uint64

No

magic

Operator type.
  • Cube operator: RT_DEV_BINARY_MAGIC_ELF_AICUBE
  • Vector operator: RT_DEV_BINARY_MAGIC_ELF_AIVEC
  • Mix fused operator: RT_DEV_BINARY_MAGIC_ELF (supported only by the )
NOTE:

RT_DEV_BINARY_MAGIC_ELF is required by the .

string

Yes

test_cases

Test data. A list is supported. Each element contains a case. For details, see Table 2.

NOTE:

Only one case can be configured during onboard operator tuning or simulation-based tuning.

map

Yes

Table 2 test_case parameter description

Parameter

Description

Type

Required

case_name

-

-

Name of a test case, which must be unique.

string

Yes

param_desc

-

-

Case description. A list is supported. Each element represents a kernel function parameter.

list

Yes

-

param_type

input/output/workspace/tiling/fftsAddr

Parameter type.

string

Yes

-

type

-

Data type supported by input and output data, for example, uint8, int16, int32, float16, float32, and float.

NOTE:

This parameter is mandatory when param_type is set to input or output.

string

No

-

shape

-

Input/Output tensor shape. All input and output tensors must support the same number of shapes.

The sample code is as follows:

[8, 3, 256, 256].

If you enter an invalid shape, for example, [0], an error is reported.

NOTE:

This parameter is required when param_type is set to input or output.

list

No

-

data_path

-

Path of the input data .bin file.

NOTE:

When param_type is set to input, data_path or value_range must be input, and data_path has a higher priority.

string

No

-

name

-

Parameter name, which must be unique.

NOTE:

This parameter is required when param_type is set to input or output.

string

No

-

user_workspace_size

-

Workspace size set by the user.

NOTE:

This parameter is mandatory when param_type is set to workspace.

int

No

-

tiling_data_size

-

Size of tiling data.

NOTE:

This parameter is mandatory when param_type is set to tiling.

int

No

-

tiling_data_path

-

Path of the tiling data .bin file.

NOTE:

This parameter is mandatory when param_type is set to tiling.

string

No

-

data_size

-

Data size of fftsAddr.

NOTE:

This parameter is mandatory when param_type is set to fftsAddr.

int

No

  • The number of parameter values in output must be the same as that in input. Failure to do so may result in test case generation failures.

    For example, if input supports two types, output should also support two types.

    The rule also applies to type, shape, and value_range of all inputs x/outputs x.

  • The number of parameter values in each input of an operator must be the same. Otherwise, test case generation fails.

    The number of type, shape, and value_range values in each input must be the same.