| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
随机数算子重构优化 Co-authored-by: fenglin28<fenglin28@huawei.com> # message auto-generated for no-merge-commit merge: !949 merge hh into master 随机数算子重构优化 Created-by: guankarl Commit-by: fenglin28 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 随机数算子重构优化,使用统一模板实现。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> https://gitcode.com/cann/ops-math/issues/552 <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x ] 其他,请描述: 随机数算子重构,总共分为 5 个部分: 算子infershape/inferdtype 实现了公共逻辑提取CommonInferShape,不同算子根据算子原型配置对应mode,新算子开发10行代码搞定 示例: static graphStatus InferShapeRandomUniformV2(gert::InferShapeContext* context) { const std::unordered_map<std::string, size_t>& input_map = { {"shape", RANDOM_UNIFORM_V2_X}, {"offset", RANDOM_UNIFORM_V2_OFFSET}}; const std::unordered_map<std::string, size_t>& output_map = { {"y", RANDOM_UNIFORM_V2_Y}, {"offset", RANDOM_UNIFORM_V2_OFFSET}}; int32_t mode = RANDOM_UNIFORM_V2_MODE_TYPE; return ops::common::CommonInferShape(context, input_map, output_map, mode); } IMPL_OP_INFERSHAPE(RandomUniformV2).InferShape(InferShapeRandomUniformV2); 算子信息库注册def 算子的不同输入如果有多组dtype时候,在算子信息库的枚举中,可能会有几十种组合,手写容易漏掉或者重复,且不好检查,通过提供RandomDtypeFmtGen类,调用对应接口即可获取全部组合类型。 示例: gen.GetSequence("inOutType") this->Input("x") .ParamType(REQUIRED) .DataType({gen.GetSequence("inOutType")}) .Format({baseFormatSeq}) .UnknownShapeFormat({baseFormatSeq}); 融合规则 有状态算子转无状态算子,存在范式的融合规则,通过提取公共类,定义公共接口,后续类似融合规则无需重新开发,直接调用对应接口即可。 class FusionRandomUtils { public: FusionRandomUtils() = default; ~FusionRandomUtils() = default; // FusionRandomUtils(const FusionRandomUtils&) = delete; // FusionRandomUtils& operator=(const FusionRandomUtils&) = delete; /** * @param graph 计算图对象 * @param opDesc 算子描述指针 * @param offsetNode 输出:创建的offset Variable节点 * @param shapeDesc Shape输入的Tensor描述 * @param outputDesc 主输出Y的Tensor描述 * @param opNode 基准算子节点(用于拼接新节点名) * @param fusionPassName 日志标识(用于日志溯源) * @param fusedOpType 融合算子类型(用于日志/错误信息溯源) * @return Status SUCCESS/FAILED/PARAM_INVALID */ static bool CheckSocVersion(const std::string& fusedOpType); static Status AddVariableNode( ge::ComputeGraph& graph, ge::NodePtr opNode, const ge::GeTensorDesc& offsetDesc, ge::NodePtr& newNode, const uint8_t* dataPtr, size_t size, const std::string& fusionPassName); static Status CreateInputOpDesc( ge::OpDescPtr& opDesc, ge::GeTensorDesc shapeDesc, ge::GeTensorDesc offsetDesc, const std::string& fusedOpType); static Status CreateOutputOpDesc( ge::OpDescPtr& opDesc, ge::GeTensorDesc outputDesc, ge::GeTensorDesc offsetDesc, const std::string& fusedOpType); static Status AddOpNodeAndDesc(ge::ComputeGraph& graph, ge::OpDescPtr& opDesc, ge::NodePtr& offsetNode, ge::GeTensorDesc shapeDesc, ge::GeTensorDesc outputDesc, ge::NodePtr opNode, const std::string& fusionPassName, const std::string& fusedOpType); static Status UpdateAttr(ge::NodePtr opNode, int64_t seed, int64_t seed2, ge::DataType dtype, const std::string& fusionPassName, const std::string& fusedOpType); static Status CreateNode(ge::ComputeGraph& graph, ge::NodePtr opNode, std::vector<ge::NodePtr>& fusionNodes, ge::NodePtr& opV2Node, const std::string& fusionPassName, const std::string& fusedOpType, const std::set<ge::DataType> aicoreDtypeSupportList); static Status RemoveNode(ge::NodePtr node, ge::ComputeGraph& graph, const std::string& fusedOpType); static Status ReplaceNode(ge::NodePtr oldNode, ge::NodePtr newNode, ge::ComputeGraph& graph, const std::string& fusedOpType, const std::string& fusionPassName); }; 算子tiling 抽象并统一流程,更加适合随机数算子,统一tilingData,按照配置做检查。 统一流程: ge::graphStatus RandomTilingArch35::DoTiling() { opName_ = context_->GetNodeName(); OP_LOGD(opName_, "Start tiling for op: %s", opName_.c_str()); // 步骤1:校验输入输出和属性 auto ret = CheckInputsOutputsAndAttrs(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Check inputs/outputs/attrs failed"); return ret; } // 步骤2: 获取硬件信息 ret = GetPlatformInfo(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Get platform info failed"); return ret; } // 步骤3: 填充TilingData ret = FillUnifiedTilingData(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Fill tiling data failed"); return ret; } // 步骤4:计算tilingKey和workspace ret = CalcTilingKeyAndWorkspace(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Calc tiling key/workspace failed"); return ret; } // 步骤5:后置处理(可选) ret = UniqueProcess(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Unique process failed"); return ret; } // 步骤6:写入context ret = WriteBackToContext(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Write tiling data to context failed"); return ret; } // 步骤7:调用dump函数 auto info = tilingData_.DumpTilingInfo(); OP_LOGI("RandomTiling", "%s", info.str().c_str()); OP_LOGD(opName_, "Tiling success for op: %s", opName_); return ge::GRAPH_SUCCESS; } 统一tilingData int64_t usedCoreNum = 0; int64_t normalCoreProNum = 0; int64_t tailCoreProNum = 0; int64_t singleBufferSize = 0; uint32_t key[2] = {0}; uint32_t counter[4] = {0}; int64_t outputSize = 0; int64_t probTensorSize = 0; int64_t sharedTmpBufSize = 0; 当前tilingData较少,后续如有需要,按需添加 按照配置做检查: OpTilingConfig config; config.inputCheckRules = { // 输入索引: dtype列表,shapeSize,dim_num {0, {{ge::DT_INT32, ge::DT_INT64}, -1, {1}, nullptr}}, // shape {1, {{ge::DT_INT64}, 1, {}, nullptr}}, // offset }; config.outputCheckRules = { // 输出索引: dtype列表,shapeSize,dim_num {0, {{ge::DT_FLOAT, ge::DT_FLOAT16, ge::DT_BF16}, -1, {1,2,3,4,5,6,7,8}, nullptr}} }; // y 算子kernel kernel抽取了RandomKernelBaseOp类,专门管理tilingData,内置了Skip函数和生成随机数函数,其他算子只需调用VarsInit接口即可 See merge request: cann/ops-math!949 | 7 个月前 | |
aclnn文档描述使用新模板,readme中link修复,修复一些文档中的描述错误 Co-authored-by: jisongyuan@h-partners.com<jisongyuan@h-partners.com> # message auto-generated for no-merge-commit merge: !1246 merge link-change into master aclnn文档描述使用新模板,readme中link修复,修复一些文档中的描述错误 Created-by: ji-songyuan Commit-by: jisongyuan@h-partners.com Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> aclnn文档描述使用新模板,readme中link修复,修复一些文档中的描述错误 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> [#736](https://gitcode.com/cann/ops-math/issues/736) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 紧文档修改,不涉及代码修改 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> https://gitcode.com/cann/ops-math/tree/master/conversion https://gitcode.com/cann/ops-math/tree/master/math https://gitcode.com/cann/ops-math/tree/master/random conversion类文档、math类文档、随机数类文档 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1246 | 6 个月前 | |
【bugfix】dsa_gen_bit_mask_md Co-authored-by: majiajian_hw<majiajian@huawei.com> # message auto-generated for no-merge-commit merge: !1306 merge random_md into master 【bugfix】dsa_gen_bit_mask_md Created-by: nunnons2 Commit-by: majiajian_hw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1306 | 6 个月前 | |
【bugfix】修复random的文档信息 Co-authored-by: mjiajian_hw<majiajian@huawei.com> # message auto-generated for no-merge-commit merge: !1089 merge bugfix_md_random_2 into master 【bugfix】修复random的文档信息 Created-by: nunnons2 Commit-by: mjiajian_hw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 1、补全SimThreadExponential算子、aclnnBernoulli&aclnnInplaceBernoulli文档的设备信息。 2、补充example用例 3、补充DSARandomUniform、DSARandomNormal、DSAGenBitMask算子的readme文件。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/517 https://gitcode.com/cann/ops-math/issues/516 https://gitcode.com/cann/ops-math/issues/515 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 文档信息已补充,example已跑通 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 1、补全SimThreadExponential算子、aclnnBernoulli&aclnnInplaceBernoulli文档的设备信息。 2、补充DSARandomUniform、DSARandomNormal、DSAGenBitMask算子的readme文件。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1089 | 6 个月前 | |
view_copy支持下一代芯片 Co-authored-by: wuxiyuan<wuxiyuan@huawei.com> # message auto-generated for no-merge-commit merge: !917 merge master into master view_copy支持下一代芯片 Created-by: wuxiyuan Commit-by: wuxiyuan Merged-by: cann-robot Description: ## 描述 view_copy支持下一代芯片,同步修改受影响算子 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/636 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 完成ST所有用例验证 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!917 | 6 个月前 | |
新增随机数simt生成方式 Co-authored-by: guankarl<guanhongwei3@huawei.com> # message auto-generated for no-merge-commit merge: !1135 merge master into master 新增随机数simt生成方式 Created-by: guankarl Commit-by: guankarl Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 增加 simt方法 生成随机数 /* 使用说明 uint32_t key[ALG_KEY_SIZE] = {0, 0}; uint32_t counter[ALG_COUNTER_SIZE] = {0, 0, 0, 0}; PhiloxAlgParsInit(key, counter, seed, offset); int32_t step = 4; uint32_t totalThreads = gridDimx(动态计算) * blockDim(固定值); uint32_t magic, shift; GetUintDivMagicAndShift(magic, shift, totalThreads); // 方式1: for (int64_t i = (Simt::GetBlockIdx() * Simt::GetThreadNum() + Simt::GetThreadIdx()) * step; i < outputLength; i += Simt::GetBlockNum() * Simt::GetThreadNum() * step) { uint32_t results[ALG_COUNTER_SIZE]; // 或者 float类型 ThreadMappingAndSkip<step, CONTINUOUS_USE>(i, counter, magic, shift, totalThreads); PhiloxRandomSimt(key, counter, results); // 使用results 对连续的4个索引做操作 } // 方式2: for (int64_t i = (Simt::GetBlockIdx() * Simt::GetThreadNum() + Simt::GetThreadIdx()); i < outputLength; i += Simt::GetBlockNum() * Simt::GetThreadNum() * step) { uint32_t results[ALG_COUNTER_SIZE]; // 或者 float类型 ThreadMappingAndSkip<step, DIS_CONTINUOUS_USE>(i, counter, magic, shift, totalThreads); PhiloxRandomSimt(key, counter, results); // 使用results 对非连续的4个索引做操作,stride为totalThreads } */ ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/690 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1135 | 6 个月前 | |
fix drop_out_v3 graph_infer Co-authored-by: 刘晔恒<liuyeheng@huawei.com> # message auto-generated for no-merge-commit merge: !1102 merge drop_out_v3 into master fix drop_out_v3 graph_infer Created-by: liu-yeheng Commit-by: 刘晔恒 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 修改了随机类算子的infershape,因为动态场景下有fail,加上了日志打印。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 完成了二级冒烟和xrun geir测试 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1102 | 6 个月前 | |
update docs and proto for random_uniform_int_v2 Co-authored-by: 薛靖晖<xuejinghui@huawei.com> # message auto-generated for no-merge-commit merge: !1057 merge master into master update docs and proto for random_uniform_int_v2 Created-by: xuejinghui Commit-by: 薛靖晖 Merged-by: cann-robot Description: ## 描述 更新random_uniform_int_v2算子文档,移除不必要的CMakeLists ## 关联的Issue https://gitcode.com/cann/ops-math/issues/600 <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1057 | 6 个月前 | |
aclnn文档描述使用新模板,readme中link修复,修复一些文档中的描述错误 Co-authored-by: jisongyuan@h-partners.com<jisongyuan@h-partners.com> # message auto-generated for no-merge-commit merge: !1246 merge link-change into master aclnn文档描述使用新模板,readme中link修复,修复一些文档中的描述错误 Created-by: ji-songyuan Commit-by: jisongyuan@h-partners.com Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> aclnn文档描述使用新模板,readme中link修复,修复一些文档中的描述错误 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> [#736](https://gitcode.com/cann/ops-math/issues/736) ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 紧文档修改,不涉及代码修改 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> https://gitcode.com/cann/ops-math/tree/master/conversion https://gitcode.com/cann/ops-math/tree/master/math https://gitcode.com/cann/ops-math/tree/master/random conversion类文档、math类文档、随机数类文档 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1246 | 6 个月前 | |
【bugfix】修复random的文档信息 Co-authored-by: mjiajian_hw<majiajian@huawei.com> # message auto-generated for no-merge-commit merge: !1089 merge bugfix_md_random_2 into master 【bugfix】修复random的文档信息 Created-by: nunnons2 Commit-by: mjiajian_hw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 1、补全SimThreadExponential算子、aclnnBernoulli&aclnnInplaceBernoulli文档的设备信息。 2、补充example用例 3、补充DSARandomUniform、DSARandomNormal、DSAGenBitMask算子的readme文件。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/517 https://gitcode.com/cann/ops-math/issues/516 https://gitcode.com/cann/ops-math/issues/515 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 文档信息已补充,example已跑通 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 1、补全SimThreadExponential算子、aclnnBernoulli&aclnnInplaceBernoulli文档的设备信息。 2、补充DSARandomUniform、DSARandomNormal、DSAGenBitMask算子的readme文件。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1089 | 6 个月前 | |
fix codecheck warning Co-authored-by: 贾剑勇<jiajianyong123@hisilicon.com> # message auto-generated for no-merge-commit merge: !1322 merge master into master fix codecheck warning Created-by: jia-jianyong Commit-by: 贾剑勇 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> CodeCheck告警清理 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/779 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:CodeCheck告警清理 See merge request: cann/ops-math!1322 | 6 个月前 | |
fix codecheck warning Co-authored-by: 贾剑勇<jiajianyong123@hisilicon.com> # message auto-generated for no-merge-commit merge: !1322 merge master into master fix codecheck warning Created-by: jia-jianyong Commit-by: 贾剑勇 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> CodeCheck告警清理 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/779 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:CodeCheck告警清理 See merge request: cann/ops-math!1322 | 6 个月前 | |
fix: StatelessRandomChoiceWithMask空tensor兼容处理 Co-authored-by: fenglin28<fenglin28@huawei.com> # message auto-generated for no-merge-commit merge: !1266 merge randomchoisewithmask_emptytensor_pref into master fix: StatelessRandomChoiceWithMask空tensor兼容处理 Created-by: fenglin28 Commit-by: fenglin28 Merged-by: cann-robot Description: ## 描述 解决空 tensor 输入 StatelessRandomChoiceWithMask 算子行为异常的问题 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/745 ## 测试 通过自测试相关空tensor ST用例 ## 文档更新 不涉及 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!1266 | 6 个月前 | |
fix codecheck warning Co-authored-by: 贾剑勇<jiajianyong123@hisilicon.com> # message auto-generated for no-merge-commit merge: !1322 merge master into master fix codecheck warning Created-by: jia-jianyong Commit-by: 贾剑勇 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> CodeCheck告警清理 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/779 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:CodeCheck告警清理 See merge request: cann/ops-math!1322 | 6 个月前 | |
fix codecheck warning Co-authored-by: 贾剑勇<jiajianyong123@hisilicon.com> # message auto-generated for no-merge-commit merge: !1322 merge master into master fix codecheck warning Created-by: jia-jianyong Commit-by: 贾剑勇 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> CodeCheck告警清理 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/779 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:CodeCheck告警清理 See merge request: cann/ops-math!1322 | 6 个月前 | |
fix: aicpu opapi aclnn ut用例执行失败 Co-authored-by: “qiang_zq”<qiang.zhangqiang@huawei.com> # message auto-generated for no-merge-commit merge: !968 merge aicpu-opapi-ut-mock into master fix: aicpu opapi aclnn ut用例执行失败 Created-by: qiang_zq Commit-by: “qiang_zq” Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> aicpu opapi aclnn ut用例执行失败 bash build.sh -u --opapi --ops=not_equal  方案 aclnn用例执行依赖底层组件,在本地执行时因无法获取底层组件而导致失败。此处将调用底层组件逻辑打桩,只跑host侧逻辑。 通过分别设置依赖不同的头文件路径,使在opapi UT执行时,走打桩函数,正常业务执行时走底层组件。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/691 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> bash build.sh -u --opapi --ops=not_equal [ OK ] l2_logical_xor_test.aclnnLogicalXor_11_21_16_float_nd_1_1_1_double_nchw_testcase017 (0 ms) [ OK ] l2_logical_xor_test.aclnnLogicalXor_1_16_29_int16_ndhwc_32_16_1_int32_ndhwc_float32_testcase015 (0 ms)   ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!968 | 6 个月前 | |
随机数算子重构优化 Co-authored-by: fenglin28<fenglin28@huawei.com> # message auto-generated for no-merge-commit merge: !949 merge hh into master 随机数算子重构优化 Created-by: guankarl Commit-by: fenglin28 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 随机数算子重构优化,使用统一模板实现。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> https://gitcode.com/cann/ops-math/issues/552 <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x ] 其他,请描述: 随机数算子重构,总共分为 5 个部分: 算子infershape/inferdtype 实现了公共逻辑提取CommonInferShape,不同算子根据算子原型配置对应mode,新算子开发10行代码搞定 示例: static graphStatus InferShapeRandomUniformV2(gert::InferShapeContext* context) { const std::unordered_map<std::string, size_t>& input_map = { {"shape", RANDOM_UNIFORM_V2_X}, {"offset", RANDOM_UNIFORM_V2_OFFSET}}; const std::unordered_map<std::string, size_t>& output_map = { {"y", RANDOM_UNIFORM_V2_Y}, {"offset", RANDOM_UNIFORM_V2_OFFSET}}; int32_t mode = RANDOM_UNIFORM_V2_MODE_TYPE; return ops::common::CommonInferShape(context, input_map, output_map, mode); } IMPL_OP_INFERSHAPE(RandomUniformV2).InferShape(InferShapeRandomUniformV2); 算子信息库注册def 算子的不同输入如果有多组dtype时候,在算子信息库的枚举中,可能会有几十种组合,手写容易漏掉或者重复,且不好检查,通过提供RandomDtypeFmtGen类,调用对应接口即可获取全部组合类型。 示例: gen.GetSequence("inOutType") this->Input("x") .ParamType(REQUIRED) .DataType({gen.GetSequence("inOutType")}) .Format({baseFormatSeq}) .UnknownShapeFormat({baseFormatSeq}); 融合规则 有状态算子转无状态算子,存在范式的融合规则,通过提取公共类,定义公共接口,后续类似融合规则无需重新开发,直接调用对应接口即可。 class FusionRandomUtils { public: FusionRandomUtils() = default; ~FusionRandomUtils() = default; // FusionRandomUtils(const FusionRandomUtils&) = delete; // FusionRandomUtils& operator=(const FusionRandomUtils&) = delete; /** * @param graph 计算图对象 * @param opDesc 算子描述指针 * @param offsetNode 输出:创建的offset Variable节点 * @param shapeDesc Shape输入的Tensor描述 * @param outputDesc 主输出Y的Tensor描述 * @param opNode 基准算子节点(用于拼接新节点名) * @param fusionPassName 日志标识(用于日志溯源) * @param fusedOpType 融合算子类型(用于日志/错误信息溯源) * @return Status SUCCESS/FAILED/PARAM_INVALID */ static bool CheckSocVersion(const std::string& fusedOpType); static Status AddVariableNode( ge::ComputeGraph& graph, ge::NodePtr opNode, const ge::GeTensorDesc& offsetDesc, ge::NodePtr& newNode, const uint8_t* dataPtr, size_t size, const std::string& fusionPassName); static Status CreateInputOpDesc( ge::OpDescPtr& opDesc, ge::GeTensorDesc shapeDesc, ge::GeTensorDesc offsetDesc, const std::string& fusedOpType); static Status CreateOutputOpDesc( ge::OpDescPtr& opDesc, ge::GeTensorDesc outputDesc, ge::GeTensorDesc offsetDesc, const std::string& fusedOpType); static Status AddOpNodeAndDesc(ge::ComputeGraph& graph, ge::OpDescPtr& opDesc, ge::NodePtr& offsetNode, ge::GeTensorDesc shapeDesc, ge::GeTensorDesc outputDesc, ge::NodePtr opNode, const std::string& fusionPassName, const std::string& fusedOpType); static Status UpdateAttr(ge::NodePtr opNode, int64_t seed, int64_t seed2, ge::DataType dtype, const std::string& fusionPassName, const std::string& fusedOpType); static Status CreateNode(ge::ComputeGraph& graph, ge::NodePtr opNode, std::vector<ge::NodePtr>& fusionNodes, ge::NodePtr& opV2Node, const std::string& fusionPassName, const std::string& fusedOpType, const std::set<ge::DataType> aicoreDtypeSupportList); static Status RemoveNode(ge::NodePtr node, ge::ComputeGraph& graph, const std::string& fusedOpType); static Status ReplaceNode(ge::NodePtr oldNode, ge::NodePtr newNode, ge::ComputeGraph& graph, const std::string& fusedOpType, const std::string& fusionPassName); }; 算子tiling 抽象并统一流程,更加适合随机数算子,统一tilingData,按照配置做检查。 统一流程: ge::graphStatus RandomTilingArch35::DoTiling() { opName_ = context_->GetNodeName(); OP_LOGD(opName_, "Start tiling for op: %s", opName_.c_str()); // 步骤1:校验输入输出和属性 auto ret = CheckInputsOutputsAndAttrs(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Check inputs/outputs/attrs failed"); return ret; } // 步骤2: 获取硬件信息 ret = GetPlatformInfo(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Get platform info failed"); return ret; } // 步骤3: 填充TilingData ret = FillUnifiedTilingData(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Fill tiling data failed"); return ret; } // 步骤4:计算tilingKey和workspace ret = CalcTilingKeyAndWorkspace(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Calc tiling key/workspace failed"); return ret; } // 步骤5:后置处理(可选) ret = UniqueProcess(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Unique process failed"); return ret; } // 步骤6:写入context ret = WriteBackToContext(); if (ret != ge::GRAPH_SUCCESS) { OP_LOGE(opName_, "Write tiling data to context failed"); return ret; } // 步骤7:调用dump函数 auto info = tilingData_.DumpTilingInfo(); OP_LOGI("RandomTiling", "%s", info.str().c_str()); OP_LOGD(opName_, "Tiling success for op: %s", opName_); return ge::GRAPH_SUCCESS; } 统一tilingData int64_t usedCoreNum = 0; int64_t normalCoreProNum = 0; int64_t tailCoreProNum = 0; int64_t singleBufferSize = 0; uint32_t key[2] = {0}; uint32_t counter[4] = {0}; int64_t outputSize = 0; int64_t probTensorSize = 0; int64_t sharedTmpBufSize = 0; 当前tilingData较少,后续如有需要,按需添加 按照配置做检查: OpTilingConfig config; config.inputCheckRules = { // 输入索引: dtype列表,shapeSize,dim_num {0, {{ge::DT_INT32, ge::DT_INT64}, -1, {1}, nullptr}}, // shape {1, {{ge::DT_INT64}, 1, {}, nullptr}}, // offset }; config.outputCheckRules = { // 输出索引: dtype列表,shapeSize,dim_num {0, {{ge::DT_FLOAT, ge::DT_FLOAT16, ge::DT_BF16}, -1, {1,2,3,4,5,6,7,8}, nullptr}} }; // y 算子kernel kernel抽取了RandomKernelBaseOp类,专门管理tilingData,内置了Skip函数和生成随机数函数,其他算子只需调用VarsInit接口即可 See merge request: cann/ops-math!949 | 7 个月前 | |
update operators Co-authored-by: biabu111<hebaojing1@huawei.com> # message auto-generated for no-merge-commit merge: !916 merge master into master update operators Created-by: biabu111 Commit-by: biabu111 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 增强以下算子功能 tensor_equal tensor_move tril triu stalessrandomuniform stalessrandomnormal assign dsarandomuniform dsarandomnormal ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> #530 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!916 | 7 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 7 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 7 个月前 | ||
| 7 个月前 |