Gpu concat kernel improvements - #5175
Draft
pfultz2 wants to merge 46 commits into
Draft
Conversation
Regressions detected 🔴 * No develop baseline was found for this PR's branch point; compared against the latest available develop run instead. |
Contributor
There was a problem hiding this comment.
Pull request overview
Optimizes GPU concat for small, equal-width fast-axis inputs using an LDS-backed tiled kernel, with supporting kernel utilities and tests.
Changes:
- Adds tiled concat selection and execution.
- Extends kernel indexing, shape, debug, and preprocessor utilities.
- Expands GPU kernel and concat verification coverage.
Review performed as a single pass without agent fan-out.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/reduce_dims.cpp |
Enables reduction across differing fast dimensions. |
src/targets/gpu/compile_gen.cpp |
Exposes tile-factor computation. |
src/targets/gpu/include/migraphx/gpu/compile_gen.hpp |
Declares the tile-factor helper. |
src/targets/gpu/jit/concat.cpp |
Selects and launches tiled concat. |
src/targets/gpu/kernels/include/migraphx/kernels/concat.hpp |
Implements tiled and simple concat algorithms. |
src/targets/gpu/kernels/include/migraphx/kernels/debug.hpp |
Supports multi-argument source-location capture. |
src/targets/gpu/kernels/include/migraphx/kernels/functional.hpp |
Reorders helpers and simplifies arg_c<0>. |
src/targets/gpu/kernels/include/migraphx/kernels/index.hpp |
Adds ceiling group counts and block-stride traversal. |
src/targets/gpu/kernels/include/migraphx/kernels/pp.hpp |
Extends recursive preprocessor utilities. |
src/targets/gpu/kernels/include/migraphx/kernels/reduce.hpp |
Adapts reduction to the revised repeat macro. |
src/targets/gpu/kernels/include/migraphx/kernels/shape.hpp |
Asserts nonempty kernel shapes. |
src/targets/gpu/kernels/include/migraphx/kernels/tensor_view.hpp |
Adds multidimensional index construction. |
src/targets/gpu/kernels/include/migraphx/kernels/test.hpp |
Adds templated kernel-test macros. |
test/gpu/compile_gen.cpp |
Tests tile-factor behavior. |
test/gpu/kernels/functional.cpp |
Adds device functional-utility tests. |
test/gpu/kernels/index.cpp |
Tests block-stride traversal. |
test/gpu/kernels/main.cpp |
Discovers templated kernel tests. |
test/gpu/kernels/pp.cpp |
Adds device preprocessor tests. |
test/gpu/kernels/shape.cpp |
Adds device shape tests. |
test/reduce_dims.cpp |
Covers differing fast dimensions. |
test/verify/test_concat_axis_neg_1.cpp |
Exercises varied concat sizes and types. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+124
to
+127
| std::transform(is.begin(), is.end(), rstrides.begin(), [&](auto i) -> std::size_t { | ||
| if(lens[i] == s.lens()[i]) | ||
| { | ||
| rstrides[i] = stride; | ||
| stride *= lens[i]; | ||
| } | ||
| else if(lens[i] != 1 and s.lens()[i] != 1) | ||
| { | ||
| return shape{}; | ||
| } | ||
| } | ||
| return base.strides()[i]; | ||
| return 0; |
Comment on lines
+132
to
+133
| if(concat_axis == axis and max_elements_per_op < 64 and | ||
| max_elements_per_op == avg_elements_per_op) |
| #endif | ||
|
|
||
| constexpr auto ngroup() const { return nglobal() / max_nlocal(); } | ||
| constexpr auto ngroup() const { return (nglobal() + max_nlocal() - _c<1>) / max_nlocal(); } |
Comment on lines
+43
to
+44
| // The name may be a template-id, so it can contain spaces and commas | ||
| // (`TEST_CASE_REGISTER(foo<unsigned long, int>)`); trim what that lets in trailing. |
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
Technical Details
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot ApplicableFollow the LLVM AI Tool Use Policy for contributions using AI.