-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL][Docs] Mention preview macro for early ABI breaks #18422
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
steffenlarsen
merged 1 commit into
intel:sycl
from
steffenlarsen:steffen/abi_policy_preview_docs
May 15, 2025
+7
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have inline namespace with API/ABI version. Why do we ignore this framework for making breaking changes and use a macro instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think they are necessarily mutually exclusive, though historically we have used the preview macro more. I personally prefer the breaking changes macro, as it makes it easier to make it clear what is going away and what is coming in with the breaking changes. It also lets us test that we can indeed remove the symbols that we intend on removing, rather than finding out during the limited ABI-break window that we still need to remove some uses of old symbols and/or someone added more without realizing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I highly recommend using symbol versioning. It enables "preview" features in non-breaking manner.
If SYCL runtime team against using versioning for some reasons, please, remove it from the library sources with the next API/ABI breaking release.
Symbol versioning has never been used.
I'm not sure I understand what makes macro to be clearer than a separate namespace.
The main advantage of preview macro solution is small code to compile. As adding a new namespace is non-breaking change, old symbols versions must be compiled as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am personally ambivalent towards it, but every time we've wanted to use it, it was insufficient or brought on other issues. It has been a while though, so I don't remember the details.
When using the preview macro, it is much easier to place the breaks close to the old changes. For example, if you want to make an API break inside a function, you can just make the changes inside the function, while with the versioning you have to place a copy of the function (or split out the functionality) into a different namespace somewhere potentially far from the current function.
For ABI breaking changes, the preview macro guard has two benefits:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vinser52, please, be aware of this discussion.
@steffenlarsen, just in case you don't follow the SYCL runtime upstreaming progress.
@KseniyaTikhomirova is pushing library API versioning to upstream. See llvm/llvm-project#144372.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that versioning via namespaces and
__INTEL_PREVIEW_BREAKING_CHANGES
macro are orthogonal. My point is that if it is possible to introduce a new API using the new version namespace, we should do it instead of using the__INTEL_PREVIEW_BREAKING_CHANGES
macro.The question is whether we want to support backward compatibility or not. And my point is how often such cases happen. But if it happens, for sure we need the new version, but then the question is how costly it is. For example, if we introduce the new version of
class A
and there are other classes that use it we might need to change them as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose
class A
is actuallysycl::detail::A
(because otherwise the signature is dictated by the spec and we simply can't change it). Nothing prevents us from addingA2
and using it in place ofA
in the headers, while still providing oldA
exports/interfaces.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure, it can be used for the internal types.
Regarding types defined by the SYCL spec it is an interesting question. If we use inline namespace (for example
sycl::v1::A
andv1
is an inline namespace) user code can still usesycl::A
. I am not sure if it contradicts the SYCL spec.I think it is less flexible because with inline namespaces we can rely on the compiler to decide which version should be used by using just
sycl::A
and the compiler will choose the version from the inline namespace.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we added versioning we assumed it's not, because source complies to the standard and other representations (e.g. AST, mangled symbols, LLVM IR) are regulated by the implementation.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, we are already using
inline namespace _V1
for versioning of public API. For examplesycl::handler
is in factsycl::_V1::handler