From cb09c111f542822e0a2108a06dffda4cb583c405 Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Fri, 3 Nov 2023 07:58:11 +0000 Subject: [PATCH] bump WAMR version - WAMR version to ~~1.3.1~~ latest commit - support linux perf - support wasm function execution time statistic (in cpu-time) --- bazel/foreign_cc/BUILD | 155 +++++++++++++++++++++++++++++++-- bazel/repositories.bzl | 11 +++ bazel/repository_locations.bzl | 30 +++++-- 3 files changed, 181 insertions(+), 15 deletions(-) diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 3d3b13d96944..1b26360e298c 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -446,6 +446,129 @@ envoy_cmake( alwayslink = True, ) +envoy_cmake( + name = "llvm_15_0_7", + cache_entries = { + # Disable both: BUILD and INCLUDE, since some of the INCLUDE + # targets build code instead of only generating build files. + "LLVM_BUILD_BENCHMARKS": "off", + "LLVM_BUILD_DOCS": "off", + "LLVM_BUILD_EXAMPLES": "off", + "LLVM_BUILD_TESTS": "off", + "LLVM_BUILD_TOOLS": "off", + "LLVM_ENABLE_IDE": "off", + "LLVM_ENABLE_LIBEDIT": "off", + "LLVM_ENABLE_LIBXML2": "off", + "LLVM_ENABLE_TERMINFO": "off", + "LLVM_ENABLE_ZLIB": "off", + "LLVM_ENABLE_ZSTD": "off", + "LLVM_INCLUDE_BENCHMARKS": "off", + "LLVM_INCLUDE_DOCS": "off", + "LLVM_INCLUDE_EXAMPLES": "off", + "LLVM_INCLUDE_TESTS": "off", + "LLVM_INCLUDE_TOOLS": "off", + "LLVM_TARGETS_TO_BUILD": "X86", + "LLVM_USE_PERF": "on", + "CMAKE_CXX_FLAGS": "-Wno-unused-command-line-argument", + }, + generate_args = ["-GNinja"] + select({ + # `lld` doesn't work on MacOS + "@platforms//os:linux": ["-DLLVM_USE_LINKER=lld"], + "//conditions:default": [], + }) + select({ + "//bazel:dbg_build": ["-DCMAKE_BUILD_TYPE=Debug"], + "//conditions:default": ["-DCMAKE_BUILD_TYPE=MinSizeRel"], + }), + lib_source = "@org_llvm_llvm_15_0_7//:all", + out_data_dirs = [ + "bin", + "include", + "lib", + "libexec", + "share", + ], + out_static_libs = [ + # How to get the library list: + # build LLVM with "-DLLVM_INCLUDE_TOOLS=ON" + # cd bin and run "./llvm-config --libnames" + "libLLVMWindowsManifest.a", + "libLLVMXRay.a", + "libLLVMLibDriver.a", + "libLLVMDlltoolDriver.a", + "libLLVMCoverage.a", + "libLLVMLineEditor.a", + "libLLVMX86Disassembler.a", + "libLLVMX86AsmParser.a", + "libLLVMX86CodeGen.a", + "libLLVMX86Desc.a", + "libLLVMX86Info.a", + "libLLVMOrcJIT.a", + "libLLVMMCJIT.a", + "libLLVMJITLink.a", + "libLLVMInterpreter.a", + "libLLVMExecutionEngine.a", + "libLLVMRuntimeDyld.a", + "libLLVMOrcTargetProcess.a", + "libLLVMOrcShared.a", + "libLLVMDWP.a", + "libLLVMSymbolize.a", + "libLLVMDebugInfoPDB.a", + "libLLVMDebugInfoGSYM.a", + "libLLVMOption.a", + "libLLVMObjectYAML.a", + "libLLVMMCA.a", + "libLLVMMCDisassembler.a", + "libLLVMLTO.a", + "libLLVMPasses.a", + "libLLVMCFGuard.a", + "libLLVMCoroutines.a", + "libLLVMObjCARCOpts.a", + "libLLVMipo.a", + "libLLVMVectorize.a", + "libLLVMLinker.a", + "libLLVMInstrumentation.a", + "libLLVMFrontendOpenMP.a", + "libLLVMFrontendOpenACC.a", + "libLLVMExtensions.a", + "libLLVMDWARFLinker.a", + "libLLVMGlobalISel.a", + "libLLVMMIRParser.a", + "libLLVMAsmPrinter.a", + "libLLVMDebugInfoMSF.a", + "libLLVMDebugInfoDWARF.a", + "libLLVMSelectionDAG.a", + "libLLVMCodeGen.a", + "libLLVMIRReader.a", + "libLLVMAsmParser.a", + "libLLVMInterfaceStub.a", + "libLLVMFileCheck.a", + "libLLVMFuzzMutate.a", + "libLLVMTarget.a", + "libLLVMScalarOpts.a", + "libLLVMInstCombine.a", + "libLLVMAggressiveInstCombine.a", + "libLLVMTransformUtils.a", + "libLLVMBitWriter.a", + "libLLVMAnalysis.a", + "libLLVMProfileData.a", + "libLLVMObject.a", + "libLLVMTextAPI.a", + "libLLVMMCParser.a", + "libLLVMMC.a", + "libLLVMDebugInfoCodeView.a", + "libLLVMBitReader.a", + "libLLVMCore.a", + "libLLVMRemarks.a", + "libLLVMBitstreamReader.a", + "libLLVMBinaryFormat.a", + "libLLVMTableGen.a", + "libLLVMSupport.a", + "libLLVMDemangle.a", + "libLLVMPerfJITEvents.a", + ], + working_directory = "llvm", +) + envoy_cmake( name = "nghttp2", cache_entries = { @@ -468,21 +591,37 @@ envoy_cmake( envoy_cmake( name = "wamr", cache_entries = { - "WAMR_BUILD_AOT": "0", - "WAMR_BUILD_FAST_INTERP": "1", - "WAMR_BUILD_INTERP": "1", - "WAMR_BUILD_JIT": "0", + "LLVM_DIR": "$EXT_BUILD_DEPS/copy_llvm_15_0_7/llvm/lib/cmake/llvm", + # AOT by default + "WAMR_BUILD_AOT": "1", + "WAMR_BUILD_FAST_INTERP": "0", + "WAMR_BUILD_INTERP": "0", + "WAMR_BUILD_JIT": "1", + # disable WASI "WAMR_BUILD_LIBC_WASI": "0", - "WAMR_BUILD_MULTI_MODULE": "0", - "WAMR_BUILD_SIMD": "0", + "WAMR_BUILD_LIBC_BUILTIN": "0", + # MVP + "WAMR_BUILD_BULK_MEMORY": "1", + "WAMR_BUILD_REF_TYPES": "1", + "WAMR_BUILD_SIMD": "1", "WAMR_BUILD_TAIL_CALL": "1", + # thread mgr + "WAMR_BUILD_THREAD_MGR": "0", + # name section + "WAMR_BUILD_CUSTOM_NAME_SECTION": "1", + "WAMR_BUILD_LOAD_CUSTOM_SECTION": "1", + # trap information + "WAMR_BUILD_DUMP_CALL_STACK": "1", + # support linux perf + "WAMR_BUILD_LINUX_PERF": "1", + # others + "WAMR_BUILD_MULTI_MODULE": "0", "WAMR_BUILD_WASM_CACHE": "0", - "WAMR_DISABLE_HW_BOUND_CHECK": "0", - "WAMR_DISABLE_STACK_HW_BOUND_CHECK": "1", }, lib_source = "@com_github_wamr//:all", out_static_libs = ["libvmlib.a"], tags = ["skip_on_windows"], + deps = [":llvm_15_0_7"], ) envoy_cmake( diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 71667227f73c..1acd4eef84dc 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -343,6 +343,7 @@ def envoy_dependencies(skip_targets = []): _kafka_deps() _org_llvm_llvm() + _org_llvm_llvm_15_0_7() _com_github_wamr() _com_github_wavm_wavm() _com_github_wasmtime() @@ -1243,6 +1244,16 @@ def _org_llvm_llvm(): actual = "@envoy//bazel/foreign_cc:llvm", ) +def _org_llvm_llvm_15_0_7(): + external_http_archive( + name = "org_llvm_llvm_15_0_7", + build_file_content = BUILD_ALL_CONTENT, + ) + native.bind( + name = "llvm-15_0_7", + actual = "@envoy//bazel/foreign_cc:llvm", + ) + def _com_github_wamr(): external_http_archive( name = "com_github_wamr", diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 7f83d0cd5f5a..e8fb2f423974 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -988,22 +988,38 @@ REPOSITORY_LOCATIONS_SPEC = dict( release_date = "2021-07-09", use_category = ["dataplane_ext"], extensions = [ - "envoy.wasm.runtime.wamr", "envoy.wasm.runtime.wavm", ], cpe = "cpe:2.3:a:llvm:*:*", license = "Apache-2.0", license_url = "https://github.com/llvm/llvm-project/blob/llvmorg-{version}/llvm/LICENSE.TXT", ), + org_llvm_llvm_15_0_7 = dict( + project_name = "LLVM", + project_desc = "LLVM Compiler Infrastructure", + project_url = "https://llvm.org", + version = "15.0.7", + sha256 = "8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6", + strip_prefix = "llvm-project-{version}.src", + urls = ["https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/llvm-project-{version}.src.tar.xz"], + release_date = "2023-01-12", + use_category = ["dataplane_ext"], + extensions = [ + "envoy.wasm.runtime.wamr", + ], + cpe = "cpe:2.3:a:llvm:*:*", + license = "Apache-2.0", + license_url = "https://github.com/llvm/llvm-project/blob/llvmorg-{version}/llvm/LICENSE.TXT", + ), com_github_wamr = dict( project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", - version = "WAMR-1.2.2", - sha256 = "d328fc1e19c54cfdb4248b861de54b62977b9b85c0a40eaaeb9cd9b628c0c788", + version = "5e2011ca1d03d2499b00e423f2eeccf221a2370c", + sha256 = "b1536dd8e86571dc28268e8ef55cae21a7ec49881c675ad5a514dc14c78afcb8", strip_prefix = "wasm-micro-runtime-{version}", urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], - release_date = "2023-05-16", + release_date = "2024-03-14", use_category = ["dataplane_ext"], extensions = ["envoy.wasm.runtime.wamr"], cpe = "N/A", @@ -1340,10 +1356,10 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "WebAssembly for Proxies (C++ host implementation)", project_desc = "WebAssembly for Proxies (C++ host implementation)", project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host", - version = "5d76116c449d6892b298b7ae79a84ef1cf5752bf", - sha256 = "a5825a1a5bbd5b0178c6189b227d5cf4370ac713a883b41f6a54edd768a03cb7", + version = "3ed8a53ff4e251805a13f72db3cb8e524a78d765", + sha256 = "d2519847a985f3e38a10032ef8428adea225940da45b1f6bcf9b92e433df03ef", strip_prefix = "proxy-wasm-cpp-host-{version}", - urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"], + urls = ["https://github.com/lum1n0us/proxy-wasm-cpp-host/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], extensions = [ "envoy.access_loggers.wasm",