ROCm / ROCm/AMDMIGraphX

Fuse "contiguous + concat"

Open
#2,847 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Perf Improve
Dominant language
C++
Stars
333
Forks
150
Avg merge
4d 19h
Merged PRs (30d)
54

Description

@212 = reshape_lazy[dims={1, 256, 20, 1, 20, 1}](@210) -> half_type, {1, 256, 20, 1, 20, 1}, {102400, 400, 20, 20, 1, 1}, target_id=0: 0.00093558ms, 1%
@213 = load[offset=4505600,end=5324800](@1) -> half_type, {1, 256, 20, 2, 20, 2}, {409600, 1600, 80, 40, 2, 1}, target_id=0: 0.00062104ms, 1%
@214 = multibroadcast[out_lens={1, 256, 20, 2, 20, 2},out_dyn_dims={}](@212) -> half_type, {1, 256, 20, 2, 20, 2}, {102400, 400, 20, 0, 1, 0}, target_id=0: 0.00112586ms, 1%
@215 = gpu::code_object[code_object=9168,symbol_name=contiguous_kernel,global=204800,local=1024,](@214,@213) -> half_type, {1, 256, 20, 2, 20, 2}, {409600, 1600, 80, 40, 2, 1}, target_id=0: 0.0184781ms, 1%
@216 = load[offset=2867200,end=4505600](@1) -> half_type, {1, 512, 40, 40}, {819200, 1600, 40, 1}, target_id=0: 0.00066402ms, 1%
@217 = reshape_lazy[dims={1, 256, 40, 40}](@215) -> half_type, {1, 256, 40, 40}, {409600, 1600, 40, 1}, target_id=0: 0.00062264ms, 1%
@218 = gpu::code_object[code_object=9352,symbol_name=concat_kernel,global=204800,local=1024,](@217,@150,@216) -> half_type, {1, 512, 40, 40}, {819200, 1600, 40, 1}, target_id=0: 0.0205865ms, 1%

This pattern is from YOLOv5s model.

For this case :
@150 which is the second input to the concat can be reshaped to {1, 256, 20, 2, 20, 2} and then can be concatenated with @215 which is the ouptut of the contiguous.

and then concat output can be reshaped to {1, 512, 40, 40}.

This way contiguous + concat can be fused togther.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the graph optimization entry points for contiguous and concat, then reproduce the YOLOv5s pattern shown by nodes @150, @215, and @218. Confirm that the contiguous operation is fused into concat and that the final output has shape {1, 512, 40, 40}; the issue names no files or tests, so those must be found in the repository.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.