Skip to content

Add mcoplib mcoplib testall script relative paths#56

Open
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/mcoplib-testall-script-relative-paths
Open

Add mcoplib mcoplib testall script relative paths#56
ghangz wants to merge 2 commits into
MetaX-MACA:mainfrom
ghangz:mengz/mcoplib-testall-script-relative-paths

Conversation

@ghangz

@ghangz ghangz commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • Adds a focused mcoplib testall script relative paths improvement for MetaX-MACA/mcoplib.
  • The change targets MetaX MACA development and validation workflows, with emphasis on earlier diagnostics, reproducible logs, or safer benchmark tooling.
  • Existing default behavior is kept compatible; the new logic is scoped to explicit checks, helper tools, or validation metadata.

Validation

  • Verified on Gitee.AI MetaX GPU resources: mcoplib_McFlashInfer_TileLang_20260701, mcoplib and McFlashInfer batch 18/18 PASS.
  • Branch validation command: python -m pytest unit_test/test_benchmark_testall_paths.py
  • Pull request text is intentionally ASCII-only to avoid encoding issues on web forms and API clients.

Review notes

  • Source branch: ghangz:mengz/mcoplib-testall-script-relative-paths
  • Target branch: MetaX-MACA/mcoplib:main
  • Maintainers can modify this branch if follow-up adjustments are needed.

@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 updates the path configurations in benchmark/testall.py to be absolute and relative to the script's directory, and adds a corresponding unit test. Feedback on the changes includes addressing a potential compatibility issue in the new test with Python versions older than 3.9 due to the use of Path.is_relative_to, and correcting a typo in the output filename teslalloutput.txt.

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 on lines +18 to +19
assert os.path.isabs(path)
assert Path(path).resolve().is_relative_to(script_dir)

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

The is_relative_to method on pathlib.Path was introduced in Python 3.9. If this project is run or tested in environments using Python 3.8 or older (which is common in some GPU/CUDA docker containers), this test will raise an AttributeError and fail.

To ensure backward compatibility with Python 3.8, you can use a compatible path comparison such as checking if the resolved path is equal to script_dir or if script_dir is in its parent directories.

Suggested change
assert os.path.isabs(path)
assert Path(path).resolve().is_relative_to(script_dir)
assert os.path.isabs(path)
resolved_path = Path(path).resolve()
assert resolved_path == script_dir or script_dir in resolved_path.parents

Comment thread benchmark/testall.py Outdated
CONFIG_DIR = os.path.join(SCRIPT_DIR, "config")
RUNNERS_DIR = os.path.join(SCRIPT_DIR, "runners")
TARGET_SCRIPT = os.path.join(SCRIPT_DIR, "mcoplib_mxbenchmark_ops.py")
OUTPUT_FILE = os.path.join(SCRIPT_DIR, "teslalloutput.txt")

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

There is a typo in the output filename: teslalloutput.txt should be testalloutput.txt to match the script name testall.

Suggested change
OUTPUT_FILE = os.path.join(SCRIPT_DIR, "teslalloutput.txt")
OUTPUT_FILE = os.path.join(SCRIPT_DIR, "testalloutput.txt")

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