Skip to content

Commit 53a7d09

Browse files
committed
Fix torch 2.4.1 patch
1 parent f51c636 commit 53a7d09

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

graalpython/lib-graalpython/patches/torch-2.4.1.patch

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,19 @@ index f5fdbf155..d76176cb6 100644
178178

179179

180180
class TestWrapperSubclassAliasing(TestCase):
181+
diff --git a/third_party/fbgemm/CMakeLists.txt b/third_party/fbgemm/CMakeLists.txt
182+
index 134523e7d..a00538e3c 100644
183+
--- a/third_party/fbgemm/CMakeLists.txt
184+
+++ b/third_party/fbgemm/CMakeLists.txt
185+
@@ -10,6 +10,8 @@
186+
187+
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
188+
189+
+add_compile_options(-Wno-error=maybe-uninitialized -Wno-error=uninitialized -Wno-error=restrict)
190+
+
191+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
192+
193+
# Define function to extract filelists from defs.bzl file
181194
diff --git a/third_party/pybind11/include/pybind11/detail/common.h b/third_party/pybind11/include/pybind11/detail/common.h
182195
index 454e6061b..7feafc7d7 100644
183196
--- a/third_party/pybind11/include/pybind11/detail/common.h
@@ -537,20 +550,6 @@ index c301da982..a2668be20 100644
537550
+const int THP_PyOpcode_Caches_size = 0;
538551
+
539552
+#endif // GraalPy change
540-
diff --git a/torch/csrc/dynamo/extra_state.c b/torch/csrc/dynamo/extra_state.c
541-
index cbe9ab37a..18740a0d8 100644
542-
--- a/torch/csrc/dynamo/extra_state.c
543-
+++ b/torch/csrc/dynamo/extra_state.c
544-
@@ -100,9 +100,6 @@ void destroy_extra_state(void* obj) {
545-
}
546-
547-
void set_extra_state(PyCodeObject* code, ExtraState* extra_state) {
548-
- ExtraState* old_extra_state = get_extra_state(code);
549-
- CHECK(extra_state == nullptr || old_extra_state != extra_state);
550-
- _PyCode_SetExtra((PyObject*)code, extra_index, extra_state);
551-
}
552-
553-
ExtraState* init_and_set_extra_state(PyCodeObject* code) {
554553
diff --git a/torch/csrc/dynamo/eval_frame.c b/torch/csrc/dynamo/eval_frame.c
555554
index cbe9ab37a..18740a0d8 100644
556555
--- a/torch/csrc/dynamo/eval_frame.c
@@ -628,6 +627,24 @@ index cbe9ab37a..18740a0d8 100644
628627

629628
return module;
630629
}
630+
diff --git a/torch/csrc/dynamo/extra_state.cpp b/torch/csrc/dynamo/extra_state.cpp
631+
index 7c9b4be00..b8edbcfda 100644
632+
--- a/torch/csrc/dynamo/extra_state.cpp
633+
+++ b/torch/csrc/dynamo/extra_state.cpp
634+
@@ -65,11 +65,13 @@ void destroy_extra_state(void* obj) {
635+
}
636+
637+
void set_extra_state(PyCodeObject* code, ExtraState* extra_state) {
638+
+#if 0 // GraalPy change
639+
ExtraState* old_extra_state = get_extra_state(code);
640+
CHECK(
641+
old_extra_state == nullptr || old_extra_state == SKIP_CODE ||
642+
old_extra_state != extra_state);
643+
_PyCode_SetExtra((PyObject*)code, extra_index, extra_state);
644+
+#endif // GraalPy change
645+
}
646+
647+
ExtraState* init_and_set_extra_state(PyCodeObject* code) {
631648
diff --git a/torch/csrc/jit/python/python_tracer.cpp b/torch/csrc/jit/python/python_tracer.cpp
632649
index 92e6e2d3a..4d2ec0bfe 100644
633650
--- a/torch/csrc/jit/python/python_tracer.cpp

0 commit comments

Comments
 (0)