PythonBPF: Add Compilation Context to allow parallel compilation of multiple jobs#82
Merged
PythonBPF: Add Compilation Context to allow parallel compilation of multiple jobs#82
Conversation
…ultiple bpf programs
r41k0u
commented
Mar 28, 2026
| sz = None | ||
| if isinstance(arg, ast.Name): | ||
| # Stack space is already allocated | ||
| ptr = get_var_ptr_from_name(arg.id, local_sym_tab) |
r41k0u
commented
Mar 28, 2026
| val = get_operand_value( | ||
| func, module, arg, builder, local_sym_tab, map_sym_tab, struct_sym_tab | ||
| ) | ||
| val = eval_expr(func, compilation_context, builder, arg, local_sym_tab) |
Collaborator
Author
There was a problem hiding this comment.
This looked sus but is probably fine
r41k0u
commented
Mar 28, 2026
pythonbpf/helper/helper_utils.py
Outdated
|
|
||
|
|
||
| _temp_pool_manager = ScratchPoolManager() # Singleton instance | ||
| # Simple check for name |
Collaborator
Author
There was a problem hiding this comment.
Don't like this, will stick to older implementation but with compilation context. This is somehow incompatible with bpf_helper_handler as well
r41k0u
commented
Mar 28, 2026
pythonbpf/maps/maps_pass.py
Outdated
| if handler and handler.is_vmlinux_enum(name): | ||
| return handler.get_vmlinux_enum_value(name) | ||
|
|
||
| # Fallback to VmlinuxHandlerRegistry if handler invalid |
Collaborator
Author
There was a problem hiding this comment.
This is unnecessary until we port VmlinuxHandlerRegistry to compilation_context
Collaborator
Author
There was a problem hiding this comment.
I'd say even undesirable
r41k0u
commented
Mar 28, 2026
pythonbpf/allocation_pass.py
Outdated
| logger.debug(f"Allocated temp variable: {temp_name}") | ||
|
|
||
|
|
||
| def _get_alignment(tmp_type): |
Collaborator
Author
There was a problem hiding this comment.
unnecessary to change this
r41k0u
commented
Mar 28, 2026
pythonbpf/allocation_pass.py
Outdated
|
|
||
|
|
||
| def _allocate_for_attribute(builder, var_name, rval, local_sym_tab, structs_sym_tab): | ||
| def _allocate_with_type(builder, var_name, ir_type): |
r41k0u
commented
Mar 28, 2026
Collaborator
Author
r41k0u
left a comment
There was a problem hiding this comment.
Reviewed once. All the things I didn't like have been changed. Will test again and merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces
Compilation Contextto allow multiple job runs on different threads, and to clean up core implementation - cleaner function signatures