From 475d0b4d9a1cced5fc035d31654766a857bb983a Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Wed, 1 Jan 2025 17:26:34 -0500 Subject: [PATCH] Revert "Modularize Bazel build (#421)" This reverts commit 9375f57693db15ee355725a76d69673a0cfbf2a1. --- deps/ReactantExtra/{src => }/API.cpp | 0 deps/ReactantExtra/BUILD | 371 +++++++++--------- deps/ReactantExtra/WORKSPACE | 183 ++++++--- deps/ReactantExtra/third_party/BUILD | 1 - .../third_party/build_bazel_rules_apple/BUILD | 0 .../build_bazel_rules_apple/workspace.bzl | 10 - deps/ReactantExtra/third_party/enzyme/BUILD | 0 .../third_party/enzyme/workspace.bzl | 12 - .../ReactantExtra/third_party/enzyme_ad/BUILD | 0 .../third_party/enzyme_ad/workspace.bzl | 12 - deps/ReactantExtra/third_party/jax/BUILD | 0 .../third_party/jax/workspace.bzl | 14 - deps/ReactantExtra/third_party/nsync/BUILD | 0 .../third_party/nsync/workspace.bzl | 12 - deps/ReactantExtra/third_party/rules_cc/BUILD | 0 .../third_party/rules_cc/workspace.bzl | 14 - .../third_party/rules_python/BUILD | 0 .../third_party/rules_python/workspace.bzl | 12 - deps/ReactantExtra/third_party/upb/BUILD | 0 .../third_party/upb/workspace.bzl | 16 - deps/ReactantExtra/third_party/xla/BUILD | 0 .../third_party/xla/workspace.bzl | 26 -- .../BUILD => toolchain/yggdrasil.bzl} | 0 deps/ReactantExtra/tools/platforms.bzl | 31 -- deps/ReactantExtra/workspace.bzl | 14 - deps/clang | 2 + deps/clang++ | 2 + deps/gcc | 3 + 28 files changed, 338 insertions(+), 397 deletions(-) rename deps/ReactantExtra/{src => }/API.cpp (100%) delete mode 100644 deps/ReactantExtra/third_party/BUILD delete mode 100644 deps/ReactantExtra/third_party/build_bazel_rules_apple/BUILD delete mode 100644 deps/ReactantExtra/third_party/build_bazel_rules_apple/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/enzyme/BUILD delete mode 100644 deps/ReactantExtra/third_party/enzyme/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/enzyme_ad/BUILD delete mode 100644 deps/ReactantExtra/third_party/enzyme_ad/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/jax/BUILD delete mode 100644 deps/ReactantExtra/third_party/jax/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/nsync/BUILD delete mode 100644 deps/ReactantExtra/third_party/nsync/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/rules_cc/BUILD delete mode 100644 deps/ReactantExtra/third_party/rules_cc/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/rules_python/BUILD delete mode 100644 deps/ReactantExtra/third_party/rules_python/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/upb/BUILD delete mode 100644 deps/ReactantExtra/third_party/upb/workspace.bzl delete mode 100644 deps/ReactantExtra/third_party/xla/BUILD delete mode 100644 deps/ReactantExtra/third_party/xla/workspace.bzl rename deps/ReactantExtra/{tools/toolchains/yggdrasil/BUILD => toolchain/yggdrasil.bzl} (100%) delete mode 100644 deps/ReactantExtra/tools/platforms.bzl delete mode 100644 deps/ReactantExtra/workspace.bzl create mode 100755 deps/clang create mode 100755 deps/clang++ create mode 100755 deps/gcc diff --git a/deps/ReactantExtra/src/API.cpp b/deps/ReactantExtra/API.cpp similarity index 100% rename from deps/ReactantExtra/src/API.cpp rename to deps/ReactantExtra/API.cpp diff --git a/deps/ReactantExtra/BUILD b/deps/ReactantExtra/BUILD index 92074fb10..781548809 100644 --- a/deps/ReactantExtra/BUILD +++ b/deps/ReactantExtra/BUILD @@ -1,10 +1,10 @@ -load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library") -load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm") +load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") load("@xla//tools/toolchains/cross_compile/cc:cc_toolchain_config.bzl", "cc_toolchain_config") - # load("//toolchain:yggdrasil.bzl", "ygg_cc_toolchain") licenses(["notice"]) +load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm") + package( default_applicable_licenses = [], default_visibility = ["//:__subpackages__"], @@ -92,7 +92,7 @@ cc_toolchain_config( "-DNDEBUG", "-ffunction-sections", "-fdata-sections", - "-stdlib=libstdc++", + "-stdlib=libstdc++" ], opt_link_flags = ["-Wl,--gc-sections"], supports_start_end_lib = True, @@ -102,10 +102,10 @@ cc_toolchain_config( #"gcc": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-gcc", #"cpp": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-g++", #"ld": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-ld", - "gcc": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-clang", - "g++": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-clang++", - "cpp": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-clang++", - "ld": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-ld.lld", + "gcc": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-clang", + "g++": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-clang++", + "cpp": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-clang++", + "ld": "/opt/bin/x86_64-linux-musl-cxx11/x86_64-linux-musl-ld.lld", #"gcc": "/opt/x86_64-linux-musl/bin/clang", #"ld": "/opt/x86_64-linux-musl/bin/ld.lld", #"cpp": "/opt/x86_64-linux-musl/bin/clang++", @@ -144,29 +144,13 @@ cc_toolchain( # TODO distinguish between clang and gcc toolchains? cc_toolchain_config( name = "ygg_aarch64_toolchain_config", + cpu = "aarch64", + compiler = "compiler", + toolchain_identifier = "ygg_aarch64", + target_system_name = "aarch64-unknown-linux-gnu", + target_libc = "", abi_libc_version = "local", abi_version = "local", - builtin_sysroot = "/opt/BB_TARGET/BB_TARGET/sys-root/", - compile_flags = [ - "-fstack-protector", - "-Wall", - "-Wunused-but-set-parameter", - "-Wno-free-nonheap-object", - "-fno-omit-frame-pointer", - # TODO cxx_builtin_include_directories doesn't seem to be working, so we add the INCLUDE_PATHs manually - "-isystem /opt/BB_TARGET/lib/gcc/BB_TARGET/13.2.0/include", - "-isystem /opt/BB_TARGET/lib/gcc/BB_TARGET/13.2.0/include-fixed", - "-isystem /opt/BB_TARGET/BB_TARGET/include", - "-isystem /opt/BB_TARGET/BB_TARGET/sys-root/usr/include", - "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0", - "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/BB_TARGET", - "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/backward", - "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/parallel", - ], - compiler = "compiler", - coverage_compile_flags = ["--coverage"], - coverage_link_flags = ["--coverage"], - cpu = "aarch64", cxx_builtin_include_directories = [ "/opt/BB_TARGET/lib/gcc/BB_TARGET/13.2.0/include", "/opt/BB_TARGET/lib/gcc/BB_TARGET/13.2.0/include-fixed", @@ -177,27 +161,6 @@ cc_toolchain_config( "/opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/backward", "/opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/parallel" ], - dbg_compile_flags = ["-g"], - host_system_name = "linux", - link_flags = [], - link_libs = [ - "-lstdc++", - "-lm", - ], - opt_compile_flags = [ - "-g0", - "-O2", - "-D_FORTIFY_SOURCE=1", - "-DNDEBUG", - "-ffunction-sections", - "-fdata-sections", - # "-stdlib=libstdc++", - ], - opt_link_flags = ["-Wl,--gc-sections"], - # TODO gcc doesn't support it, only put it on clang (maybe even only for clang on aarch64-darwin?) - supports_start_end_lib = False, - target_libc = "", - target_system_name = "aarch64-unknown-linux-gnu", tool_paths = { "ar": "/opt/bin/BB_FULL_TARGET/ar", "as": "/opt/bin/BB_FULL_TARGET/as", @@ -226,7 +189,38 @@ cc_toolchain_config( "llvm-profdata": "/opt/x86_64-linux-musl/bin/llvm-profdata", "objdump": "/usr/bin/objdump", }, - toolchain_identifier = "ygg_aarch64", + compile_flags = [ + "-fstack-protector", + "-Wall", + "-Wunused-but-set-parameter", + "-Wno-free-nonheap-object", + "-fno-omit-frame-pointer", + # TODO cxx_builtin_include_directories doesn't seem to be working, so we add the INCLUDE_PATHs manually + "-isystem /opt/BB_TARGET/lib/gcc/BB_TARGET/13.2.0/include", + "-isystem /opt/BB_TARGET/lib/gcc/BB_TARGET/13.2.0/include-fixed", + "-isystem /opt/BB_TARGET/BB_TARGET/include", + "-isystem /opt/BB_TARGET/BB_TARGET/sys-root/usr/include", + "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0", + "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/BB_TARGET", + "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/backward", + "-isystem /opt/BB_TARGET/BB_TARGET/include/c++/13.2.0/parallel", + ], + opt_compile_flags = [ + "-g0", + "-O2", + "-D_FORTIFY_SOURCE=1", + "-DNDEBUG", + "-ffunction-sections", + "-fdata-sections", + # "-stdlib=libstdc++", + ], + dbg_compile_flags = ["-g"], + link_flags = [], + link_libs = [ + "-lstdc++", + "-lm", + ], + opt_link_flags = ["-Wl,--gc-sections"], unfiltered_compile_flags = [ "-no-canonical-prefixes", "-Wno-builtin-macro-redefined", @@ -236,6 +230,12 @@ cc_toolchain_config( "-Wno-unused-command-line-argument", "-Wno-gnu-offsetof-extensions", ], + builtin_sysroot = "/opt/BB_TARGET/BB_TARGET/sys-root/", + coverage_compile_flags = ["--coverage"], + coverage_link_flags = ["--coverage"], + host_system_name = "linux", + # TODO gcc doesn't support it, only put it on clang (maybe even only for clang on aarch64-darwin?) + supports_start_end_lib = False, ) cc_toolchain( @@ -271,8 +271,7 @@ cc_toolchain_config( "/usr/include/c++/11", "/usr/include/x86_64-linux-gnu/c++/11", ], - dbg_compile_flags = [ - "-g", + dbg_compile_flags = ["-g", "-I/usr/include/c++/11", ], host_system_name = "linux", @@ -280,7 +279,7 @@ cc_toolchain_config( "-fuse-ld=lld", "--ld-path=/home/wmoses/llvms/llvm16/install/bin/ld.lld", "-stdlib=libstdc++", - "-static-libstdc++", + "-static-libstdc++" ], link_libs = [ "-lstdc++", @@ -305,9 +304,9 @@ cc_toolchain_config( # "/usr/bin/gcc": "/home/wmoses/git/Reactant.jl/deps/clang", # "gcc": "/home/wmoses/git/Reactant.jl/deps/clang", "gcc": "/home/wmoses/llvms/llvm16/install/bin/clang", - "g++": "/home/wmoses/llvms/llvm16/install/bin/clang++", - "cpp": "/home/wmoses/llvms/llvm16/install/bin/clang++", - "ld": "/home/wmoses/llvms/llvm16/install/bin/ld.lld", + "g++": "/home/wmoses/llvms/llvm16/install/bin/clang++", + "cpp": "/home/wmoses/llvms/llvm16/install/bin/clang++", + "ld": "/home/wmoses/llvms/llvm16/install/bin/ld.lld", }, toolchain_identifier = "beast_x86_toolchain", unfiltered_compile_flags = [ @@ -321,6 +320,8 @@ cc_toolchain_config( ], ) + + platform( name = "darwin_x86_64", constraint_values = [ @@ -329,6 +330,7 @@ platform( ], ) + platform( name = "darwin_arm64", constraint_values = [ @@ -356,10 +358,13 @@ platform( cc_library( name = "ReactantExtraLib", srcs = glob( - ["src/*.cpp"], + [ + "*.cpp", + ], + ) + [ - "@enzyme_ad//src/enzyme_ad/jax:RegistryUtils.cpp", - "@enzyme_ad//src/enzyme_ad/jax:gpu.cc", + "@enzyme_ad//src/enzyme_ad/jax:RegistryUtils.cpp", + "@enzyme_ad//src/enzyme_ad/jax:gpu.cc", # "@com_google_protobuf//:src/google/protobuf/io/coded_stream.cc", # "@xla//xla:xla.pb.cc", "@xla//xla:xla_data.pb.cc", @@ -372,7 +377,7 @@ cc_library( "@xla//xla:autotuning.pb.cc", "@xla//xla:autotune_results.pb.cc", "@xla//xla/service:buffer_assignment.pb.cc", - ], + ], hdrs = glob([ "*.h", ]), @@ -381,18 +386,58 @@ cc_library( "-Werror=unused-but-set-variable", "-Werror=return-type", "-Werror=unused-result", - "-Wno-error=stringop-truncation", + "-Wno-error=stringop-truncation" ], - linkopts = select({ - "//conditions:default": [], - "@bazel_tools//src/conditions:darwin": [ - "-fvisibility=default", - "-Wl,-unexported_symbol,_*llvm*", - ], - }), + alwayslink = True, linkstatic = True, + linkopts = select({ + "//conditions:default": [], + "@bazel_tools//src/conditions:darwin": [ +"-Wl,-exported_symbol,_stablehlo*", +"-Wl,-exported_symbol,_mlir*", +"-Wl,-exported_symbol,_InitializeLogs", +"-Wl,-exported_symbol,_SetLogLevel", +"-Wl,-exported_symbol,_SetModuleLogLevel", +"-Wl,-exported_symbol,_GetDefaultTargetTriple", +"-Wl,-exported_symbol,_enzymeActivityAttrGet", +"-Wl,-exported_symbol,_MakeCPUClient", +"-Wl,-exported_symbol,_MakeGPUClient", +"-Wl,-exported_symbol,_MakeTPUClient", +"-Wl,-exported_symbol,_LoadPjrtPlugin", +"-Wl,-exported_symbol,_InitializePjrtPlugin", +"-Wl,-exported_symbol,_GetCApiClient", +"-Wl,-exported_symbol,_ClientNumDevices", +"-Wl,-exported_symbol,_ClientNumAddressableDevices", +"-Wl,-exported_symbol,_ClientProcessIndex", +"-Wl,-exported_symbol,_ClientGetDevice", +"-Wl,-exported_symbol,_ClientGetAddressableDevice", +"-Wl,-exported_symbol,_ExecutableFree", +"-Wl,-exported_symbol,_BufferToDevice", +"-Wl,-exported_symbol,_BufferToClient", +"-Wl,-exported_symbol,_DeviceToClient", +"-Wl,-exported_symbol,_PjRtBufferFree", +"-Wl,-exported_symbol,_UnsafeBufferPointer", +"-Wl,-exported_symbol,_ArrayFromHostBuffer", +"-Wl,-exported_symbol,_BufferOnCPU", +"-Wl,-exported_symbol,_CopyBufferToDevice", +"-Wl,-exported_symbol,_BufferToHost", +"-Wl,-exported_symbol,_FreeClient", +"-Wl,-exported_symbol,_ClientCompile", +"-Wl,-exported_symbol,_LinkInModule", +"-Wl,-exported_symbol,_FreeFuture", +"-Wl,-exported_symbol,_FutureIsReady", +"-Wl,-exported_symbol,_FutureAwait", +"-Wl,-exported_symbol,_XLAExecute", +"-Wl,-exported_symbol,_RegisterDialects", +"-Wl,-exported_symbol,_InitializeRegistryAndPasses", +"-Wl,-exported_symbol,_ifrt_*", +"-Wl,-exported_symbol,_RegisterCustomCallTarget", +"-Wl,-exported_symbol,_ConvertLLVMToMLIR", +"-Wl,-exported_symbol,_RegisterEnzymeXLAGPUHandler", +"-Wl,-exported_symbol,_ReactantThrowError", + ]}), deps = [ - "@enzyme//:EnzymeMLIR", + "@enzyme//:EnzymeMLIR", "@llvm-project//mlir:AffineDialect", "@llvm-project//mlir:AllPassesAndDialects", "@llvm-project//mlir:ArithDialect", @@ -415,9 +460,11 @@ cc_library( "@llvm-project//mlir:SCFDialect", "@llvm-project//mlir:TransformDialect", "@llvm-project//mlir:Transforms", + "@llvm-project//mlir:LLVMIRToLLVMTranslation", "@llvm-project//mlir:LLVMIRToNVVMTranslation", "@llvm-project//mlir:LLVMIRTransforms", + "@llvm-project//llvm:IRReader", "@llvm-project//llvm:Support", "@llvm-project//llvm:AArch64AsmParser", @@ -433,25 +480,31 @@ cc_library( "@xla//xla/pjrt:pjrt_api", "@xla//xla/pjrt:pjrt_c_api_client", "@xla//xla/pjrt/cpu:cpu_client", + "@xla//xla:xla_proto_cc", "@xla//xla:xla_proto_cc_impl", + "@xla//xla/service:metrics_proto_cc", "@xla//xla/service:metrics_proto_cc_impl", + "@xla//xla/service/cpu:cpu_compiler", "@xla//xla/stream_executor/tpu:tpu_on_demand_compiler", "@xla//xla/stream_executor/tpu:tpu_executor", "@xla//xla/stream_executor/tpu:tpu_transfer_manager", + "@xla//xla/service/cpu:cpu_transfer_manager", "@xla//xla/pjrt/gpu:se_gpu_pjrt_client", - "@xla//xla/tsl/protobuf:protos_all_cc_impl", + + "@xla//xla/tsl/protobuf:protos_all_cc_impl", "@xla//xla/tsl/framework:allocator_registry_impl", + "@xla//xla/pjrt:status_casters", - "@xla//xla/python/ifrt", - "@xla//xla/python/pjrt_ifrt", + "@xla//xla/python/ifrt:ifrt", + "@xla//xla/python/pjrt_ifrt:pjrt_ifrt", "@xla//xla/python/ifrt/hlo:hlo_program", "@xla//xla/ffi:call_frame", "@com_google_protobuf//:protobuf", - "@xla//xla/tsl/profiler/backends/cpu:annotation_stack_impl", + "@xla//xla/tsl/profiler/backends/cpu:annotation_stack_impl", "@xla//xla/tsl/profiler/backends/cpu:traceme_recorder_impl", "@xla//xla/tsl/profiler/utils:time_utils_impl", "@tsl//tsl/platform:env_impl", @@ -459,43 +512,36 @@ cc_library( "@xla//xla/mlir/utils:type_util", "@stablehlo//:stablehlo_capi_objects", "@stablehlo//:chlo_capi_objects", - "@com_google_absl//absl/hash", + "@com_google_absl//absl/hash:hash", "@com_google_absl//absl/log:initialize", "@com_google_absl//absl/log:globals", "@llvm-project//mlir:CAPIIRObjects", ] + select({ - "@xla//xla/tsl:is_cuda_enabled_and_oss": [ - "@xla//xla/service/gpu:gpu_transfer_manager", - "@xla//xla/service/gpu:nvptx_compiler", - "@xla//xla/service/gpu/model:hlo_op_profile_proto_cc_impl", - "@xla//xla/service/gpu/model:hlo_op_profiles", - "@xla//xla/stream_executor:kernel", - "@xla//xla/stream_executor/cuda:all_runtime", - ], - "//conditions:default": [], + "@xla//xla/tsl:is_cuda_enabled_and_oss":[ + "@xla//xla/stream_executor/cuda:all_runtime", + "@xla//xla/service/gpu/model:hlo_op_profiles", + "@xla//xla/service/gpu/model:hlo_op_profile_proto_cc_impl", + "@xla//xla/service/gpu:nvptx_compiler", + "@xla//xla/service/gpu:gpu_transfer_manager", + "@xla//xla/stream_executor:kernel", + ], + "//conditions:default": [], }) + if_rocm([ "@xla//xla/service/gpu:amdgpu_compiler", ]), - alwayslink = True, ) # cc_shared_library( cc_binary( name = "libReactantExtra.so", - linkshared = 1, ## important - linkstatic = 1, ## important + linkshared = 1, ## important + linkstatic = 1, ## important deps = [":ReactantExtraLib"], ) cc_binary( name = "mlir-jl-tblgen", - srcs = [ - "//tblgen:jl-generators.cc", - "//tblgen:mlir-jl-tblgen.cc", - ], - tags = [ - "optional", - ], + srcs = ["//tblgen:mlir-jl-tblgen.cc", "//tblgen:jl-generators.cc"], visibility = ["//visibility:public"], deps = [ "@llvm-project//llvm:Support", @@ -503,173 +549,143 @@ cc_binary( "@llvm-project//llvm:config", "@llvm-project//mlir:TableGen", ], + tags = [ + "optional" + ], ) gentbl_cc_library( name = "BuiltinJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "Builtin.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "Builtin.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@llvm-project//mlir:include/mlir/IR/BuiltinOps.td", deps = [ "@llvm-project//mlir:BuiltinDialectTdFiles", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "ArithJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "Arith.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "Arith.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@llvm-project//mlir:include/mlir/Dialect/Arith/IR/ArithOps.td", deps = [ "@llvm-project//mlir:ArithOpsTdFiles", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "AffineJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "Affine.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "Affine.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@llvm-project//mlir:include/mlir/Dialect/Affine/IR/AffineOps.td", deps = [ "@llvm-project//mlir:AffineOpsTdFiles", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "FuncJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "Func.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "Func.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@llvm-project//mlir:include/mlir/Dialect/Func/IR/FuncOps.td", deps = [ "@llvm-project//mlir:FuncTdFiles", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "EnzymeJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "Enzyme.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "Enzyme.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@enzyme//:Enzyme/MLIR/Dialect/EnzymeOps.td", deps = [ "@enzyme//:EnzymeDialectTdFiles", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "EnzymeXLAJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "EnzymeXLA.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "EnzymeXLA.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@enzyme_ad//src/enzyme_ad/jax:Dialect/EnzymeXLAOps.td", deps = [ "@enzyme//:EnzymeDialectTdFiles", "@enzyme_ad//src/enzyme_ad/jax:EnzymeXLADialectTdFiles", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "StableHLOJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "StableHLO.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "StableHLO.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@stablehlo//:stablehlo/dialect/StablehloOps.td", deps = [ "@stablehlo//:stablehlo_ops_td_files", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "CHLOJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "CHLO.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "CHLO.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@stablehlo//:stablehlo/dialect/ChloOps.td", deps = [ "@stablehlo//:chlo_ops_td_files", ], + tblgen = "//:mlir-jl-tblgen", ) gentbl_cc_library( name = "VHLOJLIncGen", - tbl_outs = [ - ( - [ - "--generator=jl-op-defs", - "--disable-module-wrap=0", - ], - "VHLO.jl", - ), + tbl_outs = [( + ["--generator=jl-op-defs", "--disable-module-wrap=0"], + "VHLO.jl" + ) ], - tblgen = "//:mlir-jl-tblgen", td_file = "@stablehlo//:stablehlo/dialect/VhloOps.td", deps = [ "@stablehlo//:vhlo_ops_td_files", ], + tblgen = "//:mlir-jl-tblgen", ) genrule( name = "libMLIR_h.jl", + tags = [ + "jlrule" + ], srcs = [ "@llvm-project//mlir:include/mlir-c/Bindings/Python/Interop.h", "@llvm-project//llvm:include/llvm-c/Support.h", @@ -688,11 +704,8 @@ genrule( "//:Manifest.toml", "//:wrap.toml", "//:missing_defs.jl", - "//:make.jl", + "//:make.jl" ], outs = ["libMLIR_h.jl"], cmd = "$$JULIA \"--project=$(location //:Project.toml)\" \"$(location //:make.jl)\" \"$(location @llvm-project//mlir:include/mlir-c/Bindings/Python/Interop.h)\" \"$(location @llvm-project//llvm:include/llvm-c/Support.h)\" \"$(locations @llvm-project//mlir:ConversionPassIncGen_filegroup)\" \"$(location @stablehlo//:stablehlo/integrations/c/StablehloAttributes.h)\" \"$@\"", - tags = [ - "jlrule", - ], ) diff --git a/deps/ReactantExtra/WORKSPACE b/deps/ReactantExtra/WORKSPACE index b7fc309e9..95c2b7bb9 100644 --- a/deps/ReactantExtra/WORKSPACE +++ b/deps/ReactantExtra/WORKSPACE @@ -1,29 +1,121 @@ -workspace(name = "Reactant") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +NSYNC_COMMIT = "82b118aa7ace3132e517e2c467f8732978cf4023" +NSYNC_SHA256 = "" +http_archive( + name = "nsync", + sha256 = NSYNC_SHA256, + strip_prefix = "nsync-" + NSYNC_COMMIT, + urls = ["https://github.com/wsmoses/nsync/archive/{commit}.tar.gz".format(commit = NSYNC_COMMIT)], +) + +ENZYMEXLA_COMMIT = "74046d05089c02946058f8fd94ed23efd0bf3ccc" +ENZYMEXLA_SHA256 = "" + +http_archive( + name = "enzyme_ad", + sha256 = ENZYMEXLA_SHA256, + strip_prefix = "Enzyme-JAX-" + ENZYMEXLA_COMMIT, + urls = ["https://github.com/EnzymeAD/Enzyme-JAX/archive/{commit}.tar.gz".format(commit = ENZYMEXLA_COMMIT)], +) + + +http_archive( + name = "rules_python", + sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", + strip_prefix = "rules_python-0.34.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", +) -load("//third_party/nsync:workspace.bzl", nsync_workspace = "repo") -nsync_workspace() +# Hedron's Compile Commands Extractor for Bazel +# https://github.com/hedronvision/bazel-compile-commands-extractor +http_archive( + name = "hedron_compile_commands", -load("//third_party/rules_python:workspace.bzl", rules_python_workspace = "repo") -rules_python_workspace() + # Replace the commit hash (0e990032f3c5a866e72615cf67e5ce22186dcb97) in both places (below) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main), rather than using the stale one here. + # Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README). + url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/4f28899228fb3ad0126897876f147ca15026151e.tar.gz", + strip_prefix = "bazel-compile-commands-extractor-4f28899228fb3ad0126897876f147ca15026151e", + # When you first run this tool, it'll recommend a sha256 hash to put here with a message like: "DEBUG: Rule 'hedron_compile_commands' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = ..." +) +load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") +hedron_compile_commands_setup() +load("@hedron_compile_commands//:workspace_setup_transitive.bzl", "hedron_compile_commands_setup_transitive") +hedron_compile_commands_setup_transitive() +load("@hedron_compile_commands//:workspace_setup_transitive_transitive.bzl", "hedron_compile_commands_setup_transitive_transitive") +hedron_compile_commands_setup_transitive_transitive() +load("@hedron_compile_commands//:workspace_setup_transitive_transitive_transitive.bzl", "hedron_compile_commands_setup_transitive_transitive_transitive") +hedron_compile_commands_setup_transitive_transitive_transitive() -load("//third_party/enzyme_ad:workspace.bzl", enzyme_ad_workspace = "repo") -enzyme_ad_workspace() +load("@enzyme_ad//:workspace.bzl", "JAX_COMMIT", "JAX_SHA256", "ENZYME_COMMIT", "ENZYME_SHA256", "XLA_PATCHES") + +XLA_PATCHES = XLA_PATCHES + [ +""" +sed -i.bak0 "s/__cpp_lib_hardware_interference_size/HW_INTERFERENCE_SIZE/g" xla/backends/cpu/runtime/thunk_executor.h +""", +""" +sed -i.bak0 "s/__cpp_lib_hardware_interference_size/HW_INTERFERENCE_SIZE/g" xla/stream_executor/host/host_kernel.cc +""", +""" +sed -i.bak0 "s/__cpp_lib_hardware_interference_size/HW_INTERFERENCE_SIZE/g" xla/tsl/concurrency/async_value_ref.h +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_LINK_H=1\\/HAVE_LINK_H=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/LLVM_ENABLE_THREADS=1\\/LLVM_ENABLE_THREADS=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_MALLINFO=1\\/DONT_HAVE_ANY_MALLINFO=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_PTHREAD_GETNAME_NP=1\\/FAKE_HAVE_PTHREAD_GETNAME_NP=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_PTHREAD_SETNAME_NP=1\\/FAKE_HAVE_PTHREAD_SETNAME_NP=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.h -exec sed -i.bak0 's\\/ENABLE_CRASH_OVERRIDES 1\\/ENABLE_CRASH_OVERRIDES 0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.h -exec sed -i.bak0 's\\/HAVE_PTHREAD_GETNAME_NP\\/FAKE_HAVE_PTHREAD_GETNAME_NP\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +""" +sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.h -exec sed -i.bak0 's\\/HAVE_PTHREAD_SETNAME_NP\\/FAKE_HAVE_PTHREAD_SETNAME_NP\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl +""", +# """ +# sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\['find . -type f -name BUILD.bazel -exec sed -i.bak0 \\\\\\'s\\/\\\"CAPIIR\\\",\\/\\\"CAPIIR\\\",alwayslink=1,\\/g\\\\\\\\' {} +',/g" third_party/llvm/workspace.bzl +# """, +] -load("//third_party/rules_cc:workspace.bzl", rules_cc_workspace = "repo") -rules_cc_workspace() +LLVM_TARGETS = select({ + "@bazel_tools//src/conditions:windows": ["AMDGPU", "NVPTX"], + "@bazel_tools//src/conditions:darwin": [], + "//conditions:default": ["AMDGPU", "NVPTX"], +}) + ["AArch64", "X86", "ARM"] -load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") -rules_cc_dependencies() +http_archive( + name = "jax", + sha256 = JAX_SHA256, + strip_prefix = "jax-" + JAX_COMMIT, + urls = ["https://github.com/google/jax/archive/{commit}.tar.gz".format(commit = JAX_COMMIT)], + patch_args = ["-p1"], + patches = ["@enzyme_ad//:patches/jax.patch"], +) -load("//third_party/jax:workspace.bzl", jax_workspace = "repo") -jax_workspace() +load("@jax//third_party/xla:workspace.bzl", "XLA_COMMIT", "XLA_SHA256") -load("//third_party/xla:workspace.bzl", xla_workspace = "repo") -xla_workspace() +http_archive( + name = "xla", + sha256 = XLA_SHA256, + strip_prefix = "xla-" + XLA_COMMIT, + urls = ["https://github.com/wsmoses/xla/archive/{commit}.tar.gz".format(commit = XLA_COMMIT)], + patch_cmds = XLA_PATCHES +) load("@xla//third_party/py:python_init_rules.bzl", "python_init_rules") python_init_rules() - + load("@xla//third_party/py:python_init_repositories.bzl", "python_init_repositories") python_init_repositories( requirements = { @@ -34,7 +126,7 @@ python_init_repositories( "3.13": "//build:requirements_lock_3_13.txt", }, ) - + load("@xla//third_party/py:python_init_toolchains.bzl", "python_init_toolchains") python_init_toolchains() # @@ -52,24 +144,42 @@ python_init_toolchains() # # pip_install_dependencies() -load("//third_party/enzyme:workspace.bzl", enzyme_workspace = "repo") -enzyme_workspace() +http_archive( + name = "enzyme", + sha256 = ENZYME_SHA256, + strip_prefix = "Enzyme-" + ENZYME_COMMIT + "/enzyme", + urls = ["https://github.com/EnzymeAD/Enzyme/archive/{commit}.tar.gz".format(commit = ENZYME_COMMIT)], +) -load("//third_party/build_bazel_rules_apple:workspace.bzl", build_bazel_rules_apple_workspace = "repo") -build_bazel_rules_apple_workspace() +http_archive( + name = "build_bazel_rules_apple", + sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7", + url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz", +) load( "@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies", ) + apple_rules_dependencies() -load("//third_party/upb:workspace.bzl", upb_workspace = "repo") -upb_workspace() + +http_archive( + name = "upb", + sha256 = "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454", + strip_prefix = "upb-9effcbcb27f0a665f9f345030188c0b291e32482", + patch_cmds = [ + "sed -i.bak0 's/@bazel_tools\\/\\/platforms:windows/@platforms\\/\\/os:windows/g' BUILD", + "sed -i.bak0 's/-Werror//g' BUILD" + ], + url = "https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz" +) load("@jax//third_party/xla:workspace.bzl", jax_xla_workspace = "repo") jax_xla_workspace() + load("@xla//:workspace4.bzl", "xla_workspace4") xla_workspace4() @@ -78,12 +188,6 @@ xla_workspace3() load("@xla//:workspace2.bzl", "xla_workspace2") -LLVM_TARGETS = select({ - "@bazel_tools//src/conditions:windows": ["AMDGPU", "NVPTX"], - "@bazel_tools//src/conditions:darwin": [], - "//conditions:default": ["AMDGPU", "NVPTX"], -}) + ["AArch64", "X86", "ARM"] - load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure") llvm_configure(name = "llvm-project", targets = LLVM_TARGETS) xla_workspace2() @@ -101,6 +205,7 @@ load( "@tsl//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl", "cuda_json_init_repository", ) + cuda_json_init_repository() load( @@ -113,9 +218,11 @@ load( "cuda_redist_init_repositories", "cudnn_redist_init_repository", ) + cuda_redist_init_repositories( cuda_redistributions = CUDA_REDISTRIBUTIONS, ) + cudnn_redist_init_repository( cudnn_redistributions = CUDNN_REDISTRIBUTIONS, ) @@ -124,31 +231,19 @@ load( "@tsl//third_party/gpus/cuda/hermetic:cuda_configure.bzl", "cuda_configure", ) + cuda_configure(name = "local_config_cuda") load( "@tsl//third_party/nccl/hermetic:nccl_redist_init_repository.bzl", "nccl_redist_init_repository", ) + nccl_redist_init_repository() load( "@tsl//third_party/nccl/hermetic:nccl_configure.bzl", "nccl_configure", ) -nccl_configure(name = "local_config_nccl") - -load("@enzyme_ad//third_party/hedron_compile_commands:workspace.bzl", hedron_compile_commands_workspace = "repo") -hedron_compile_commands_workspace() - -load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") -hedron_compile_commands_setup() - -load("@hedron_compile_commands//:workspace_setup_transitive.bzl", "hedron_compile_commands_setup_transitive") -hedron_compile_commands_setup_transitive() - -load("@hedron_compile_commands//:workspace_setup_transitive_transitive.bzl", "hedron_compile_commands_setup_transitive_transitive") -hedron_compile_commands_setup_transitive_transitive() -load("@hedron_compile_commands//:workspace_setup_transitive_transitive_transitive.bzl", "hedron_compile_commands_setup_transitive_transitive_transitive") -hedron_compile_commands_setup_transitive_transitive_transitive() +nccl_configure(name = "local_config_nccl") diff --git a/deps/ReactantExtra/third_party/BUILD b/deps/ReactantExtra/third_party/BUILD deleted file mode 100644 index b2c46fa7a..000000000 --- a/deps/ReactantExtra/third_party/BUILD +++ /dev/null @@ -1 +0,0 @@ -licenses(["notice"]) \ No newline at end of file diff --git a/deps/ReactantExtra/third_party/build_bazel_rules_apple/BUILD b/deps/ReactantExtra/third_party/build_bazel_rules_apple/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/build_bazel_rules_apple/workspace.bzl b/deps/ReactantExtra/third_party/build_bazel_rules_apple/workspace.bzl deleted file mode 100644 index f4350d99a..000000000 --- a/deps/ReactantExtra/third_party/build_bazel_rules_apple/workspace.bzl +++ /dev/null @@ -1,10 +0,0 @@ -"""Loads bazel rules for apple.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -def repo(): - http_archive( - name = "build_bazel_rules_apple", - sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz", - ) diff --git a/deps/ReactantExtra/third_party/enzyme/BUILD b/deps/ReactantExtra/third_party/enzyme/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/enzyme/workspace.bzl b/deps/ReactantExtra/third_party/enzyme/workspace.bzl deleted file mode 100644 index c7db5aef4..000000000 --- a/deps/ReactantExtra/third_party/enzyme/workspace.bzl +++ /dev/null @@ -1,12 +0,0 @@ -"""Loads Enzyme.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@enzyme_ad//:workspace.bzl", "ENZYME_COMMIT", "ENZYME_SHA256") - -def repo(): - http_archive( - name = "enzyme", - sha256 = ENZYME_SHA256, - strip_prefix = "Enzyme-" + ENZYME_COMMIT + "/enzyme", - urls = ["https://github.com/EnzymeAD/Enzyme/archive/{commit}.tar.gz".format(commit = ENZYME_COMMIT)], - ) diff --git a/deps/ReactantExtra/third_party/enzyme_ad/BUILD b/deps/ReactantExtra/third_party/enzyme_ad/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/enzyme_ad/workspace.bzl b/deps/ReactantExtra/third_party/enzyme_ad/workspace.bzl deleted file mode 100644 index e02b73579..000000000 --- a/deps/ReactantExtra/third_party/enzyme_ad/workspace.bzl +++ /dev/null @@ -1,12 +0,0 @@ -"""Loads Enzyme-JAX.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:workspace.bzl", "ENZYMEXLA_COMMIT", "ENZYMEXLA_SHA256") - -def repo(): - http_archive( - name = "enzyme_ad", - sha256 = ENZYMEXLA_SHA256, - strip_prefix = "Enzyme-JAX-" + ENZYMEXLA_COMMIT, - urls = ["https://github.com/EnzymeAD/Enzyme-JAX/archive/{commit}.tar.gz".format(commit = ENZYMEXLA_COMMIT)], - ) diff --git a/deps/ReactantExtra/third_party/jax/BUILD b/deps/ReactantExtra/third_party/jax/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/jax/workspace.bzl b/deps/ReactantExtra/third_party/jax/workspace.bzl deleted file mode 100644 index 53e0cac75..000000000 --- a/deps/ReactantExtra/third_party/jax/workspace.bzl +++ /dev/null @@ -1,14 +0,0 @@ -"""Loads Enzyme-JAX.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@enzyme_ad//:workspace.bzl", "JAX_COMMIT", "JAX_SHA256") - -def repo(): - http_archive( - name = "jax", - sha256 = JAX_SHA256, - strip_prefix = "jax-" + JAX_COMMIT, - urls = ["https://github.com/google/jax/archive/{commit}.tar.gz".format(commit = JAX_COMMIT)], - patch_args = ["-p1"], - patches = ["@enzyme_ad//:patches/jax.patch"], - ) diff --git a/deps/ReactantExtra/third_party/nsync/BUILD b/deps/ReactantExtra/third_party/nsync/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/nsync/workspace.bzl b/deps/ReactantExtra/third_party/nsync/workspace.bzl deleted file mode 100644 index 53dac7f67..000000000 --- a/deps/ReactantExtra/third_party/nsync/workspace.bzl +++ /dev/null @@ -1,12 +0,0 @@ -"""Loads nsync.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:workspace.bzl", "NSYNC_COMMIT", "NSYNC_SHA256") - -def repo(): - http_archive( - name = "nsync", - sha256 = NSYNC_SHA256, - strip_prefix = "nsync-" + NSYNC_COMMIT, - urls = ["https://github.com/wsmoses/nsync/archive/{commit}.tar.gz".format(commit = NSYNC_COMMIT)], - ) diff --git a/deps/ReactantExtra/third_party/rules_cc/BUILD b/deps/ReactantExtra/third_party/rules_cc/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/rules_cc/workspace.bzl b/deps/ReactantExtra/third_party/rules_cc/workspace.bzl deleted file mode 100644 index b7e8d25a6..000000000 --- a/deps/ReactantExtra/third_party/rules_cc/workspace.bzl +++ /dev/null @@ -1,14 +0,0 @@ -"""Loads bazel rules_cc.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:workspace.bzl", "RULES_CC_COMMIT", "RULES_CC_SHA256") - -def repo(): - http_archive( - name = "rules_cc", - sha256 = RULES_CC_SHA256, - strip_prefix = "rules_cc-" + RULES_CC_COMMIT, - urls = [ - "https://github.com/bazelbuild/rules_cc/archive/{commit}.tar.gz".format(commit = RULES_CC_COMMIT), - ], - ) diff --git a/deps/ReactantExtra/third_party/rules_python/BUILD b/deps/ReactantExtra/third_party/rules_python/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/rules_python/workspace.bzl b/deps/ReactantExtra/third_party/rules_python/workspace.bzl deleted file mode 100644 index 10db7c2fa..000000000 --- a/deps/ReactantExtra/third_party/rules_python/workspace.bzl +++ /dev/null @@ -1,12 +0,0 @@ -"""Loads rules_python (downgrades over the one used by XLA due to a bug in the latest release).""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:workspace.bzl", "RULES_PYTHON_SHA256", "RULES_PYTHON_VERSION") - -def repo(): - http_archive( - name = "rules_python", - sha256 = RULES_PYTHON_SHA256, - strip_prefix = "rules_python-" + RULES_PYTHON_VERSION, - url = "https://github.com/bazelbuild/rules_python/releases/download/{commit}/rules_python-{commit}.tar.gz".format(commit = RULES_PYTHON_VERSION), - ) diff --git a/deps/ReactantExtra/third_party/upb/BUILD b/deps/ReactantExtra/third_party/upb/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/upb/workspace.bzl b/deps/ReactantExtra/third_party/upb/workspace.bzl deleted file mode 100644 index 100f0c28a..000000000 --- a/deps/ReactantExtra/third_party/upb/workspace.bzl +++ /dev/null @@ -1,16 +0,0 @@ -"""Loads upb.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:workspace.bzl", "UPB_COMMIT", "UPB_SHA256") - -def repo(): - http_archive( - name = "upb", - sha256 = UPB_SHA256, - strip_prefix = "upb-" + UPB_COMMIT, - patch_cmds = [ - "sed -i.bak0 's/@bazel_tools\\/\\/platforms:windows/@platforms\\/\\/os:windows/g' BUILD", - "sed -i.bak0 's/-Werror//g' BUILD", - ], - url = "https://github.com/protocolbuffers/upb/archive/{commit}.tar.gz".format(commit = UPB_COMMIT), - ) diff --git a/deps/ReactantExtra/third_party/xla/BUILD b/deps/ReactantExtra/third_party/xla/BUILD deleted file mode 100644 index e69de29bb..000000000 diff --git a/deps/ReactantExtra/third_party/xla/workspace.bzl b/deps/ReactantExtra/third_party/xla/workspace.bzl deleted file mode 100644 index dd2479db3..000000000 --- a/deps/ReactantExtra/third_party/xla/workspace.bzl +++ /dev/null @@ -1,26 +0,0 @@ -"""Loads XLA.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@enzyme_ad//:workspace.bzl", "XLA_PATCHES") -load("@jax//third_party/xla:workspace.bzl", "XLA_COMMIT", "XLA_SHA256") - -def repo(): - http_archive( - name = "xla", - sha256 = XLA_SHA256, - strip_prefix = "xla-" + XLA_COMMIT, - urls = ["https://github.com/wsmoses/xla/archive/{commit}.tar.gz".format(commit = XLA_COMMIT)], - patch_cmds = XLA_PATCHES + [ - """sed -i.bak0 "s/__cpp_lib_hardware_interference_size/HW_INTERFERENCE_SIZE/g" xla/backends/cpu/runtime/thunk_executor.h""", - """sed -i.bak0 "s/__cpp_lib_hardware_interference_size/HW_INTERFERENCE_SIZE/g" xla/stream_executor/host/host_kernel.cc""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_LINK_H=1\\/HAVE_LINK_H=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/LLVM_ENABLE_THREADS=1\\/LLVM_ENABLE_THREADS=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_MALLINFO=1\\/DONT_HAVE_ANY_MALLINFO=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_PTHREAD_GETNAME_NP=1\\/FAKE_HAVE_PTHREAD_GETNAME_NP=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.bzl -exec sed -i.bak0 's\\/HAVE_PTHREAD_SETNAME_NP=1\\/FAKE_HAVE_PTHREAD_SETNAME_NP=0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.h -exec sed -i.bak0 's\\/ENABLE_CRASH_OVERRIDES 1\\/ENABLE_CRASH_OVERRIDES 0\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.h -exec sed -i.bak0 's\\/HAVE_PTHREAD_GETNAME_NP\\/FAKE_HAVE_PTHREAD_GETNAME_NP\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\[\\\"find . -type f -name config.h -exec sed -i.bak0 's\\/HAVE_PTHREAD_SETNAME_NP\\/FAKE_HAVE_PTHREAD_SETNAME_NP\\/g' {} +\\\",/g" third_party/llvm/workspace.bzl""", - # """sed -i.bak0 "s/patch_cmds = \\[/patch_cmds = \\['find . -type f -name BUILD.bazel -exec sed -i.bak0 \\\\\\'s\\/\\\"CAPIIR\\\",\\/\\\"CAPIIR\\\",alwayslink=1,\\/g\\\\\\\\' {} +',/g" third_party/llvm/workspace.bzl""", - ], - ) diff --git a/deps/ReactantExtra/tools/toolchains/yggdrasil/BUILD b/deps/ReactantExtra/toolchain/yggdrasil.bzl similarity index 100% rename from deps/ReactantExtra/tools/toolchains/yggdrasil/BUILD rename to deps/ReactantExtra/toolchain/yggdrasil.bzl diff --git a/deps/ReactantExtra/tools/platforms.bzl b/deps/ReactantExtra/tools/platforms.bzl deleted file mode 100644 index da7dfc796..000000000 --- a/deps/ReactantExtra/tools/platforms.bzl +++ /dev/null @@ -1,31 +0,0 @@ -platform( - name = "darwin_x86_64", - constraint_values = [ - "@platforms//os:macos", - "@platforms//cpu:x86_64", - ], -) - -platform( - name = "darwin_arm64", - constraint_values = [ - "@platforms//os:macos", - "@platforms//cpu:arm64", - ], -) - -platform( - name = "linux_x86_64", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], -) - -platform( - name = "linux_aarch64", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:aarch64", - ], -) diff --git a/deps/ReactantExtra/workspace.bzl b/deps/ReactantExtra/workspace.bzl deleted file mode 100644 index 3da44029e..000000000 --- a/deps/ReactantExtra/workspace.bzl +++ /dev/null @@ -1,14 +0,0 @@ -ENZYMEXLA_COMMIT = "52e14543628df5e3f806dce096243c4603d3e103" -ENZYMEXLA_SHA256 = "" - -NSYNC_COMMIT = "82b118aa7ace3132e517e2c467f8732978cf4023" -NSYNC_SHA256 = "" - -RULES_CC_COMMIT = "c8c38f8c710cbbf834283e4777916b68261b359c" -RULES_CC_SHA256 = "85723d827f080c5e927334f1fb18a294c0b3f94fee6d6b45945f5cdae6ea0fd4" - -RULES_PYTHON_VERSION = "0.34.0" -RULES_PYTHON_SHA256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618" - -UPB_COMMIT = "9effcbcb27f0a665f9f345030188c0b291e32482" -UPB_SHA256 = "61d0417abd60e65ed589c9deee7c124fe76a4106831f6ad39464e1525cef1454" diff --git a/deps/clang b/deps/clang new file mode 100755 index 000000000..77df2a34c --- /dev/null +++ b/deps/clang @@ -0,0 +1,2 @@ +#!/bin/bash +/home/wmoses/llvms/llvm16/install/bin/clang -I/usr/include/x86_64-linux-gnu/c++/11 -L/home/wmoses/llvms/llvm16/build/lib/x86_64-unknown-linux-gnu -stdlib=libc++ -v "$@" diff --git a/deps/clang++ b/deps/clang++ new file mode 100755 index 000000000..25b16f719 --- /dev/null +++ b/deps/clang++ @@ -0,0 +1,2 @@ +#!/bin/bash +/home/wmoses/llvms/llvm16/build/bin/clang++ -I/usr/include/x86_64-linux-gnu/c++/11 -I/usr/include/c++/11 -I/usr/include/x86_64-linux-gnu/c++/11 -L/usr/lib/x86_64-linux-gnu "$@" diff --git a/deps/gcc b/deps/gcc new file mode 100755 index 000000000..d92c9c10d --- /dev/null +++ b/deps/gcc @@ -0,0 +1,3 @@ +#!/bin/bash +# /usr/local/cuda/bin/nvcc "$@" +/home/wmoses/llvms/llvm16/install/bin/clang -Xclang -fcuda-allow-variadic-functions -I/usr/include/c++/11 -I/usr/include/x86_64-linux-gnu/c++/11 -Wno-unused-command-line-argument -L/usr/lib/gcc/x86_64-linux-gnu/11 -static-libstdc++ "$@" || /home/wmoses/llvms/llvm16/install/bin/clang -Xclang -fcuda-allow-variadic-functions -I/usr/include/c++/11 -I/usr/include/x86_64-linux-gnu/c++/11 -Wno-unused-command-line-argument -L/usr/lib/gcc/x86_64-linux-gnu/11 -static-libstdc++ -g0 "$@" -g0