Skip to content

Commit 66f08a3

Browse files
authored
[ET][Windows] Fix ExecuTorch Windows host build portability defects
Differential Revision: D112012051 Pull Request resolved: #20948
1 parent dea6f73 commit 66f08a3

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

backends/vulkan/runtime/api/containers/Tensor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,11 @@ class vTensor final {
549549
return sizes_;
550550
}
551551

552-
inline const int64_t size(size_t dim) const {
552+
inline int64_t size(size_t dim) const {
553553
return sizes().at(dim);
554554
}
555555

556-
inline const int64_t dim() const {
556+
inline int64_t dim() const {
557557
return sizes_.size();
558558
}
559559

extension/data_loader/mman.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ ET_INLINE void fcntl_rdadvise_apple(int fd, size_t file_size) {
8181

8282
#else
8383

84+
#ifndef NOMINMAX
8485
#define NOMINMAX
8586
#include <windows.h>
8687
#undef NOMINMAX
88+
#else
89+
#include <windows.h>
90+
#endif
8791
#include <io.h>
8892

8993
#include <executorch/extension/data_loader/mman_windows.h>

extension/data_loader/mman_windows.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@
2323
#include <io.h>
2424
#include <cstdint>
2525
#include <limits>
26+
#ifndef NOMINMAX
2627
#define NOMINMAX
2728
#include <windows.h>
2829
#undef NOMINMAX
30+
#else
31+
#include <windows.h>
32+
#endif
2933

3034
#ifndef STATUS_SECTION_TOO_BIG
3135
#define STATUS_SECTION_TOO_BIG 0xC0000040L

runtime/core/portable_type/c10/c10/targets.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ def define_common_targets():
8181
"ovr_config//build_mode:arvr_mode[enabled]": select({
8282
"DEFAULT": ["fbsource//xplat/caffe2:ovrsource_aten_Config.h"],
8383
# ovrsource_aten_Config.h is an oxx_static_library that only
84-
# works on OVR-native platforms. On Android, it produces no
85-
# outputs, so use the xplat variant instead.
84+
# works on OVR-native platforms. On Android and the Windows
85+
# host, it produces no outputs, so use the xplat variant.
8686
"ovr_config//os:android": ["fbsource//xplat/caffe2:generated_aten_config_header"],
87+
"ovr_config//os:windows": ["fbsource//xplat/caffe2:generated_aten_config_header"],
8788
}),
8889
}) + get_sleef_deps(),
8990
fbcode_exported_deps = ([

0 commit comments

Comments
 (0)