Skip to content

[TorchToTosa] Avoid i1 gather by casting through i8#4491

Open
catcor01 wants to merge 5 commits intollvm:mainfrom
catcor01:gather_cast
Open

[TorchToTosa] Avoid i1 gather by casting through i8#4491
catcor01 wants to merge 5 commits intollvm:mainfrom
catcor01:gather_cast

Conversation

@catcor01
Copy link
Contributor

@catcor01 catcor01 commented Mar 6, 2026

TOSA gather does not accept i1 tensors.
When gather element type is i1, cast inputs to i8, perform the gather (including gather-nd paths), then cast back to i1.

Change-Id: I8e3034612c2fabec7c9e75d8295a863860a674c2

TOSA gather does not accept i1 tensors.
When gather element type is i1, cast inputs to i8,
perform the gather (including gather-nd paths), then cast back to i1.

Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: I8e3034612c2fabec7c9e75d8295a863860a674c2
@catcor01
Copy link
Contributor Author

catcor01 commented Mar 9, 2026

@sahas3 @Lallapallooza

Copy link
Member

@sahas3 sahas3 left a comment

Choose a reason for hiding this comment

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

Thanks for the enhancement!

- Add a TOSA utility to create gather ops with i1→i8 casting, reuse it in
  two lowering sites, and add a bool gather e2e test.

Change-Id: Iff173dadfbf03ba982cac0409492b939255cdbd9
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
@catcor01 catcor01 requested a review from sahas3 March 11, 2026 07:07
Copy link
Member

@sahas3 sahas3 left a comment

Choose a reason for hiding this comment

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

LG with some suggestions!

catcor01 and others added 2 commits March 12, 2026 09:29
Change-Id: I153fa333170725c4ccd4c2941d93f36dfa5f712e
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Copy link
Member

@Lallapallooza Lallapallooza left a comment

Choose a reason for hiding this comment

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

LGTM, small nit

Change-Id: If77622dd5626139f3f740539488c2c8de4f07098
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
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