Skip to content

[SYCL] Add Self macro versioning#21572

Merged
sarnex merged 5 commits intointel:syclfrom
ykhatav:self-macro-versioning
Mar 23, 2026
Merged

[SYCL] Add Self macro versioning#21572
sarnex merged 5 commits intointel:syclfrom
ykhatav:self-macro-versioning

Conversation

@ykhatav
Copy link
Copy Markdown
Contributor

@ykhatav ykhatav commented Mar 19, 2026

Adds DPC++ compiler self-identification macros to differentiate intel/llvm compiler from upstream Clang and enable version detection for intel/llvm releases.
Fixes:#21509
Depends on: #21570

@ykhatav ykhatav marked this pull request as ready for review March 19, 2026 19:47
@ykhatav ykhatav requested review from a team and bader as code owners March 19, 2026 19:47
@ykhatav
Copy link
Copy Markdown
Contributor Author

ykhatav commented Mar 19, 2026

CC: @tahonermann , @dvrogozh

@tahonermann
Copy link
Copy Markdown
Contributor

Thanks @ykhatav, this looks good to me once #21570 is merged.

Copy link
Copy Markdown
Contributor

@dvrogozh dvrogozh left a comment

Choose a reason for hiding this comment

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

Let's get #21570 merged first then rebase this one on top. Setting -1 just to avoid accidental merge.

Comment thread clang/lib/Frontend/InitPreprocessor.cpp Outdated
Copy link
Copy Markdown
Contributor

@YuriPlyakhin YuriPlyakhin left a comment

Choose a reason for hiding this comment

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

llvm/CMakeLists.txt change LGTM

Copy link
Copy Markdown
Contributor

@hchilama hchilama left a comment

Choose a reason for hiding this comment

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

Driver - LGTM

Comment thread clang/lib/Frontend/InitPreprocessor.cpp
@ykhatav ykhatav force-pushed the self-macro-versioning branch from dbdd3fe to 74d4e93 Compare March 23, 2026 15:14
@ykhatav ykhatav force-pushed the self-macro-versioning branch from 74d4e93 to 4acb486 Compare March 23, 2026 15:46
Comment thread clang/lib/Frontend/InitPreprocessor.cpp
Copy link
Copy Markdown
Contributor

@tahonermann tahonermann left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Once these changes go into an official release, we should submit a PR to https://github.com/cpredef/predef/blob/master/Compilers.md to document these macros.

Copy link
Copy Markdown
Contributor

@dvrogozh dvrogozh left a comment

Choose a reason for hiding this comment

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

LGTM

@sarnex sarnex merged commit 6e4dcd8 into intel:sycl Mar 23, 2026
31 checks passed
// Format: "DPC++ 6.3.0 git (https://github.com/intel/llvm.git ...)"
std::string buf;
llvm::raw_string_ostream OS(buf);
OS << "DPC++ " DPCPP_VERSION;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know that this was already merged, but perhaps we should follow up with an additional change to add the pre-release indicator here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll create a follow-up PR. Just to confirm the output format for pre-release, does the following look good? "DPC++ 7.0.0 (pre-release) git (https://github.com/intel/llvm.git ...)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, that looks great!

KornevNikita pushed a commit that referenced this pull request Mar 25, 2026
This is a follow-up PR after- #21572
to add pre-release indicator to the text of the __VERSION__ macro so
that it matches the --version output.
Comment on lines 148 to +149
}
std::string getDPCPPFullCPPVersion() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
std::string getDPCPPFullCPPVersion() {
}
std::string getDPCPPFullCPPVersion() {

return buf;
}
std::string getDPCPPFullCPPVersion() {
// Format: "DPC++ 6.3.0 git (https://github.com/intel/llvm.git ...)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This string looks like an example of the format rather than a format itself.

Suggested change
// Format: "DPC++ 6.3.0 git (https://github.com/intel/llvm.git ...)"
// Format example: "DPC++ 6.3.0 git (https://github.com/intel/llvm.git ...)"

Comment on lines +156 to +158
if (!repo.empty()) {
OS << " " << repo;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!repo.empty()) {
OS << " " << repo;
}
if (!repo.empty())
OS << " " << repo;

// SPARC:#define __UINT_LEAST8_TYPE__ unsigned char
// SPARC:#define __USER_LABEL_PREFIX__
// SPARC:#define __VERSION__ "{{.*}}Clang{{.*}}
// SPARC:#define __VERSION__ "{{.*}}DPC++{{.*}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// SPARC:#define __VERSION__ "{{.*}}DPC++{{.*}}
// SPARC:#define __VERSION__ "{{.*}}DPC++{{.*}}"

KornevNikita pushed a commit to KornevNikita/llvm that referenced this pull request Apr 8, 2026
Adds DPC++ compiler self-identification macros to differentiate
intel/llvm compiler from upstream Clang and enable version detection for
intel/llvm releases.
Fixes:intel#21509
Depends on: intel#21570
KornevNikita pushed a commit to KornevNikita/llvm that referenced this pull request Apr 8, 2026
This is a follow-up PR after- intel#21572
to add pre-release indicator to the text of the __VERSION__ macro so
that it matches the --version output.
KornevNikita added a commit that referenced this pull request Apr 13, 2026
Cherry-pick patches adding version macros:
#21570
#21572
#21610
#21702

And also remove some info from the workflow file, since it's placed in
the source code now.

---------

Co-authored-by: elizabethandrews <elizabeth.andrews@intel.com>
Co-authored-by: ykhatav <yashasvi.khatavkar@intel.com>
KornevNikita pushed a commit that referenced this pull request Apr 17, 2026
Adds DPC++ compiler self-identification macros to differentiate
intel/llvm compiler from upstream Clang and enable version detection for
intel/llvm releases.
Fixes:#21509
Depends on: #21570
KornevNikita pushed a commit that referenced this pull request Apr 17, 2026
This is a follow-up PR after- #21572
to add pre-release indicator to the text of the __VERSION__ macro so
that it matches the --version output.
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.

8 participants