Revert "[dynamo] added github_cli to detect unimplemented_v2 calls (#155610)"

This reverts commit 5dd07c70e53a86b73f49711b8186d86dc4f1b32a.

Reverted https://github.com/pytorch/pytorch/pull/155610 on behalf of https://github.com/malfet due to Looks like it fails on every pull request, based on https://github.com/pytorch/pytorch/actions/workflows/check-unimplemented-calls.yml, but it does not run on trunk ([comment](https://github.com/pytorch/pytorch/pull/155610#issuecomment-2963929765))
This commit is contained in:
PyTorch MergeBot
2025-06-11 19:31:53 +00:00
parent 1e373d02d5
commit f80a61adf5
2 changed files with 1 additions and 128 deletions

View File

@ -1,51 +0,0 @@
name: Check unimplemented_v2 calls
on:
pull_request:
paths:
- 'torch/_dynamo/**/*.py'
jobs:
check-unimplemented-calls:
if: github.repository_owner == 'pytorch'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Get changed files
id: changed-files
run: |
echo "files=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep '\.py$' | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
- name: Check unimplemented_v2 calls
run: |
python tools/dynamo/gb_id_mapping.py check --files "${{ steps.changed-files.outputs.files }}" --registry-path tools/dynamo/graph_break_registry.json
continue-on-error: true
id: check-calls
- name: Fail if unimplemented_v2 calls don't match registry
if: steps.check-calls.outcome == 'failure'
run: |
echo "::error::Found unimplemented_v2 calls that don't match the registry."
echo "::error::Please update the registry using one of these commands:"
echo "::error::- Add new entry: python tools/dynamo/gb_id_mapping.py add \"GB_TYPE\" PATH_TO_FILE [--additional-info \"INFO\"]"
echo "::error::- Update existing: python tools/dynamo/gb_id_mapping.py update \"GB_TYPE\" PATH_TO_FILE [--new_gb_type \"NEW_NAME\"] [--additional-info \"INFO\"]"
echo "::error::- Recreate registry: python tools/dynamo/gb_id_mapping.py create"
echo "::error::Note: If you've reset the entire registry file, you can force push to bypass this check."
exit 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

View File

@ -266,53 +266,6 @@ def cmd_update_gb_type(
return True
def check_unimplemented_calls(files, registry_path):
"""
Checks if the unimplemented_v2 calls in the specified files match the entries in the registry.
Args:
files (list of str): A list of file paths to check for unimplemented_v2 calls.
registry_path (str or Path): The path to the registry JSON file containing expected entries.
Returns:
bool: True if all unimplemented_v2 calls match the registry entries, False if there are mismatches.
The function compares the gb_type, context, explanation, and hints of each unimplemented_v2 call
in the provided files against the corresponding entries in the registry. If any discrepancies are
found, it prints the details and returns False. Otherwise, it confirms that all calls match the
registry and returns True.
"""
registry_path = Path(registry_path)
reg = load_registry(registry_path)
gb_type_to_entry = {entries[0]["Gb_type"]: entries[0] for _, entries in reg.items()}
mismatches = []
for file in files:
calls = find_unimplemented_v2_calls(Path(file))
for call in calls:
gb_type = call["gb_type"]
if gb_type not in gb_type_to_entry:
mismatches.append((gb_type, file, "Not found in registry"))
continue
entry = gb_type_to_entry[gb_type]
if call["context"] != entry["Context"]:
mismatches.append((gb_type, file, "Context mismatch"))
elif call["explanation"] != entry["Explanation"]:
mismatches.append((gb_type, file, "Explanation mismatch"))
elif sorted(call["hints"]) != sorted(entry["Hints"]):
mismatches.append((gb_type, file, "Hints mismatch"))
if mismatches:
for gb_type, file, reason in mismatches:
print(f" - {gb_type} in {file}: {reason}")
return False
print("All unimplemented_v2 calls match the registry.")
return True
def create_registry(dynamo_dir, registry_path):
calls = find_unimplemented_v2_calls(dynamo_dir)
registry = {}
@ -361,12 +314,6 @@ def main():
default=default_dynamo_dir,
help="Directory to search for unimplemented_v2 calls.",
)
create_parser.add_argument(
"--registry-path",
type=str,
default=str(registry_path),
help="Path to save the registry JSON file",
)
add_parser = subparsers.add_parser("add", help="Add a gb_type to registry")
add_parser.add_argument("gb_type", help="The gb_type to add")
@ -376,12 +323,6 @@ def main():
add_parser.add_argument(
"--additional-info", help="Optional additional information to include"
)
add_parser.add_argument(
"--registry-path",
type=str,
default=str(registry_path),
help="Path to save the registry JSON file",
)
update_parser = subparsers.add_parser(
"update", help="Update an existing gb_type in registry"
@ -397,20 +338,8 @@ def main():
update_parser.add_argument(
"--additional-info", help="Optional additional information to include"
)
update_parser.add_argument(
"--registry-path",
type=str,
default=str(registry_path),
help="Path to save the registry JSON file",
)
check_parser = subparsers.add_parser(
"check", help="Check if unimplemented_v2 calls match registry entries"
)
check_parser.add_argument(
"--files", type=str, help="Space-separated list of files to check"
)
check_parser.add_argument(
parser.add_argument(
"--registry-path",
type=str,
default=str(registry_path),
@ -437,11 +366,6 @@ def main():
)
if not success:
sys.exit(1)
elif args.command == "check":
files = args.files.split()
success = check_unimplemented_calls(files, args.registry_path)
if not success:
sys.exit(1)
else:
parser.print_help()