Skip to content

Commit

Permalink
Disable type_caster ODR guard for CUDACC and NVCOMPILER: the missin…
Browse files Browse the repository at this point in the history
…g `test_descr_src_loc` in tests/CMakeLists.txt masked that `src_loc` is not reliable.
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Jul 21, 2024
1 parent 432714c commit a8ce277
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
5 changes: 4 additions & 1 deletion include/pybind11/detail/descr.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ PYBIND11_NAMESPACE_BEGIN(detail)
// * MSVC 193732825 C++17 windows-2020 is failing for unknown reasons.
// * Intel 2021.6.0.20220226 (g++ 9.4 mode) __builtin_LINE() is unreliable
// (line numbers vary between translation units).
// * NVIDIA 12.2.140 (CUDACC) src_loc is unreliable for unknown reasons.
// * NVHPC 23.5.0 (NVCOMPILER) src_loc is unreliable for unknown reasons.
#if defined(PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD_IF_AVAILABLE) \
&& !defined(PYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD) && defined(PYBIND11_CPP17) \
&& !defined(__INTEL_COMPILER) \
&& !defined(__INTEL_COMPILER) && !defined(__CUDACC_VER_MAJOR__) \
&& !defined(__NVCOMPILER_MAJOR__) \
&& (!defined(_MSC_VER) \
|| (_MSC_VER >= 1920 /* MSVC 2019 or newer */ \
&& (_MSC_FULL_VER < 193732825 || _MSC_FULL_VER > 193732826 \
Expand Down
15 changes: 0 additions & 15 deletions tests/test_type_caster_odr_guard_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,4 @@ TEST_SUBMODULE(type_caster_odr_guard_1, m) {
#else
false;
#endif

m.attr("CUDACC") =
#if defined(__CUDACC_VER_MAJOR__)
PYBIND11_TOSTRING(__CUDACC_VER_MAJOR__) "." PYBIND11_TOSTRING(
__CUDACC_VER_MINOR__) "." PYBIND11_TOSTRING(__CUDACC_VER_BUILD__);
#else
py::none();
#endif
m.attr("NVCOMPILER") =
#if defined(__NVCOMPILER_MAJOR__)
PYBIND11_TOSTRING(__NVCOMPILER_MAJOR__) "." PYBIND11_TOSTRING(
__NVCOMPILER_MINOR__) "." PYBIND11_TOSTRING(__NVCOMPILER_PATCHLEVEL__);
#else
py::none();
#endif
}
4 changes: 0 additions & 4 deletions tests/test_type_caster_odr_guard_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,4 @@ def test_type_caster_odr_violation_detected_counter():
if num_violations == 0:
if m.if_defined__NO_INLINE__:
pytest.skip(_count_0_message("__NO_INLINE__"))
if m.CUDACC is not None:
pytest.skip(_count_0_message(f"CUDACC = {m.CUDACC}"))
if m.NVCOMPILER is not None:
pytest.skip(_count_0_message(f"NVCOMPILER = {m.NVCOMPILER}"))
assert num_violations == 1

0 comments on commit a8ce277

Please sign in to comment.