Skip to content

Correct deprecation syntax of oneapi::dpl::experimental::kt::esimd namespace #2135

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
Mar 18, 2025

Conversation

mmichel11
Copy link
Contributor

@mmichel11 mmichel11 commented Mar 17, 2025

When including <oneapi/dpl/experimental/kernel_templates> with newer compilers, I see the following compilation error:

In file included from ../repos/oneDPL/include/oneapi/dpl/experimental/kernel_templates:18:
../repos/oneDPL/include/oneapi/dpl/experimental/kt/esimd_radix_sort.h:179:5: error: an attribute list cannot appear here
  179 |     [[deprecated("Use of oneapi::dpl::experimental::kt::esimd namespace is deprecated "
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  180 |                  "and will be removed in a future release. "
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  181 |                  "Use oneapi::dpl::experimental::kt::gpu::esimd instead")]]

According to https://en.cppreference.com/w/cpp/language/attributes/deprecated, it appears the proper syntax to deprecate a namespace is namespace [[deprecated]] NS { ... }. Our deprecation attribute is provided after the namespace's name which appears incorrect.

After correcting this, I see the proper warning when trying to compile using the deprecated namespace:

 warning: 'esimd' is deprecated: Use of oneapi::dpl::experimental::kt::esimd namespace is deprecated and will be removed in a future release. Use oneapi::dpl::experimental::kt::gpu::esimd instead [-Wdeprecated-declarations]

The placement of the attribute after the namespace seems to be a new error in clang which can be seen on trunk, an error with MSVC, and a warning with gcc when compiling with -Wpedantic: https://godbolt.org/z/xo4YfPKqo

Signed-off-by: Matthew Michel <[email protected]>
@mmichel11 mmichel11 added this to the 2022.9.0 milestone Mar 17, 2025
Copy link
Contributor

@dmitriy-sobolev dmitriy-sobolev left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for finding and fixing it.

@mmichel11 mmichel11 merged commit e4161bf into main Mar 18, 2025
19 checks passed
@mmichel11 mmichel11 deleted the dev/mmichel11/fix_deprecated_namespace branch March 18, 2025 13:06
timmiesmith pushed a commit that referenced this pull request Jun 9, 2025
…mespace (#2135)

* Fix deprecation of oneapi::dpl::experimental::kt::esimd namespace. The deprecation attribute should be placed before the namespace's name.

---------

Signed-off-by: Matthew Michel <[email protected]>
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