Skip to content

Commit 65ced5c

Browse files
authored
Merge pull request #196547 from Homebrew/onnxruntime-1.20.0
onnxruntime 1.20.0
2 parents 1083792 + 8fefa58 commit 65ced5c

File tree

1 file changed

+87
-18
lines changed

1 file changed

+87
-18
lines changed

Formula/o/onnxruntime.rb

Lines changed: 87 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ class Onnxruntime < Formula
22
desc "Cross-platform, high performance scoring engine for ML models"
33
homepage "https://github.com/microsoft/onnxruntime"
44
url "https://github.com/microsoft/onnxruntime.git",
5-
tag: "v1.17.1",
6-
revision: "8f5c79cb63f09ef1302e85081093a3fe4da1bc7d"
5+
tag: "v1.20.0",
6+
revision: "c4fb724e810bb496165b9015c77f402727392933"
77
license "MIT"
88

99
livecheck do
@@ -12,30 +12,86 @@ class Onnxruntime < Formula
1212
end
1313

1414
bottle do
15-
sha256 cellar: :any, arm64_sonoma: "d97103bb5f94fab8a364c031879f186079ec34ff3e3034d9f9a9d941cfa7ba99"
16-
sha256 cellar: :any, arm64_ventura: "7515067567fb810bd6a49b9b221458cd6a7c377e220279f199151808a9e1bfc1"
17-
sha256 cellar: :any, arm64_monterey: "b9963245e88af5ef863bcf0e8d28c078c312ab31d330eae4e69c243837281ec4"
18-
sha256 cellar: :any, sonoma: "31bd37397424abc33c1981dede657ba0f1b7209262c70854b774841857809b88"
19-
sha256 cellar: :any, ventura: "eab070cc7924e3b5d38277f24b3313c4b181e6fd9a7f4f8e0f539a057ff1f544"
20-
sha256 cellar: :any, monterey: "aa8b359507d4b024ce46baadf0c75772fe1ba6ffb3e43551cf6e3d6b7a487fc9"
21-
sha256 cellar: :any_skip_relocation, x86_64_linux: "dde778dd1564940af7b2116cba7d4c8b45b4d6e335c78620cf97b1e1e6a688b1"
15+
sha256 cellar: :any, arm64_sequoia: "89afd3b53934d9f0a30347a77ade4125439dd36100a5963042b8ec887166d84f"
16+
sha256 cellar: :any, arm64_sonoma: "d2ff2da6a74099a7f9feb7bbd7eefe5ae8d85cae62c84b619d4f5f677e9ffeec"
17+
sha256 cellar: :any, arm64_ventura: "1067d78cfd1733723cb9d8311c5001bca0850d31df5980bd4e99a3219b5dd006"
18+
sha256 cellar: :any, sonoma: "397d5caa78399e71a210e9a28d785b904fe8c8f6d2f2bf71eaed0bc43091ff93"
19+
sha256 cellar: :any, ventura: "889cd506031e2db70625859623edd40b88157735e73fccba5d7336bdc10f2f3a"
20+
sha256 cellar: :any_skip_relocation, x86_64_linux: "e25d31a6f9ea4d9e895e3da3ec523387179274f6b021777301acc87d35ba4cf5"
2221
end
2322

23+
depends_on "boost" => :build
2424
depends_on "cmake" => :build
25-
depends_on "[email protected]" => :build
25+
depends_on "cpp-gsl" => :build
26+
depends_on "flatbuffers" => :build # NOTE: links to static library
27+
depends_on "howard-hinnant-date" => :build
28+
depends_on "nlohmann-json" => :build
29+
depends_on "[email protected]" => :build
30+
depends_on "safeint" => :build
31+
depends_on "abseil"
32+
depends_on "nsync"
33+
depends_on "protobuf@21" # https://github.com/microsoft/onnxruntime/issues/21308
34+
depends_on "re2"
2635

27-
fails_with gcc: "5" # GCC version < 7 is no longer supported
36+
# Need newer than stable `eigen` after https://github.com/microsoft/onnxruntime/pull/21492
37+
# element_wise_ops.cc:708:32: error: no matching member function for call to 'min'
38+
#
39+
# https://github.com/microsoft/onnxruntime/blob/v#{version}/cmake/deps.txt#L25
40+
resource "eigen" do
41+
url "https://gitlab.com/libeigen/eigen/-/archive/e7248b26a1ed53fa030c5c459f7ea095dfd276ac/eigen-e7248b26a1ed53fa030c5c459f7ea095dfd276ac.tar.bz2"
42+
sha256 "a3f1724de1dc7e7f74fbcc206ffcaeba27fd89b37dc71f9c31e505634d0c1634"
43+
end
44+
45+
# https://github.com/microsoft/onnxruntime/blob/v#{version}/cmake/deps.txt#L52
46+
resource "pytorch_cpuinfo" do
47+
url "https://github.com/pytorch/cpuinfo/archive/ca678952a9a8eaa6de112d154e8e104b22f9ab3f.tar.gz"
48+
sha256 "c8f43b307fa7d911d88fec05448161eb1949c3fc0cb62f3a7a2c61928cdf2e9b"
49+
end
50+
51+
# TODO: Consider making separate formula
52+
resource "onnx" do
53+
url "https://github.com/onnx/onnx/archive/refs/tags/v1.17.0.tar.gz"
54+
sha256 "8d5e983c36037003615e5a02d36b18fc286541bf52de1a78f6cf9f32005a820e"
55+
end
56+
57+
# Fix build on Linux
58+
# TODO: Upstream if it works
59+
patch :DATA
2860

2961
def install
30-
cmake_args = %W[
31-
-Donnxruntime_RUN_ONNX_TESTS=OFF
32-
-Donnxruntime_GENERATE_TEST_REPORTS=OFF
33-
-DPYTHON_EXECUTABLE=#{which("python3.12")}
62+
python3 = which("python3.13")
63+
64+
# Workaround to use brew `nsync`. Remove in future release with
65+
# https://github.com/microsoft/onnxruntime/commit/88676e62b966add2cc144a4e7d8ae1dbda1148e8
66+
inreplace "cmake/external/onnxruntime_external_deps.cmake" do |s|
67+
s.gsub!(/ NAMES nsync unofficial-nsync$/, " NAMES nsync_cpp")
68+
s.gsub!(/\bunofficial::nsync::nsync_cpp\b/, "nsync_cpp")
69+
end
70+
71+
resources.each do |r|
72+
(buildpath/"build/_deps/#{r.name}-src").install r
73+
end
74+
75+
args = %W[
76+
-DHOMEBREW_ALLOW_FETCHCONTENT=ON
77+
-DFETCHCONTENT_FULLY_DISCONNECTED=ON
78+
-DFETCHCONTENT_SOURCE_DIR_PYTORCH_CLOG=#{buildpath}/build/_deps/pytorch_cpuinfo-src
79+
-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS
80+
-DPYTHON_EXECUTABLE=#{python3}
81+
-DONNX_CUSTOM_PROTOC_EXECUTABLE=#{Formula["protobuf@21"].opt_bin}/protoc
3482
-Donnxruntime_BUILD_SHARED_LIB=ON
3583
-Donnxruntime_BUILD_UNIT_TESTS=OFF
84+
-Donnxruntime_GENERATE_TEST_REPORTS=OFF
85+
-Donnxruntime_RUN_ONNX_TESTS=OFF
86+
-Donnxruntime_USE_FULL_PROTOBUF=ON
3687
]
3788

38-
system "cmake", "-S", "cmake", "-B", "build", *cmake_args, *std_cmake_args
89+
# Regenerate C++ bindings to use newer `flatbuffers`
90+
flatc = Formula["flatbuffers"].opt_bin/"flatc"
91+
system python3, "onnxruntime/core/flatbuffers/schema/compile_schema.py", "--flatc", flatc
92+
system python3, "onnxruntime/lora/adapter_format/compile_schema.py", "--flatc", flatc
93+
94+
system "cmake", "-S", "cmake", "-B", "build", *args, *std_cmake_args
3995
system "cmake", "--build", "build"
4096
system "cmake", "--install", "build"
4197
end
@@ -50,8 +106,21 @@ def install
50106
return 0;
51107
}
52108
C
53-
system ENV.cc, "-I#{include}", testpath/"test.c",
54-
"-L#{lib}", "-lonnxruntime", "-o", testpath/"test"
109+
system ENV.cc, "-I#{include}", "test.c", "-L#{lib}", "-lonnxruntime", "-o", "test"
55110
assert_equal version, shell_output("./test").strip
56111
end
57112
end
113+
114+
__END__
115+
diff --git a/onnxruntime/core/optimizer/transpose_optimization/onnx_transpose_optimization.cc b/onnxruntime/core/optimizer/transpose_optimization/onnx_transpose_optimization.cc
116+
index 470838d36e..81a842eb87 100644
117+
--- a/onnxruntime/core/optimizer/transpose_optimization/onnx_transpose_optimization.cc
118+
+++ b/onnxruntime/core/optimizer/transpose_optimization/onnx_transpose_optimization.cc
119+
@@ -5,6 +5,7 @@
120+
121+
#include <algorithm>
122+
#include <cassert>
123+
+#include <cstring>
124+
#include <iostream>
125+
#include <memory>
126+
#include <unordered_map>

0 commit comments

Comments
 (0)