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
We'd like an AST-based utility (for
kernels-community) that statically checks kernel source for common correctness issues, in particular: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.:
vx.y.z, or latest stable).foo/bar/baztotorch-ext/bar/baz.torch-ext/bar.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