Skip to content

增加算子库校验基准configs#37

Open
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/mcoplib-lint-benchmark-configs
Open

增加算子库校验基准configs#37
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/mcoplib-lint-benchmark-configs

Conversation

@ghangz

@ghangz ghangz commented Jun 10, 2026

Copy link
Copy Markdown

这次改动补上了算子库校验基准configs,主要是为了解决算子库构建和诊断流程里相关信息不够集中、人工整理成本较高的问题,让日常排查、验证和结果归档更直接。

实现上补充了对应工具或脚本逻辑,补上了对应测试,同时尽量保持现有用法不变,避免影响已有流程。

这一分支已经在沐曦算力环境完成实际验证,相关检查均已通过,现提交合入。

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new linting script, tools/lint_benchmark_configs.py, along with its corresponding unit tests, to validate that benchmark configuration JSON files and runner Python scripts are correctly paired and that the JSON files are valid. The review feedback suggests improving the robustness of the script's JSON parsing logic by catching (OSError, ValueError) instead of only json.JSONDecodeError, which prevents potential script crashes due to unreadable files or encoding issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tools/lint_benchmark_configs.py Outdated
Comment on lines +38 to +41
try:
json.loads(path.read_text(encoding="utf-8"))
except json.JSONDecodeError as exc:
errors.append(f"invalid JSON in {path.relative_to(root).as_posix()}: {exc}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在读取和解析 JSON 文件时,仅捕获 json.JSONDecodeError 可能会导致其他异常(例如文件编码不正确导致的 UnicodeDecodeError,或者权限问题导致的 OSError)未被捕获,从而导致整个校验脚本崩溃。建议捕获 (OSError, ValueError) 以提高脚本的健壮性。

Suggested change
try:
json.loads(path.read_text(encoding="utf-8"))
except json.JSONDecodeError as exc:
errors.append(f"invalid JSON in {path.relative_to(root).as_posix()}: {exc}")
try:
json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
errors.append(f"invalid JSON or unreadable file in {path.relative_to(root).as_posix()}: {exc}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant