[PyCDE] Set MLIR op location based on Python call site
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Right now, everything created in PyCDE has the operation location set to 'Unknown'. This makes debugging obscenely difficult. What I'd prefer is a mechanism to set the default location (`DefaultingPyLocation`) to call a function (either C++ or Python) to compute the location. In that function, we could get a stack trace, find the user code which is calling into PyCDE and creating the operation, then return a location which corresponds to that Python code.
@stellaraccident Is it possible to do this now? I haven't found a way. I also think it would just be a matter of modifying `PyLocation` to accept a callback rather than just a static location, yes? Alternatively, what do you think about making `get()` virtual and allowing users to override it from Python (a la https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python)?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing PyCDE operation creation through DefaultingPyLocation and PyLocation, including the get() entry point mentioned in the issue. Determine whether a callback or overridable implementation can identify the Python caller and produce an MLIR location instead of Unknown; done means PyCDE operations receive useful source locations from Python call sites.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100