Skip to content

frontend: support conditionals as scf.if statements #1571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

asraa
Copy link
Collaborator

@asraa asraa commented Mar 17, 2025

TODO: the rlwe pipeline doesn't allow for arith.cmpi so I need some other way of lowering it

Comment on lines +466 to +468
import ipdb

ipdb.set_trace()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
import ipdb
ipdb.set_trace()

@asraa asraa marked this pull request as draft March 18, 2025 20:06
copybara-service bot pushed a commit that referenced this pull request Mar 25, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
copybara-service bot pushed a commit that referenced this pull request Mar 25, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
copybara-service bot pushed a commit that referenced this pull request Mar 25, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
@AlexanderViand-Intel
Copy link
Collaborator

AlexanderViand-Intel commented Mar 25, 2025

TODO: the rlwe pipeline doesn't allow for arith.cmpi so I need some other way of lowering it

Now that we have polynomial evaluation, a lowering for CMP (see #827) should be doable, but we won't be able to run such code in OpenFHE, as it's only feasible for small plaintext moduli which OpenFHE does not (afaik) do.

copybara-service bot pushed a commit that referenced this pull request Mar 26, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
copybara-service bot pushed a commit that referenced this pull request Mar 26, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
@j2kun
Copy link
Collaborator

j2kun commented Mar 27, 2025

TODO: the rlwe pipeline doesn't allow for arith.cmpi so I need some other way of lowering it

Now that we have polynomial evaluation, a lowering for CMP (see #827) should be doable, but we won't be able to run such code in OpenFHE, as it's only feasible for small plaintext moduli which OpenFHE does not (afaik) do.

Why not use the comparison work from Jelle Vos's paper #920 ? I finally got a chance to read in on the flight to HES and it gives comparison kernels in terms of polynomial evaluation.

@j2kun
Copy link
Collaborator

j2kun commented Mar 27, 2025

edit: sorry misclick

@j2kun j2kun closed this Mar 27, 2025
@j2kun j2kun reopened this Mar 27, 2025
copybara-service bot pushed a commit that referenced this pull request Mar 27, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
copybara-service bot pushed a commit that referenced this pull request Mar 27, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
@AlexanderViand-Intel
Copy link
Collaborator

Why not use the comparison work from Jelle Vos's paper #920 ? I finally got a chance to read in on the flight to HES and it gives comparison kernels in terms of polynomial evaluation.

Good point! The comparison issue predates Jelle's paper by just a few days but I guess it should be updated

ZenithalHourlyRate pushed a commit to ZenithalHourlyRate/heir that referenced this pull request Mar 30, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per google#1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes google#1619

This is actually a part of google#1571 :P

PiperOrigin-RevId: 740397951
ZenithalHourlyRate pushed a commit to ZenithalHourlyRate/heir that referenced this pull request Apr 1, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per google#1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes google#1619

This is actually a part of google#1571 :P

PiperOrigin-RevId: 740397951
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 740397951
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
copybara-service bot pushed a commit that referenced this pull request Apr 2, 2025
This stress tests data dependent conditionals lowering all the way to openfhe and translated. I had to modify
* fixing subplain's operand ordering per #1619
* heir-translate emitting boolean types
* heir-translate allowing extui for boolean extension to avoid canonicalizing arith constant = true -> extui to i64 as a -1

Fixes #1619

This is actually a part of #1571 :P

PiperOrigin-RevId: 743164460
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