Skip to content
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

Try using c++20 throughout catalyst #1229

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(catalyst LANGUAGES CXX C)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD 20)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

put back cache


find_package(MLIR REQUIRED CONFIG)
find_package(MHLO REQUIRED CONFIG)
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Catalyst/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ set(DEPENDS
)

add_mlir_library(${LIBRARY_NAME} STATIC ${SRC} LINK_LIBS PRIVATE ${LIBS} DEPENDS ${DEPENDS})
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_17)
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_20)
target_include_directories(${LIBRARY_NAME} PUBLIC
.
${PROJECT_SOURCE_DIR}/include
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Gradient/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(DEPENDS
)

add_mlir_library(${LIBRARY_NAME} STATIC ${SRC} LINK_LIBS PRIVATE ${LIBS} DEPENDS ${DEPENDS})
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_17)
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_20)
target_include_directories(${LIBRARY_NAME} PUBLIC
.
${PROJECT_SOURCE_DIR}/include
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Mitigation/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(DEPENDS
)

add_mlir_library(${LIBRARY_NAME} STATIC ${SRC} LINK_LIBS PRIVATE ${LIBS} DEPENDS ${DEPENDS})
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_17)
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_20)
target_include_directories(${LIBRARY_NAME} PUBLIC
.
${PROJECT_SOURCE_DIR}/include
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Quantum/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set(DEPENDS
)

add_mlir_library(${LIBRARY_NAME} STATIC ${SRC} LINK_LIBS PRIVATE ${LIBS} DEPENDS ${DEPENDS})
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_17)
target_compile_features(${LIBRARY_NAME} PUBLIC cxx_std_20)
target_include_directories(${LIBRARY_NAME} PUBLIC
.
${PROJECT_SOURCE_DIR}/include
Expand Down
3 changes: 3 additions & 0 deletions mlir/lib/Quantum/Transforms/remove_chained_self_inverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define DEBUG_TYPE "remove-chained-self-inverse"

#include <memory>
#include <numbers>
#include <vector>

#include "llvm/Support/Debug.h"
Expand Down Expand Up @@ -52,6 +53,8 @@ struct RemoveChainedSelfInversePass
LLVM_DEBUG(dbgs() << "remove chained self inverse pass"
<< "\n");

llvm::errs() << std::numbers::pi << "\n";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remember to remove this "unit test"!


// Run cse pass before running remove-chained-self-inverse,
// to aid identifying equivalent SSA values when verifying
// the gates have the same params
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def run(self):
"frontend/catalyst/utils/jax_cpu_lapack_kernels/lapack_kernels.cpp",
"frontend/catalyst/utils/jax_cpu_lapack_kernels/lapack_kernels_using_lapack.cpp",
],
extra_compile_args=["-std=c++17"],
extra_compile_args=["-std=c++20"],
)
cmdclass = {"build_ext": CustomBuildExtLinux}

Expand All @@ -198,7 +198,7 @@ def run(self):
"frontend/catalyst/utils/jax_cpu_lapack_kernels/lapack_kernels.cpp",
"frontend/catalyst/utils/jax_cpu_lapack_kernels/lapack_kernels_using_lapack.cpp",
],
extra_compile_args=["-std=c++17"],
extra_compile_args=["-std=c++20"],
)
cmdclass = {"build_ext": CustomBuildExtMacos}

Expand All @@ -211,7 +211,7 @@ def run(self):
ext._add_ldflags(["-L", lib_path_npymath]) # pylint: disable=protected-access
ext._add_ldflags(["-lnpymath"]) # pylint: disable=protected-access
ext._add_cflags(["-I", np.get_include()]) # pylint: disable=protected-access
ext._add_cflags(["-std=c++17"]) # pylint: disable=protected-access
ext._add_cflags(["-std=c++20"]) # pylint: disable=protected-access
ext_modules.extend(intree_extension_list)
# For any compiler packages seeking to be registered in PennyLane, it is imperative that they
# expose the entry_points metadata under the designated group name `pennylane.compilers`, with
Expand Down
Loading