Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs of feature that disabling optimization pipeline in runtime #119158

Open
corona10 opened this issue May 18, 2024 · 0 comments
Open

Needs of feature that disabling optimization pipeline in runtime #119158

corona10 opened this issue May 18, 2024 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@corona10
Copy link
Member

corona10 commented May 18, 2024

@iritkatriel
This feature is needed for debugging or experimentation when handling optimized bytecode.
When I want to take a look at the sequence of bytecodes that is optimized with the specific pipeline but not all pipelines, I need to disable several pipelines from

cpython/Python/flowgraph.c

Lines 1843 to 1851 in 30b4e9f

RETURN_IF_ERROR(check_cfg(g));
RETURN_IF_ERROR(inline_small_or_no_lineno_blocks(g->g_entryblock));
RETURN_IF_ERROR(remove_unreachable(g->g_entryblock));
RETURN_IF_ERROR(resolve_line_numbers(g, firstlineno));
RETURN_IF_ERROR(optimize_load_const(const_cache, g, consts));
for (basicblock *b = g->g_entryblock; b != NULL; b = b->b_next) {
RETURN_IF_ERROR(optimize_basic_block(const_cache, b, consts));
}
RETURN_IF_ERROR(remove_redundant_nops_and_pairs(g->g_entryblock));
and rebuild the CPython it's pretty painful because when I want to change the combination of optimization than I should rebuild CPython every time.

It would be great if there is a way to disable specific optimization pipelines at runtime when I want.
Above example is just one specific case and sometime I want to disable all _PyCfg_OptimizeCodeUnit or part of _PyCfg_OptimizeCodeUnit.

This is what I wanted to ask about at the PyCon and will happy to see your opinion about this.

@Eclips4 Eclips4 added the type-feature A feature request or enhancement label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants