Skip to content

Commit 36087db

Browse files
committed
fix build break on windows
1 parent c473ca3 commit 36087db

File tree

9 files changed

+32
-35
lines changed

9 files changed

+32
-35
lines changed

tensorflow/compiler/xla/service/gpu/BUILD

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ load(
1414
"tf_cc_test",
1515
"tf_copts",
1616
"tf_cuda_library",
17+
"if_not_windows",
1718
)
1819
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
1920
load(
@@ -605,8 +606,9 @@ cc_library(
605606
"@com_google_absl//absl/strings:str_format",
606607
"@com_google_absl//absl/types:optional",
607608
"@com_google_absl//absl/types:span",
609+
] + if_not_windows([
608610
"@nvtx_archive//:nvtx",
609-
] + if_cuda_is_configured([
611+
]) + if_cuda_is_configured([
610612
"//tensorflow/stream_executor/cuda:cuda_stream",
611613
"//tensorflow/core/platform/default/build_config:cublas_plugin",
612614
"//tensorflow/core/platform/default/build_config:cudnn_plugin",

tensorflow/core/BUILD

+3-2
Original file line numberDiff line numberDiff line change
@@ -3287,9 +3287,10 @@ tf_cuda_library(
32873287
"//third_party/eigen3",
32883288
"//tensorflow/core/grappler/utils:functions",
32893289
"//tensorflow/core/profiler/lib:traceme",
3290-
"@nvtx_archive//:nvtx",
32913290
"//tensorflow/core/profiler/internal:traceme_recorder",
3292-
] + mkl_deps(),
3291+
] + if_not_windows([
3292+
"@nvtx_archive//:nvtx",
3293+
]) + mkl_deps(),
32933294
alwayslink = 1,
32943295
)
32953296

tensorflow/core/common_runtime/eager/BUILD

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ load(
33
"tf_cc_test",
44
"tf_copts",
55
"tf_cuda_library",
6+
"if_not_windows",
67
)
78
load(
89
"//third_party/mkl:build_defs.bzl",
@@ -203,9 +204,10 @@ tf_cuda_library(
203204
"//tensorflow/core:protos_all_cc",
204205
"//tensorflow/core/profiler/lib:traceme",
205206
"//tensorflow/core/grappler/optimizers:meta_optimizer",
206-
"@nvtx_archive//:nvtx",
207207
],
208-
}),
208+
}) + if_not_windows([
209+
"@nvtx_archive//:nvtx",
210+
]),
209211
)
210212

211213
tf_cc_test(

tensorflow/core/kernels/non_max_suppression_op.cu.cc

-21
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,6 @@ __device__ EIGEN_STRONG_INLINE void ClearBit(T* bit_mask, int bit) {
149149
atomicAnd(bit_mask + bin, ~(T(1) << (bit & kRemainderMask)));
150150
}
151151

152-
__global__ void FlipBoxes(Box* boxes, const int* num_batch_boxes,
153-
const int* box_strides, const int batch_size) {
154-
// for (int b = 0; b < batch_size; ++b) {
155-
// int box_offset = box_strides[b];
156-
for (const int y : CudaGridRangeY(batch_size)) {
157-
int box_offset = box_strides[y];
158-
Box* curr_boxes = boxes + box_offset;
159-
// if (threadIdx.x == 0) {
160-
// printf(" FBx batch=%d, box_offset=%d, num_batch_boxes=%d boxes@ %p \n",
161-
// y,
162-
// box_offset, num_batch_boxes[y],curr_boxes);
163-
// }
164-
165-
for (int i : GpuGridRangeX(num_batch_boxes[y])) {
166-
Flipped<true>(curr_boxes[i]);
167-
}
168-
}
169-
// }
170-
}
171-
172-
173152
// Produce a global bitmask (result_mask) of selected boxes from bitmask
174153
// generated by NMSKernel Abort early if max_boxes boxes are selected.
175154
// Bitmask is num_boxes*bit_mask_len bits indicating whether to keep or

tensorflow/core/platform/env.cc

-6
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,4 @@ Status ReadTextOrBinaryProto(Env* env, const string& fname,
570570
return ReadBinaryProto(env, fname, proto);
571571
}
572572

573-
int setenv(const char* name, const char* value, int overwrite) {
574-
return ::setenv(name, value, overwrite);
575-
}
576-
577-
int unsetenv(const char* name) { return ::unsetenv(name); }
578-
579573
} // namespace tensorflow

