Skip to content

[FlagPrism][Mthreads] Integrate profiler and debugger - #1106

Open
Jacob-yen wants to merge 2 commits into
flagos-ai:mainfrom
ZQ-Struggle:mthread-dev-202609
Open

[FlagPrism][Mthreads] Integrate profiler and debugger#1106
Jacob-yen wants to merge 2 commits into
flagos-ai:mainfrom
ZQ-Struggle:mthread-dev-202609

Conversation

@Jacob-yen

Copy link
Copy Markdown
Contributor

This pull request extends support for the FlagPrism profiler/debugger to the mthreads backend and integrates FlagPrism instrumentation throughout the mthreads compilation and runtime pipeline. It also introduces mechanisms for using external FlagPrism source directories, improves error messages and test coverage, and adds hooks for debugger integration and event emission during compilation and code generation.

FlagPrism support for mthreads backend:

  • The mthreads backend is now recognized as a supported backend for FlagPrism in both CMake (FlagTreeOptions.cmake) and Python (setup_helper.py). This enables the profiler/debugger by default for mthreads and updates error messages and tests to reflect this support. [1] [2] [3] [4]

External source and build configuration improvements:

  • Both CMake and Python build scripts now allow specifying a custom FLAGPRISM_SOURCE_DIR for local development, rather than requiring the bundled third-party directory. The build configuration is updated accordingly. [1] [2] [3]

mthreads backend integration with FlagPrism:

  • The mthreads driver (driver.py) is instrumented to preserve user arguments and launch metadata, append a debugger control pointer to the ABI when needed, and wrap kernel launches with debugger context when enabled. [1] [2] [3] [4]

Compiler and code generation hooks:

  • The mthreads code generator and compiler now emit FlagPrism events for assignments and expressions, load optional dialects, and allow profiler/debugger options to participate in specialization and cache-key construction. Compiler events are emitted after IR overrides. [1] [2] [3] [4] [5] [6] [7] [8]

Runtime integration:

  • The JIT runtime now applies profiler/debugger options before backend specialization, ensuring correct instrumentation during kernel execution. [1] [2]

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant