Unverified Commit a862be07 authored by Zexin Yuan's avatar Zexin Yuan
Browse files

python3Packages.warp-lang: 1.9.1 -> 1.10.0

parent efb24d6f
Loading
Loading
Loading
Loading
+0 −51
Original line number Diff line number Diff line
diff --git a/build_llvm.py b/build_llvm.py
index aee0a9f1..bf281f6d 100644
--- a/build_llvm.py
+++ b/build_llvm.py
@@ -402,16 +402,4 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
 
 def build_warp_clang(args, lib_name: str) -> None:
     """Build the CPU-only Warp library using Clang/LLVM."""
-
-    if sys.platform == "darwin":
-        # create a universal binary by combining x86-64 and AArch64 builds
-        build_warp_clang_for_arch(args, lib_name + "-x86_64", "x86_64")
-        build_warp_clang_for_arch(args, lib_name + "-aarch64", "aarch64")
-
-        dylib_path = os.path.join(build_path, f"bin/{lib_name}")
-        run_cmd(f"lipo -create -output {dylib_path} {dylib_path}-x86_64 {dylib_path}-aarch64")
-        os.remove(f"{dylib_path}-x86_64")
-        os.remove(f"{dylib_path}-aarch64")
-
-    else:
-        build_warp_clang_for_arch(args, lib_name, machine_architecture())
+    build_warp_clang_for_arch(args, lib_name, machine_architecture())
diff --git a/warp/build_dll.py b/warp/build_dll.py
index 2218ff13..c0d978ce 100644
--- a/warp/build_dll.py
+++ b/warp/build_dll.py
@@ -410,7 +410,7 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, arch, libs: Optional[
         includes = cpp_includes + cuda_includes
 
         if sys.platform == "darwin":
-            version = f"--target={arch}-apple-macos11"
+            version = ""
         else:
             if cpp_compiler == "g++":
                 version = "-fabi-version=13"  # GCC 8.2+
@@ -491,14 +491,4 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, arch, libs: Optional[
 
 
 def build_dll(args, dll_path, cpp_paths, cu_path, libs=None):
-    if sys.platform == "darwin":
-        # create a universal binary by combining x86-64 and AArch64 builds
-        build_dll_for_arch(args, dll_path + "-x86_64", cpp_paths, cu_path, "x86_64", libs)
-        build_dll_for_arch(args, dll_path + "-aarch64", cpp_paths, cu_path, "aarch64", libs)
-
-        run_cmd(f"lipo -create -output {dll_path} {dll_path}-x86_64 {dll_path}-aarch64")
-        os.remove(f"{dll_path}-x86_64")
-        os.remove(f"{dll_path}-aarch64")
-
-    else:
-        build_dll_for_arch(args, dll_path, cpp_paths, cu_path, machine_architecture(), libs)
+    build_dll_for_arch(args, dll_path, cpp_paths, cu_path, machine_architecture(), libs)
+19 −22
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ let
  effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else args.stdenv;
  stdenv = throw "Use effectiveStdenv instead of stdenv directly, as it may be replaced by cudaPackages.backendStdenv";

  version = "1.9.1";
  version = "1.10.0";

  libmathdx = callPackage ./libmathdx.nix { };
in
@@ -59,14 +59,10 @@ buildPythonPackage {
    owner = "NVIDIA";
    repo = "warp";
    tag = "v${version}";
    hash = "sha256-Atp3WyxQ7GYwWLmQIUgoPULyVlNjduh4/9CBixNWFwc=";
    hash = "sha256-9OEyYdVq+/SzxHfNT+sa/YeBKklaUfpKUiJZuiuzxhQ=";
  };

  patches =
    lib.optionals effectiveStdenv.hostPlatform.isDarwin [
      ./darwin-single-target.patch
    ]
    ++ lib.optionals standaloneSupport [
  patches = lib.optionals standaloneSupport [
    (replaceVars ./dynamic-link.patch {
      LLVM_LIB = llvmPackages.llvm.lib;
      LIBCLANG_LIB = llvmPackages.libclang.lib;
@@ -80,13 +76,14 @@ buildPythonPackage {
        '"-D", f"CMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 {abi_version}",  # The pre-C++11 ABI is still the default on the CentOS 7 toolchain' \
        ""

    substituteInPlace "$PWD/warp/build_dll.py" \
    substituteInPlace "$PWD/warp/_src/build_dll.py" \
      --replace-fail " -D_GLIBCXX_USE_CXX11_ABI=0" ""
  ''
  + lib.optionalString effectiveStdenv.hostPlatform.isDarwin (
    ''
      nixLog "patching $PWD/warp/build_dll.py to link against libc++"
      substituteInPlace "$PWD/warp/build_dll.py" \
      nixLog "patching $PWD/warp/_src/build_dll.py to remove macOS target flag and link against libc++"
      substituteInPlace "$PWD/warp/_src/build_dll.py" \
        --replace-fail "--target={arch}-apple-macos11" "" \
        --replace-fail 'ld_inputs = []' "ld_inputs = ['-L\"${llvmPackages.libcxx}/lib\" -lc++']"
    ''
    # AssertionError: 0.4082476496696472 != 0.40824246406555176 within 5 places
@@ -97,11 +94,11 @@ buildPythonPackage {
    ''
  )
  + lib.optionalString effectiveStdenv.cc.isClang ''
    substituteInPlace "$PWD/warp/build_dll.py" \
    substituteInPlace "$PWD/warp/_src/build_dll.py" \
      --replace-fail "clang++" "${effectiveStdenv.cc}/bin/cc"
  ''
  + lib.optionalString standaloneSupport ''
    substituteInPlace "$PWD/warp/build_dll.py" \
    substituteInPlace "$PWD/warp/_src/build_dll.py" \
      --replace-fail \
        '-I"{warp_home_path.parent}/external/llvm-project/out/install/{mode}-{arch}/include"' \
        '-I"${llvmPackages.llvm.dev}/include"' \
@@ -122,16 +119,16 @@ buildPythonPackage {
      ) cudaPackages.flags.realArches;
    in
    ''
      nixLog "patching $PWD/warp/build_dll.py to use our gencode flags"
      substituteInPlace "$PWD/warp/build_dll.py" \
      nixLog "patching $PWD/warp/_src/build_dll.py to use our gencode flags"
      substituteInPlace "$PWD/warp/_src/build_dll.py" \
        --replace-fail '*gencode_opts,' '${gencodeOpts},' \
        --replace-fail '*clang_arch_flags,' '${clangArchFlags},'
    ''
    # Patch build_dll.py to use dynamic libraries rather than static ones.
    # NOTE: We do not patch the `nvptxcompiler_static` path because it is not available as a dynamic library.
    + ''
      nixLog "patching $PWD/warp/build_dll.py to use dynamic libraries"
      substituteInPlace "$PWD/warp/build_dll.py" \
      nixLog "patching $PWD/warp/_srsc/build_dll.py to use dynamic libraries"
      substituteInPlace "$PWD/warp/_src/build_dll.py" \
        --replace-fail '-lcudart_static' '-lcudart' \
        --replace-fail '-lnvrtc_static' '-lnvrtc' \
        --replace-fail '-lnvrtc-builtins_static' '-lnvrtc-builtins' \
@@ -321,7 +318,7 @@ buildPythonPackage {
    homepage = "https://github.com/NVIDIA/warp";
    changelog = "https://github.com/NVIDIA/warp/blob/v${version}/CHANGELOG.md";
    license = lib.licenses.asl20;
    platforms = with lib.platforms; linux ++ darwin;
    platforms = lib.platforms.linux ++ [ "aarch64-darwin" ];
    maintainers = with lib.maintainers; [ yzx9 ];
  };
}
+3 −2
Original line number Diff line number Diff line
diff --git a/build_llvm.py b/build_llvm.py
index aee0a9f1..20cfe8f3 100644
index 1aa8631a..2304ce1f 100644
--- a/build_llvm.py
+++ b/build_llvm.py
@@ -350,33 +350,23 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
@@ -346,34 +346,24 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
 
         clang_dll_path = os.path.join(build_path, f"bin/{lib_name}")
 
@@ -27,6 +27,7 @@ index aee0a9f1..20cfe8f3 100644
         if os.name == "nt":
             libs.append("Version.lib")
             libs.append("Ws2_32.lib")
             libs.append("ntdll.lib")
-            libs.append(f'/LIBPATH:"{libpath}"')
+            libs.extend(f'/LIBPATH:"{libpath}"' for libpath in libpaths)
         else: