Skip to content

Conversation

sarnex
Copy link
Member

@sarnex sarnex commented Sep 2, 2025

We should set the correct target-specific AS for the SrcLocStr global created in OMPIRBuilder.

We also may have to insert a constexpr addrspacecast because the struct field type may be different than the value used to initialize it.

I actually want the cast to be from AS 1 to AS 4, but getting the type to be AS4 relies on a PR currently in-review, so leave the cast target to AS 0 for now.

@sarnex sarnex marked this pull request as ready for review September 2, 2025 20:42
@sarnex sarnex requested a review from jhuber6 September 2, 2025 20:43
Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

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

Seems reasonable, guessing this is SPIR-V only? Sometimes default address spaces dependent on language cause issues when mixing IR.

SrcLocStr = Builder.CreateGlobalString(LocStr, /* Name */ "",
/* AddressSpace */ 0, &M);
SrcLocStr = Builder.CreateGlobalString(
LocStr, /* Name */ "",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LocStr, /* Name */ "",
LocStr, /*Name=*/ "",

Signed-off-by: Sarnie, Nick <[email protected]>
Copy link

github-actions bot commented Sep 2, 2025

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

Signed-off-by: Sarnie, Nick <[email protected]>
@sarnex
Copy link
Member Author

sarnex commented Sep 2, 2025

Seems reasonable, guessing this is SPIR-V only? Sometimes default address spaces dependent on language cause issues when mixing IR.

Yep, SPIR-V is really strict with AS. These usage here is specifying target AS so it should be language-independent. The rules should be the same across all source languages when using the same SPIR-V target so mixing IR should work, but I do doubt they are implemented correctly in all cases. If we see some problems I can add a triple check or something.

@sarnex sarnex merged commit e6c63d9 into llvm:main Sep 3, 2025
9 checks passed
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