Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Nested compilation exits before benchmark MXR files can be saved when dump mode is enabled.
2 open findings
What changed in this PR
Batches GPU operation compilation across the root module and reachable submodules to improve kernel deduplication and parallelism.
Changes:
- Collects eligible modules and compiles their plans together.
- Batches compilation of inserted device operations.
- Adds cross-submodule binary-cache coverage.
Review was performed as a single pass without agent fan-out.
| File | Description |
|---|---|
src/targets/gpu/compile_ops.cpp |
Implements cross-module compilation batching. |
test/gpu/binary_cache.cpp |
Tests deduplication across conditional submodules. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| // Exit on the root module so all submodules get processed first. | ||
| if(dump_mxr and is_root) | ||
| if(dump_mxr) |
| EXPECT(cache->get_stats().reused == 1); | ||
| } | ||
|
|
||
| static migraphx::program same_pointwise_in_two_submodules() |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5370 +/- ##
===========================================
- Coverage 92.71% 92.70% -0.00%
===========================================
Files 635 635
Lines 36204 36204
===========================================
- Hits 33563 33562 -1
- Misses 2641 2642 +1 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.


Motivation
compile_opsran once per module, so each submodule compiled and benchmarked its own precompile ops in isolation. Identical kernels in different submodules only avoided a second compile by hitting the in-memory binary cache after the first module finished, and the parallel compile was split into many small per-module batches instead of one large one.Technical Details
compile_ops::applynow returns immediately for non-root modules. On the root it collects the root plus every reachable submodule, deduplicated and skipping bypassed modules, matching what the pass manager skips.compile_managergainedadd_plans(ctx, module), andcompile()no longer takes a module oris_rootflag. Eachcompile_planalready records its owning module, so results are replaced intocp.mod.replace_inserted_device_opstakes a list of modules. It runsdead_code_eliminationandlower_device_opson each, then compiles the inserted device ops in one batch as well. The benchmark MXR dump path passes a single-module list.same_kernel_in_two_submodules_compiles_oncetotest/gpu/binary_cache.cpp. Anifprogram with the same pointwise kernel in both branches must produce one code object per submodule with exactly one compile and zero cache reuses, which pins the batched behavior rather than the old compile-then-reuse sequence.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot ApplicableFollow the LLVM AI Tool Use Policy for contributions using AI.