Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simdutf 6.1.0 #205349

Merged
merged 2 commits into from
Jan 24, 2025
Merged

simdutf 6.1.0 #205349

merged 2 commits into from
Jan 24, 2025

Conversation

BrewTestBot
Copy link
Member

@BrewTestBot BrewTestBot commented Jan 23, 2025

Created by brew bump


Created with brew bump-formula-pr.

  • resource blocks have been checked for updates.
release notes
## What's Changed
* Optimize icelake latin1 to utf32 for small inputs using masked AVX512 instructions by @tantei3 in https://github.com/simdutf/simdutf/pull/645
* Add CMake toolchain files for various archs by @WojciechMula in https://github.com/simdutf/simdutf/pull/643
* add test for issue 633 by @pauldreik in https://github.com/simdutf/simdutf/pull/649
* Extract ASCII validation into a separate file by @WojciechMula in https://github.com/simdutf/simdutf/pull/646
* Sort out including scalar/* files by @WojciechMula in https://github.com/simdutf/simdutf/pull/650
* Simplify calculating length latin1 <=> UTF16/UTF32 by @WojciechMula in https://github.com/simdutf/simdutf/pull/652
* Refactor amalgamate.py by @WojciechMula in https://github.com/simdutf/simdutf/pull/653
* Fix fuzz test failure in lsx and lasx by @Xiao-Tao in https://github.com/simdutf/simdutf/pull/654
* Enable selective amalgamation by @WojciechMula in https://github.com/simdutf/simdutf/pull/637
* Optimized icelake AVX512 for utf32 to utf16 conversion by @tantei3 in https://github.com/simdutf/simdutf/pull/648

Full Changelog: simdutf/simdutf@v6.0.3...v6.1.0

@github-actions github-actions bot added bump-formula-pr PR was created using `brew bump-formula-pr` no Linux bottle Formula has no Linux bottle icu4c ICU use is a significant feature of the PR or issue labels Jan 23, 2025
@daeho-ro
Copy link
Member

cd /tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/build/tests/reference && /opt/homebrew/Library/Homebrew/shims/mac/super/clang++  -I/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/include -O3 -DNDEBUG -std=c++11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -fPIC -MD -MT tests/reference/CMakeFiles/simdutf_tests_reference.dir/encode_latin1.cpp.o -MF CMakeFiles/simdutf_tests_reference.dir/encode_latin1.cpp.o.d -o CMakeFiles/simdutf_tests_reference.dir/encode_latin1.cpp.o -c /tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/tests/reference/encode_latin1.cpp
  fatal: not a git repository (or any of the parent directories): .git
  using env variable AMALGAMATE_SOURCE_PATH=/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/src
  using env variable AMALGAMATE_OUTPUT_PATH=/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/build/singleheader
  SCRIPTPATH=/tmp/simdutf-[202](https://github.com/Homebrew/homebrew-core/actions/runs/12939781735/job/36092978643?pr=205349#step:3:203)50123-5191-lh9adf/simdutf-6.1.0/singleheader PROJECTPATH=/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0
  We are about to amalgamate all simdutf files into one source file.
  See https://www.sqlite.org/amalgamation.html and https://en.wikipedia.org/wiki/Single_Compilation_Unit for rationale.
  Traceback (most recent call last):
    File "/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/singleheader/amalgamate.py", line 478, in <module>
      main()
    File "/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/singleheader/amalgamate.py", line 40, in main
      context.timestamp        = get_timestamp()
    File "/tmp/simdutf-20250123-5191-lh9adf/simdutf-6.1.0/singleheader/amalgamate.py", line 236, in get_timestamp
      raise ValueError(f"non-zero exit code {ret.returncode}")
  ValueError: non-zero exit code 128
  make[2]: *** [singleheader/simdutf.cpp] Error 1
  make[1]: *** [singleheader/CMakeFiles/simdutf-singleheader-files.dir/all] Error 2
  make[1]: *** Waiting for unfinished jobs....

@daeho-ro daeho-ro added the build failure CI fails while building the software label Jan 23, 2025
@botantony
Copy link
Contributor

This patch may fix the issue:

diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py
index 5b18ea16..d600647e 100755
--- a/singleheader/amalgamate.py
+++ b/singleheader/amalgamate.py
@@ -7,6 +7,7 @@
 import os.path
 import subprocess
 import os
+import pathlib
 import re
 import shutil
 import datetime
@@ -229,15 +230,24 @@ def get_timestamp():
     # Forcing it to be UTC is difficult, because it needs to be portable
     # between gnu date and busybox date.
     try:
-        ret = subprocess.run(['git', 'show', '-s', '--format=%ci', 'HEAD'],
-                             stdout=subprocess.PIPE)
+        # avoid git going outside simdutf, which could happen when
+        # unpacking a release tarball inside a subdirectory of an unrelated
+        # git repository. that would lead to picking up the timestamp of the
+        # unrelated git repository.
+        parent = pathlib.Path(SCRIPTPATH).absolute().parent
+        GIT_CEILING_DIRECTORIES = str(parent)
+        ret = subprocess.run(['git', '-C', SCRIPTPATH, 'show', '-s', '--format=%ci', 'HEAD'],
+                             stdout=subprocess.PIPE,
+                             env=dict(os.environ, GIT_CEILING_DIRECTORIES=GIT_CEILING_DIRECTORIES))
 
         if ret.returncode != 0:
-            raise ValueError(f"non-zero exit code {ret.returncode}")
+            print(f"git called resulted in non-zero exit code {ret.returncode}")
+            print("timestamp based on current time")
+            return str(datetime.datetime.now())
 
         return ret.stdout.decode('utf-8').strip()
     except (UnicodeDecodeError, FileNotFoundError):
-        print("git not found, timestamp based on current time")
+        print("UnicodeDecodeError or FileNotFoundError, timestamp based on current time")
         return str(datetime.datetime.now())

@chenrui333
Copy link
Member

@botantony yeah, that is what I was thinking yesterday :) can you filed an upstream PR on it? thanks! 🙏

@botantony
Copy link
Contributor

Unfortunately I cannot do upstream PR due to lack of permissions (I am a contributor, not organization member).
Here's the final formula with applied patch:

class Simdutf < Formula
  desc "Unicode conversion routines, fast"
  homepage "https://github.com/simdutf/simdutf"
  url "https://github.com/simdutf/simdutf/archive/refs/tags/v6.1.0.tar.gz"
  sha256 "ef2903a7f085090c58f3acfa93a62733ae92a3f9b1d50800edec77a6816d7d67"
  license any_of: ["Apache-2.0", "MIT"]
  head "https://github.com/simdutf/simdutf.git", branch: "master"

  livecheck do
    url :stable
    regex(/^v?(\d+(?:\.\d+)+)$/i)
  end

  bottle do
    sha256 cellar: :any, arm64_sequoia: "e4e6f6c35a03b5298d8fc5e903f4f052f6a836d714182f8cdf8a6a249fd95a3c"
    sha256 cellar: :any, arm64_sonoma:  "78d81462239a71c50179a65e9ae63bda64ab170e1a0f54e97db4f765ab2e4265"
    sha256 cellar: :any, arm64_ventura: "0847766dd42149d771e60db322a329e54bb8b65c8feb1031b0a6cd35bca79b3a"
    sha256 cellar: :any, sonoma:        "1f6835d989644af3e6db2ac1c785b37c2e14bb8ad539d78e773baac200c8bc3f"
    sha256 cellar: :any, ventura:       "680f6afecf5b1b5e35330e5351e6eb34d87486e961f52f66b8fa5cf8cab9e056"
  end

  depends_on "cmake" => :build
  depends_on "icu4c@76"
  depends_on macos: :catalina

  uses_from_macos "python" => :build

  patch :DATA

  # VERSION=#{version} && curl -s https://raw.githubusercontent.com/simdutf/simdutf/v$VERSION/benchmarks/base64/CMakeLists.txt | grep -C 1 'VERSION'
  resource "base64" do
    url "https://github.com/aklomp/base64/archive/refs/tags/v0.5.2.tar.gz"
    sha256 "723a0f9f4cf44cf79e97bcc315ec8f85e52eb104c8882942c3f2fba95acc080d"
  end

  def install
    (buildpath/"base64").install resource("base64")

    args = %W[
      -DBUILD_SHARED_LIBS=ON
      -DCMAKE_INSTALL_RPATH=#{rpath}
      -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
      -DFETCHCONTENT_SOURCE_DIR_BASE64=#{buildpath}/base64
      -DPython3_EXECUTABLE=#{which("python3")}
      -DSIMDUTF_BENCHMARKS=ON
    ]
    system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
    system "cmake", "--build", "build"
    system "cmake", "--install", "build"
    bin.install "build/benchmarks/benchmark" => "sutf-benchmark"
  end

  test do
    system bin/"sutf-benchmark", "--random-utf8", "1024", "-I", "20"
  end
end

__END__
diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py
index 5b18ea16..d600647e 100755
--- a/singleheader/amalgamate.py
+++ b/singleheader/amalgamate.py
@@ -7,6 +7,7 @@
 import os.path
 import subprocess
 import os
+import pathlib
 import re
 import shutil
 import datetime
@@ -229,15 +230,24 @@ def get_timestamp():
     # Forcing it to be UTC is difficult, because it needs to be portable
     # between gnu date and busybox date.
     try:
-        ret = subprocess.run(['git', 'show', '-s', '--format=%ci', 'HEAD'],
-                             stdout=subprocess.PIPE)
+        # avoid git going outside simdutf, which could happen when
+        # unpacking a release tarball inside a subdirectory of an unrelated
+        # git repository. that would lead to picking up the timestamp of the
+        # unrelated git repository.
+        parent = pathlib.Path(SCRIPTPATH).absolute().parent
+        GIT_CEILING_DIRECTORIES = str(parent)
+        ret = subprocess.run(['git', '-C', SCRIPTPATH, 'show', '-s', '--format=%ci', 'HEAD'],
+                             stdout=subprocess.PIPE,
+                             env=dict(os.environ, GIT_CEILING_DIRECTORIES=GIT_CEILING_DIRECTORIES))

         if ret.returncode != 0:
-            raise ValueError(f"non-zero exit code {ret.returncode}")
+            print(f"git called resulted in non-zero exit code {ret.returncode}")
+            print("timestamp based on current time")
+            return str(datetime.datetime.now())

         return ret.stdout.decode('utf-8').strip()
     except (UnicodeDecodeError, FileNotFoundError):
-        print("git not found, timestamp based on current time")
+        print("UnicodeDecodeError or FileNotFoundError, timestamp based on current time")
         return str(datetime.datetime.now())

@botantony
Copy link
Contributor

forgot to ping @chenrui333

@chenrui333
Copy link
Member

oh, there is already a PR on this, simdutf/simdutf#657

simdutf: add git patch

Signed-off-by: Rui Chen <[email protected]>
@chenrui333 chenrui333 added ready to merge PR can be merged once CI is green and removed build failure CI fails while building the software labels Jan 24, 2025
Copy link
Contributor

🤖 An automated task has requested bottles to be published to this PR.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Jan 24, 2025
@BrewTestBot BrewTestBot enabled auto-merge January 24, 2025 22:00
@BrewTestBot BrewTestBot added this pull request to the merge queue Jan 24, 2025
Merged via the queue into master with commit a694fb1 Jan 24, 2025
15 checks passed
@BrewTestBot BrewTestBot deleted the bump-simdutf-6.1.0 branch January 24, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump-formula-pr PR was created using `brew bump-formula-pr` CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. icu4c ICU use is a significant feature of the PR or issue no Linux bottle Formula has no Linux bottle ready to merge PR can be merged once CI is green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants