1load("//tools/build_defs:glob_defs.bzl", "subdir_glob") 2load( 3 ":pt_ops.bzl", 4 "pt_operator_library", 5) 6load(":buckbuild.bzl", 7 "define_buck_targets", 8 "get_pt_operator_registry_dict", 9) 10 11# define shared buck targets 12define_buck_targets() 13 14# define OSS only targets 15cxx_library( 16 name = "pthreadpool", 17 srcs = ['caffe2/utils/threadpool/pthreadpool.cc', 'caffe2/utils/threadpool/pthreadpool_impl.cc', 'caffe2/utils/threadpool/pthreadpool-cpp.cc', 'caffe2/utils/threadpool/thread_pool_guard.cpp', 'caffe2/utils/threadpool/ThreadPool.cc'], 18 deps = [':caffe2_headers', '//third_party:cpuinfo', '//third_party:glog', '//c10:c10', '//third_party:FXdiv'], 19 exported_deps = ['//third_party:pthreadpool'], 20 compiler_flags = ['-Wno-unused-function'], 21 preferred_linkage = "static", 22 exported_headers = subdir_glob([("", "caffe2/utils/threadpool/*.h")]), 23 exported_preprocessor_flags = ['-DUSE_PTHREADPOOL'], 24 header_namespace = "", 25 headers = [], 26 link_whole = True, 27 platform_preprocessor_flags = [['windows', ['-D_WINDOWS', '-D_WIN32', '-DWIN32', '-DNOMINMAX', '-D_CRT_SECURE_NO_WARNINGS', '-D_USE_MATH_DEFINES']], ['windows.*64$', ['-D_WIN64']]], 28 visibility = ['PUBLIC'], 29) 30 31cxx_library( 32 name = "caffe2_headers", 33 deps = ['//c10:c10'], 34 exported_headers = subdir_glob( 35 [ 36 ("", "caffe2/**/*.h"), 37 ("", "binaries/**/*.h"), 38 ("modules", "**/*.h"), 39 ("aten/src", "ATen/core/**/*.h"), 40 ], 41 exclude = [ 42 "caffe2/fb/**/*.h", 43 "caffe2/mobile/contrib/libopencl-stub/**/*.h", 44 "caffe2/mobile/contrib/libvulkan-stub/**/*.h", 45 "caffe2/mobile/contrib/nnapi/**/*.h", 46 "caffe2/mobile/fb/binary/**/*.h", 47 "caffe2/mobile/fb/snpe_so/**/*.h", 48 "caffe2/mobile/fb/boltnn/bolt_lib/include/**/*.h", 49 "caffe2/mobile/contrib/snpe/**/*.h", 50 "caffe2/mobile/fb/qpl/jni/QuickPerformanceLogger.h", 51 "caffe2/share/fb/x3d/ldi/*.h", 52 "**/*.pb.h", 53 ], 54 ), 55 compiler_flags = ['-Os', '-fexceptions', '-frtti', '-Wno-shadow', '-Wno-unknown-pragmas', '-Wno-unused-variable', '-Wno-sign-compare', '-Icaffe2', '-Imodules', '-DEIGEN_NO_DEBUG', '-DCAFFE2_USE_LITE_PROTO', '-DCAFFE2_USE_GOOGLE_GLOG', '-DCAFFE2_RNN_NO_TEXT_FORMAT', '-DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK=1', '-DCAFFE2_IS_XPLAT_BUILD', '-DSTRIP_ERROR_MESSAGES', '-DUSE_INTERNAL_PTHREADPOOL_IMPL', '-DCAFFE2_USE_HPTT'], 56 preferred_linkage = "static", 57 platform_preprocessor_flags = [['windows', ['-D_WINDOWS', '-D_WIN32', '-DWIN32', '-DNOMINMAX', '-D_CRT_SECURE_NO_WARNINGS', '-D_USE_MATH_DEFINES']], ['windows.*64$', ['-D_WIN64']]], 58 preprocessor_flags = ['-DUSE_INTERNAL_PTHREADPOOL_IMPL'], 59 visibility = ['PUBLIC'], 60) 61 62cxx_library( 63 name = "caffe2_serialize", 64 srcs = [ 65 "caffe2/serialize/file_adapter.cc", 66 "caffe2/serialize/inline_container.cc", 67 "caffe2/serialize/istream_adapter.cc", 68 "caffe2/serialize/read_adapter_interface.cc", 69 ], 70 visibility = ["PUBLIC"], 71 deps = [ 72 ":caffe2_headers", 73 "//third_party:glog", 74 "//c10:c10", 75 "//third_party:miniz", 76 ], 77) 78 79pt_operator_library( 80 name = "torch_mobile_ops_full_dev", 81 include_all_operators = True, 82) 83 84cxx_library( 85 name = "pt_ops_full", 86 **get_pt_operator_registry_dict( 87 name = "pt_ops_full", 88 deps = [ 89 ":torch_mobile_ops_full_dev", 90 ], 91 ) 92) 93 94cxx_binary( 95 name = 'ptmobile_benchmark', 96 srcs = [ 97 'binaries/speed_benchmark_torch.cc', 98 ], 99 compiler_flags = [ 100 "-fexceptions", 101 "-frtti", 102 "-Wno-deprecated-declarations", 103 ], 104 preprocessor_flags = [ 105 "-DBUILD_LITE_INTERPRETER", 106 ], 107 platform_linker_flags = [ 108 ( 109 "^linux.*$", 110 [ 111 "-Wl,--no-as-needed", 112 "-ldl", 113 "-pthread", 114 ], 115 ), 116 ], 117 deps = [ 118 ":torch_mobile_core", 119 ":pt_ops_full", 120 "//c10:c10", 121 ], 122) 123