tensorflow/core/platform/nvtx.h

+4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ limitations under the License.
1616
#ifndef TENSORFLOW_CORE_PLATFORM_NVTX_H_
1717
#define TENSORFLOW_CORE_PLATFORM_NVTX_H_
1818

19+
#ifdef _WIN32
20+
#include "cuda/include/nvtx3/nvToolsExt.h"
21+
#else
1922
#include "third_party/nvtx3/nvToolsExt.h"
23+
#endif
2024

2125
#include "tensorflow/core/framework/attr_value.pb.h"
2226
#include "tensorflow/core/framework/attr_value_util.h"

tensorflow/core/platform/posix/env.cc

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818
#include <fcntl.h>
1919
#include <fnmatch.h>
2020
#include <stdio.h>
21+
#include <stdlib.h>
2122
#include <sys/mman.h>
2223
#include <sys/stat.h>
2324
#include <sys/time.h>
@@ -258,4 +259,10 @@ void PosixEnv::GetLocalTempDirectories(std::vector<string>* list) {
258259
}
259260
}
260261

262+
int setenv(const char* name, const char* value, int overwrite) {
263+
return ::setenv(name, value, overwrite);
264+
}
265+
266+
int unsetenv(const char* name) { return ::unsetenv(name); }
267+
261268
} // namespace tensorflow

tensorflow/stream_executor/stream.h

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class AlgorithmDesc;
7373

7474
class StreamExecutor;
7575
class ScratchAllocator;
76-
enum BatchNormalizationKind;
7776

7877
// Convert a type to the corresponding QuantizedActivationMode.
7978
template <typename ElementType>

third_party/gpus/cuda_configure.bzl

+11-2
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,10 @@ def lib_name(base_name, cpu_value, version = None, static = False):
531531
return "lib%s.a" % base_name
532532
return "lib%s.so%s" % (base_name, version)
533533
elif cpu_value == "Windows":
534-
return "%s.lib" % base_name
534+
if base_name == "nvToolsExt":
535+
return "lib/x64/nvToolsExt64_1.lib"
536+
else:
537+
return "%s.lib" % base_name
535538
elif cpu_value == "Darwin":
536539
if static:
537540
return "lib%s.a" % base_name
@@ -669,7 +672,7 @@ def _find_libs(repository_ctx, cuda_config):
669672
"nvToolsExt",
670673
repository_ctx,
671674
cpu_value,
672-
cuda_config.config["cuda_library_dir"],
675+
cuda_config.nvToolsExt_path,
673676
"1",
674677
),
675678
"cupti": _find_cuda_lib(
@@ -762,6 +765,11 @@ def _get_cuda_config(repository_ctx):
762765
cufft_version = cuda_version
763766
cusparse_version = cuda_version
764767

768+
if cpu_value == "Windows":
769+
nvToolsExt_path = repository_ctx.os.environ.get("NVTOOLSEXT_PATH", "C:/Program Files/NVIDIA Corporation/NvToolsExt/")
770+
else:
771+
nvToolsExt_path = toolkit_path
772+
765773
return struct(
766774
cuda_toolkit_path = toolkit_path,
767775
cuda_version = cuda_version,
@@ -775,6 +783,7 @@ def _get_cuda_config(repository_ctx):
775783
compute_capabilities = compute_capabilities(repository_ctx),
776784
cpu_value = cpu_value,
777785
config = config,
786+
nvToolsExt_path=nvToolsExt_path,
778787
)
779788

780789
def _tpl(repository_ctx, tpl, substitutions = {}, out = None):

0 commit comments

Comments
 (0)