Skip to content

Remove -restrict from icpx CXXFLAGS#413

Merged
bartgol merged 2 commits intomasterfrom
azamat/rm-restrict-icpx
Feb 12, 2026
Merged

Remove -restrict from icpx CXXFLAGS#413
bartgol merged 2 commits intomasterfrom
azamat/rm-restrict-icpx

Conversation

@amametjanov
Copy link
Member

Remove -restrict from icpx CXXFLAGS.

Fixes #412

[BFB]


Testing:

  • SMS.ne30pg2_EC30to60E2r2.WCYCLXX2010.aurora_oneapi-ifxgpu: no warnings about -restrict

@welcome
Copy link

welcome bot commented Feb 11, 2026

Thanks for opening this pull request! Please check out our contributing guidelines.

@amametjanov amametjanov added cmake Related to cmake build system and/or cmake utilities code cleanup labels Feb 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates EKAT’s CMake compiler-flag setup to avoid passing the Intel classic -restrict C++ flag to IntelLLVM/oneAPI toolchains (e.g., icpx), addressing EKAT#412 by eliminating related warnings in oneAPI builds.

Changes:

  • Restricts use of -restrict to the Intel (classic) Fortran toolchain path.
  • Splits Intel vs IntelLLVM handling in SetGeneralFlags so IntelLLVM no longer receives -restrict via CXXFLAGS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +76 to 82
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
SetFlags (FFLAGS "-assume byterecl -ftz" CXXFLAGS -restrict)
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
SetFlags (FFLAGS "-assume byterecl -ftz")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
SetFlags (FFLAGS -ffree-line-length-none)
endif()
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

-restrict is a C/C++-only flag, but it’s currently being added based on CMAKE_Fortran_COMPILER_ID. The project explicitly supports using different compilers per language, so this can still pass -restrict to a non-Intel C++ compiler (e.g., icpx/IntelLLVM or GCC) when Fortran is Intel, reintroducing the warning/flag error.

Consider splitting the call: always set the Intel Fortran flags, and add CXXFLAGS -restrict only when CMAKE_CXX_COMPILER_ID STREQUAL "Intel" (and not for IntelLLVM).

Suggested change
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
SetFlags (FFLAGS "-assume byterecl -ftz" CXXFLAGS -restrict)
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
SetFlags (FFLAGS "-assume byterecl -ftz")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
SetFlags (FFLAGS -ffree-line-length-none)
endif()
# Fortran compiler-specific flags
if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
SetFlags (FFLAGS "-assume byterecl -ftz")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
SetFlags (FFLAGS "-assume byterecl -ftz")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
SetFlags (FFLAGS -ffree-line-length-none)
endif()
# C++ compiler-specific flags
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
SetFlags (CXXFLAGS -restrict)
endif()

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks apt for IntelLLVM and Intel compiler toolchains!

Copy link
Member Author

Choose a reason for hiding this comment

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

@bartgol do you want me to make the changes suggested by copilot?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think that's a good idea. We don't want to get lots of compiler warnings b/c the ftn flag is not recognized...

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, applied the suggestion.
Please feel free to merge or let me know if i should merge.

bartgol
bartgol previously approved these changes Feb 11, 2026
Copy link
Contributor

@bartgol bartgol left a comment

Choose a reason for hiding this comment

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

Thanks!

We should prob start to go through ekat and eamxx, to ensure we set "generic" flags only if building in standalone mode (and not as part of e3sm).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@abagusetty abagusetty left a comment

Choose a reason for hiding this comment

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

LGTM!

@bartgol bartgol merged commit 1d456ec into master Feb 12, 2026
4 of 8 checks passed
@bartgol bartgol deleted the azamat/rm-restrict-icpx branch February 12, 2026 23:00
@welcome
Copy link

welcome bot commented Feb 12, 2026

Congrats on merging your first pull request! We hope this is only the first of many to come.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Related to cmake build system and/or cmake utilities code cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove -restrict from IntelLLVM CXXFLAGS

4 participants