Skip to content

[PyCDE] Set MLIR op location based on Python call site #1346

Open
@teqdruid

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)?

Metadata

Assignees

No one assigned

    Labels

    PyCDEPython CIRCT Design Entry API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions