Skip to content

Commit 25f4aaa

Browse files
committed
Update on "[ONNX] Update typing and error messages in symbolic_helper"
### Description - Clearer error messages with more context - Created `SymbolicValueError` which adds context of the value to the error message - Type annotation example error message: ``` torch.onnx.errors.SymbolicValueError: ONNX symbolic does not understand the Constant node '%1 : Long(2, strides=[1], device=cpu) = onnx::Constant[value= 3 3 [ CPULongType{2} ]]() ' specified with descriptor 'is'. [Caused by the value '1 defined in (%1 : Long(2, strides=[1], device=cpu) = onnx::Constant[value= 3 3 [ CPULongType{2} ]]() )' (type 'Tensor') in the TorchScript graph. The containing node has kind 'onnx::Constant'.] Inputs: Empty Outputs: #0: 1 defined in (%1 : Long(2, strides=[1], device=cpu) = onnx::Constant[value= 3 3 [ CPULongType{2} ]]() ) (type 'Tensor') ``` ### Issue - #77316 (Runtime error during symbolic conversion) ### Testing Unit tested [ghstack-poisoned]
2 parents 2fc64f6 + 8c90e15 commit 25f4aaa

File tree

89 files changed

+8515
-1051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+8515
-1051
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
### Description
2-
<!-- What did you change and why was it needed? -->
3-
4-
### Issue
5-
<!-- Link to Issue ticket or RFP -->
6-
7-
### Testing
8-
<!-- How did you test your change? -->
1+
Fixes #ISSUE_NUMBER

.github/scale-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ runner_types:
6565
windows.8xlarge.nvidia.gpu:
6666
instance_type: p3.2xlarge
6767
os: windows
68-
max_available: 50
68+
max_available: 100
6969
disk_size: 256

.github/workflows/_ios-build-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
scripts/build_ios.sh
141141
142142
- name: Run Build Test
143+
timeout-minutes: 5
143144
run: |
144145
PROFILE=PyTorch_CI_2022
145146
# run the ruby build script

.lintrunner.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ exclude_patterns = [
102102
'torch/distributed/elastic/agent/server/api.py',
103103
'torch/testing/_internal/**',
104104
'torch/distributed/fsdp/fully_sharded_data_parallel.py',
105+
'torch/distributed/distributed_c10d.py',
105106
# TODO(suo): these exclusions were added just to get lint clean on master.
106107
# Follow up to do more target suppressions and remove them.
107108
'torch/distributed/fsdp/flatten_params_wrapper.py',

CMakeLists.txt

Lines changed: 42 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard whose features are reques
4343
if(DEFINED GLIBCXX_USE_CXX11_ABI)
4444
if(${GLIBCXX_USE_CXX11_ABI} EQUAL 1)
4545
set(CXX_STANDARD_REQUIRED ON)
46-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")
46+
string(APPEND CMAKE_CXX_FLAGS " -D_GLIBCXX_USE_CXX11_ABI=1")
4747
else()
4848
# Please note this is required in order to ensure compatibility between gcc 9 and gcc 7
4949
# This could be removed when all Linux PyTorch binary builds are compiled by the same toolchain again
@@ -799,22 +799,22 @@ if(NOT MSVC)
799799
# Details at http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1459
800800
string(APPEND CMAKE_CXX_FLAGS " -Wall")
801801
string(APPEND CMAKE_CXX_FLAGS " -Wextra")
802-
string(APPEND CMAKE_CXX_FLAGS " -Werror=return-type")
802+
append_cxx_flag_if_supported("-Werror=return-type" CMAKE_CXX_FLAGS)
803803
if(NOT USE_CUDNN)
804804
# Temporary fix to ignore non virtual dtor error if cudnn is used. A
805805
# separate PR to cudnn_frontend is needed to address this later on
806-
string(APPEND CMAKE_CXX_FLAGS " -Werror=non-virtual-dtor")
806+
append_cxx_flag_if_supported("-Werror=non-virtual-dtor" CMAKE_CXX_FLAGS)
807807
endif()
808-
string(APPEND CMAKE_CXX_FLAGS " -Wno-missing-field-initializers")
809-
string(APPEND CMAKE_CXX_FLAGS " -Wno-type-limits")
810-
string(APPEND CMAKE_CXX_FLAGS " -Wno-array-bounds")
811-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unknown-pragmas")
812-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-parameter")
813-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-function")
814-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-result")
815-
string(APPEND CMAKE_CXX_FLAGS " -Wno-strict-overflow")
816-
string(APPEND CMAKE_CXX_FLAGS " -Wno-strict-aliasing")
817-
string(APPEND CMAKE_CXX_FLAGS " -Wno-error=deprecated-declarations")
808+
append_cxx_flag_if_supported("-Wno-missing-field-initializers" CMAKE_CXX_FLAGS)
809+
append_cxx_flag_if_supported("-Wno-type-limits" CMAKE_CXX_FLAGS)
810+
append_cxx_flag_if_supported("-Wno-array-bounds" CMAKE_CXX_FLAGS)
811+
append_cxx_flag_if_supported("-Wno-unknown-pragmas" CMAKE_CXX_FLAGS)
812+
append_cxx_flag_if_supported("-Wno-unused-parameter" CMAKE_CXX_FLAGS)
813+
append_cxx_flag_if_supported("-Wno-unused-function" CMAKE_CXX_FLAGS)
814+
append_cxx_flag_if_supported("-Wno-unused-result" CMAKE_CXX_FLAGS)
815+
append_cxx_flag_if_supported("-Wno-strict-overflow" CMAKE_CXX_FLAGS)
816+
append_cxx_flag_if_supported("-Wno-strict-aliasing" CMAKE_CXX_FLAGS)
817+
append_cxx_flag_if_supported("-Wno-error=deprecated-declarations" CMAKE_CXX_FLAGS)
818818
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
819819
string(APPEND CMAKE_CXX_FLAGS " -Wno-range-loop-analysis")
820820
string(APPEND CMAKE_CXX_FLAGS " -Wno-pass-failed")
@@ -855,32 +855,31 @@ if(NOT MSVC)
855855
endif()
856856
endif()
857857

858-
string(APPEND CMAKE_CXX_FLAGS " -Wno-error=pedantic")
859-
string(APPEND CMAKE_CXX_FLAGS " -Wno-error=redundant-decls")
860-
string(APPEND CMAKE_CXX_FLAGS " -Wno-error=old-style-cast")
858+
append_cxx_flag_if_supported("-Wno-error=pedantic" CMAKE_CXX_FLAGS)
859+
append_cxx_flag_if_supported("-Wno-error=redundant-decls" CMAKE_CXX_FLAGS)
860+
append_cxx_flag_if_supported("-Wno-error=old-style-cast" CMAKE_CXX_FLAGS)
861861
# These flags are not available in GCC-4.8.5. Set only when using clang.
862862
# Compared against https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Option-Summary.html
863863
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
864-
string(APPEND CMAKE_CXX_FLAGS " -Wconstant-conversion")
865-
string(APPEND CMAKE_CXX_FLAGS " -Wno-invalid-partial-specialization")
866-
string(APPEND CMAKE_CXX_FLAGS " -Wno-typedef-redefinition")
867-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unknown-warning-option")
868-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-private-field")
869-
string(APPEND CMAKE_CXX_FLAGS " -Wno-inconsistent-missing-override")
870-
string(APPEND CMAKE_CXX_FLAGS " -Wno-aligned-allocation-unavailable")
871-
string(APPEND CMAKE_CXX_FLAGS " -Wno-c++14-extensions")
872-
string(APPEND CMAKE_CXX_FLAGS " -Wno-constexpr-not-const")
873-
string(APPEND CMAKE_CXX_FLAGS " -Wno-missing-braces")
874-
string(APPEND CMAKE_CXX_FLAGS " -Qunused-arguments")
864+
append_cxx_flag_if_supported("-Wconstant-conversion" CMAKE_CXX_FLAGS)
865+
append_cxx_flag_if_supported("-Wno-invalid-partial-specialization" CMAKE_CXX_FLAGS)
866+
append_cxx_flag_if_supported("-Wno-typedef-redefinition" CMAKE_CXX_FLAGS)
867+
append_cxx_flag_if_supported("-Wno-unused-private-field" CMAKE_CXX_FLAGS)
868+
append_cxx_flag_if_supported("-Wno-inconsistent-missing-override" CMAKE_CXX_FLAGS)
869+
append_cxx_flag_if_supported("-Wno-aligned-allocation-unavailable" CMAKE_CXX_FLAGS)
870+
append_cxx_flag_if_supported("-Wno-c++14-extensions" CMAKE_CXX_FLAGS)
871+
append_cxx_flag_if_supported("-Wno-constexpr-not-const" CMAKE_CXX_FLAGS)
872+
append_cxx_flag_if_supported("-Wno-missing-braces" CMAKE_CXX_FLAGS)
873+
append_cxx_flag_if_supported("-Qunused-arguments" CMAKE_CXX_FLAGS)
875874
if(${COLORIZE_OUTPUT})
876-
string(APPEND CMAKE_CXX_FLAGS " -fcolor-diagnostics")
877875
endif()
878876
endif()
879-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9)
880-
if(${COLORIZE_OUTPUT})
881-
string(APPEND CMAKE_CXX_FLAGS " -fdiagnostics-color=always")
882-
endif()
877+
878+
if(${COLORIZE_OUTPUT})
879+
append_cxx_flag_if_supported("-fcolor-diagnostics" CMAKE_CXX_FLAGS)
880+
append_cxx_flag_if_supported("-fdiagnostics-color=always" CMAKE_CXX_FLAGS)
883881
endif()
882+
884883
if((APPLE AND (NOT ("${CLANG_VERSION_STRING}" VERSION_LESS "9.0")))
885884
OR(CMAKE_COMPILER_IS_GNUCXX
886885
AND(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0 AND NOT APPLE)))
@@ -895,21 +894,15 @@ if(NOT MSVC)
895894
endif()
896895
endif(WERROR)
897896
if(NOT APPLE)
898-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-but-set-variable")
899-
string(APPEND CMAKE_CXX_FLAGS " -Wno-maybe-uninitialized")
897+
append_cxx_flag_if_supported("-Wno-unused-but-set-variable" CMAKE_CXX_FLAGS)
898+
append_cxx_flag_if_supported("-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)
900899
endif()
901900
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fno-omit-frame-pointer -O0")
902901
string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fno-omit-frame-pointer -O0")
903-
string(APPEND CMAKE_CXX_FLAGS " -fno-math-errno")
904-
string(APPEND CMAKE_CXX_FLAGS " -fno-trapping-math")
905-
check_cxx_compiler_flag("-Werror=format" HAS_WERROR_FORMAT)
906-
if(HAS_WERROR_FORMAT)
907-
string(APPEND CMAKE_CXX_FLAGS " -Werror=format")
908-
endif()
909-
check_cxx_compiler_flag("-Werror=cast-function-type" HAS_WERROR_CAST_FUNCTION_TYPE)
910-
if(HAS_WERROR_CAST_FUNCTION_TYPE)
911-
string(APPEND CMAKE_CXX_FLAGS " -Werror=cast-function-type")
912-
endif()
902+
append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS)
903+
append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS)
904+
append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
905+
append_cxx_flag_if_supported("-Werror=cast-function-type" CMAKE_CXX_FLAGS)
913906
check_cxx_compiler_flag("-Werror=sign-compare" HAS_WERROR_SIGN_COMPARE)
914907
# This doesn't work globally so we use the test on specific
915908
# target_compile_options
@@ -971,19 +964,17 @@ if(APPLE)
971964
string(APPEND CMAKE_CXX_FLAGS " -DUSE_MPS -fno-objc-arc")
972965
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -weak_framework Foundation -weak_framework MetalPerformanceShaders -weak_framework MetalPerformanceShadersGraph -weak_framework Metal")
973966
endif()
974-
string(APPEND CMAKE_CXX_FLAGS " -Wno-unused-private-field")
975-
string(APPEND CMAKE_CXX_FLAGS " -Wno-missing-braces")
976-
string(APPEND CMAKE_CXX_FLAGS " -Wno-c++14-extensions")
977-
string(APPEND CMAKE_CXX_FLAGS " -Wno-constexpr-not-const")
967+
append_cxx_flag_if_supported("-Wno-unused-private-field" CMAKE_CXX_FLAGS)
968+
append_cxx_flag_if_supported("-Wno-missing-braces" CMAKE_CXX_FLAGS)
969+
append_cxx_flag_if_supported("-Wno-c++14-extensions" CMAKE_CXX_FLAGS)
970+
append_cxx_flag_if_supported("-Wno-constexpr-not-const" CMAKE_CXX_FLAGS)
978971
endif()
979972

