Skip to content

fix: incorrect spec about int/float metadata flags #48

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

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

Conversation

qartik
Copy link
Contributor

@qartik qartik commented May 5, 2025

Closes: #47

@qartik qartik marked this pull request as ready for review May 5, 2025 23:14
@qartik
Copy link
Contributor Author

qartik commented May 12, 2025

@bettinaheim @idavis could you please review this PR?

I wish the repository was configured to suggest default reviewers. Unsure if that's possible.

@bettinaheim bettinaheim self-requested a review May 28, 2025 17:52
Comment on lines +521 to +522
!10 = !{!"i32", !"i64"}
!11 = !{!"float", !"double"}
Copy link
Contributor

@swernli swernli Jul 3, 2025

Choose a reason for hiding this comment

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

actually, on trying to implement these changes in a test branch where only i64 are supported, I've found that flags in this format fail linking with the error message:

incorrect number of operands in module flag `!5 = !{!"i64"}`

If there is only one supprted value, should it appear inline rather than as a separate flag?

Copy link
Contributor

Choose a reason for hiding this comment

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

Whoops, never mind. I had a different mistake. The flag used as the reference cannot be listed in the !llvm.module.flags. That's why I was getting an error. This syntax is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @swernli, if I change my copy of the adaptive profile example program to just have !10 = !{!"i64"}, I don't see any error flagged by LLVM. FYI, I also have !4 = !{i32 5, !"int_computations", !10}.

If I try inlining, I still get an error as before this PR.

Perhaps, there is something else going on in your branch? What LLVM version are you using? And what does the attribute for int_computations look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see you resolved it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, thanks! In fact, I stumbled across a short-hand syntax that the LLVM parser supports where the "sub-flag" can be inlined into the parent. I was able to test this with PyQIR's linking capabilities. So this works:
image

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.

Module Flags for int and float computations are specified incorrectly in the Adaptive profile
3 participants