in_x = Tensor("GM", "FP16", [64], format="ND") l1_x = Tensor("L1") fp_x = Tensor("FB") bt_x = Tensor("BT") l1_x.load(in_x) l1_x_to_fp = l1_x[0:32] l1_x_to_bt = l1_x[32:64] fp_x.load(l1_x_to_fp) bt_x.load(l1_x_to_bt)
在昇腾AI处理器的CUBE单元中,进行计算的数据格式需要是特殊的私有NZ格式。而通常在GM上的数据都是ND格式,因此在进行Cube运算时,需要将数据格式进行转换。在Atlas A2训练系列产品中,GM到CUBE相关的存储单元的搬运通路已具备ND转NZ的随路转换能力。
在mskpp工具中,若GM-L1且用户定义GM的tensor是ND,L1的tensor是NZ,或从L0C-GM且用户定义L0C上的tensor是NZ,GM的tensor是ND,则开启随路转换,调取相关实测数据。
in_x = Tensor("GM", "FP16", [128, 256], format="ND") l1_x1 = Tensor("L1", format="NZ") l1_x2 = Tensor("L1", format="NZ") l1_x1.load(in_x[128, 0:128]) l1_x2.load(in_x[128, 128:])
L2Cache是指部分GM空间与vectorcore和cubecore存在高带宽的搬运通路,当L2Cache命中率接近100%与L2Cache命中率接近0%时,带宽能有两倍以上的差距。mskpp工具目前支持用户手动调整L2Cache命中率。
with Chip("Ascendxxxyy") as chip: config = {"cache_hit_ratio": 0.6} chip.set_config(config)
with Chip("Ascendxxxyy") as chip: chip.enable_metrics() chip.set_prof_summary_path("/home/HwHiAiUser/project/add_custom/OPPROF_{timestamp}_XXX/PipeUtilization.csv")