WAR compiler ice in nlohmann json.

Only seeing this on GCC 9 + CTK 11.1. Seems to be
having trouble with the `[[no_unique_address]]` optimization.
This commit is contained in:
Allison Piper
2024-04-06 12:53:37 +00:00
parent a9bf1d3e42
commit 476ed2ceae
2 changed files with 28 additions and 0 deletions

View File

@@ -28,6 +28,12 @@ rapids_cpm_find(nlohmann_json 3.11.3
CPM_ARGS
URL https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip
URL_HASH SHA256=a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d
PATCH_COMMAND
${CMAKE_COMMAND}
-D "CUDA_VERSION=${CMAKE_CUDA_COMPILER_VERSION}"
-D "CXX_VERSION=${CMAKE_CXX_COMPILER_VERSION}"
-D "CXX_ID=${CMAKE_CXX_COMPILER_ID}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/json_unordered_map_ice.cmake"
)
add_library(nvbench_json INTERFACE IMPORTED)

View File

@@ -0,0 +1,22 @@
# NVCC 11.1 and GCC 9 need a patch to build, otherwise:
#
# nlohmann/ordered_map.hpp(29): error #3316:
# Internal Compiler Error (codegen): "internal error during structure layout!"
#
# Usage:
# ${CMAKE_COMMAND}
# -D "CUDA_VERSION=${CMAKE_CUDA_COMPILER_VERSION}"
# -D "CXX_VERSION=${CMAKE_CXX_COMPILER_VERSION}"
# -D "CXX_ID=${CMAKE_CXX_COMPILER_ID}"
# -P "json_unordered_map_ice.cmake"
if(CUDA_VERSION VERSION_GREATER 11.8 OR NOT CXX_ID STREQUAL "GNU" OR CXX_VERSION VERSION_LESS 9.0)
return()
endif()
# Read the file and replace the string "JSON_NO_UNIQUE_ADDRESS" with
# "/* JSON_NO_UNIQUE_ADDRESS */".
file(READ "include/nlohmann/ordered_map.hpp" NLOHMANN_ORDERED_MAP_HPP)
string(REPLACE "JSON_NO_UNIQUE_ADDRESS" "/* [NVBench Patch] JSON_NO_UNIQUE_ADDRESS */"
NLOHMANN_ORDERED_MAP_HPP "${NLOHMANN_ORDERED_MAP_HPP}")
file(WRITE "include/nlohmann/ordered_map.hpp" "${NLOHMANN_ORDERED_MAP_HPP}")