Skip to content

[CIR][CodeGen][LowerToLLVM] String literals for OpenCL #1091

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

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

seven-mile
Copy link
Collaborator

This PR supports string literals in OpenCL end to end, making it possible to use printf. This involves two changes:

  • In CIRGen, ensure we create the global symbol for string literals with correct constant address space.
  • In LowerToLLVM, make the lowering of GlobalViewAttr aware of the upstream address space.

Other proper refactors are also applied.

Two test cases from OG CodeGen are reused. str_literals.cl is the primary test, while printf.cl is the bonus one.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM pending conflict resolutions

Copy link

github-actions bot commented Nov 9, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@bcardosolopes bcardosolopes merged commit f220fa7 into llvm:main Nov 9, 2024
6 checks passed
lanza pushed a commit that referenced this pull request Mar 18, 2025
This PR supports string literals in OpenCL end to end, making it
possible to use `printf`. This involves two changes:

* In CIRGen, ensure we create the global symbol for string literals with
correct `constant` address space.
* In LowerToLLVM, make the lowering of `GlobalViewAttr` aware of the
upstream address space.

Other proper refactors are also applied.

Two test cases from OG CodeGen are reused. `str_literals.cl` is the
primary test, while `printf.cl` is the bonus one.
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.

2 participants