Skip to content

Commit

Permalink
Remove tbb
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyever committed May 24, 2024
1 parent 4105f91 commit 3390dd1
Show file tree
Hide file tree
Showing 33 changed files with 9 additions and 859 deletions.
5 changes: 1 addition & 4 deletions .ci/pytorch/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ if [[ "$BUILD_ENVIRONMENT" == *cuda11* ]]; then
fi
fi

if [[ ${BUILD_ENVIRONMENT} == *"paralleltbb"* ]]; then
export ATEN_THREADING=TBB
export USE_TBB=1
elif [[ ${BUILD_ENVIRONMENT} == *"parallelnative"* ]]; then
if [[ ${BUILD_ENVIRONMENT} == *"parallelnative"* ]]; then
export ATEN_THREADING=NATIVE
fi

Expand Down
18 changes: 0 additions & 18 deletions .ci/pytorch/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,6 @@ test_aten() {
${SUDO} ln -sf "$TORCH_LIB_DIR"/libmkldnn* "$TEST_BASE_DIR"
${SUDO} ln -sf "$TORCH_LIB_DIR"/libnccl* "$TEST_BASE_DIR"
${SUDO} ln -sf "$TORCH_LIB_DIR"/libtorch* "$TEST_BASE_DIR"
${SUDO} ln -sf "$TORCH_LIB_DIR"/libtbb* "$TEST_BASE_DIR"

ls "$TEST_BASE_DIR"
aten/tools/run_tests.sh "$TEST_BASE_DIR"
Expand All @@ -716,21 +715,6 @@ test_without_numpy() {
popd
}

# pytorch extensions require including torch/extension.h which includes all.h
# which includes utils.h which includes Parallel.h.
# So you can call for instance parallel_for() from your extension,
# but the compilation will fail because of Parallel.h has only declarations
# and definitions are conditionally included Parallel.h(see last lines of Parallel.h).
# I tried to solve it #39612 and #39881 by including Config.h into Parallel.h
# But if Pytorch is built with TBB it provides Config.h
# that has AT_PARALLEL_NATIVE_TBB=1(see #3961 or #39881) and it means that if you include
# torch/extension.h which transitively includes Parallel.h
# which transitively includes tbb.h which is not available!
if [[ "${BUILD_ENVIRONMENT}" == *tbb* ]]; then
sudo mkdir -p /usr/include/tbb
sudo cp -r "$PWD"/third_party/tbb/include/tbb/* /usr/include/tbb
fi

test_libtorch() {
local SHARD="$1"

Expand All @@ -744,7 +728,6 @@ test_libtorch() {
ln -sf "$TORCH_LIB_DIR"/libc10* "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libshm* "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libtorch* "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libtbb* "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libnvfuser* "$TORCH_BIN_DIR"

export CPP_TESTS_DIR="${TORCH_BIN_DIR}"
Expand Down Expand Up @@ -881,7 +864,6 @@ test_rpc() {
# test reporting process to function as expected.
ln -sf "$TORCH_LIB_DIR"/libtorch* "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libc10* "$TORCH_BIN_DIR"
ln -sf "$TORCH_LIB_DIR"/libtbb* "$TORCH_BIN_DIR"

CPP_TESTS_DIR="${TORCH_BIN_DIR}" python test/run_test.py --cpp --verbose -i cpp/test_cpp_rpc
}
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@
ignore = dirty
path = third_party/foxi
url = https://github.com/houseroad/foxi.git
[submodule "third_party/tbb"]
path = third_party/tbb
url = https://github.com/01org/tbb
branch = tbb_2018
[submodule "android/libs/fbjni"]
ignore = dirty
path = android/libs/fbjni
Expand Down
5 changes: 0 additions & 5 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ filegroup(
data = [":generate-code"],
)

exports_files(
srcs = ["aten/src/ATen/cpu/tbb/extra/version_string.ver.in"],
)

# ATen
filegroup(
name = "aten_base_cpp",
Expand Down Expand Up @@ -275,7 +271,6 @@ header_template_rule(
"@AT_BUILD_WITH_LAPACK@": "1",
"@AT_PARALLEL_OPENMP@": "0",
"@AT_PARALLEL_NATIVE@": "1",
"@AT_PARALLEL_NATIVE_TBB@": "0",
"@AT_BLAS_F2C@": "0",
"@AT_BLAS_USE_CBLAS_DOT@": "1",
},
Expand Down
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ cmake_dependent_option(
cmake_dependent_option(
USE_TENSORPIPE "Use TensorPipe. Only available if USE_DISTRIBUTED is on." ON
"USE_DISTRIBUTED" OFF)
option(USE_TBB "Use TBB (Deprecated)" OFF)
cmake_dependent_option(
USE_SYSTEM_TBB "Use system-provided Intel TBB." OFF "USE_TBB" OFF)
option(ONNX_ML "Enable traditional ONNX ML API." ON)
option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" OFF)
option(BUILD_LIBTORCH_CPU_WITH_DEBUG "Enable RelWithDebInfo for libtorch_cpu target only" OFF)
Expand Down Expand Up @@ -431,9 +428,6 @@ if(USE_SYSTEM_LIBS)
if(USE_NCCL)
set(USE_SYSTEM_NCCL ON)
endif()
if(USE_TBB)
set(USE_SYSTEM_TBB ON)
endif()
endif()

# Used when building Caffe2 through setup.py
Expand Down
10 changes: 0 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,6 @@ new_local_repository(
path = "third_party/opentelemetry-cpp",
)

new_patched_local_repository(
name = "tbb",
build_file = "//third_party:tbb.BUILD",
patch_strip = 1,
patches = [
"@//third_party:tbb.patch",
],
path = "third_party/tbb",
)

new_local_repository(
name = "tensorpipe",
build_file = "//third_party:tensorpipe.BUILD",
Expand Down
10 changes: 0 additions & 10 deletions aten/src/ATen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,6 @@ endif()

list(APPEND ATen_CPU_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/..)

if(USE_TBB)
if(USE_SYSTEM_TBB)
message("ATen is compiled with system-provided Intel TBB.")
else()
message("ATen is compiled with Intel TBB (${TBB_ROOT_DIR}).")
endif()
list(APPEND ATen_CPU_INCLUDE ${TBB_INCLUDE_DIR})
list(APPEND ATen_CPU_DEPENDENCY_LIBS TBB::tbb)
endif()

if(BLAS_FOUND)
if($ENV{TH_BINARY_BUILD})
message(STATUS "TH_BINARY_BUILD detected. Enabling special linkage.")
Expand Down
1 change: 0 additions & 1 deletion aten/src/ATen/Config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@
#define AT_BUILD_WITH_LAPACK() @AT_BUILD_WITH_LAPACK@
#define AT_PARALLEL_OPENMP @AT_PARALLEL_OPENMP@
#define AT_PARALLEL_NATIVE @AT_PARALLEL_NATIVE@
#define AT_PARALLEL_NATIVE_TBB @AT_PARALLEL_NATIVE_TBB@
#define AT_BLAS_F2C() @AT_BLAS_F2C@
#define AT_BLAS_USE_CBLAS_DOT() @AT_BLAS_USE_CBLAS_DOT@
2 changes: 0 additions & 2 deletions aten/src/ATen/Parallel.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ TORCH_API int intraop_default_num_threads();
#include <ATen/ParallelOpenMP.h> // IWYU pragma: keep
#elif AT_PARALLEL_NATIVE
#include <ATen/ParallelNative.h> // IWYU pragma: keep
#elif AT_PARALLEL_NATIVE_TBB
#include <ATen/ParallelNativeTBB.h> // IWYU pragma: keep
#endif

#include <ATen/Parallel-inl.h> // IWYU pragma: keep
2 changes: 0 additions & 2 deletions aten/src/ATen/ParallelCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ std::string get_parallel_info() {
ss << "OpenMP";
#elif AT_PARALLEL_NATIVE
ss << "native thread pool";
#elif AT_PARALLEL_NATIVE_TBB
ss << "native thread pool and TBB";
#endif
#ifdef C10_MOBILE
ss << " [mobile]";
Expand Down
115 changes: 0 additions & 115 deletions aten/src/ATen/ParallelNativeTBB.cpp

This file was deleted.

52 changes: 0 additions & 52 deletions aten/src/ATen/ParallelNativeTBB.h

This file was deleted.

2 changes: 1 addition & 1 deletion aten/src/ATen/ParallelThreadPoolNative.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <ATen/Config.h>
#if AT_PARALLEL_OPENMP || AT_PARALLEL_NATIVE || AT_PARALLEL_NATIVE_TBB
#if AT_PARALLEL_OPENMP || AT_PARALLEL_NATIVE
#include <ATen/Parallel.h>
#include <ATen/PTThreadPool.h>
#include <ATen/ThreadLocalState.h>
Expand Down
Loading

0 comments on commit 3390dd1

Please sign in to comment.