ROCm / ROCm/AMDMIGraphX

Concat broadcast rewrite to handle more cases

Open
#3,095 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

Found during investigation for issue #3023

Issue is in find_concat_multibroadcasts of simplify_reshapes.
What we matched is:

param0: lens = [1, 1, 1, 1, 64], strides = [1, 1, 60, 64, 194]
param1: lens = [1, 1, 60, 64, 192], strides = [737280, 737280, 12288, 192 ,1]
mb0: multibroadcast(param0, lens = [1, 12, 60, 64, 64])
mb1: multibroadcast(param1, lens = [1, 12, 60, 64, 192])
concat(mb0, mb1, axis = 4)

It currently tries to move the concat before the multibroadcast to:

param0: lens = [1, 1, 1, 1, 64], strides = [1, 1, 60, 64, 194]
param1: lens = [1, 1, 60, 64, 192], strides = [737280, 737280, 12288, 192 ,1]
con0: concat(param0, param1, axis = 4)
multibroadcast(con0, lens = [1, 12, 60, 64, 256])

This fails because concat does not work if the dimensions other than axis to concat over are not the same.

  • We should be able to rewrite concat to handle this case also.

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 at find_concat_multibroadcasts in simplify_reshapes and reproduce the two multibroadcast inputs and axis-4 concat shown in the issue. Trace why the current concat-before-multibroadcast rewrite rejects unequal non-concat dimensions; done means the concat broadcast rewrite handles this case without violating concat’s dimension requirements.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.