Skip to content

AST-based utility for checking ops registration and relative imports #729

Description

@moon-bot-app

We'd like an AST-based utility (for kernels-community) that statically checks kernel source for common correctness issues, in particular:

  • Ops registration — verify that ops are correctly registered (e.g. names match, definitions are consistent).
  • Relative imports — verify that Python files in torch-ext/ use correctly relativized imports.

Motivation / context

This came up while discussing how to make kernel conversion more deterministic. A lot of the conversion steps could be automated, e.g.:

  • Fetch a kernel from a URL at a given tag (vx.y.z, or latest stable).
  • Copy files from foo/bar/baz to torch-ext/bar/baz.
  • Relativize paths in Python files in torch-ext/bar.
  • Fix op definitions in Python files in torch-ext/hello.

The AST-based checker/utility could become a reusable component for that flow. There's an open question of whether the conversion tooling should be a full DSL or just a Python utility — this issue tracks the underlying AST-based utility itself, which is useful either way.

Related: #718


Requested by Sayak Paul - Slack thread - Agent trace

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions