NVIDIA / NVIDIA/cutlass

[FEA][torchinductor-EVT] Allow function source code to be passed directly to EVT tracer

Open
#2,244 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

? - Needs Triage feature request inactive-30d inactive-90d
Dominant language
C++
Stars
10.5k
Forks
2.1k
Avg merge
3d 11h
Merged PRs (30d)
7

Description

Is your feature request related to a problem? Please describe.
At https://github.com/NVIDIA/cutlass/blob/5e497243f7ad13a2aa842143f9b10bbb23d98292/python/cutlass/epilogue/epilogue.py#L117

the trace(..) API takes in a function. The main issue here is that when dynamically defining a python function like so

fn = exec("""
def fn(x):
  return x
"""

extracting the source using inspect.getsource here fails.

This is how inductor generates the python source in essence (it generates a function string) so this does signature doesn't work.

Describe the solution you'd like
Modify the signature of trace to take the function source string directly.

cc @henrylhtsang, @eellison

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the trace API in python/cutlass/epilogue/epilogue.py around line 117, then inspect source extraction in python/cutlass/backend/evt/frontend/python_ast.py around line 59. Trace how the function input is consumed and determine the expected behavior for a dynamically generated function source string. Done means the API accepts source directly and avoids the failing inspect.getsource path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.