980973
if(EMSCRIPTEN)
981974
string(APPEND CMAKE_CXX_FLAGS " -Wno-implicit-function-declaration -DEMSCRIPTEN -s DISABLE_EXCEPTION_CATCHING=0")
982975
endif()
983976

984-
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0.0)
985-
string(APPEND CMAKE_CXX_FLAGS " -Wno-stringop-overflow")
986-
endif()
977+
append_cxx_flag_if_supported("-Wno-stringop-overflow" CMAKE_CXX_FLAGS)
987978

988979
if(ANDROID AND (NOT ANDROID_DEBUG_SYMBOLS))
989980
if(CMAKE_COMPILER_IS_GNUCXX)

aten/src/ATen/cpu/vec/vec256/vec256_qint.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,12 @@ struct Vectorized<c10::qint8> : public Vectorizedqi {
417417
// This is needed because the compiler emits awful code for the default
418418
// constructor for moving the enum
419419
// NOLINTNEXTLINE(clang-diagnostic-deprecated-copy)
420-
#pragma clang diagnostic push
421-
#pragma clang diagnostic ignored "-Wdeprecated-copy"
420+
C10_CLANG_DIAGNOSTIC_PUSH()
421+
#if C10_CLANG_HAS_WARNING("-Wdeprecated-copy")
422+
C10_CLANG_DIAGNOSTIC_IGNORE("-Wdeprecated-copy")
423+
#endif
422424
Vectorized(const Vectorized<c10::qint8>& other) : Vectorizedqi(other.vals) { }
423-
#pragma clang diagnostic pop
425+
C10_CLANG_DIAGNOSTIC_POP()
424426

425427
void store(void* ptr, int count = size()) const {
426428
if (count != size()) {
@@ -580,10 +582,12 @@ struct Vectorized<c10::quint8> : public Vectorizedqi {
580582
}
581583

582584
// NOLINTNEXTLINE(clang-diagnostic-deprecated-copy)
583-
#pragma clang diagnostic push
584-
#pragma clang diagnostic ignored "-Wdeprecated-copy"
585+
C10_CLANG_DIAGNOSTIC_PUSH()
586+
#if C10_CLANG_HAS_WARNING("-Wdeprecated-copy")
587+
C10_CLANG_DIAGNOSTIC_IGNORE("-Wdeprecated-copy")
588+
#endif
585589
Vectorized(const Vectorized<c10::quint8>& other) : Vectorizedqi(other.vals) { }
586-
#pragma clang diagnostic pop
590+
C10_CLANG_DIAGNOSTIC_POP()
587591

588592
void store(void* ptr, int count = size()) const {
589593
if (count != size()) {

aten/src/ATen/native/Onehot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Tensor one_hot(const Tensor &self, int64_t num_classes) {
2323
}
2424

2525
// non-empty tensor
26-
if (self.device().type() != at::kCUDA) {
26+
if (self.device().type() != at::kCUDA && self.device().type() != at::kMPS) {
2727
//for cuda, rely on device assert thrown by scatter
2828
TORCH_CHECK(self.min().item().toLong() >= 0, "Class values must be non-negative.");
2929
}
3030
if (num_classes == -1) {
3131
num_classes = self.max().item().toLong() + 1;
3232
} else {
33-
if (self.device().type() != at::kCUDA) {
33+
if (self.device().type() != at::kCUDA && self.device().type() != at::kMPS) {
3434
//rely on device asserts from scatter to avoid sync here
3535
TORCH_CHECK(num_classes > self.max().item().toLong(), "Class values must be smaller than num_classes.");
3636
} else {

aten/src/ATen/native/cpu/Loops.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
#include <ATen/native/TensorIteratorDynamicCasting.h>
3737
#include <ATen/cpu/vec/vec.h>
3838

39-
#ifndef _MSC_VER
40-
#pragma GCC diagnostic push
41-
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
42-
#endif
43-
4439
namespace at { namespace native { inline namespace CPU_CAPABILITY {
4540

4641
using namespace vec;

aten/src/ATen/native/cuda/PersistentSoftmax.cuh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ __global__ void softmax_warp_forward(output_t *dst, const input_t *src, int batc
9090
dst += idx_offset;
9191

9292
if (is_transformer_mask) {
93-
mask += (idx_offset / head_chunk_size) * stride + local_idx;
93+
mask += ((first_batch * stride) / head_chunk_size) * stride + local_idx;
9494
} else {
9595
mask += idx_offset;
9696
}
@@ -117,13 +117,14 @@ __global__ void softmax_warp_forward(output_t *dst, const input_t *src, int batc
117117
acc_t max_value[WARP_BATCH];
118118
#pragma unroll
119119
for (int i = 0; i < WARP_BATCH; ++i) {
120+
int batch_element_count = (i >= local_batches) ? 0 : element_count;
120121
bool is_meaningful_max = false;
121122
max_value[i] = elements[i][0];
122123
#pragma unroll
123124
for (int it = 0; it < WARP_ITERATIONS; ++it) {
124125
if (is_masked) {
125126
int idx = it*WARP_SIZE;
126-
if ((idx + local_idx) < element_count) {
127+
if ((idx + local_idx) < batch_element_count) {
127128
if (!is_transformer_mask) {
128129
idx += i*element_count;
129130
}
@@ -147,6 +148,7 @@ __global__ void softmax_warp_forward(output_t *dst, const input_t *src, int batc
147148
acc_t sum[WARP_BATCH] { 0.0f };
148149
#pragma unroll
149150
for (int i = 0; i < WARP_BATCH; ++i) {
151+
int batch_element_count = (i >= local_batches) ? 0 : element_count;
150152
#pragma unroll
151153
for (int it = 0; it < WARP_ITERATIONS; ++it) {
152154
if (!is_masked) {
@@ -158,7 +160,7 @@ __global__ void softmax_warp_forward(output_t *dst, const input_t *src, int batc
158160
}
159161
} else {
160162
int idx = it*WARP_SIZE;
161-
bool valid = (idx + local_idx) < element_count;
163+
bool valid = (idx + local_idx) < batch_element_count;
162164
if (!is_transformer_mask) {
163165
idx += i*element_count;
164166
}

aten/src/ATen/native/mps/operations/BitwiseBinaryOps.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ void handle_tensor_scalar_binary_op(const at::Tensor& self, const at::Scalar& ot
204204
[commandEncoder setBuffer:outBuf offset:output.storage_offset()*output.itemsize() atIndex:1];
205205
[commandEncoder setBuffer:selfBuf offset:self.storage_offset()*self.itemsize() atIndex:2];
206206
[commandEncoder setBytes:&sval length:sizeof(sval) atIndex:3];
207-
[commandEncoder dispatchThreadgroups:MTLSizeMake((length + 511) / 512, 1, 1)
208-
threadsPerThreadgroup:MTLSizeMake(512, 1, 1)];
207+
dispatch1DJob(commandEncoder, cplState, length);
209208
[commandEncoder endEncoding];
209+
stream->commit(true);
210210
});
211211
}
212212

aten/src/ATen/native/mps/operations/Distributions.mm

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
// Copyright © 2022 Apple Inc.
22

3-
#include <ATen/ATen.h>
4-
#include <ATen/Tensor.h>
5-
#include <ATen/Utils.h>
6-
#include <ATen/native/UnaryOps.h>
7-
#include <ATen/Dispatch.h>
83
#include <ATen/native/Distributions.h>
94
#include <ATen/native/DistributionTemplates.h>
10-
#include <ATen/native/TensorIterator.h>
11-
#include <ATen/mps/MPSStream.h>
125
#include <ATen/native/mps/OperationUtils.h>
13-
#include <torch/library.h>
146

157
namespace at {
168
namespace native {
@@ -198,11 +190,6 @@ Tensor normal_mps(const Tensor& mean, const Tensor& std, c10::optional<Generator
198190
}
199191

200192
Tensor& normal_mps_out(double mean, const Tensor& std, c10::optional<Generator> gen, Tensor& output) {
201-
TORCH_CHECK(
202-
std.min().ge(0).item<bool>(),
203-
"normal expects all elements of std >= 0.0");
204-
205-
206193
Tensor mean_t = empty_mps(
207194
output.sizes(),
208195
output.scalar_type(),
@@ -218,7 +205,6 @@ Tensor normal_mps(const Tensor& mean, const Tensor& std, c10::optional<Generator
218205

219206
Tensor& normal_mps_out(const Tensor& mean, const Tensor& std, c10::optional<Generator> gen, Tensor& output) {
220207
TORCH_CHECK(!std.is_complex(), "normal expects standard deviation to be non-complex");
221-
TORCH_CHECK(std.numel() == 0 || std.min().ge(0).item<bool>(), "normal expects all elements of std >= 0.0");
222208
// Check that mean and std have same number of elements
223209
TORCH_CHECK(mean.numel() == std.numel(), "normal_mps_out: mean and std must have same number of elements")
224210

benchmarks/cpp/nvfuser/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ if(USE_CUDA)
2626

2727
target_link_libraries(nvfuser_bench PRIVATE torch_library benchmark)
2828
if(NOT MSVC)
29-
target_compile_options(nvfuser_bench PRIVATE -Wno-unused-variable -Wno-deprecated-copy -Werror)
29+
target_compile_options_if_supported(nvfuser_bench -Werror)
30+
target_compile_options_if_supported(nvfuser_bench -Wno-unused-variable)
31+
target_compile_options_if_supported(nvfuser_bench -Wno-deprecated-copy)
3032
endif()
3133

3234
endif()

build_variables.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ libtorch_profiler_sources = [
130130
"torch/csrc/autograd/profiler_kineto.cpp",
131131
"torch/csrc/profiler/api.cpp",
132132
"torch/csrc/profiler/collection.cpp",
133+
"torch/csrc/profiler/execution_graph_observer.cpp",
133134
"torch/csrc/profiler/kineto_shim.cpp",
134135
"torch/csrc/profiler/nvtx_observer.cpp",
135136
"torch/csrc/profiler/kineto_client_interface.cpp",
@@ -917,7 +918,6 @@ libtorch_python_core_sources = [
917918
"torch/csrc/monitor/python_init.cpp",
918919
"torch/csrc/multiprocessing/init.cpp",
919920
"torch/csrc/onnx/init.cpp",
920-
"torch/csrc/profiler/execution_graph_observer.cpp",
921921
"torch/csrc/serialization.cpp",
922922
"torch/csrc/tensor/python_tensor.cpp",
923923
"torch/csrc/utils/init.cpp",

cmake/Dependencies.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -823,12 +823,8 @@ if(USE_FBGEMM)
823823
set_property(TARGET fbgemm PROPERTY POSITION_INDEPENDENT_CODE ON)
824824
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 13.0.0)
825825
# See https://github.com/pytorch/pytorch/issues/74352
826-
target_compile_options(asmjit PRIVATE -Wno-deprecated-copy)
827-
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.6)
828-
OR("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0.0))
829-
# -Wno-unused-but-set-variable doesn't exist in Apple clang version 13.0.0 (clang-1300.0.29.30)
830-
target_compile_options(asmjit PRIVATE -Wno-unused-but-set-variable)
831-
endif()
826+
target_compile_options_if_supported(asmjit -Wno-deprecated-copy)
827+
target_compile_options_if_supported(asmjit -Wno-unused-but-set-variable)
832828
endif()
833829
endif()
834830

0 commit comments

Comments
 (0)