ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

CANN/GE ATC原始GE选项配置

2026/9/10 4:53:08 拓冰建站 浏览量
CANN/GE ATC原始GE选项配置 ATC Raw GE Options【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge1. OverviewATC offline compilation entry supports two types of GE compile option inputs:Explicit command-line parameters, e.g.,--jit_compile,--optimization_switch,--static_model_ops_lower_limitJSON file pointed to by--raw_ge_optionsjson_pathATC still only passes one flattenedstd::mapstd::string, std::stringoptions to GE Compiler. raw JSON only changes the source and merge order of options, not changing GE Compiler, Runtime, OM serialization format or global/session/graph option API.2. raw_ge_options FormatATC only parses top-levelcompile optionsand ignoresexecute options:{ compile options: { global: { ge.jit_compile: 1 }, session: { ge.jit_compile: 1 }, graph: { ge.jit_compile: 2 } } }Onlyglobal,session,graphthree objects are allowed undercompile options. Three segments of configuration will be flattened to same options map, with override order:graph session globalEach option key must be non-empty, each option value must be JSON string.3. Support and Priorityraw option support is based on GE options already supported by ATC:GE option keys maintained inBuildAtcGeOptionToCliNameMap()inapi/atc/atc_option_map.ccATC visible optimization items registered inOptionRegistry::GetVisibleOptions(OoEntryPoint::kAtc)When--raw_ge_options_ignore_unsupportedfalse, unsupported options appearing in raw file will fail; whentrue, unsupported items will be skipped, other supported items continue to take effect.Final merge rules:ATC first parses command line, recording user explicitly passed CLI parametersraw file is parsed and validated to get raw optionsIf raw key corresponds to ATC required CLI parameter, and that CLI parameter was not explicitly set by user, then error, raw cannot replace required CLIIf raw keys corresponding ATC CLI parameter was not explicitly set by user, then write raw value to correspondingFLAGS_*SubsequentCheckFlags(),ParseGraph(),SetOutputNodeInfo()and options construction continue on original CLI pathFor dynamically registered optimization items inOptionRegistry, raw also merges into final options by CLI explicit priority ruleAppendOptimizationOptions()finally appends ATC fixed optimization switches, e.g.,forbidden_close_pass:onThis order guaranteesge.outputDatatype,ge.inputShape,ge.enableCompressWeight,ge.status_checkand other options depending on ATC pre-parsing, value conversion or side effects behave consistently with CLI.4. Constraintsraw file cannot replace ATC required parameters, e.g.,--model,--framework,--soc_version,--outputOption values in raw file first reuse corresponding CLI flags basic type and enum validation; e.g.,ge.jit_compilemust be0,1or2ge.exec.static_model_ops_lower_limitadditionally reuses CLIs[-1, INT64_MAX]range validationCombination constraints involving multiple options are uniformly validated by originalCheckFlags()after raw injection intoFLAGS_*, avoiding dual rules when raw combines with explicit CLIIn OM2 mode, raw injected flags participate in OM2 unsupported parameter check together with user explicit CLI parametersge.optimizationSwitchis transparently passed as string at ATC entry, subsequently parsed by existing OptimizationOption flow; dynamically registered optimization items reuse their registered value checkerThis feature only applies to ATC offline compilation entry, does not affect online Session/API entry【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考