用户在使用Ascend C调测工具之前,需要提供算子输入数据及标杆数据,同时还需根据实际情况配置算子信息json文件,这些是后续各种调测功能的输入。
支持采用工具随机生成的数据、自定义Python脚本生成的数据等作为输入/标杆数据,具体方法请参见输入数据和标杆数据准备。
本场景以工具自带的FlashAttentionScore算子json配置文件为模板,其获取步骤如下:
执行如下命令,屏显返回算子样例路径,标识为${fa_case_dir}。
find $HOME -name flash_attention_score_case -type d
其中$HOME是CANN包的安装根目录,若以root用户安装,默认为“/usr/local”;若非root用户安装,请替换为实际安装的目录。
该配置模板在样例flash_attention_score_case路径下,即${fa_case_dir}/flash_attention_score_demo.json。
{ "op_type": "FlashAttentionScore", "data_script": "", "gen_data": false, "inputs": [{ "name": "query", "dtype": "float16", "format": "ND", "ignore": false, "shape": [24,144,1280], "param_type": "required", "data_file": "/path/q.bin" }], "outputs": [{ "name": "softmax_max", "dtype": "float32", "format": "ND", "shape": [24,20,144,8], "ignore": false, "param_type": "required", "data_file": "/path/out.bin" }], "attrs": [{ "name": "scale_value", "dtype": "float", "value": 1.0 }] }
配置项 |
数据类型 |
参数说明 |
配置值建议 |
|
---|---|---|---|---|
op_type |
string |
算子名。 |
与待调测算子严格匹配。 |
|
data_script |
string |
数据生成脚本(python),用于生成输入和标杆数据。 |
此处填写""。 |
|
gen_data |
bool |
是否根据data_script生成输入和标杆数据。 |
此处填写false。 |
|
inputs / outputs |
name |
string |
输入/输出的参数名。 |
用户根据实际情况填写。 |
dtype |
string |
输入/输出的数据类型。 |
支持的数据类型有bool、int8、int16、int32、int64、uint8、uint16、uint32、uint64、float16、float32、float64、bfloat16。 |
|
format |
string |
输入/输出的存储格式。 |
用户根据实际情况填写。 |
|
shape |
list |
输入/输出的shape。 |
根据算子实际的shape填写,例如[24,20,144,8]。 |
|
ignore |
bool |
是否忽略该输入/输出。 |
用户根据实际情况填写。 |
|
param_type |
string |
是否必选该输入/输出。 |
用户根据实际情况填写。 |
|
data_file |
string |
|
填写数据bin文件的绝对路径,例如 "/path/data.bin"。 |
|
attrs |
name |
string |
算子的属性名。 |
用户根据实际情况填写。 |
dtype |
string |
数据类型。 |
用户根据实际情况填写。 |
|
value |
可变 |
属性值。 |
用户根据实际情况填写。 |