mcst-linux-kernel/patches-2024.06.26/pytorch-1.13.1/0004-test-stash-undefined-r...

81 lines
2.9 KiB
Diff

Subject: work around static class member definition error
Bug: 130555
Tags: lcc
diff -rupN a/test/cpp/jit/CMakeLists.txt b/test/cpp/jit/CMakeLists.txt
--- a/test/cpp/jit/CMakeLists.txt 2023-08-07 16:05:25.137479207 +0300
+++ b/test/cpp/jit/CMakeLists.txt 2023-08-07 16:34:55.880662176 +0300
@@ -42,7 +42,6 @@ set(JIT_TEST_SRCS
${JIT_TEST_ROOT}/test_add_if_then_else.cpp
${JIT_TEST_ROOT}/test_alias_analysis.cpp
${JIT_TEST_ROOT}/test_argument_spec.cpp
- ${JIT_TEST_ROOT}/test_autodiff.cpp
${JIT_TEST_ROOT}/test_load_upgraders.cpp
${JIT_TEST_ROOT}/test_op_replacement.cpp
${JIT_TEST_ROOT}/test_upgrader_utils.cpp
@@ -60,7 +59,6 @@ set(JIT_TEST_SRCS
${JIT_TEST_ROOT}/test_custom_class_registrations.cpp
${JIT_TEST_ROOT}/test_custom_operators.cpp
${JIT_TEST_ROOT}/test_dce.cpp
- ${JIT_TEST_ROOT}/test_fuser.cpp
${JIT_TEST_ROOT}/test_graph_executor.cpp
${JIT_TEST_ROOT}/test_graph_iterator.cpp
${JIT_TEST_ROOT}/test_cs_debug_info_serialization.cpp
@@ -95,6 +93,10 @@ set(JIT_TEST_SRCS
${JIT_TEST_ROOT}/test_flatbuffer.cpp
)
+# bug 130555: disable tests conflicting with test_misc.cpp (ArgumentStash::stash)
+# ${JIT_TEST_ROOT}/test_autodiff.cpp
+# ${JIT_TEST_ROOT}/test_fuser.cpp
+
if(USE_CUDA)
list(APPEND JIT_TEST_SRCS ${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/python_frontend/test/test_nvfuser_fusion_definition.cpp)
list(APPEND JIT_TEST_SRCS ${TORCH_SRC_DIR}/csrc/jit/codegen/cuda/python_frontend/test/test_nvfuser_fusion_cache.cpp)
diff -rupN a/test/cpp/jit/test_autodiff.cpp b/test/cpp/jit/test_autodiff.cpp
--- a/test/cpp/jit/test_autodiff.cpp 2023-08-07 16:05:25.147476802 +0300
+++ b/test/cpp/jit/test_autodiff.cpp 2023-08-07 16:34:55.880662176 +0300
@@ -25,6 +25,11 @@
namespace torch {
namespace jit {
+#ifdef __LCC__
+using ArgumentStash = torch::jit::tracer::ArgumentStash;
+thread_local ArgumentStash ArgumentStash::stash;
+#endif
+
using namespace torch::autograd;
using var_meta_type = std::vector<int64_t>;
diff -rupN a/test/cpp/jit/test_fuser.cpp b/test/cpp/jit/test_fuser.cpp
--- a/test/cpp/jit/test_fuser.cpp 2023-08-07 16:05:25.147476802 +0300
+++ b/test/cpp/jit/test_fuser.cpp 2023-08-07 16:34:55.880662176 +0300
@@ -55,6 +55,11 @@
namespace torch {
namespace jit {
+#ifdef __LCC__
+using ArgumentStash = torch::jit::tracer::ArgumentStash;
+thread_local ArgumentStash ArgumentStash::stash;
+#endif
+
class FuserTest : public ::testing::Test {
void SetUp() override {
old_nvfuser_value_ = fuser::cuda::setEnabled(false);
diff -rupN a/test/cpp/jit/test_misc.cpp b/test/cpp/jit/test_misc.cpp
--- a/test/cpp/jit/test_misc.cpp 2023-08-07 16:05:25.147476802 +0300
+++ b/test/cpp/jit/test_misc.cpp 2023-08-07 16:34:55.900657327 +0300
@@ -84,6 +84,12 @@
namespace torch {
namespace jit {
+
+#ifdef __LCC__
+using ArgumentStash = torch::jit::tracer::ArgumentStash;
+thread_local ArgumentStash ArgumentStash::stash;
+#endif
+
inline c10::AliasAnalysisKind aliasAnalysisFromSchema() {
return c10::AliasAnalysisKind::FROM_SCHEMA;
}