Skip to content

Commit

Permalink
[aten] Move submodules to third_party (pytorch#6866)
Browse files Browse the repository at this point in the history
* [aten] Move submodules to third_party

* [aten] Update aten_mirror.sh script for third_party

* [aten] Move ATen submodules def to root and rename

* [aten] Update cpuinfo cmake build

* [aten] Fix cpuinfo cmake build

* Update third_party/cpuinfo to d03d5d296063063c66877fb559cf34469734e3e1

* [aten] Fix JIT test reference to catch
  • Loading branch information
orionr authored and ezyang committed Apr 25, 2018
1 parent c33d7f5 commit dec5e99
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 34 deletions.
11 changes: 4 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[submodule "aten/src/ATen/cpu/cpuinfo"]
path = aten/src/ATen/cpu/cpuinfo
url = https://github.com/Maratyszcza/cpuinfo
[submodule "aten/src/ATen/cpu/tbb/tbb_remote"]
path = aten/src/ATen/cpu/tbb/tbb_remote
[submodule "third_party/tbb"]
path = third_party/tbb
url = https://github.com/01org/tbb
branch = tbb_2018
[submodule "aten/src/ATen/utils/catch"]
path = aten/src/ATen/utils/catch
[submodule "third_party/catch"]
path = third_party/catch
url = https://github.com/catchorg/Catch2.git
[submodule "third_party/nanopb"]
path = third_party/nanopb
Expand Down
10 changes: 10 additions & 0 deletions .gitmodules.aten
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[submodule "third_party/tbb"]
path = third_party/tbb
url = https://github.com/01org/tbb
branch = tbb_2018
[submodule "third_party/catch"]
path = third_party/catch
url = https://github.com/catchorg/Catch2.git
[submodule "third-party/cpuinfo"]
path = third_party/cpuinfo
url = https://github.com/Maratyszcza/cpuinfo.git
10 changes: 0 additions & 10 deletions aten/.gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion aten/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/src/THCUNN)
add_subdirectory(src/ATen)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/ATen/utils/catch/single_include
${CMAKE_CURRENT_SOURCE_DIR}/../third_party/catch/single_include
${CMAKE_CURRENT_BINARY_DIR}/src/ATen)
if(NOT NO_CUDA)
include_directories(${CUDA_INCLUDE_DIRS})
Expand Down
35 changes: 27 additions & 8 deletions aten/src/ATen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ ELSE()
ENDIF()
ADD_DEPENDENCIES(ATen aten_files_are_generated)

set(TBB_ROOT_DIR "${PROJECT_SOURCE_DIR}/src/ATen/cpu/tbb/tbb_remote")
set(TBB_ROOT_DIR "${PROJECT_SOURCE_DIR}/../third_party/tbb")
set(TBB_BUILD_STATIC ON CACHE BOOL " " FORCE)
set(TBB_BUILD_SHARED OFF CACHE BOOL " " FORCE)
set(TBB_BUILD_TBBMALLOC OFF CACHE BOOL " " FORCE)
Expand Down Expand Up @@ -323,14 +323,33 @@ if(MKLDNN_FOUND)
target_link_libraries(ATen ${MKLDNN_LIBRARIES})
endif(MKLDNN_FOUND)

# Directory where cpuinfo will download and build all dependencies
set(CONFU_DEPENDENCIES_BINARY_DIR ${PROJECT_BINARY_DIR}/confu-deps
CACHE PATH "Confu-style dependencies binary directory")

# ---[ Configure cpuinfo
IF(NOT TARGET cpuinfo)
SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_BENCHMARKS OFF CACHE BOOL "")
ADD_SUBDIRECTORY("cpu/cpuinfo")
ENDIF()
if (NOT TARGET cpuinfo)
if (NOT DEFINED CPUINFO_SOURCE_DIR)
set(CPUINFO_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../third_party/cpuinfo" CACHE STRING "cpuinfo source directory")
endif()

set(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
set(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
set(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "")
set(CPUINFO_BUILD_BENCHMARKS OFF CACHE BOOL "")
set(CPUINFO_LIBRARY_TYPE "static" CACHE STRING "")
if(MSVC)
# ATen is built with default MSVC runtime linking, which is /MD (DLL)
# so no need to check *_USE_MSVC_STATIC_RUNTIME or some equivalent.
set(CPUINFO_RUNTIME_TYPE "shared" CACHE STRING "")
endif()
add_subdirectory(
"${CPUINFO_SOURCE_DIR}"
"${CONFU_DEPENDENCIES_BINARY_DIR}/cpuinfo")
# We build static version of cpuinfo but link
# them into a shared library for Caffe2, so they need PIC.
set_property(TARGET cpuinfo PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
TARGET_LINK_LIBRARIES(ATen cpuinfo)

IF(CUDA_FOUND)
Expand Down
1 change: 0 additions & 1 deletion aten/src/ATen/cpu/cpuinfo
Submodule cpuinfo deleted from d0222b
2 changes: 1 addition & 1 deletion aten/src/ATen/native/cpu/CapabilityDispatch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "ATen/cpu/cpuinfo/include/cpuinfo.h"
#include <cpuinfo.h>
#include <type_traits>
#include <iostream>

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ def check_file(f):
check_file(os.path.join(third_party_path, "gloo", "CMakeLists.txt"))
check_file(os.path.join(third_party_path, "nanopb", "CMakeLists.txt"))
check_file(os.path.join(third_party_path, "pybind11", "CMakeLists.txt"))
check_file(os.path.join('aten', 'src', 'ATen', 'cpu', 'cpuinfo', 'CMakeLists.txt'))
check_file(os.path.join('aten', 'src', 'ATen', 'cpu', 'tbb', 'tbb_remote', 'Makefile'))
check_file(os.path.join('aten', 'src', 'ATen', 'utils', 'catch', 'CMakeLists.txt'))
check_file(os.path.join(third_party_path, 'cpuinfo', 'CMakeLists.txt'))
check_file(os.path.join(third_party_path, 'tbb', 'Makefile'))
check_file(os.path.join(third_party_path, 'catch', 'CMakeLists.txt'))

check_pydep('yaml', 'pyyaml')
check_pydep('typing', 'typing')
Expand Down
2 changes: 1 addition & 1 deletion third_party/cpuinfo
Submodule cpuinfo updated 98 files
+19 −2 CMakeLists.txt
+1 −1 README.md
+8 −8 include/cpuinfo.h
+27 −1 jni/Android.mk
+2 −0 scripts/android-arm64-mock.sh
+4 −0 scripts/android-armv7-mock.sh
+77 −32 scripts/android-device-dump.py
+2 −0 scripts/android-x86-mock.sh
+5 −0 src/arm/cache.c
+24 −0 src/arm/linux/aarch32-isa.c
+19 −3 src/arm/linux/aarch64-isa.c
+2 −0 src/arm/linux/api.h
+19 −22 src/arm/linux/init.c
+7 −7 src/arm/linux/midr.c
+3 −0 src/x86/uarch.c
+96 −0 test/arm-cache.cc
+15 −15 test/build.prop/galaxy-s7-global.log
+16 −14 test/build.prop/galaxy-s7-us.log
+14 −13 test/build.prop/galaxy-s8-global.log
+240 −0 test/build.prop/huawei-honor-6.log
+7 −7 test/build.prop/huawei-mate-8.log
+12 −10 test/build.prop/huawei-mate-9.log
+276 −0 test/build.prop/leagoo-t5c.log
+28 −25 test/build.prop/nexus6p.log
+38 −0 test/cpuid/leagoo-t5c.log
+13 −0 test/cpuinfo/alcatel-revvl.armeabi.log
+72 −0 test/cpuinfo/galaxy-a8-2018.armeabi.log
+19 −0 test/cpuinfo/galaxy-c9-pro.armeabi.log
+4 −4 test/cpuinfo/galaxy-c9-pro.log
+17 −0 test/cpuinfo/galaxy-s6.armeabi.log
+48 −0 test/cpuinfo/galaxy-s7-global.armeabi.log
+0 −48 test/cpuinfo/galaxy-s7-int.log
+38 −0 test/cpuinfo/galaxy-s7-us.armeabi.log
+8 −8 test/cpuinfo/galaxy-s8-global.armeabi.log
+82 −0 test/cpuinfo/galaxy-s8-us.armeabi.log
+80 −0 test/cpuinfo/galaxy-s9-global.armeabi.log
+72 −0 test/cpuinfo/galaxy-s9-global.log
+82 −0 test/cpuinfo/galaxy-s9-us.armeabi.log
+35 −0 test/cpuinfo/huawei-honor-6.log
+80 −0 test/cpuinfo/huawei-mate-10.armeabi.log
+73 −0 test/cpuinfo/huawei-mate-8.armeabi.log
+73 −0 test/cpuinfo/huawei-mate-9.armeabi.log
+17 −0 test/cpuinfo/huawei-p8-lite.armeabi.log
+17 −0 test/cpuinfo/huawei-p9-lite.armeabi.log
+37 −0 test/cpuinfo/iconia-one-10.armeabi.log
+22 −0 test/cpuinfo/iconia-one-10.log
+219 −0 test/cpuinfo/leagoo-t5c.log
+49 −0 test/cpuinfo/nexus5x.armeabi.log
+38 −4 test/cpuinfo/nexus5x.log
+17 −0 test/cpuinfo/nexus6p.armeabi.log
+37 −0 test/cpuinfo/oneplus-3t.armeabi.log
+0 −1 test/cpuinfo/oneplus-3t.log
+82 −0 test/cpuinfo/oneplus-5.armeabi.log
+82 −0 test/cpuinfo/oneplus-5t.armeabi.log
+15 −0 test/cpuinfo/oppo-a37.armeabi.log
+11 −0 test/cpuinfo/oppo-r9.armeabi.log
+8 −0 test/cpuinfo/oppo-r9.log
+54 −0 test/cpuinfo/xiaomi-mi-5c.armeabi.log
+18 −0 test/cpuinfo/xiaomi-mi-5c.log
+17 −0 test/cpuinfo/xiaomi-redmi-note-3.armeabi.log
+74 −0 test/cpuinfo/xiaomi-redmi-note-4.armeabi.log
+11 −0 test/cpuinfo/xperia-c4-dual.armeabi.log
+21 −0 test/mock/alcatel-revvl.h
+478 −176 test/mock/galaxy-a8-2018.h
+822 −241 test/mock/galaxy-c9-pro.h
+768 −337 test/mock/galaxy-s6.h
+415 −310 test/mock/galaxy-s7-global.h
+1,176 −198 test/mock/galaxy-s7-us.h
+507 −314 test/mock/galaxy-s8-global.h
+1,312 −1,572 test/mock/galaxy-s8-us.h
+840 −0 test/mock/galaxy-s9-global.cc
+3,610 −0 test/mock/galaxy-s9-global.h
+2 −6 test/mock/galaxy-s9-us.cc
+483 −416 test/mock/galaxy-s9-us.h
+735 −0 test/mock/huawei-honor-6.cc
+2,976 −0 test/mock/huawei-honor-6.h
+373 −236 test/mock/huawei-mate-10.h
+376 −272 test/mock/huawei-mate-8.h
+488 −358 test/mock/huawei-mate-9.h
+87 −62 test/mock/huawei-p8-lite.h
+398 −218 test/mock/huawei-p9-lite.h
+146 −86 test/mock/iconia-one-10.h
+702 −0 test/mock/leagoo-t5c.cc
+3,404 −0 test/mock/leagoo-t5c.h
+515 −346 test/mock/nexus5x.h
+371 −680 test/mock/nexus6p.h
+970 −1,064 test/mock/oneplus-3t.h
+881 −307 test/mock/oneplus-5.h
+846 −308 test/mock/oneplus-5t.h
+362 −66 test/mock/oppo-a37.h
+68 −98 test/mock/oppo-r9.h
+382 −93 test/mock/xiaomi-mi-5c.h
+772 −158 test/mock/xiaomi-redmi-note-3.h
+656 −128 test/mock/xiaomi-redmi-note-4.h
+71 −57 test/mock/xperia-c4-dual.h
+0 −2 tools/auxv-dump.c
+45 −0 tools/cpuinfo-dump.c
+5 −1 tools/isa-info.c
2 changes: 1 addition & 1 deletion tools/aten_mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git fetch fullrepo
git checkout -b temporary-split-branch fullrepo/master
# Cribbed from https://stackoverflow.com/questions/2982055/detach-many-subdirectories-into-a-new-separate-git-repository
# and https://stackoverflow.com/questions/42355621/git-filter-branch-moving-a-folder-with-index-filter-does-not-work
git filter-branch -f --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- aten cmake third_party/cpuinfo && (git ls-files -s | sed "s-.travis.aten.yml-.travis.yml-" | git update-index --index-info)'
git filter-branch -f --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- aten cmake third_party/tbb third_party/catch third_party/cpuinfo && (git ls-files -s | sed "s-.travis.aten.yml-.travis.yml-" | sed "s-.gitmodules.aten-.gitmodules-" | git update-index --index-info)'
git checkout master
git merge temporary-split-branch
git push
2 changes: 1 addition & 1 deletion tools/cpp_build/libtorch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ target_link_libraries(test_jit torch)

target_include_directories(test_jit PUBLIC
"${TORCH_SRC_DIR}/../"
"${TORCH_SRC_DIR}/../aten/src/ATen/utils/catch/single_include"
"${TORCH_SRC_DIR}/../third_party/catch/single_include"
"${COMMON_INCLUDES}")

install(TARGETS test_jit
Expand Down

0 comments on commit dec5e99

Please sign in to comment.