Skip to content

compiler/plugins/input/TOSA: fix: TOSA arith lowering must handle apply scale introduced by linalg lowering - #24121

Merged
egebeysel merged 1 commit into
iree-org:mainfrom
Manewing:compiler_fix_tosa_input_conversion_apply_scale
May 4, 2026
Merged

egebeysel merged 1 commit into
iree-org:mainfrom
Manewing:compiler_fix_tosa_input_conversion_apply_scale

Conversation

@Manewing

Copy link
Copy Markdown
Contributor

TOSA to linalg lowering may (re-)introduce some additional TOSA operations as not all TOSA operations can be lowering to linalg. These need a following run of TOSA to arith lowering for element wise operations. The current pass pipeline is missing the option to enable lowering of tosa.apply_scale, which may be introduced during the lowering to linalg. This causes errors in the later stage of the compilation flow such as vectorization.

@Manewing
Manewing requested review from krzysz00 and lialan and removed request for MaheshRavishankar and rsuderman April 15, 2026 12:37
@lialan

lialan commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Yeah you need to update the lit tests as well.

@hanhanW
hanhanW requested a review from rsuderman April 16, 2026 00:26
@Manewing
Manewing force-pushed the compiler_fix_tosa_input_conversion_apply_scale branch 2 times, most recently from fc3395b to 26f19c2 Compare April 16, 2026 12:46
@Manewing

Copy link
Copy Markdown
Contributor Author

@lialan sry for the confusion, I incorrectly assumed that use32Bit = true would also be required for proper lowering. However, after further investigation it turned out that it is not. Now the LIT tests are also not failing anymore!

@Manewing
Manewing force-pushed the compiler_fix_tosa_input_conversion_apply_scale branch 2 times, most recently from 9b6d32e to ac52bcf Compare April 23, 2026 09:08

@egebeysel egebeysel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@lialan if you don't have anything to add here, I'll help @Manewing merge this in :)

…ly scale introduced by linalg lowering

Signed-off-by: Florian Walbroel <[email protected]>
@Manewing
Manewing force-pushed the compiler_fix_tosa_input_conversion_apply_scale branch from ac52bcf to 64828c3 Compare April 29, 2026 07:56
@egebeysel
egebeysel merged commit d4e04f7 into iree-org:main May 4, 2026
61 of 63 checks passed
jerryyin pushed a commit that referenced this pull request May 7, 2026
…ly scale introduced by linalg lowering (#24121)

TOSA to linalg lowering may (re-)introduce some additional TOSA
operations as not all TOSA operations can be lowering to linalg. These
need a following run of TOSA to arith lowering for element wise
operations. The current pass pipeline is missing the option to enable
lowering of tosa.apply_scale, which may be introduced during the
lowering to linalg. This causes errors in the later stage of the
compilation flow such as vectorization.

Signed-off-by: Florian Walbroel <[email protected]>
RattataKing pushed a commit to RattataKing/iree that referenced this pull request May 27, 2026
…ly scale introduced by linalg lowering (iree-org#24121)

TOSA to linalg lowering may (re-)introduce some additional TOSA
operations as not all TOSA operations can be lowering to linalg. These
need a following run of TOSA to arith lowering for element wise
operations. The current pass pipeline is missing the option to enable
lowering of tosa.apply_scale, which may be introduced during the
lowering to linalg. This causes errors in the later stage of the
compilation flow such as vectorization.

Signed-off-by: Florian Walbroel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants