diff --git a/third_party/tsl/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl b/third_party/tsl/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl index c46e09484fdfa..eb3a1d8c8ddf0 100644 --- a/third_party/tsl/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl +++ b/third_party/tsl/third_party/gpus/crosstool/windows/msvc_wrapper_for_nvcc.py.tpl @@ -181,6 +181,9 @@ def InvokeNvcc(argv, log=False): nvccopts += ['--keep', '--keep-dir', tempdir] # Force C++17 dialect (note, everything in just one string!) nvccopts += ['--std c++17'] + # This is so that nvcc does not complain about MSVC or CLANG. + nvccopts += ['-allow-unsupported-compiler'] + nvccopts += ['--expt-extended-lambda', '--expt-relaxed-constexpr'] if log: Log([NVCC_PATH] + nvccopts) diff --git a/third_party/tsl/third_party/gpus/cuda/build_defs.bzl.tpl b/third_party/tsl/third_party/gpus/cuda/build_defs.bzl.tpl index bc865cecb3240..955103611afe1 100644 --- a/third_party/tsl/third_party/gpus/cuda/build_defs.bzl.tpl +++ b/third_party/tsl/third_party/gpus/cuda/build_defs.bzl.tpl @@ -104,9 +104,16 @@ def if_cuda_newer_than(wanted_ver, if_true, if_false = []): wanted_major = int(wanted_ver.split('_')[0]) wanted_minor = int(wanted_ver.split('_')[1]) - configured_version = "%{cuda_version}" - configured_major = int(configured_version.split('.')[0]) - configured_minor = int(configured_version.split('.')[1]) + # Strip "64_" which appears in the CUDA version on Windows. + configured_version = "%{cuda_version}".rsplit("_", 1)[-1] + configured_version_parts = configured_version.split('.') + + # On Windows, the major and minor versions are concatenated without a period and the minor only contains one digit. + if len(configured_version_parts) == 1: + configured_version_parts = [configured_version[0:-1], configured_version[-1:]] + + configured_major = int(configured_version_parts[0]) + configured_minor = int(configured_version_parts[1]) if %{cuda_is_configured} and (wanted_major, wanted_minor) <= (configured_major, configured_minor): return select({"//conditions:default": if_true}) diff --git a/third_party/tsl/tsl/profiler/lib/nvtx_utils.cc b/third_party/tsl/tsl/profiler/lib/nvtx_utils.cc index 438f98c2b3ef2..4943fba0c1bfe 100644 --- a/third_party/tsl/tsl/profiler/lib/nvtx_utils.cc +++ b/third_party/tsl/tsl/profiler/lib/nvtx_utils.cc @@ -36,7 +36,7 @@ namespace { // nvtxNameOsThreadA: // https://nvidia.github.io/NVTX/doxygen/group___r_e_s_o_u_r_c_e___n_a_m_i_n_g.html // This convention may not match the one in tsl::Env::GetCurrentThreadId(). -std::optional GetCurrentThreadId() { +std::optional MaybeGetCurrentThreadId() { #ifdef __linux__ return syscall(SYS_gettid); #else @@ -57,7 +57,8 @@ ProfilerDomainHandle DefaultProfilerDomain() { } void NameCurrentThread(const std::string& thread_name) { - if (std::optional tid = GetCurrentThreadId(); tid.has_value()) { + if (std::optional tid = MaybeGetCurrentThreadId(); + tid.has_value()) { nvtxNameOsThreadA(*tid, thread_name.c_str()); } }