kali20gakki/msAgent / skills/accuracy/deterministic-calculation-analysis
deterministic-calculation-analysis
Verified执行msProbe数据比对并分析比对结果,定位确定性计算问题首个输入一致输出不一致的API。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.1 KB |
| scripts/find_first_diff_api_L1.py | script | 9.7 KB |
| scripts/find_first_diff_api_mix.py | script | 12.6 KB |
| scripts/md5_dump_files_checker.py | script | 7.3 KB |
| scripts/msprobe_utils.py | script | 3.3 KB |
scripts/msprobe_utils.py
View on GitHub# -------------------------------------------------------------------------
# This file is part of the MindStudio project.
# Copyright (c) 2026 Huawei Technologies Co.,Ltd.
#
# MindStudio is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# -------------------------------------------------------------------------
"""msprobe分析工具公共模块:排除规则、双列表格输出、API排除判断。"""
# 不参与md5比对的API参数
EXCLUDED_PARAMS = {
'Distributed.recv': {'inputs': [0]},
'Distributed.irecv': {'inputs': [0, 'tensor']},
'Distributed.isend': {'outputs': [0]},
'Distributed.all_gather': {'inputs': [0]},
'Distributed.gather': {'inputs': [1]},
'Distributed.scatter': {'inputs': [0]},
'Distributed.reduce_scatter': {'inputs': [0]},
'Distributed._reduce_scatter_base': {'inputs': [0]},
'Distributed._all_gather_base': {'inputs': [0]},
'Distributed.all_to_all_single': {'inputs': [0]},
'Distributed.all_to_all': {'inputs': [0]},
'Distributed.all_gather_into_tensor': {'inputs': [0]},
'Distributed.reduce_scatter_tensor': {'inputs': [0]},
'NPU.npu_fusion_attention': {'outputs': [4, 5]},
}
def build_excluded_rules():
"""从EXCLUDED_PARAMS构建排除规则列表,格式: [(prefix, direction, set_of_str_indices)]"""
rules = []
for prefix, config in EXCLUDED_PARAMS.items():
if 'inputs' in config:
rules.append((prefix, 'input', set(str(i) for i in config['inputs'])))
if 'outputs' in config:
rules.append((prefix, 'output', set(str(i) for i in config['outputs'])))
return rules
def is_key_excluded(api_name, io_type, index_str, rules):
"""判断(api_name, io_type, index_str)是否在排除规则中。"""
for prefix, direction, indices in rules:
if direction != io_type:
continue
if api_name.startswith(prefix):
if index_str in indices:
return True
return False
def print_kv_table(rank, kv_rows, col_field=20, col_value=120):
"""打印单个rank的双列表格。value_str支持换行符自动分行。"""
sep = '+' + '-' * (col_field + 2) + '+' + '-' * (col_value + 2) + '+'
header = f"| {'Rank ' + str(rank):^{col_field + col_value + 3}} |"
print()
print(sep)
print(header)
print(sep)
for field, value in kv_rows:
value_lines = value.split('\n')
first = True
for vl in value_lines:
f_display = field if first else ''
print(f"| {f_display:<{col_field}} | {vl:<{col_value}} |")
first = False
print(sep)
def is_api_excluded(api_name, excluded_apis):
"""判断API是否被用户排除(前缀匹配)。"""
if not excluded_apis:
return False
for prefix in excluded_apis:
if api_name.startswith(prefix):
return True
return False
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |