加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BUILD.bazel 64.43 KB
一键复制 编辑 原始数据 按行查看 历史
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@pytorch//third_party:substitution.bzl", "header_template_rule", "template_rule")
load("@pytorch//:tools/bazel.bzl", "rules")
load("@pytorch//tools/rules:cu.bzl", "cu_library")
load("@pytorch//tools/config:defs.bzl", "if_cuda")
load("@pytorch//:aten.bzl", "generate_aten", "intern_build_aten_ops")
load(":build.bzl", "GENERATED_AUTOGRAD_CPP", "GENERATED_AUTOGRAD_PYTHON", "define_targets")
load(":build_variables.bzl", "jit_core_sources", "lazy_tensor_ts_sources", "libtorch_core_sources", "libtorch_cuda_sources", "libtorch_distributed_sources", "libtorch_extra_sources", "libtorch_nvfuser_generated_headers", "libtorch_nvfuser_runtime_sources", "libtorch_python_core_sources", "torch_cpp_srcs", "libtorch_python_cuda_sources", "libtorch_python_distributed_sources")
load(":ufunc_defs.bzl", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cuda_sources")
load("//:tools/bazel.bzl", "rules")
define_targets(rules = rules)
COMMON_COPTS = [
"-DHAVE_MALLOC_USABLE_SIZE=1",
"-DHAVE_MMAP=1",
"-DHAVE_SHM_OPEN=1",
"-DHAVE_SHM_UNLINK=1",
"-D_FILE_OFFSET_BITS=64",
"-DTH_HAVE_THREAD",
"-DUSE_FBGEMM",
"-DUSE_DISTRIBUTED",
"-DAT_PER_OPERATOR_HEADERS",
"-DATEN_THREADING=NATIVE",
"-DNO_CUDNN_DESTROY_HANDLE",
] + if_cuda([
"-DUSE_CUDA",
"-DUSE_CUDNN",
# TODO: This should be passed only when building for CUDA-11.5 or newer
# use cub in a safe manner, see:
# https://github.com/pytorch/pytorch/pull/55292
"-DCUB_WRAPPED_NAMESPACE=at_cuda_detail",
])
aten_generation_srcs = ["aten/src/ATen/native/native_functions.yaml"] + ["aten/src/ATen/native/tags.yaml"] + glob(["aten/src/ATen/templates/**"])
generated_cpu_cpp = [
"aten/src/ATen/RegisterBackendSelect.cpp",
"aten/src/ATen/RegisterCPU.cpp",
"aten/src/ATen/RegisterFunctionalization_0.cpp",
"aten/src/ATen/RegisterFunctionalization_1.cpp",
"aten/src/ATen/RegisterFunctionalization_2.cpp",
"aten/src/ATen/RegisterFunctionalization_3.cpp",
# "aten/src/ATen/RegisterFunctionalizationEverything.cpp",
"aten/src/ATen/RegisterMkldnnCPU.cpp",
"aten/src/ATen/RegisterNestedTensorCPU.cpp",
"aten/src/ATen/RegisterQuantizedCPU.cpp",
"aten/src/ATen/RegisterSparseCPU.cpp",
"aten/src/ATen/RegisterSparseCsrCPU.cpp",
"aten/src/ATen/RegisterZeroTensor.cpp",
"aten/src/ATen/RegisterCompositeImplicitAutograd.cpp",
"aten/src/ATen/RegisterCompositeImplicitAutogradNestedTensor.cpp",
"aten/src/ATen/RegisterCompositeExplicitAutograd.cpp",
"aten/src/ATen/RegisterCompositeExplicitAutogradNonFunctional.cpp",
"aten/src/ATen/RegisterMeta.cpp",
"aten/src/ATen/RegisterSparseMeta.cpp",
"aten/src/ATen/RegisterQuantizedMeta.cpp",
"aten/src/ATen/RegisterNestedTensorMeta.cpp",
"aten/src/ATen/RegisterSchema.cpp",
"aten/src/ATen/CPUFunctions.h",
"aten/src/ATen/CPUFunctions_inl.h",
"aten/src/ATen/CompositeExplicitAutogradFunctions.h",
"aten/src/ATen/CompositeExplicitAutogradFunctions_inl.h",
"aten/src/ATen/CompositeExplicitAutogradNonFunctionalFunctions.h",
"aten/src/ATen/CompositeExplicitAutogradNonFunctionalFunctions_inl.h",
"aten/src/ATen/CompositeImplicitAutogradFunctions.h",
"aten/src/ATen/CompositeImplicitAutogradFunctions_inl.h",
"aten/src/ATen/CompositeImplicitAutogradNestedTensorFunctions.h",
"aten/src/ATen/CompositeImplicitAutogradNestedTensorFunctions_inl.h",
"aten/src/ATen/CompositeViewCopyKernels.cpp",
"aten/src/ATen/FunctionalInverses.h",
"aten/src/ATen/Functions.h",
"aten/src/ATen/Functions.cpp",
"aten/src/ATen/RedispatchFunctions.h",
"aten/src/ATen/Operators.h",
"aten/src/ATen/Operators_0.cpp",
"aten/src/ATen/Operators_1.cpp",
"aten/src/ATen/Operators_2.cpp",
"aten/src/ATen/Operators_3.cpp",
"aten/src/ATen/Operators_4.cpp",
"aten/src/ATen/NativeFunctions.h",
"aten/src/ATen/MetaFunctions.h",
"aten/src/ATen/MetaFunctions_inl.h",
"aten/src/ATen/MethodOperators.h",
"aten/src/ATen/NativeMetaFunctions.h",
"aten/src/ATen/RegistrationDeclarations.h",
"aten/src/ATen/VmapGeneratedPlumbing.h",
"aten/src/ATen/core/aten_interned_strings.h",
"aten/src/ATen/core/enum_tag.h",
"aten/src/ATen/core/TensorBody.h",
"aten/src/ATen/core/TensorMethods.cpp",
"aten/src/ATen/core/ATenOpList.cpp",
]
generated_cuda_cpp = [
"aten/src/ATen/CUDAFunctions.h",
"aten/src/ATen/CUDAFunctions_inl.h",
"aten/src/ATen/RegisterCUDA.cpp",
"aten/src/ATen/RegisterNestedTensorCUDA.cpp",
"aten/src/ATen/RegisterQuantizedCUDA.cpp",
"aten/src/ATen/RegisterSparseCUDA.cpp",
"aten/src/ATen/RegisterSparseCsrCUDA.cpp",
]
generate_aten(
name = "generated_aten_cpp",
srcs = aten_generation_srcs,
outs = (
generated_cpu_cpp +
generated_cuda_cpp +
aten_ufunc_generated_cpu_sources("aten/src/ATen/{}") +
aten_ufunc_generated_cpu_kernel_sources("aten/src/ATen/{}") +
aten_ufunc_generated_cuda_sources("aten/src/ATen/{}") + [
"aten/src/ATen/Declarations.yaml",
]
),
generator = "//torchgen:gen",
)
filegroup(
name = "cpp_generated_code",
srcs = GENERATED_AUTOGRAD_CPP,
data = [":generate-code"],
)
exports_files(
srcs = ["aten/src/ATen/cpu/tbb/extra/version_string.ver.in"],
)
# ATen
filegroup(
name = "aten_base_cpp",
srcs = glob([
"aten/src/ATen/*.cpp",
"aten/src/ATen/functorch/*.cpp",
"aten/src/ATen/detail/*.cpp",
"aten/src/ATen/cpu/*.cpp",
]),
)
filegroup(
name = "ATen_CORE_SRCS",
srcs = glob(
[
"aten/src/ATen/core/**/*.cpp",
],
exclude = [
"aten/src/ATen/core/**/*_test.cpp",
],
),
)
filegroup(
name = "aten_native_cpp",
srcs = glob(["aten/src/ATen/native/*.cpp"]),
)
filegroup(
name = "aten_native_sparse_cpp",
srcs = glob(["aten/src/ATen/native/sparse/*.cpp"]),
)
filegroup(
name = "aten_native_nested_cpp",
srcs = glob(["aten/src/ATen/native/nested/*.cpp"]),
)
filegroup(
name = "aten_native_quantized_cpp",
srcs = glob(
[
"aten/src/ATen/native/quantized/*.cpp",
"aten/src/ATen/native/quantized/cpu/*.cpp",
],
),
)
filegroup(
name = "aten_native_transformers_cpp",
srcs = glob(["aten/src/ATen/native/transformers/*.cpp"]),
)
filegroup(
name = "aten_native_mkl_cpp",
srcs = glob([
"aten/src/ATen/native/mkl/*.cpp",
"aten/src/ATen/mkl/*.cpp",
]),
)
filegroup(
name = "aten_native_mkldnn_cpp",
srcs = glob(["aten/src/ATen/native/mkldnn/*.cpp"]),
)
filegroup(
name = "aten_native_xnnpack",
srcs = glob(["aten/src/ATen/native/xnnpack/*.cpp"]),
)
filegroup(
name = "aten_base_vulkan",
srcs = glob(["aten/src/ATen/vulkan/*.cpp"]),
)
filegroup(
name = "aten_base_metal",
srcs = glob(["aten/src/ATen/metal/*.cpp"]),
)
filegroup(
name = "ATen_QUANTIZED_SRCS",
srcs = glob(
[
"aten/src/ATen/quantized/**/*.cpp",
],
exclude = [
"aten/src/ATen/quantized/**/*_test.cpp",
],
),
)
filegroup(
name = "aten_cuda_cpp_srcs",
srcs = glob(
[
"aten/src/ATen/cuda/*.cpp",
"aten/src/ATen/cuda/detail/*.cpp",
"aten/src/ATen/cudnn/*.cpp",
"aten/src/ATen/native/cuda/*.cpp",
"aten/src/ATen/native/cuda/linalg/*.cpp",
"aten/src/ATen/native/cudnn/*.cpp",
"aten/src/ATen/native/miopen/*.cpp",
"aten/src/ATen/native/nested/cuda/*.cpp",
"aten/src/ATen/native/quantized/cuda/*.cpp",
"aten/src/ATen/native/quantized/cudnn/*.cpp",
"aten/src/ATen/native/sparse/cuda/*.cpp",
"aten/src/ATen/native/transformers/cuda/*.cpp",
],
),
)
filegroup(
name = "aten_cu_srcs",
srcs = glob([
"aten/src/ATen/cuda/*.cu",
"aten/src/ATen/cuda/detail/*.cu",
"aten/src/ATen/native/cuda/*.cu",
"aten/src/ATen/native/nested/cuda/*.cu",
"aten/src/ATen/native/quantized/cuda/*.cu",
"aten/src/ATen/native/sparse/cuda/*.cu",
"aten/src/ATen/native/transformers/cuda/*.cu",
]) + aten_ufunc_generated_cuda_sources("aten/src/ATen/{}"),
# It's a bit puzzling to me why it's not necessary to declare the
# target that generates these sources...
)
header_template_rule(
name = "aten_src_ATen_config",
src = "aten/src/ATen/Config.h.in",
out = "aten/src/ATen/Config.h",
include = "aten/src",
substitutions = {
"@AT_MKLDNN_ENABLED@": "1",
"@AT_MKLDNN_ACL_ENABLED@": "0",
"@AT_MKL_ENABLED@": "1",
"@AT_MKL_SEQUENTIAL@": "0",
"@AT_FFTW_ENABLED@": "0",
"@AT_POCKETFFT_ENABLED@": "0",
"@AT_NNPACK_ENABLED@": "0",
"@CAFFE2_STATIC_LINK_CUDA_INT@": "0",
"@AT_BUILD_WITH_BLAS@": "1",
"@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",
},
)
header_template_rule(
name = "aten_src_ATen_cuda_config",
src = "aten/src/ATen/cuda/CUDAConfig.h.in",
out = "aten/src/ATen/cuda/CUDAConfig.h",
include = "aten/src",
substitutions = {
"@AT_CUDNN_ENABLED@": "1",
"@AT_CUSPARSELT_ENABLED@": "0",
"@AT_ROCM_ENABLED@": "0",
"@AT_MAGMA_ENABLED@": "0",
"@NVCC_FLAGS_EXTRA@": "",
},
)
cc_library(
name = "aten_headers",
hdrs = [
"torch/csrc/Export.h",
"torch/csrc/jit/frontend/function_schema_parser.h",
] + glob(
[
"aten/src/**/*.h",
"aten/src/**/*.hpp",
"aten/src/ATen/cuda/**/*.cuh",
"aten/src/ATen/native/**/*.cuh",
"aten/src/THC/*.cuh",
],
) + [
":aten_src_ATen_config",
":generated_aten_cpp",
],
includes = [
"aten/src",
],
deps = [
"//c10",
],
)
ATEN_COPTS = COMMON_COPTS + [
"-DCAFFE2_BUILD_MAIN_LIBS",
"-DHAVE_AVX_CPU_DEFINITION",
"-DHAVE_AVX2_CPU_DEFINITION",
"-fvisibility-inlines-hidden",
"-fno-math-errno",
"-fno-trapping-math",
]
intern_build_aten_ops(
copts = ATEN_COPTS,
extra_impls = aten_ufunc_generated_cpu_kernel_sources("aten/src/ATen/{}"),
deps = [
":aten_headers",
"@fbgemm",
"@mkl",
"@sleef",
],
)
cc_library(
name = "aten",
srcs = [
":ATen_CORE_SRCS",
":ATen_QUANTIZED_SRCS",
":aten_base_cpp",
":aten_base_metal",
":aten_base_vulkan",
":aten_native_cpp",
":aten_native_mkl_cpp",
":aten_native_mkldnn_cpp",
":aten_native_nested_cpp",
":aten_native_quantized_cpp",
":aten_native_sparse_cpp",
":aten_native_transformers_cpp",
":aten_native_xnnpack",
":aten_src_ATen_config",
] + generated_cpu_cpp + aten_ufunc_generated_cpu_sources("aten/src/ATen/{}"),
copts = ATEN_COPTS,
data = if_cuda(
[":libcaffe2_nvrtc.so"],
[],
),
visibility = ["//visibility:public"],
deps = [
":ATen_CPU",
":aten_headers",
":caffe2_for_aten_headers",
":torch_headers",
"@fbgemm",
"@ideep",
],
alwayslink = True,
)
cc_library(
name = "aten_nvrtc",
srcs = glob([
"aten/src/ATen/cuda/nvrtc_stub/*.cpp",
]),
copts = ATEN_COPTS,
linkstatic = True,
visibility = ["//visibility:public"],
deps = [
":aten_headers",
"//c10",
"@cuda",
"@cuda//:cuda_driver",
"@cuda//:nvrtc",
],
alwayslink = True,
)
cc_binary(
name = "libcaffe2_nvrtc.so",
linkshared = True,
visibility = ["//visibility:public"],
deps = [
":aten_nvrtc",
],
)
cc_library(
name = "aten_cuda_cpp",
srcs = [":aten_cuda_cpp_srcs"] + generated_cuda_cpp,
hdrs = [":aten_src_ATen_cuda_config"],
copts = ATEN_COPTS,
visibility = ["//visibility:public"],
deps = [
":aten",
"@cuda",
"@cuda//:cusolver",
"@cuda//:nvrtc",
"@cudnn",
],
alwayslink = True,
)
torch_cuda_half_options = [
"-DCUDA_HAS_FP16=1",
"-D__CUDA_NO_HALF_OPERATORS__",
"-D__CUDA_NO_HALF_CONVERSIONS__",
"-D__CUDA_NO_BFLOAT16_CONVERSIONS__",
"-D__CUDA_NO_HALF2_OPERATORS__",
]
cu_library(
name = "aten_cuda",
srcs = [":aten_cu_srcs"],
copts = ATEN_COPTS + torch_cuda_half_options,
visibility = ["//visibility:public"],
deps = [
":aten_cuda_cpp",
"//c10/util:bit_cast",
"@cuda//:cublas",
"@cuda//:cufft",
"@cuda//:cusparse",
"@cutlass",
],
alwayslink = True,
)
# caffe2
CAFFE2_COPTS = COMMON_COPTS + [
"-Dcaffe2_EXPORTS",
"-DCAFFE2_USE_GLOO",
"-DCAFFE2_USE_CUDNN",
"-DCAFFE2_BUILD_MAIN_LIB",
"-fvisibility-inlines-hidden",
"-fno-math-errno",
"-fno-trapping-math",
]
filegroup(
name = "caffe2_contrib_srcs",
srcs = [
"caffe2/contrib/aten/aten_op.cc",
"caffe2/contrib/gloo/allgather_ops.cc",
"caffe2/contrib/gloo/allreduce_ops.cc",
"caffe2/contrib/gloo/barrier_ops.cc",
"caffe2/contrib/gloo/broadcast_ops.cc",
"caffe2/contrib/gloo/common.cc",
"caffe2/contrib/gloo/common_world_ops.cc",
"caffe2/contrib/gloo/context.cc",
"caffe2/contrib/gloo/reduce_scatter_ops.cc",
"caffe2/contrib/gloo/store_handler.cc",
],
)
filegroup(
name = "caffe2_core_srcs",
srcs = [
"caffe2/core/allocator.cc",
"caffe2/core/blob_serialization.cc",
"caffe2/core/blob_stats.cc",
"caffe2/core/common.cc",
"caffe2/core/context.cc",
"caffe2/core/context_base.cc",
"caffe2/core/db.cc",
"caffe2/core/event.cc",
"caffe2/core/export_c10_op_to_caffe2.cc",
"caffe2/core/graph.cc",
"caffe2/core/init.cc",
"caffe2/core/init_denormals.cc",
"caffe2/core/init_intrinsics_check.cc",
"caffe2/core/init_omp.cc",
"caffe2/core/int8_serialization.cc",
"caffe2/core/memonger.cc",
"caffe2/core/module.cc",
"caffe2/core/net.cc",
"caffe2/core/net_async_base.cc",
"caffe2/core/net_async_scheduling.cc",
"caffe2/core/net_async_task.cc",
"caffe2/core/net_async_task_future.cc",
"caffe2/core/net_async_task_graph.cc",
"caffe2/core/net_async_tracing.cc",
"caffe2/core/net_dag_utils.cc",
"caffe2/core/net_parallel.cc",
"caffe2/core/net_simple.cc",
"caffe2/core/net_simple_refcount.cc",
"caffe2/core/nomnigraph/Representations/NeuralNet.cc",
"caffe2/core/nomnigraph/tests/test_util.cc",
"caffe2/core/numa.cc",
"caffe2/core/operator.cc",
"caffe2/core/operator_schema.cc",
"caffe2/core/plan_executor.cc",
"caffe2/core/prof_dag_counters.cc",
"caffe2/core/qtensor.cc",
"caffe2/core/qtensor_serialization.cc",
"caffe2/core/stats.cc",
"caffe2/core/tensor.cc",
"caffe2/core/tensor_int8.cc",
"caffe2/core/test_utils.cc",
"caffe2/core/transform.cc",
"caffe2/core/types.cc",
"caffe2/core/workspace.cc",
],
)
filegroup(
name = "caffe2_distributed_srcs",
srcs = [
"caffe2/distributed/file_store_handler.cc",
"caffe2/distributed/file_store_handler_op.cc",
"caffe2/distributed/store_handler.cc",
"caffe2/distributed/store_ops.cc",
],
)
filegroup(
name = "caffe2_ideep_srcs",
srcs = [
"caffe2/ideep/operators/adam_op.cc",
"caffe2/ideep/operators/channel_shuffle_op.cc",
"caffe2/ideep/operators/concat_split_op.cc",
"caffe2/ideep/operators/conv_op.cc",
"caffe2/ideep/operators/conv_transpose_op.cc",
"caffe2/ideep/operators/dropout_op.cc",
"caffe2/ideep/operators/elementwise_sum_op.cc",
"caffe2/ideep/operators/expand_squeeze_dims_op.cc",
"caffe2/ideep/operators/fully_connected_op.cc",
"caffe2/ideep/operators/local_response_normalization_op.cc",
"caffe2/ideep/operators/momentum_sgd_op.cc",
"caffe2/ideep/operators/operator_fallback_ideep.cc",
"caffe2/ideep/operators/order_switch_ops.cc",
"caffe2/ideep/operators/pool_op.cc",
"caffe2/ideep/operators/quantization/int8_add_op.cc",
"caffe2/ideep/operators/quantization/int8_conv_op.cc",
"caffe2/ideep/operators/quantization/int8_dequantize_op.cc",
"caffe2/ideep/operators/quantization/int8_fully_connected_op.cc",
"caffe2/ideep/operators/quantization/int8_given_tensor_fill_op.cc",
"caffe2/ideep/operators/quantization/int8_pool_op.cc",
"caffe2/ideep/operators/quantization/int8_quantize_op.cc",
"caffe2/ideep/operators/quantization/int8_relu_op.cc",
"caffe2/ideep/operators/queue_ops.cc",
"caffe2/ideep/operators/relu_op.cc",
"caffe2/ideep/operators/reshape_op.cc",
"caffe2/ideep/operators/shape_op.cc",
"caffe2/ideep/operators/sigmoid_op.cc",
"caffe2/ideep/operators/spatial_batch_norm_op.cc",
"caffe2/ideep/operators/transpose_op.cc",
"caffe2/ideep/operators/utility_ops.cc",
"caffe2/ideep/utils/ideep_register.cc",
],
)
filegroup(
name = "caffe2_onnx_srcs",
srcs = [
"caffe2/onnx/backend.cc",
"caffe2/onnx/backend_rep.cc",
"caffe2/onnx/device.cc",
"caffe2/onnx/helper.cc",
"caffe2/onnx/offline_tensor.cc",
"caffe2/onnx/onnx_exporter.cc",
"caffe2/onnx/onnxifi_graph_info.cc",
"caffe2/onnx/onnxifi_init.cc",
],
)
filegroup(
name = "caffe2_operators_srcs",
srcs = [
"caffe2/operators/abs_op.cc",
"caffe2/operators/accumulate_op.cc",
"caffe2/operators/accuracy_op.cc",
"caffe2/operators/acos_op.cc",
"caffe2/operators/affine_channel_op.cc",
"caffe2/operators/alias_with_name.cc",
"caffe2/operators/apmeter_op.cc",
"caffe2/operators/arg_ops.cc",
"caffe2/operators/asin_op.cc",
"caffe2/operators/assert_op.cc",
"caffe2/operators/atan_op.cc",
"caffe2/operators/atomic_ops.cc",
"caffe2/operators/batch_box_cox_op.cc",
"caffe2/operators/batch_bucketize_op.cc",
"caffe2/operators/batch_gather_ops.cc",
"caffe2/operators/batch_matmul_op.cc",
"caffe2/operators/batch_moments_op.cc",
"caffe2/operators/batch_permutation_op.cc",
"caffe2/operators/batch_sparse_to_dense_op.cc",
"caffe2/operators/bbox_transform_op.cc",
"caffe2/operators/bisect_percentile_op.cc",
"caffe2/operators/boolean_mask_ops.cc",
"caffe2/operators/boolean_unmask_ops.cc",
"caffe2/operators/box_with_nms_limit_op.cc",
"caffe2/operators/bucketize_op.cc",
"caffe2/operators/byte_weight_dequant_op.cc",
"caffe2/operators/cast_op.cc",
"caffe2/operators/cbrt_op.cc",
"caffe2/operators/cc_bmm_bg_op.cc",
"caffe2/operators/ceil_op.cc",
"caffe2/operators/channel_backprop_stats_op.cc",
"caffe2/operators/channel_shuffle_op.cc",
"caffe2/operators/channel_stats_op.cc",
"caffe2/operators/clip_op.cc",
"caffe2/operators/collect_and_distribute_fpn_rpn_proposals_op.cc",
"caffe2/operators/communicator_op.cc",
"caffe2/operators/concat_split_op.cc",
"caffe2/operators/conditional_op.cc",
"caffe2/operators/conv_gradient_op.cc",
"caffe2/operators/conv_op.cc",
"caffe2/operators/conv_op_eigen.cc",
"caffe2/operators/conv_op_shared.cc",
"caffe2/operators/conv_transpose_gradient_op.cc",
"caffe2/operators/conv_transpose_op.cc",
"caffe2/operators/conv_transpose_op_mobile.cc",
"caffe2/operators/copy_op.cc",
"caffe2/operators/copy_rows_to_tensor_op.cc",
"caffe2/operators/cos_op.cc",
"caffe2/operators/cosh_op.cc",
"caffe2/operators/cosine_embedding_criterion_op.cc",
"caffe2/operators/counter_ops.cc",
"caffe2/operators/crash_op.cc",
"caffe2/operators/create_scope_op.cc",
"caffe2/operators/crf_viterbi_op.cc",
"caffe2/operators/cross_entropy_op.cc",
"caffe2/operators/ctc_beam_search_decoder_op.cc",
"caffe2/operators/ctc_greedy_decoder_op.cc",
"caffe2/operators/cube_op.cc",
"caffe2/operators/data_couple.cc",
"caffe2/operators/dataset_ops.cc",
"caffe2/operators/deform_conv_gradient_op.cc",
"caffe2/operators/deform_conv_op.cc",
"caffe2/operators/dense_vector_to_id_list_op.cc",
"caffe2/operators/distance_op.cc",
"caffe2/operators/do_op.cc",
"caffe2/operators/dropout_op.cc",
"caffe2/operators/elementwise_add_gradient_op.cc",
"caffe2/operators/elementwise_add_op.cc",
"caffe2/operators/elementwise_div_gradient_op.cc",
"caffe2/operators/elementwise_div_op.cc",
"caffe2/operators/elementwise_linear_op.cc",
"caffe2/operators/elementwise_logical_ops.cc",
"caffe2/operators/elementwise_mul_gradient_op.cc",
"caffe2/operators/elementwise_mul_op.cc",
"caffe2/operators/elementwise_ops.cc",
"caffe2/operators/elementwise_ops_schema.cc",
"caffe2/operators/elementwise_ops_utils.cc",
"caffe2/operators/elementwise_sub_gradient_op.cc",
"caffe2/operators/elementwise_sub_op.cc",
"caffe2/operators/elementwise_sum_op.cc",
"caffe2/operators/elu_op.cc",
"caffe2/operators/enforce_finite_op.cc",
"caffe2/operators/ensure_clipped_op.cc",
"caffe2/operators/ensure_cpu_output_op.cc",
"caffe2/operators/erf_op.cc",
"caffe2/operators/exp_op.cc",
"caffe2/operators/expand_op.cc",
"caffe2/operators/expand_squeeze_dims_op.cc",
"caffe2/operators/fc_inference.cc",
"caffe2/operators/feature_maps_ops.cc",
"caffe2/operators/feed_blob_op.cc",
"caffe2/operators/filler_op.cc",
"caffe2/operators/find_duplicate_elements_op.cc",
"caffe2/operators/find_op.cc",
"caffe2/operators/flatten_op.cc",
"caffe2/operators/flexible_top_k.cc",
"caffe2/operators/floor_op.cc",
"caffe2/operators/free_op.cc",
"caffe2/operators/fully_connected_op.cc",
"caffe2/operators/fused_rowwise_8bit_conversion_ops.cc",
"caffe2/operators/fused_rowwise_random_quantization_ops.cc",
"caffe2/operators/gather_fused_8bit_rowwise_op.cc",
"caffe2/operators/gather_op.cc",
"caffe2/operators/gather_ranges_to_dense_op.cc",
"caffe2/operators/gelu_op.cc",
"caffe2/operators/generate_proposals_op.cc",
"caffe2/operators/given_tensor_byte_string_to_uint8_fill_op.cc",
"caffe2/operators/given_tensor_fill_op.cc",
"caffe2/operators/glu_op.cc",
"caffe2/operators/group_norm_op.cc",
"caffe2/operators/gru_unit_op.cc",
"caffe2/operators/h_softmax_op.cc",
"caffe2/operators/half_float_ops.cc",
"caffe2/operators/hard_sigmoid_op.cc",
"caffe2/operators/heatmap_max_keypoint_op.cc",
"caffe2/operators/if_op.cc",
"caffe2/operators/im2col_op.cc",
"caffe2/operators/index_hash_ops.cc",
"caffe2/operators/index_ops.cc",
"caffe2/operators/inference_lstm_op.cc",
"caffe2/operators/instance_norm_gradient_op.cc",
"caffe2/operators/instance_norm_op.cc",
"caffe2/operators/integral_image_op.cc",
"caffe2/operators/is_empty_op.cc",
"caffe2/operators/jsd_op.cc",
"caffe2/operators/key_split_ops.cc",
"caffe2/operators/last_n_window_collector.cc",
"caffe2/operators/layer_norm_op.cc",
"caffe2/operators/leaky_relu_op.cc",
"caffe2/operators/length_split_op.cc",
"caffe2/operators/lengths_pad_op.cc",
"caffe2/operators/lengths_reducer_fused_8bit_rowwise_ops.cc",
"caffe2/operators/lengths_reducer_ops.cc",
"caffe2/operators/lengths_reducer_rowwise_8bit_ops.cc",
"caffe2/operators/lengths_tile_op.cc",
"caffe2/operators/lengths_top_k_op.cc",
"caffe2/operators/listwise_l2r_op.cc",
"caffe2/operators/load_save_op.cc",
"caffe2/operators/load_save_op_util.cc",
"caffe2/operators/local_response_normalization_op.cc",
"caffe2/operators/locally_connected_op.cc",
"caffe2/operators/locally_connected_op_util.cc",
"caffe2/operators/log_op.cc",
"caffe2/operators/logit_op.cc",
"caffe2/operators/loss_op.cc",
"caffe2/operators/lp_pool_op.cc",
"caffe2/operators/lpnorm_op.cc",
"caffe2/operators/lstm_unit_op.cc",
"caffe2/operators/map_ops.cc",
"caffe2/operators/margin_ranking_criterion_op.cc",
"caffe2/operators/matmul_op.cc",
"caffe2/operators/mean_op.cc",
"caffe2/operators/merge_id_lists_op.cc",
"caffe2/operators/minmax_gradient_ops.cc",
"caffe2/operators/minmax_ops.cc",
"caffe2/operators/mod_op.cc",
"caffe2/operators/moments_op.cc",
"caffe2/operators/multi_class_accuracy_op.cc",
"caffe2/operators/negate_gradient_op.cc",
"caffe2/operators/negative_op.cc",
"caffe2/operators/ngram_ops.cc",
"caffe2/operators/norm_planar_yuv_op.cc",
"caffe2/operators/normalize_l1_op.cc",
"caffe2/operators/normalize_op.cc",
"caffe2/operators/numpy_tile_op.cc",
"caffe2/operators/one_hot_ops.cc",
"caffe2/operators/onnx_while_op.cc",
"caffe2/operators/order_switch_ops.cc",
"caffe2/operators/pack_rnn_sequence_op.cc",
"caffe2/operators/pack_segments.cc",
"caffe2/operators/pad_op.cc",
"caffe2/operators/partition_ops.cc",
"caffe2/operators/percentile_op.cc",
"caffe2/operators/perplexity_op.cc",
"caffe2/operators/piecewise_linear_transform_op.cc",
"caffe2/operators/pool_gradient_op.cc",
"caffe2/operators/pool_op.cc",
"caffe2/operators/pool_op_util.cc",
"caffe2/operators/pow_op.cc",
"caffe2/operators/prelu_op.cc",
"caffe2/operators/prepend_dim_op.cc",
"caffe2/operators/quant_decode_op.cc",
"caffe2/operators/rank_loss_op.cc",
"caffe2/operators/reciprocal_gradient_op.cc",
"caffe2/operators/reciprocal_op.cc",
"caffe2/operators/reduce_front_back_max_ops.cc",
"caffe2/operators/reduce_front_back_mean_ops.cc",
"caffe2/operators/reduce_front_back_sum_ops.cc",
"caffe2/operators/reduce_ops.cc",
"caffe2/operators/reduction_ops.cc",
"caffe2/operators/relu_n_op.cc",
"caffe2/operators/relu_op.cc",
"caffe2/operators/remove_data_blocks_op.cc",
"caffe2/operators/replace_nan_op.cc",
"caffe2/operators/reservoir_sampling.cc",
"caffe2/operators/reshape_op.cc",
"caffe2/operators/resize_3d_op.cc",
"caffe2/operators/resize_op.cc",
"caffe2/operators/reverse_packed_segs_op.cc",
"caffe2/operators/rmac_regions_op.cc",
"caffe2/operators/rnn/recurrent_network_blob_fetcher_op.cc",
"caffe2/operators/rnn/recurrent_network_executor.cc",
"caffe2/operators/rnn/recurrent_network_op.cc",
"caffe2/operators/roi_align_gradient_op.cc",
"caffe2/operators/roi_align_op.cc",
"caffe2/operators/roi_align_rotated_gradient_op.cc",
"caffe2/operators/roi_align_rotated_op.cc",
"caffe2/operators/roi_pool_op.cc",
"caffe2/operators/rowmul_op.cc",
"caffe2/operators/rsqrt_op.cc",
"caffe2/operators/scale_blobs_op.cc",
"caffe2/operators/scale_op.cc",
"caffe2/operators/segment_reduction_op.cc",
"caffe2/operators/selu_op.cc",
"caffe2/operators/sequence_ops.cc",
"caffe2/operators/shape_op.cc",
"caffe2/operators/sigmoid_gradient_op.cc",
"caffe2/operators/sigmoid_op.cc",
"caffe2/operators/sin_op.cc",
"caffe2/operators/sinh_op.cc",
"caffe2/operators/sinusoid_position_encoding_op.cc",
"caffe2/operators/slice_op.cc",
"caffe2/operators/softmax_op.cc",
"caffe2/operators/softmax_utils.cc",
"caffe2/operators/softmax_with_loss_op.cc",
"caffe2/operators/softplus_op.cc",
"caffe2/operators/softsign_op.cc",
"caffe2/operators/space_batch_op.cc",
"caffe2/operators/sparse_dropout_with_replacement_op.cc",
"caffe2/operators/sparse_normalize_op.cc",
"caffe2/operators/sparse_to_dense_mask_op.cc",
"caffe2/operators/sparse_to_dense_op.cc",
"caffe2/operators/spatial_batch_norm_gradient_op.cc",
"caffe2/operators/spatial_batch_norm_op.cc",
"caffe2/operators/spatial_softmax_with_loss_op.cc",
"caffe2/operators/sqr_op.cc",
"caffe2/operators/sqrt_op.cc",
"caffe2/operators/square_root_divide_op.cc",
"caffe2/operators/stats_ops.cc",
"caffe2/operators/stats_put_ops.cc",
"caffe2/operators/stop_gradient.cc",
"caffe2/operators/string_ops.cc",
"caffe2/operators/stump_func_op.cc",
"caffe2/operators/stylizer_ops.cc",
"caffe2/operators/summarize_op.cc",
"caffe2/operators/swish_op.cc",
"caffe2/operators/tan_op.cc",
"caffe2/operators/tanh_gradient_op.cc",
"caffe2/operators/tanh_op.cc",
"caffe2/operators/tensor_protos_db_input.cc",
"caffe2/operators/text_file_reader.cc",
"caffe2/operators/text_file_reader_utils.cc",
"caffe2/operators/thresholded_relu_op.cc",
"caffe2/operators/tile_op.cc",
"caffe2/operators/top_k.cc",
"caffe2/operators/transpose_op.cc",
"caffe2/operators/tt_linear_op.cc",
"caffe2/operators/unique_ops.cc",
"caffe2/operators/upsample_op.cc",
"caffe2/operators/utility_ops.cc",
"caffe2/operators/variable_length_sequence_padding.cc",
"caffe2/operators/weighted_multi_sampling_op.cc",
"caffe2/operators/weighted_sample_op.cc",
"caffe2/operators/while_op.cc",
"caffe2/operators/workspace_ops.cc",
"caffe2/operators/zero_gradient_op.cc",
],
)
filegroup(
name = "caffe2_opt_srcs",
srcs = [
"caffe2/opt/annotations.cc",
"caffe2/opt/backend_cutting.cc",
"caffe2/opt/backend_transformer_base.cc",
"caffe2/opt/bound_shape_inferencer.cc",
"caffe2/opt/converter.cc",
"caffe2/opt/dead_code_elim.cc",
"caffe2/opt/device.cc",
"caffe2/opt/distributed.cc",
"caffe2/opt/distributed_converter.cc",
"caffe2/opt/fusion.cc",
"caffe2/opt/mobile.cc",
"caffe2/opt/onnxifi_op.cc",
"caffe2/opt/onnxifi_transformer.cc",
"caffe2/opt/optimize_ideep.cc",
"caffe2/opt/optimizer.cc",
"caffe2/opt/passes.cc",
"caffe2/opt/shape_info.cc",
"caffe2/opt/tvm_transformer.cc",
],
)
filegroup(
name = "caffe2_perfkernels_srcs",
srcs = [
"caffe2/perfkernels/adagrad.cc",
"caffe2/perfkernels/embedding_lookup.cc",
"caffe2/perfkernels/embedding_lookup_idx.cc",
"caffe2/perfkernels/fused_8bit_rowwise_embedding_lookup.cc",
"caffe2/perfkernels/fused_8bit_rowwise_embedding_lookup_idx.cc",
"caffe2/perfkernels/fused_nbit_rowwise_conversion.cc",
"caffe2/perfkernels/lstm_unit_cpu_common.cc",
"caffe2/perfkernels/math_cpu_base.cc",
"caffe2/perfkernels/typed_axpy.cc",
],
)
filegroup(
name = "caffe2_predictor_srcs",
srcs = [
"caffe2/predictor/emulator/data_filler.cc",
"caffe2/predictor/emulator/data_filler.h",
"caffe2/predictor/predictor.cc",
"caffe2/predictor/predictor_config.cc",
"caffe2/predictor/predictor_utils.cc",
],
)
filegroup(
name = "caffe2_quantization_srcs",
srcs = [
"caffe2/quantization/server/activation_distribution_observer.cc",
"caffe2/quantization/server/batch_matmul_dnnlowp_op.cc",
"caffe2/quantization/server/caffe2_dnnlowp_utils.cc",
"caffe2/quantization/server/channel_shuffle_dnnlowp_op.cc",
"caffe2/quantization/server/concat_dnnlowp_op.cc",
"caffe2/quantization/server/conv_dnnlowp_acc16_op.cc",
"caffe2/quantization/server/conv_dnnlowp_op.cc",
"caffe2/quantization/server/conv_relu_op.cc",
"caffe2/quantization/server/dequantize_dnnlowp_op.cc",
"caffe2/quantization/server/dnnlowp.cc",
"caffe2/quantization/server/dnnlowp_partition.cc",
"caffe2/quantization/server/dynamic_histogram.cc",
"caffe2/quantization/server/elementwise_add_dnnlowp_op.cc",
"caffe2/quantization/server/elementwise_linear_dnnlowp_op.cc",
"caffe2/quantization/server/elementwise_mul_dnnlowp_op.cc",
"caffe2/quantization/server/elementwise_sum_dnnlowp_op.cc",
"caffe2/quantization/server/elementwise_sum_relu_op.cc",
"caffe2/quantization/server/fbgemm_pack_matrix_cache.cc",
"caffe2/quantization/server/fbgemm_pack_op.cc",
"caffe2/quantization/server/fully_connected_dnnlowp_acc16_op.cc",
"caffe2/quantization/server/fully_connected_dnnlowp_op.cc",
"caffe2/quantization/server/fully_connected_fake_lowp_op.cc",
"caffe2/quantization/server/group_norm_dnnlowp_op.cc",
"caffe2/quantization/server/int8_gen_quant_params.cc",
"caffe2/quantization/server/kl_minimization.cc",
"caffe2/quantization/server/lstm_unit_dnnlowp_op.cc",
"caffe2/quantization/server/norm_minimization.cc",
"caffe2/quantization/server/p99.cc",
"caffe2/quantization/server/pool_dnnlowp_op.cc",
"caffe2/quantization/server/quantize_dnnlowp_op.cc",
"caffe2/quantization/server/relu_dnnlowp_op.cc",
"caffe2/quantization/server/sigmoid.cc",
"caffe2/quantization/server/sigmoid_dnnlowp_op.cc",
"caffe2/quantization/server/spatial_batch_norm_dnnlowp_op.cc",
"caffe2/quantization/server/tanh.cc",
"caffe2/quantization/server/tanh_dnnlowp_op.cc",
"caffe2/quantization/server/utility_dnnlowp_ops.cc",
],
)
filegroup(
name = "caffe2_queue_srcs",
srcs = [
"caffe2/queue/blobs_queue.cc",
"caffe2/queue/blobs_queue_db.cc",
"caffe2/queue/queue_ops.cc",
"caffe2/queue/rebatching_queue.cc",
"caffe2/queue/rebatching_queue_ops.cc",
],
)
filegroup(
name = "caffe2_serialize_srcs",
srcs = [
"caffe2/serialize/file_adapter.cc",
"caffe2/serialize/inline_container.cc",
"caffe2/serialize/istream_adapter.cc",
"caffe2/serialize/read_adapter_interface.cc",
],
)
filegroup(
name = "caffe2_sgd_srcs",
srcs = [
"caffe2/sgd/adadelta_op.cc",
"caffe2/sgd/adagrad_op.cc",
"caffe2/sgd/adam_op.cc",
"caffe2/sgd/clip_tensor_op.cc",
"caffe2/sgd/ftrl_op.cc",
"caffe2/sgd/gftrl_op.cc",
"caffe2/sgd/iter_op.cc",
"caffe2/sgd/lars_op.cc",
"caffe2/sgd/learning_rate_adaption_op.cc",
"caffe2/sgd/learning_rate_op.cc",
"caffe2/sgd/momentum_sgd_op.cc",
"caffe2/sgd/rmsprop_op.cc",
"caffe2/sgd/wngrad_op.cc",
"caffe2/sgd/yellowfin_op.cc",
],
)
filegroup(
name = "caffe2_transforms_srcs",
srcs = [
"caffe2/transforms/common_subexpression_elimination.cc",
"caffe2/transforms/conv_to_nnpack_transform.cc",
"caffe2/transforms/pattern_net_transform.cc",
"caffe2/transforms/single_op_transform.cc",
],
)
filegroup(
name = "caffe2_utils_srcs",
srcs = [
"caffe2/utils/bench_utils.cc",
"caffe2/utils/cpuid.cc",
"caffe2/utils/math/broadcast.cc",
"caffe2/utils/math/elementwise.cc",
"caffe2/utils/math/reduce.cc",
"caffe2/utils/math/transpose.cc",
"caffe2/utils/math/utils.cc",
"caffe2/utils/math_cpu.cc",
"caffe2/utils/murmur_hash3.cc",
"caffe2/utils/proto_utils.cc",
"caffe2/utils/proto_wrap.cc",
"caffe2/utils/signal_handler.cc",
"caffe2/utils/smart_tensor_printer.cc",
"caffe2/utils/string_utils.cc",
"caffe2/utils/threadpool/ThreadPool.cc",
"caffe2/utils/threadpool/pthreadpool.cc",
"caffe2/utils/threadpool/pthreadpool_impl.cc",
"caffe2/utils/threadpool/thread_pool_guard.cpp",
],
)
filegroup(
name = "caffe2_cuda_cpp_srcs",
srcs = [
"caffe2/contrib/aten/aten_op_gpu.cc",
"caffe2/contrib/gloo/allreduce_ops_gpu.cc",
"caffe2/contrib/gloo/broadcast_ops_gpu.cc",
"caffe2/contrib/gloo/common_world_ops_gpu.cc",
"caffe2/core/blob_serialization_gpu.cc",
"caffe2/core/common_cudnn.cc",
"caffe2/core/common_gpu.cc",
"caffe2/core/event_gpu.cc",
"caffe2/db/create_db_op_gpu.cc",
"caffe2/distributed/file_store_handler_op_gpu.cc",
"caffe2/operators/communicator_op_gpu.cc",
"caffe2/operators/concat_split_op_gpu.cc",
"caffe2/operators/conv_op_cache_cudnn.cc",
"caffe2/operators/conv_op_cudnn.cc",
"caffe2/operators/conv_op_gpu.cc",
"caffe2/operators/conv_op_shared_gpu.cc",
"caffe2/operators/conv_transpose_op_cudnn.cc",
"caffe2/operators/conv_transpose_op_gpu.cc",
"caffe2/operators/counter_ops_gpu.cc",
"caffe2/operators/do_op_gpu.cc",
"caffe2/operators/dropout_op_cudnn.cc",
"caffe2/operators/elementwise_add_op_gpu.cc",
"caffe2/operators/elementwise_sub_op_gpu.cc",
"caffe2/operators/elu_op_cudnn.cc",
"caffe2/operators/exp_op_gpu.cc",
"caffe2/operators/expand_op_gpu.cc",
"caffe2/operators/expand_squeeze_dims_op_gpu.cc",
"caffe2/operators/free_op_gpu.cc",
"caffe2/operators/fully_connected_op_gpu.cc",
"caffe2/operators/if_op_gpu.cc",
"caffe2/operators/im2col_op_gpu.cc",
"caffe2/operators/load_save_op_gpu.cc",
"caffe2/operators/local_response_normalization_op_cudnn.cc",
"caffe2/operators/locally_connected_op_gpu.cc",
"caffe2/operators/log_op_gpu.cc",
"caffe2/operators/matmul_op_gpu.cc",
"caffe2/operators/negate_gradient_op_gpu.cc",
"caffe2/operators/negative_op_gpu.cc",
"caffe2/operators/order_switch_ops_cudnn.cc",
"caffe2/operators/order_switch_ops_gpu.cc",
"caffe2/operators/pool_op_cudnn.cc",
"caffe2/operators/prepend_dim_op_gpu.cc",
"caffe2/operators/reshape_op_gpu.cc",
"caffe2/operators/rnn/recurrent_network_blob_fetcher_op_gpu.cc",
"caffe2/operators/rnn/recurrent_network_executor_gpu.cc",
"caffe2/operators/rnn/recurrent_op_cudnn.cc",
"caffe2/operators/scale_op_gpu.cc",
"caffe2/operators/shape_op_gpu.cc",
"caffe2/operators/sigmoid_op_cudnn.cc",
"caffe2/operators/softmax_op_cudnn.cc",
"caffe2/operators/sqr_op_gpu.cc",
"caffe2/operators/sqrt_op_gpu.cc",
"caffe2/operators/stop_gradient_gpu.cc",
"caffe2/operators/tanh_op_cudnn.cc",
"caffe2/operators/tensor_protos_db_input_gpu.cc",
"caffe2/operators/transpose_op_cudnn.cc",
"caffe2/operators/while_op_gpu.cc",
"caffe2/operators/zero_gradient_op_gpu.cc",
"caffe2/queue/queue_ops_gpu.cc",
"caffe2/sgd/iter_op_gpu.cc",
"caffe2/sgd/learning_rate_op_gpu.cc",
],
)
filegroup(
name = "caffe2_cu_srcs",
srcs = [
"caffe2/core/context_gpu.cu",
"caffe2/operators/abs_op.cu",
"caffe2/operators/accumulate_op.cu",
"caffe2/operators/accuracy_op.cu",
"caffe2/operators/acos_op.cu",
"caffe2/operators/affine_channel_op.cu",
"caffe2/operators/alias_with_name.cu",
"caffe2/operators/arg_ops.cu",
"caffe2/operators/asin_op.cu",
"caffe2/operators/assert_op.cu",
"caffe2/operators/atan_op.cu",
"caffe2/operators/batch_gather_ops.cu",
"caffe2/operators/batch_matmul_op.cu",
"caffe2/operators/batch_moments_op.cu",
"caffe2/operators/batch_permutation_op.cu",
"caffe2/operators/batch_sparse_to_dense_op.cu",
"caffe2/operators/boolean_mask_ops.cu",
"caffe2/operators/boolean_unmask_ops.cu",
"caffe2/operators/bucketize_op.cu",
"caffe2/operators/cast_op.cu",
"caffe2/operators/cbrt_op.cu",
"caffe2/operators/ceil_op.cu",
"caffe2/operators/channel_backprop_stats_op.cu",
"caffe2/operators/channel_shuffle_op.cu",
"caffe2/operators/channel_stats_op.cu",
"caffe2/operators/channelwise_conv3d_op_cudnn.cu",
"caffe2/operators/clip_op.cu",
"caffe2/operators/copy_op.cu",
"caffe2/operators/cos_op.cu",
"caffe2/operators/cosh_op.cu",
"caffe2/operators/cosine_embedding_criterion_op.cu",
"caffe2/operators/cross_entropy_op.cu",
"caffe2/operators/cube_op.cu",
"caffe2/operators/data_couple_gpu.cu",
"caffe2/operators/deform_conv_op.cu",
"caffe2/operators/depthwise_3x3_conv_op_cudnn.cu",
"caffe2/operators/distance_op.cu",
"caffe2/operators/dropout_op.cu",
"caffe2/operators/elementwise_div_op.cu",
"caffe2/operators/elementwise_linear_op.cu",
"caffe2/operators/elementwise_mul_op.cu",
"caffe2/operators/elementwise_ops.cu",
"caffe2/operators/elu_op.cu",
"caffe2/operators/enforce_finite_op.cu",
"caffe2/operators/ensure_cpu_output_op.cu",
"caffe2/operators/erf_op.cu",
"caffe2/operators/filler_op.cu",
"caffe2/operators/find_op.cu",
"caffe2/operators/floor_op.cu",
"caffe2/operators/gather_op.cu",
"caffe2/operators/gelu_op.cu",
"caffe2/operators/generate_proposals_op.cu",
"caffe2/operators/generate_proposals_op_util_nms_gpu.cu",
"caffe2/operators/given_tensor_byte_string_to_uint8_fill_op.cu",
"caffe2/operators/given_tensor_fill_op.cu",
"caffe2/operators/glu_op.cu",
"caffe2/operators/group_norm_op.cu",
"caffe2/operators/gru_unit_op_gpu.cu",
"caffe2/operators/half_float_ops.cu",
"caffe2/operators/hard_sigmoid_op.cu",
"caffe2/operators/instance_norm_op.cu",
"caffe2/operators/integral_image_op.cu",
"caffe2/operators/layer_norm_op.cu",
"caffe2/operators/leaky_relu_op.cu",
"caffe2/operators/lengths_pad_op.cu",
"caffe2/operators/lengths_tile_op.cu",
"caffe2/operators/local_response_normalization_op.cu",
"caffe2/operators/logit_op.cu",
"caffe2/operators/loss_op.cu",
"caffe2/operators/lp_pool_op.cu",
"caffe2/operators/lstm_unit_op_gpu.cu",
"caffe2/operators/margin_ranking_criterion_op.cu",
"caffe2/operators/max_pool_with_index.cu",
"caffe2/operators/mean_op.cu",
"caffe2/operators/mem_query_op.cu",
"caffe2/operators/minmax_ops.cu",
"caffe2/operators/moments_op.cu",
"caffe2/operators/multi_class_accuracy_op.cu",
"caffe2/operators/normalize_ops.cu",
"caffe2/operators/one_hot_ops.cu",
"caffe2/operators/pack_segments.cu",
"caffe2/operators/pad_op_gpu.cu",
"caffe2/operators/perplexity_op.cu",
"caffe2/operators/piecewise_linear_transform_op.cu",
"caffe2/operators/pool_op.cu",
"caffe2/operators/pow_op.cu",
"caffe2/operators/prelu_op.cu",
"caffe2/operators/reciprocal_op.cu",
"caffe2/operators/reduce_front_back_max_ops.cu",
"caffe2/operators/reduce_front_back_sum_mean_ops.cu",
"caffe2/operators/reduce_ops.cu",
"caffe2/operators/reduction_ops.cu",
"caffe2/operators/relu_n_op.cu",
"caffe2/operators/relu_op.cu",
"caffe2/operators/replace_nan_op.cu",
"caffe2/operators/resize_3d_op.cu",
"caffe2/operators/resize_op.cu",
"caffe2/operators/reverse_packed_segs_op.cu",
"caffe2/operators/rmac_regions_op.cu",
"caffe2/operators/rnn/recurrent_network_op_gpu.cu",
"caffe2/operators/roi_align_gradient_op.cu",
"caffe2/operators/roi_align_op.cu",
"caffe2/operators/roi_align_rotated_gradient_op.cu",
"caffe2/operators/roi_align_rotated_op.cu",
"caffe2/operators/roi_pool_op.cu",
"caffe2/operators/rsqrt_op.cu",
"caffe2/operators/scale_blobs_op.cu",
"caffe2/operators/segment_reduction_op_gpu.cu",
"caffe2/operators/selu_op.cu",
"caffe2/operators/sequence_ops.cu",
"caffe2/operators/sigmoid_op.cu",
"caffe2/operators/sin_op.cu",
"caffe2/operators/sinh_op.cu",
"caffe2/operators/slice_op.cu",
"caffe2/operators/softmax_ops.cu",
"caffe2/operators/softplus_op.cu",
"caffe2/operators/softsign_op.cu",
"caffe2/operators/space_batch_op_gpu.cu",
"caffe2/operators/sparse_normalize_op_gpu.cu",
"caffe2/operators/sparse_to_dense_op.cu",
"caffe2/operators/spatial_batch_norm_op.cu",
"caffe2/operators/spatial_batch_norm_op_cudnn.cu",
"caffe2/operators/stump_func_op.cu",
"caffe2/operators/summarize_op.cu",
"caffe2/operators/swish_op.cu",
"caffe2/operators/tan_op.cu",
"caffe2/operators/tanh_op.cu",
"caffe2/operators/thresholded_relu_op.cu",
"caffe2/operators/tile_op.cu",
"caffe2/operators/top_k.cu",
"caffe2/operators/transpose_op.cu",
"caffe2/operators/unique_ops.cu",
"caffe2/operators/upsample_op.cu",
"caffe2/operators/utility_ops.cu",
"caffe2/operators/weighted_sample_op.cu",
"caffe2/sgd/adadelta_op_gpu.cu",
"caffe2/sgd/adagrad_op_gpu.cu",
"caffe2/sgd/adam_op_gpu.cu",
"caffe2/sgd/fp16_momentum_sgd_op.cu",
"caffe2/sgd/fp32_momentum_sgd_op.cu",
"caffe2/sgd/lars_op_gpu.cu",
"caffe2/sgd/momentum_sgd_op_gpu.cu",
"caffe2/sgd/rmsprop_op_gpu.cu",
"caffe2/sgd/yellowfin_op_gpu.cu",
"caffe2/utils/math/broadcast.cu",
"caffe2/utils/math/elementwise.cu",
"caffe2/utils/math/reduce.cu",
"caffe2/utils/math/transpose.cu",
"caffe2/utils/math_gpu.cu",
],
)
# To achieve finer granularity and make debug easier, caffe2 is split into three libraries:
# ATen, caffe2 and caffe2_for_aten_headers. ATen lib group up source codes under
# aten/ directory and caffe2 contains most files under `caffe2/` directory. Since the
# ATen lib and the caffe2 lib would depend on each other, `caffe2_for_aten_headers` is splitted
# out from `caffe2` to avoid dependency cycle.
cc_library(
name = "caffe2_for_aten_headers",
hdrs = [
"caffe2/core/common.h",
"caffe2/core/logging.h",
"caffe2/core/types.h",
"caffe2/perfkernels/common.h",
"caffe2/perfkernels/embedding_lookup.h",
"caffe2/perfkernels/embedding_lookup_idx.h",
"caffe2/utils/cpuid.h",
"caffe2/utils/fixed_divisor.h",
] + glob([
"caffe2/utils/threadpool/*.h",
]),
copts = CAFFE2_COPTS,
visibility = ["//visibility:public"],
deps = [
":caffe2_core_macros",
"//c10",
"//caffe2/proto:caffe2_pb",
],
)
py_binary(
name = "gen_op",
srcs = ["caffe2/contrib/aten/gen_op.py"],
deps = ["//torchgen"],
)
genrule(
name = "generated_caffe2_aten_op_headers",
srcs = [
"caffe2/contrib/aten/aten_op_template.h",
"aten/src/ATen/Declarations.yaml",
],
outs = ["caffe2/caffe2/contrib/aten/gen_aten_op.h"],
cmd = """
$(location :gen_op) \
--output_prefix gen_ \
--install_dir $(@D) \
--aten_root `dirname $(location aten/src/ATen/Declarations.yaml)`/../.. \
--template_dir `dirname $(location caffe2/contrib/aten/aten_op_template.h)` \
--yaml_dir `dirname $(location aten/src/ATen/Declarations.yaml)`""",
tools = [":gen_op"],
)
cc_library(
name = "caffe2_headers",
hdrs = glob(
[
"caffe2/contrib/aten/*.h",
"caffe2/contrib/gloo/*.h",
"caffe2/core/*.h",
"caffe2/core/nomnigraph/include/nomnigraph/Converters/*.h",
"caffe2/core/nomnigraph/include/nomnigraph/Generated/*.h",
"caffe2/core/nomnigraph/include/nomnigraph/Graph/*.h",
"caffe2/core/nomnigraph/include/nomnigraph/Representations/*.h",
"caffe2/core/nomnigraph/include/nomnigraph/Support/*.h",
"caffe2/core/nomnigraph/include/nomnigraph/Transformations/*.h",
"caffe2/core/nomnigraph/tests/*.h",
"caffe2/db/*.h",
"caffe2/distributed/*.h",
"caffe2/ideep/*.h",
"caffe2/ideep/operators/*.h",
"caffe2/ideep/operators/quantization/*.h",
"caffe2/ideep/utils/*.h",
"caffe2/onnx/*.h",
"caffe2/operators/*.h",
"caffe2/operators/rnn/*.h",
"caffe2/opt/*.h",
"caffe2/perfkernels/*.h",
"caffe2/predictor/*.h",
"caffe2/predictor/emulator/*.h",
"caffe2/quantization/server/*.h",
"caffe2/queue/*.h",
"caffe2/serialize/*.h",
"caffe2/sgd/*.h",
"caffe2/share/contrib/depthwise/*.h",
"caffe2/transforms/*.h",
"caffe2/utils/*.h",
"caffe2/utils/math/*.h",
"caffe2/utils/threadpool/*.h",
"modules/**/*.h",
],
exclude = [
"caffe2/core/macros.h",
],
) + if_cuda(glob([
"caffe2/**/*.cuh",
"caffe2/image/*.h",
])) + [":generated_caffe2_aten_op_headers"],
copts = CAFFE2_COPTS,
includes = [
"caffe2/contrib/aten",
"caffe2/core/nomnigraph/include",
],
visibility = ["//visibility:public"],
deps = [
":caffe2_core_macros",
":caffe2_for_aten_headers",
"//caffe2/proto:caffe2_pb",
"//caffe2/proto:cc_proto",
],
)
cc_library(
name = "caffe2_dnnlowp_avx2_ops",
srcs = [
"caffe2/quantization/server/elementwise_sum_dnnlowp_op_avx2.cc",
"caffe2/quantization/server/fully_connected_fake_lowp_op_avx2.cc",
"caffe2/quantization/server/group_norm_dnnlowp_op_avx2.cc",
"caffe2/quantization/server/norm_minimization_avx2.cc",
"caffe2/quantization/server/pool_dnnlowp_op_avx2.cc",
"caffe2/quantization/server/relu_dnnlowp_op_avx2.cc",
"caffe2/quantization/server/spatial_batch_norm_dnnlowp_op_avx2.cc",
"caffe2/quantization/server/transpose.cc",
],
copts = CAFFE2_COPTS + [
"-mf16c",
"-mavx2",
"-mfma",
"-mxsave",
],
visibility = ["//visibility:public"],
deps = [
":caffe2_headers",
"@fbgemm",
],
alwayslink = True,
)
cc_library(
name = "caffe2",
srcs = [
"caffe2/db/create_db_op.cc",
"caffe2/db/protodb.cc",
"caffe2/share/contrib/depthwise/depthwise3x3_conv_op.cc",
":caffe2_contrib_srcs",
":caffe2_core_srcs",
":caffe2_distributed_srcs",
":caffe2_ideep_srcs",
":caffe2_onnx_srcs",
":caffe2_operators_srcs",
":caffe2_opt_srcs",
":caffe2_perfkernels_srcs",
":caffe2_predictor_srcs",
":caffe2_quantization_srcs",
":caffe2_queue_srcs",
":caffe2_serialize_srcs",
":caffe2_sgd_srcs",
":caffe2_transforms_srcs",
":caffe2_utils_srcs",
],
copts = CAFFE2_COPTS + ["-mf16c"],
linkstatic = 1,
visibility = ["//visibility:public"],
deps = [
":caffe2_core_macros",
":caffe2_dnnlowp_avx2_ops",
":caffe2_headers",
":caffe2_perfkernels_avx",
":caffe2_perfkernels_avx2",
":caffe2_perfkernels_avx512",
"//caffe2/proto:caffe2_pb",
"//caffe2/proto:cc_proto",
"//third_party/miniz-2.1.0:miniz",
"@com_google_protobuf//:protobuf",
"@eigen",
"@fbgemm//:fbgemm_src_headers",
"@fmt",
"@foxi",
"@gloo",
"@onnx",
] + if_cuda(
[
":caffe2_cuda_cpp",
":aten_cuda",
"@tensorpipe//:tensorpipe_cuda",
],
[
":aten",
"@tensorpipe//:tensorpipe_cpu",
],
),
alwayslink = True,
)
cc_library(
name = "caffe2_cuda_cpp",
srcs = [":caffe2_cuda_cpp_srcs"],
copts = CAFFE2_COPTS,
visibility = ["//visibility:public"],
deps = [
":caffe2_cuda",
":caffe2_headers",
],
alwayslink = True,
)
cu_library(
name = "caffe2_cuda",
# one may think that `quantization_gpu.cu` could be a separate kernel,
# however that leads to de-registration problem that's described in
# https://github.com/pytorch/pytorch/issues/79236
# To solve it we add it into the `caffe2_cuda`,
# this is also aligned with the CMake build.
srcs = [":caffe2_cu_srcs"] + ["torch/csrc/distributed/c10d/quantization/quantization_gpu.cu"],
copts = CAFFE2_COPTS + torch_cuda_half_options,
visibility = ["//visibility:public"],
deps = [
":aten",
":caffe2_headers",
"@cuda//:cublas",
"@cuda//:curand",
"@cudnn",
"@eigen",
"@gloo",
"@tensorpipe//:tensorpipe_cuda",
],
alwayslink = True,
)
PERF_COPTS = [
"-DTH_HAVE_THREAD",
"-DHAVE_AVX_CPU_DEFINITION",
"-DHAVE_AVX2_CPU_DEFINITION",
"-DENABLE_ALIAS=1",
"-DHAVE_MALLOC_USABLE_SIZE=1",
"-DHAVE_MMAP=1",
"-DHAVE_SHM_OPEN=1",
"-DHAVE_SHM_UNLINK=1",
"-DSLEEF_STATIC_LIBS=1",
"-DTH_BALS_MKL",
"-D_FILE_OFFSET_BITS=64",
"-DUSE_FBGEMM",
"-fvisibility-inlines-hidden",
"-Wunused-parameter",
"-fno-math-errno",
"-fno-trapping-math",
"-mf16c",
]
PERF_HEADERS = glob([
"caffe2/perfkernels/*.h",
"caffe2/core/*.h",
])
cc_library(
name = "caffe2_perfkernels_avx",
srcs = glob([
"caffe2/perfkernels/*_avx.cc",
]),
hdrs = PERF_HEADERS,
copts = PERF_COPTS + [
"-mavx",
],
visibility = ["//visibility:public"],
deps = [
":caffe2_headers",
"//c10",
],
alwayslink = True,
)
cc_library(
name = "caffe2_perfkernels_avx2",
srcs = glob([
"caffe2/perfkernels/*_avx2.cc",
]),
hdrs = PERF_HEADERS,
copts = PERF_COPTS + [
"-mavx2",
"-mfma",
"-mavx",
],
visibility = ["//visibility:public"],
deps = [
":caffe2_headers",
"//c10",
],
alwayslink = True,
)
cc_library(
name = "caffe2_perfkernels_avx512",
srcs = [
"caffe2/perfkernels/common_avx512.cc",
],
hdrs = PERF_HEADERS,
copts = PERF_COPTS + [
"-mavx512f",
"-mavx512dq",
"-mavx512vl",
"-mavx2",
"-mfma",
"-mavx",
],
visibility = ["//visibility:public"],
deps = [
":caffe2_headers",
"//c10",
],
alwayslink = True,
)
# torch
torch_cuda_headers = glob(["torch/csrc/cuda/*.h"])
cc_library(
name = "torch_headers",
hdrs = if_cuda(
torch_cuda_headers,
) + glob(
[
"torch/*.h",
"torch/csrc/**/*.h",
"torch/csrc/distributed/c10d/*.hpp",
"torch/lib/libshm/*.h",
],
exclude = [
"torch/csrc/*/generated/*.h",
] + torch_cuda_headers,
) + GENERATED_AUTOGRAD_CPP + [":version_h"],
includes = [
"third_party/kineto/libkineto/include",
"torch/csrc",
"torch/csrc/api/include",
"torch/csrc/distributed",
"torch/lib",
"torch/lib/libshm",
],
visibility = ["//visibility:public"],
deps = [
":aten_headers",
":caffe2_headers",
"//c10",
"@com_github_google_flatbuffers//:flatbuffers",
"@local_config_python//:python_headers",
"@onnx",
],
alwayslink = True,
)
TORCH_COPTS = COMMON_COPTS + [
"-Dtorch_EXPORTS",
"-DHAVE_AVX_CPU_DEFINITION",
"-DHAVE_AVX2_CPU_DEFINITION",
"-DCAFFE2_USE_GLOO",
"-fvisibility-inlines-hidden",
"-fno-math-errno ",
"-fno-trapping-math",
"-Wno-error=unused-function",
]
torch_sources = {
k: ""
for k in (
libtorch_core_sources +
libtorch_distributed_sources +
torch_cpp_srcs +
libtorch_extra_sources +
jit_core_sources +
lazy_tensor_ts_sources +
GENERATED_AUTOGRAD_CPP
)
}.keys()
cc_library(
name = "torch",
srcs = if_cuda(glob(
libtorch_cuda_sources,
exclude = [
"torch/csrc/cuda/python_nccl.cpp",
"torch/csrc/cuda/nccl.cpp",
"torch/csrc/distributed/c10d/quantization/quantization_gpu.cu",
],
)) + torch_sources,
copts = TORCH_COPTS,
defines = [
"CAFFE2_NIGHTLY_VERSION=20200115",
],
visibility = ["//visibility:public"],
deps = [
":caffe2",
":torch_headers",
"//caffe2/proto:torch_cc_proto",
"@kineto",
] + if_cuda([
"@cuda//:nvToolsExt",
"@cutlass",
]),
alwayslink = True,
)
cc_library(
name = "shm",
srcs = glob(["torch/lib/libshm/*.cpp"]),
deps = [
":torch",
],
)
cc_library(
name = "libtorch_headers",
hdrs = glob([
"**/*.h",
"**/*.cuh",
]) + [
# We need the filegroup here because the raw list causes Bazel
# to see duplicate files. It knows how to deduplicate with the
# filegroup.
":cpp_generated_code",
],
includes = [
"torch/csrc/api/include",
"torch/csrc/distributed",
"torch/lib",
"torch/lib/libshm",
],
visibility = ["//visibility:public"],
deps = [
":torch_headers",
],
)
cc_library(
name = "torch_python",
srcs = libtorch_python_core_sources
+ if_cuda(libtorch_python_cuda_sources)
+ if_cuda(libtorch_python_distributed_sources)
+ GENERATED_AUTOGRAD_PYTHON,
hdrs = glob([
"torch/csrc/generic/*.cpp",
]),
copts = COMMON_COPTS + if_cuda(["-DUSE_CUDA=1"]),
deps = [
":torch",
":shm",
"@pybind11",
],
)
pybind_extension(
name = "torch/_C",
srcs = ["torch/csrc/stub.c"],
deps = [
":torch_python",
":aten_nvrtc",
],
)
cc_library(
name = "functorch",
hdrs = glob([
"functorch/csrc/dim/*.h",
]),
srcs = glob([
"functorch/csrc/dim/*.cpp",
]),
deps = [
":aten_nvrtc",
":torch_python",
"@pybind11",
],
)
pybind_extension(
name = "functorch/_C",
copts=[
"-DTORCH_EXTENSION_NAME=_C"
],
srcs = [
"functorch/csrc/init_dim_only.cpp",
],
deps = [
":functorch",
":torch_python",
":aten_nvrtc",
],
)
cc_binary(
name = "torch/bin/torch_shm_manager",
srcs = [
"torch/lib/libshm/manager.cpp",
],
deps = [
":shm",
],
linkstatic = False,
)
template_rule(
name = "gen_version_py",
src = ":torch/version.py.tpl",
out = "torch/version.py",
substitutions = if_cuda({
# Set default to 11.2. Otherwise Torchvision complains about incompatibility.
"{{CUDA_VERSION}}": "11.2",
"{{VERSION}}": "2.0.0",
}, {
"{{CUDA_VERSION}}": "None",
"{{VERSION}}": "2.0.0",
}),
)
py_library(
name = "pytorch_py",
visibility = ["//visibility:public"],
srcs = glob(["torch/**/*.py"], exclude = ["torch/version.py"]) + [":torch/version.py"] + glob(["functorch/**/*.py"]),
deps = [
rules.requirement("future"),
rules.requirement("numpy"),
rules.requirement("pyyaml"),
rules.requirement("requests"),
rules.requirement("setuptools"),
rules.requirement("six"),
rules.requirement("sympy"),
rules.requirement("typing_extensions"),
"//torchgen",
],
data = [
":torch/_C.so",
":functorch/_C.so",
":torch/bin/torch_shm_manager",
],
)
# cpp api tests
cc_library(
name = "test_support",
testonly = True,
srcs = [
"test/cpp/api/support.cpp",
],
hdrs = [
"test/cpp/api/init_baseline.h",
"test/cpp/api/optim_baseline.h",
"test/cpp/api/support.h",
"test/cpp/common/support.h",
],
deps = [
":torch",
"@com_google_googletest//:gtest_main",
],
)
# Torch integration tests rely on a labeled data set from the MNIST database.
# http://yann.lecun.com/exdb/mnist/
cpp_api_tests = glob(
["test/cpp/api/*.cpp"],
exclude = [
"test/cpp/api/imethod.cpp",
"test/cpp/api/integration.cpp",
],
)
cc_test(
name = "integration_test",
size = "medium",
srcs = ["test/cpp/api/integration.cpp"],
data = [
":download_mnist",
],
tags = [
"gpu-required",
],
deps = [
":test_support",
"@com_google_googletest//:gtest_main",
],
)
[
cc_test(
name = paths.split_extension(paths.basename(filename))[0].replace("-", "_") + "_test",
size = "medium",
srcs = [filename],
deps = [
":test_support",
"@com_google_googletest//:gtest_main",
],
)
for filename in cpp_api_tests
]
test_suite(
name = "api_tests",
tests = [
"any_test",
"autograd_test",
"dataloader_test",
"enum_test",
"expanding_array_test",
"functional_test",
"init_test",
"integration_test",
"jit_test",
"memory_test",
"misc_test",
"module_test",
"modulelist_test",
"modules_test",
"nn_utils_test",
"optim_test",
"ordered_dict_test",
"rnn_test",
"sequential_test",
"serialize_test",
"static_test",
"tensor_options_test",
"tensor_test",
"torch_include_test",
],
)
# dist autograd tests
cc_test(
name = "torch_dist_autograd_test",
size = "small",
srcs = ["test/cpp/dist_autograd/test_dist_autograd.cpp"],
tags = [
"exclusive",
"gpu-required",
],
deps = [
":torch",
"@com_google_googletest//:gtest_main",
],
)
# jit tests
# Because these individual unit tests require custom registering,
# it is easier to mimic the cmake build by globing together a single test.
cc_test(
name = "jit_tests",
size = "small",
srcs = glob(
[
"test/cpp/jit/*.cpp",
"test/cpp/jit/*.h",
"test/cpp/tensorexpr/*.cpp",
"test/cpp/tensorexpr/*.h",
],
exclude = [
# skip this since <pybind11/embed.h> is not found in OSS build
"test/cpp/jit/test_exception.cpp",
],
),
linkstatic = True,
tags = [
"exclusive",
"gpu-required",
],
deps = [
":torch",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "lazy_tests",
size = "small",
srcs = glob(
[
"test/cpp/lazy/*.cpp",
"test/cpp/lazy/*.h",
],
exclude = [
# skip these since they depend on generated LazyIr.h which isn't available in bazel yet
"test/cpp/lazy/test_ir.cpp",
"test/cpp/lazy/test_lazy_ops.cpp",
"test/cpp/lazy/test_lazy_ops_util.cpp",
],
),
linkstatic = True,
tags = [
"exclusive",
],
deps = [
":torch",
"@com_google_googletest//:gtest_main",
],
)
# python api tests
py_test(
name = "test_bazel",
srcs = ["test/_test_bazel.py"],
main = "test/_test_bazel.py",
deps = [":pytorch_py"],
)
# all tests
test_suite(
name = "all_tests",
tests = [
"api_tests",
"jit_tests",
"torch_dist_autograd_test",
"//c10/test:tests",
],
)
# An internal genrule that we are converging with refers to these file
# as if they are from this package, so we alias them for
# compatibility.
[
alias(
name = paths.basename(path),
actual = path,
)
for path in [
"aten/src/ATen/templates/DispatchKeyNativeFunctions.cpp",
"aten/src/ATen/templates/DispatchKeyNativeFunctions.h",
"aten/src/ATen/templates/LazyIr.h",
"aten/src/ATen/templates/LazyNonNativeIr.h",
"aten/src/ATen/templates/RegisterDispatchKey.cpp",
"aten/src/ATen/templates/RegisterDispatchDefinitions.ini",
"aten/src/ATen/native/native_functions.yaml",
"aten/src/ATen/native/tags.yaml",
"aten/src/ATen/native/ts_native_functions.yaml",
"torch/csrc/lazy/core/shape_inference.h",
"torch/csrc/lazy/ts_backend/ts_native_functions.cpp",
]
]
genrule(
name = "download_mnist",
srcs = ["//:tools/download_mnist.py"],
outs = [
"mnist/train-images-idx3-ubyte",
"mnist/train-labels-idx1-ubyte",
"mnist/t10k-images-idx3-ubyte",
"mnist/t10k-labels-idx1-ubyte",
],
cmd = "python3 tools/download_mnist.py -d $(RULEDIR)/mnist",
)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化