From adaefcb7b41acf0e2b34498613ea39990698f793 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 31 Oct 2024 23:21:12 +0200 Subject: [PATCH 01/23] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/06cf0e1da4208d3766d898b7fdab6513366d45b9' (2024-09-29) → 'github:NixOS/nixpkgs/807e9154dcb16384b1b765ebe9cd2bba2ac287fd' (2024-10-29) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index e5b14f2..d6a0883 100644 --- a/flake.lock +++ b/flake.lock @@ -18,11 +18,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727634051, - "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", "type": "github" }, "original": { From 268673f04bb3dcab9306d579d6e24646777ce293 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 17 Oct 2024 20:25:30 +0300 Subject: [PATCH 02/23] buda things --- docker/nix/default.nix | 68 +++ docker/nix/fake_nixpkgs/default.nix | 10 + docker/nix/root/etc/group | 21 + docker/nix/root/etc/nsswitch.conf | 11 + docker/nix/root/etc/passwd | 34 ++ flake.nix | 7 + pkgs/buda-docker/default.nix | 41 ++ pkgs/buda-prebuilt/default.nix | 181 ++++++++ pkgs/buda-prebuilt/test.py | 26 ++ pkgs/buda-prebuilt/vendored/auto-patchelf.py | 439 ++++++++++++++++++ pkgs/buda-prebuilt/vendored/auto-patchelf.sh | 20 + pkgs/buda-prebuilt/vendored/boost/1.74.nix | 15 + .../vendored/boost/cmake-paths-173.patch | 22 + .../vendored/boost/cmake-paths.patch | 21 + .../boost/darwin-no-system-python.patch | 45 ++ pkgs/buda-prebuilt/vendored/boost/default.nix | 20 + pkgs/buda-prebuilt/vendored/boost/generic.nix | 249 ++++++++++ .../boost/pthread-stack-min-fix.patch | 15 + pkgs/buda-prebuilt/vendored/libyaml-cpp.nix | 24 + .../vendored/nuke-references.nix | 43 ++ pkgs/buda-prebuilt/vendored/nuke-refs.sh | 34 ++ .../vendored/pip-install-hook.sh | 24 + pkgs/buda/default.nix | 58 +++ 23 files changed, 1428 insertions(+) create mode 100644 docker/nix/default.nix create mode 100644 docker/nix/fake_nixpkgs/default.nix create mode 100644 docker/nix/root/etc/group create mode 100644 docker/nix/root/etc/nsswitch.conf create mode 100644 docker/nix/root/etc/passwd create mode 100644 pkgs/buda-docker/default.nix create mode 100644 pkgs/buda-prebuilt/default.nix create mode 100644 pkgs/buda-prebuilt/test.py create mode 100644 pkgs/buda-prebuilt/vendored/auto-patchelf.py create mode 100644 pkgs/buda-prebuilt/vendored/auto-patchelf.sh create mode 100644 pkgs/buda-prebuilt/vendored/boost/1.74.nix create mode 100644 pkgs/buda-prebuilt/vendored/boost/cmake-paths-173.patch create mode 100644 pkgs/buda-prebuilt/vendored/boost/cmake-paths.patch create mode 100644 pkgs/buda-prebuilt/vendored/boost/darwin-no-system-python.patch create mode 100644 pkgs/buda-prebuilt/vendored/boost/default.nix create mode 100644 pkgs/buda-prebuilt/vendored/boost/generic.nix create mode 100644 pkgs/buda-prebuilt/vendored/boost/pthread-stack-min-fix.patch create mode 100644 pkgs/buda-prebuilt/vendored/libyaml-cpp.nix create mode 100644 pkgs/buda-prebuilt/vendored/nuke-references.nix create mode 100644 pkgs/buda-prebuilt/vendored/nuke-refs.sh create mode 100644 pkgs/buda-prebuilt/vendored/pip-install-hook.sh create mode 100644 pkgs/buda/default.nix diff --git a/docker/nix/default.nix b/docker/nix/default.nix new file mode 100644 index 0000000..d5a44fd --- /dev/null +++ b/docker/nix/default.nix @@ -0,0 +1,68 @@ +{ dockerTools +, bashInteractive +, cacert +, coreutils +, curl +, gitReallyMinimal +, gnutar +, gzip +, iana-etc +, nix +, openssh +, xz +, fromImage +, extraContents ? [ ] +, extraEnv ? [ ] +}: +let + image = dockerTools.buildImageWithNixDb { + inherit (nix) name; + inherit fromImage; + + contents = [ + ./root + coreutils + # add /bin/sh + bashInteractive + nix + + # runtime dependencies of nix + cacert + gitReallyMinimal + gnutar + gzip + openssh + xz + + # for haskell binaries + iana-etc + ] ++ extraContents; + + extraCommands = '' + # for /usr/bin/env + mkdir usr + ln -s ../bin usr/bin + + # make sure /tmp exists + mkdir -m 1777 tmp + + # need a HOME + mkdir -vp root + ''; + + config = { + Cmd = [ "/bin/bash" ]; + Env = [ + "ENV=/etc/profile.d/nix.sh" + "BASH_ENV=/etc/profile.d/nix.sh" + "NIX_BUILD_SHELL=/bin/bash" + "NIX_PATH=nixpkgs=${./fake_nixpkgs}" + "PAGER=cat" + "PATH=/usr/bin:/bin" + "SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt" + "USER=root" + ] ++ extraEnv; + }; + }; +in +image // { meta = nix.meta // image.meta; } diff --git a/docker/nix/fake_nixpkgs/default.nix b/docker/nix/fake_nixpkgs/default.nix new file mode 100644 index 0000000..eee7aac --- /dev/null +++ b/docker/nix/fake_nixpkgs/default.nix @@ -0,0 +1,10 @@ +_: +throw '' + This container doesn't include nixpkgs. + + The best way to work around that is to pin your dependencies. See + https://nix.dev/tutorials/first-steps/towards-reproducibility-pinning-nixpkgs.html + + Or if you must, override the NIX_PATH environment variable with eg: + "NIX_PATH=nixpkgs=channel:nixos-unstable" +'' diff --git a/docker/nix/root/etc/group b/docker/nix/root/etc/group new file mode 100644 index 0000000..162f79f --- /dev/null +++ b/docker/nix/root/etc/group @@ -0,0 +1,21 @@ +root:x:0: +wheel:x:1: +kmem:x:2: +tty:x:3: +messagebus:x:4: +disk:x:6: +audio:x:17: +floppy:x:18: +uucp:x:19: +lp:x:20: +cdrom:x:24: +tape:x:25: +video:x:26: +dialout:x:27: +utmp:x:29: +adm:x:55: +keys:x:96: +users:x:100: +input:x:174: +nixbld:x:30000:nixbld1,nixbld10,nixbld11,nixbld12,nixbld13,nixbld14,nixbld15,nixbld16,nixbld17,nixbld18,nixbld19,nixbld2,nixbld20,nixbld21,nixbld22,nixbld23,nixbld24,nixbld25,nixbld26,nixbld27,nixbld28,nixbld29,nixbld3,nixbld30,nixbld31,nixbld32,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9 +nogroup:x:65534: diff --git a/docker/nix/root/etc/nsswitch.conf b/docker/nix/root/etc/nsswitch.conf new file mode 100644 index 0000000..59a2141 --- /dev/null +++ b/docker/nix/root/etc/nsswitch.conf @@ -0,0 +1,11 @@ +passwd: files mymachines systemd +group: files mymachines systemd +shadow: files + +hosts: files mymachines dns myhostname +networks: files + +ethers: files +services: files +protocols: files +rpc: files diff --git a/docker/nix/root/etc/passwd b/docker/nix/root/etc/passwd new file mode 100644 index 0000000..006b53f --- /dev/null +++ b/docker/nix/root/etc/passwd @@ -0,0 +1,34 @@ +root:x:0:0:System administrator:/root:/bin/bash +nixbld1:x:30001:30000:Nix build user 1:/var/empty:/run/current-system/sw/bin/nologin +nixbld2:x:30002:30000:Nix build user 2:/var/empty:/run/current-system/sw/bin/nologin +nixbld3:x:30003:30000:Nix build user 3:/var/empty:/run/current-system/sw/bin/nologin +nixbld4:x:30004:30000:Nix build user 4:/var/empty:/run/current-system/sw/bin/nologin +nixbld5:x:30005:30000:Nix build user 5:/var/empty:/run/current-system/sw/bin/nologin +nixbld6:x:30006:30000:Nix build user 6:/var/empty:/run/current-system/sw/bin/nologin +nixbld7:x:30007:30000:Nix build user 7:/var/empty:/run/current-system/sw/bin/nologin +nixbld8:x:30008:30000:Nix build user 8:/var/empty:/run/current-system/sw/bin/nologin +nixbld9:x:30009:30000:Nix build user 9:/var/empty:/run/current-system/sw/bin/nologin +nixbld10:x:30010:30000:Nix build user 10:/var/empty:/run/current-system/sw/bin/nologin +nixbld11:x:30011:30000:Nix build user 11:/var/empty:/run/current-system/sw/bin/nologin +nixbld12:x:30012:30000:Nix build user 12:/var/empty:/run/current-system/sw/bin/nologin +nixbld13:x:30013:30000:Nix build user 13:/var/empty:/run/current-system/sw/bin/nologin +nixbld14:x:30014:30000:Nix build user 14:/var/empty:/run/current-system/sw/bin/nologin +nixbld15:x:30015:30000:Nix build user 15:/var/empty:/run/current-system/sw/bin/nologin +nixbld16:x:30016:30000:Nix build user 16:/var/empty:/run/current-system/sw/bin/nologin +nixbld17:x:30017:30000:Nix build user 17:/var/empty:/run/current-system/sw/bin/nologin +nixbld18:x:30018:30000:Nix build user 18:/var/empty:/run/current-system/sw/bin/nologin +nixbld19:x:30019:30000:Nix build user 19:/var/empty:/run/current-system/sw/bin/nologin +nixbld20:x:30020:30000:Nix build user 20:/var/empty:/run/current-system/sw/bin/nologin +nixbld21:x:30021:30000:Nix build user 21:/var/empty:/run/current-system/sw/bin/nologin +nixbld22:x:30022:30000:Nix build user 22:/var/empty:/run/current-system/sw/bin/nologin +nixbld23:x:30023:30000:Nix build user 23:/var/empty:/run/current-system/sw/bin/nologin +nixbld24:x:30024:30000:Nix build user 24:/var/empty:/run/current-system/sw/bin/nologin +nixbld25:x:30025:30000:Nix build user 25:/var/empty:/run/current-system/sw/bin/nologin +nixbld26:x:30026:30000:Nix build user 26:/var/empty:/run/current-system/sw/bin/nologin +nixbld27:x:30027:30000:Nix build user 27:/var/empty:/run/current-system/sw/bin/nologin +nixbld28:x:30028:30000:Nix build user 28:/var/empty:/run/current-system/sw/bin/nologin +nixbld29:x:30029:30000:Nix build user 29:/var/empty:/run/current-system/sw/bin/nologin +nixbld30:x:30030:30000:Nix build user 30:/var/empty:/run/current-system/sw/bin/nologin +nixbld31:x:30031:30000:Nix build user 31:/var/empty:/run/current-system/sw/bin/nologin +nixbld32:x:30032:30000:Nix build user 32:/var/empty:/run/current-system/sw/bin/nologin +nobody:x:65534:65534:Unprivileged account (don't use!):/var/empty:/run/current-system/sw/bin/nologin diff --git a/flake.nix b/flake.nix index a8d0a90..24f25bf 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,10 @@ }; umd = callPackage ./pkgs/umd { }; metal = callPackage ./pkgs/metal { }; + buda-docker = callPackage ./pkgs/buda-docker { }; + # Will be difficult to get these 2 working and keep them working + buda-prebuilt = callPackage ./pkgs/buda-prebuilt { }; + buda = callPackage ./pkgs/buda { }; } ); @@ -61,6 +65,9 @@ flash = scope.flash; umd = scope.umd; metal = scope.metal; + buda-docker = scope.buda-docker; + buda-prebuilt = scope.buda-prebuilt; + buda = scope.buda; default = self.packages.${system}.smi; }; diff --git a/pkgs/buda-docker/default.nix b/pkgs/buda-docker/default.nix new file mode 100644 index 0000000..95af17a --- /dev/null +++ b/pkgs/buda-docker/default.nix @@ -0,0 +1,41 @@ +{ + dockerTools, + callPackage, + git, +}: + +let + budaDocker = dockerTools.pullImage { + imageName = "ghcr.io/tenstorrent/tt-buda/ubuntu-22-04-amd64/wh_b0"; + imageDigest = "sha256:3a6f84ed355c8738432737f6498745c4bee235b871e97608394e29e396ff6925"; + sha256 = "1vx7v9yx211dibshzgzz9zwm9xgkfj25iabplff19hx687w0n3sz"; + finalImageName = "ghcr.io/tenstorrent/tt-buda/ubuntu-22-04-amd64/wh_b0"; + finalImageTag = "v0.19.3"; + }; + + #nixDocker = dockerTools.pullImage { + # imageName = "nixpkgs/nix-flakes"; + # imageDigest = "sha256:cab18b64d25e4bc30415758d6e2f6bc05ecf6ae576092c0cf407b1cebb1ea0e5"; + # sha256 = "0v4npm2h4z0k3y0h75zsk3q589vhris76g4vg5gkjlfbg16c822j"; + # finalImageName = "nixpkgs/nix-flakes"; + # finalImageTag = "latest"; + #}; + + nixDocker = callPackage ../../docker/nix/default.nix { + fromImage = budaDocker; + + # gitMinimal still ships with perl and python + gitReallyMinimal = + (git.override { + perlSupport = false; + pythonSupport = false; + withManual = false; + withpcre2 = false; + }).overrideAttrs + (_: { + # installCheck is broken when perl is disabled + doInstallCheck = false; + }); + }; +in +budaDocker diff --git a/pkgs/buda-prebuilt/default.nix b/pkgs/buda-prebuilt/default.nix new file mode 100644 index 0000000..4d4eb93 --- /dev/null +++ b/pkgs/buda-prebuilt/default.nix @@ -0,0 +1,181 @@ +{ + lib, + python310Packages, + fetchzip, + stdenv, + callPackage, + __splicedPackages, + darwin, + runCommand, +}: + +let + python3Packages = python310Packages; + pkgs = __splicedPackages; + + boost_1_74 = (callPackage ./vendored/boost/default.nix { }).boost174; + yaml-cpp_0_6 = callPackage ./vendored/libyaml-cpp.nix { }; + + prebuilt-buda = fetchzip { + url = "https://github.com/tenstorrent/tt-buda/releases/download/v0.19.3/pybuda-wh.b0-v0.19.3-ubuntu-22-04-amd64-python3.10.zip"; + hash = "sha256-M9sgFKSmWra+BglEWgrfFPJRS+UIVKUG+ZF1oTPVexg="; + stripRoot = false; + }; + + pipInstallHook' = python3Packages.callPackage ( + { makePythonHook, pip }: + makePythonHook { + name = "pip-install-hook"; + propagatedBuildInputs = [ pip ]; + substitutions = { + pythonInterpreter = python3Packages.python.interpreter; + pythonSitePackages = python3Packages.python.sitePackages; + }; + } ./vendored/pip-install-hook.sh + ) { }; + + nukeReferences = callPackage ./vendored/nuke-references.nix { + inherit (darwin) signingUtils; + }; + + autoPatchelfHook = callPackage ( + { makeSetupHook, bintools }: + makeSetupHook { + name = "auto-patchelf-hook"; + propagatedBuildInputs = [ + bintools + ]; + substitutions = { + pythonInterpreter = "${python3Packages.python.withPackages (ps: [ ps.pyelftools ])}/bin/python"; + autoPatchelfScript = ./vendored/auto-patchelf.py; + }; + } ./auto-patchelf.sh + ) { }; + + tt-buda = stdenv.mkDerivation rec { + pname = "tt-buda"; + version = "0.19.3"; + format = "wheel"; + + src = prebuilt-buda; + + nativeBuildInputs = [ + pipInstallHook' + nukeReferences + ]; + + preInstall = '' + mkdir dist + mv *.whl dist/ + ''; + + postInstall = '' + find $out -name "__pycache__" -type d | xargs rm -rf + + find $out/bin/ -type f -not -name 'debuda' -print0 | xargs -0 rm -- + substituteInPlace $out/bin/debuda \ + --replace-fail "${python3Packages.python.interpreter}" "/usr/bin/env python3" + + # error: illegal path references in fixed-output derivation + find $out -print0 | xargs -0 nuke-refs + + ''; + + dontPatchShebangs = true; + dontFixup = true; + + outputHash = "sha256-eSU10kgIQzJ0kv6gmQwMCdVw0uBpohVyYqkjK4RU2ng="; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + + meta = { + description = "Tenstorrent TT-BUDA Repository"; + homepage = "https://github.com/tenstorrent/tt-buda"; + license = lib.licenses.asl20; + mainProgram = "tt-buda"; + }; + }; + + tt-buda-final = python3Packages.toPythonModule ( + stdenv.mkDerivation (finalAttrs: { + pname = "tt-buda-final"; + inherit (tt-buda) version; + + nativeBuildInputs = [ + autoPatchelfHook + python3Packages.pythonImportsCheckHook + ]; + + buildInputs = + with pkgs; + [ + stdenv.cc.libc.libgcc + stdenv.cc.libc.libgcc.lib + libpng + python3Packages.python + ncurses + expat + hwloc + zeromq + libjpeg8 + glib + libGL + boost_1_74 + yaml-cpp_0_6 + ] + ++ (with pkgs.xorg; [ + libxcb + libXext + libX11 + libSM + libICE + ]); + + #runtimeDependencies = [ + # # from torch._C import * # noqa: F403 + # # ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory + # stdenv.cc.libc.libgcc.lib + + #]; + + #pythonImportsCheck = [ + # "pybuda" + # "torch" + #]; + + passthru = { + inherit tt-buda yaml-cpp_0_6 boost_1_74; + pythonWith = python3Packages.python.withPackages (ps: [ finalAttrs.finalPackage ]); + + tests = { + integrationTest = + runCommand "tt-buda-tests-integration-test" + { + strictDeps = true; + nativeBuildInputs = [ + finalAttrs.passthru.pythonWith + stdenv.cc.libc.libgcc.lib + ]; + LD_LIBRARY_PATH = lib.makeLibraryPath [ stdenv.cc.libc.libgcc.lib ]; + } + '' + export HOME=$(mktemp -d) + python3 "${./test.py}" + touch "$out" + ''; + }; + }; + + dontUnpack = true; + installPhase = '' + runHook preInstall + mkdir -p $out + cp -r ${tt-buda}/* $out + runHook postInstall + + + ''; + }) + ); +in +tt-buda-final diff --git a/pkgs/buda-prebuilt/test.py b/pkgs/buda-prebuilt/test.py new file mode 100644 index 0000000..98bedff --- /dev/null +++ b/pkgs/buda-prebuilt/test.py @@ -0,0 +1,26 @@ +import pybuda +import torch + + +# Sample PyTorch module +class PyTorchTestModule(torch.nn.Module): + def __init__(self): + super().__init__() + self.weights1 = torch.nn.Parameter(torch.rand(32, 32), requires_grad=True) + self.weights2 = torch.nn.Parameter(torch.rand(32, 32), requires_grad=True) + def forward(self, act1, act2): + m1 = torch.matmul(act1, self.weights1) + m2 = torch.matmul(act2, self.weights2) + return m1 + m2, m1 + + +def test_module_direct_pytorch(): + input1 = torch.rand(4, 32, 32) + input2 = torch.rand(4, 32, 32) + # Run single inference pass on a PyTorch module, using a wrapper to convert to PyBUDA first + output = pybuda.PyTorchModule("direct_pt", PyTorchTestModule()).run(input1, input2) + print(output) + + +if __name__ == "__main__": + test_module_direct_pytorch() diff --git a/pkgs/buda-prebuilt/vendored/auto-patchelf.py b/pkgs/buda-prebuilt/vendored/auto-patchelf.py new file mode 100644 index 0000000..eca3007 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/auto-patchelf.py @@ -0,0 +1,439 @@ +#!/usr/bin/env python3 + +import argparse +import os +import pprint +import subprocess +import sys +import json +from fnmatch import fnmatch +from collections import defaultdict +from contextlib import contextmanager +from dataclasses import dataclass +from itertools import chain +from pathlib import Path, PurePath +from typing import DefaultDict, Generator, Iterator, Optional + +from elftools.common.exceptions import ELFError # type: ignore +from elftools.elf.dynamic import DynamicSection # type: ignore +from elftools.elf.sections import NoteSection # type: ignore +from elftools.elf.elffile import ELFFile # type: ignore +from elftools.elf.enums import ENUM_E_TYPE, ENUM_EI_OSABI # type: ignore + + +@contextmanager +def open_elf(path: Path) -> Iterator[ELFFile]: + with path.open('rb') as stream: + yield ELFFile(stream) + + +def is_static_executable(elf: ELFFile) -> bool: + # Statically linked executables have an ELF type of EXEC but no INTERP. + return (elf.header["e_type"] == 'ET_EXEC' + and not elf.get_section_by_name(".interp")) + + +def is_dynamic_executable(elf: ELFFile) -> bool: + # We do not require an ELF type of EXEC. This also catches + # position-independent executables, as they typically have an INTERP + # section but their ELF type is DYN. + return bool(elf.get_section_by_name(".interp")) + + +def get_dependencies(elf: ELFFile) -> list[list[Path]]: + dependencies = [] + # This convoluted code is here on purpose. For some reason, using + # elf.get_section_by_name(".dynamic") does not always return an + # instance of DynamicSection, but that is required to call iter_tags + for section in elf.iter_sections(): + if isinstance(section, DynamicSection): + for tag in section.iter_tags('DT_NEEDED'): + dependencies.append([Path(tag.needed)]) + break # There is only one dynamic section + + return dependencies + + +def get_dlopen_dependencies(elf: ELFFile) -> list[list[Path]]: + """ + Extracts dependencies from the `.note.dlopen` section. + This is a FreeDesktop standard to annotate binaries with libraries that it may `dlopen`. + See https://systemd.io/ELF_DLOPEN_METADATA/ + """ + dependencies = [] + for section in elf.iter_sections(): + if not isinstance(section, NoteSection) or section.name != ".note.dlopen": + continue + for note in section.iter_notes(): + if note["n_type"] != 0x407C0C0A or note["n_name"] != "FDO": + continue + note_desc = note["n_desc"] + text = note_desc.decode("utf-8").rstrip("\0") + j = json.loads(text) + for d in j: + dependencies.append([Path(soname) for soname in d["soname"]]) + return dependencies + + +def get_rpath(elf: ELFFile) -> list[str]: + # This convoluted code is here on purpose. For some reason, using + # elf.get_section_by_name(".dynamic") does not always return an + # instance of DynamicSection, but that is required to call iter_tags + for section in elf.iter_sections(): + if isinstance(section, DynamicSection): + for tag in section.iter_tags('DT_RUNPATH'): + return tag.runpath.split(':') + + for tag in section.iter_tags('DT_RPATH'): + return tag.rpath.split(':') + + break # There is only one dynamic section + + return [] + + +def get_arch(elf: ELFFile) -> str: + return elf.get_machine_arch() + + +def get_osabi(elf: ELFFile) -> str: + return elf.header["e_ident"]["EI_OSABI"] + + +def osabi_are_compatible(wanted: str, got: str) -> bool: + """ + Tests whether two OS ABIs are compatible, taking into account the + generally accepted compatibility of SVR4 ABI with other ABIs. + """ + if not wanted or not got: + # One of the types couldn't be detected, so as a fallback we'll + # assume they're compatible. + return True + + # Generally speaking, the base ABI (0x00), which is represented by + # readelf(1) as "UNIX - System V", indicates broad compatibility + # with other ABIs. + # + # TODO: This isn't always true. For example, some OSes embed ABI + # compatibility into SHT_NOTE sections like .note.tag and + # .note.ABI-tag. It would be prudent to add these to the detection + # logic to produce better ABI information. + if wanted == 'ELFOSABI_SYSV': + return True + + # Similarly here, we should be able to link against a superset of + # features, so even if the target has another ABI, this should be + # fine. + if got == 'ELFOSABI_SYSV': + return True + + # Otherwise, we simply return whether the ABIs are identical. + return wanted == got + + +def glob(path: Path, pattern: str, recursive: bool) -> Iterator[Path]: + if path.is_dir(): + return path.rglob(pattern) if recursive else path.glob(pattern) + else: + # path.glob won't return anything if the path is not a directory. + # We extend that behavior by matching the file name against the pattern. + # This allows to pass single files instead of dirs to auto_patchelf, + # for greater control on the files to consider. + return [path] if path.match(pattern) else [] + + +cached_paths: set[Path] = set() +soname_cache: DefaultDict[tuple[str, str], list[tuple[Path, str]]] = defaultdict(list) + + +def populate_cache(initial: list[Path], recursive: bool =False) -> None: + lib_dirs = list(initial) + + while lib_dirs: + lib_dir = lib_dirs.pop(0) + + if lib_dir in cached_paths: + continue + + cached_paths.add(lib_dir) + + for path in glob(lib_dir, "*.so*", recursive): + if not path.is_file(): + continue + + # As an optimisation, resolve the symlinks here, as the target is unique + # XXX: (layus, 2022-07-25) is this really an optimisation in all cases ? + # It could make the rpath bigger or break the fragile precedence of $out. + resolved = path.resolve() + # Do not use resolved paths when names do not match + if resolved.name != path.name: + resolved = path + + try: + with open_elf(path) as elf: + osabi = get_osabi(elf) + arch = get_arch(elf) + rpath = [Path(p) for p in get_rpath(elf) + if p and '$ORIGIN' not in p] + lib_dirs += rpath + soname_cache[(path.name, arch)].append((resolved.parent, osabi)) + + except ELFError: + # Not an ELF file in the right format + pass + + +def find_dependency(soname: str, soarch: str, soabi: str) -> Optional[Path]: + for lib, libabi in soname_cache[(soname, soarch)]: + if osabi_are_compatible(soabi, libabi): + return lib + return None + + +@dataclass +class Dependency: + file: Path # The file that contains the dependency + name: Path # The name of the dependency + found: bool = False # Whether it was found somewhere + + +def auto_patchelf_file(path: Path, runtime_deps: list[Path], append_rpaths: list[Path] = [], keep_libc: bool = False, extra_args: list[str] = []) -> list[Dependency]: + try: + with open_elf(path) as elf: + + if is_static_executable(elf): + # No point patching these + print(f"skipping {path} because it is statically linked") + return [] + + if elf.num_segments() == 0: + # no segment (e.g. object file) + print(f"skipping {path} because it contains no segment") + return [] + + file_arch = get_arch(elf) + if interpreter_arch != file_arch: + # Our target architecture is different than this file's + # architecture, so skip it. + print(f"skipping {path} because its architecture ({file_arch})" + f" differs from target ({interpreter_arch})") + return [] + + file_osabi = get_osabi(elf) + if not osabi_are_compatible(interpreter_osabi, file_osabi): + print(f"skipping {path} because its OS ABI ({file_osabi}) is" + f" not compatible with target ({interpreter_osabi})") + return [] + + file_is_dynamic_executable = is_dynamic_executable(elf) + + file_dependencies = get_dependencies(elf) + get_dlopen_dependencies(elf) + + except ELFError: + return [] + + rpath = [] + if file_is_dynamic_executable: + print("setting interpreter of", path) + subprocess.run( + ["patchelf", "--set-interpreter", interpreter_path.as_posix(), path.as_posix()] + extra_args, + check=True) + rpath += runtime_deps + + print("searching for dependencies of", path) + dependencies = [] + # Be sure to get the output of all missing dependencies instead of + # failing at the first one, because it's more useful when working + # on a new package where you don't yet know the dependencies. + for dep in file_dependencies: + was_found = False + for candidate in dep: + + # This loop determines which candidate for a given + # dependency can be found, and how. There may be multiple + # candidates for a dep because of '.note.dlopen' + # dependencies. + # + # 1. If a candidate is an absolute path, it is already a + # valid dependency if that path exists, and nothing needs + # to be done. It should be an error if that path does not exist. + # 2. If a candidate is found within libc, it should be dropped + # and resolved automatically by the dynamic linker, unless + # keep_libc is enabled. + # 3. If a candidate is found in our library dependencies, that + # dependency should be added to rpath. + # 4. If all of the above fail, libc dependencies should still be + # considered found. This is in contrast to step 2, because + # enabling keep_libc should allow libc to be found in step 3 + # if possible to preserve its presence in rpath. + # + # These conditions are checked in this order, because #2 + # and #3 may both be true. In that case, we still want to + # add the dependency to rpath, as the original binary + # presumably had it and this should be preserved. + + is_libc = (libc_lib / candidate).is_file() + + if candidate.is_absolute() and candidate.is_file(): + was_found = True + break + elif is_libc and not keep_libc: + was_found = True + break + elif found_dependency := find_dependency(candidate.name, file_arch, file_osabi): + rpath.append(found_dependency) + dependencies.append(Dependency(path, candidate, found=True)) + print(f" {candidate} -> found: {found_dependency}") + was_found = True + break + elif is_libc and keep_libc: + was_found = True + break + + if not was_found: + dep_name = dep[0] if len(dep) == 1 else f"any({', '.join(map(str, dep))})" + dependencies.append(Dependency(path, dep_name, found=False)) + print(f" {dep_name} -> not found!") + + rpath.extend(append_rpaths) + + # Dedup the rpath + rpath_str = ":".join(dict.fromkeys(map(Path.as_posix, rpath))) + + if rpath: + print("setting RPATH to:", rpath_str) + subprocess.run( + ["patchelf", "--set-rpath", rpath_str, path.as_posix()] + extra_args, + check=True) + + return dependencies + + +def auto_patchelf( + paths_to_patch: list[Path], + lib_dirs: list[Path], + runtime_deps: list[Path], + recursive: bool = True, + ignore_missing: list[str] = [], + append_rpaths: list[Path] = [], + keep_libc: bool = False, + extra_args: list[str] = []) -> None: + + if not paths_to_patch: + sys.exit("No paths to patch, stopping.") + + # Add all shared objects of the current output path to the cache, + # before lib_dirs, so that they are chosen first in find_dependency. + populate_cache(paths_to_patch, recursive) + populate_cache(lib_dirs) + + dependencies = [] + for path in chain.from_iterable(glob(p, '*', recursive) for p in paths_to_patch): + if not path.is_symlink() and path.is_file(): + dependencies += auto_patchelf_file(path, runtime_deps, append_rpaths, keep_libc, extra_args) + + missing = [dep for dep in dependencies if not dep.found] + + # Print a summary of the missing dependencies at the end + print(f"auto-patchelf: {len(missing)} dependencies could not be satisfied") + failure = False + for dep in missing: + for pattern in ignore_missing: + if fnmatch(dep.name.name, pattern): + print(f"warn: auto-patchelf ignoring missing {dep.name} wanted by {dep.file}") + break + else: + print(f"error: auto-patchelf could not satisfy dependency {dep.name} wanted by {dep.file}") + failure = True + + if failure: + sys.exit('auto-patchelf failed to find all the required dependencies.\n' + 'Add the missing dependencies to --libs or use ' + '`--ignore-missing="foo.so.1 bar.so etc.so"`.') + + +def main() -> None: + parser = argparse.ArgumentParser( + prog="auto-patchelf", + description='auto-patchelf tries as hard as possible to patch the' + ' provided binary files by looking for compatible' + 'libraries in the provided paths.') + parser.add_argument( + "--ignore-missing", + nargs="*", + type=str, + help="Do not fail when some dependencies are not found.") + parser.add_argument( + "--no-recurse", + dest="recursive", + action="store_false", + help="Disable the recursive traversal of paths to patch.") + parser.add_argument( + "--paths", nargs="*", type=Path, + help="Paths whose content needs to be patched." + " Single files and directories are accepted." + " Directories are traversed recursively by default.") + parser.add_argument( + "--libs", nargs="*", type=Path, + help="Paths where libraries are searched for." + " Single files and directories are accepted." + " Directories are not searched recursively.") + parser.add_argument( + "--runtime-dependencies", nargs="*", type=Path, + help="Paths to prepend to the runtime path of executable binaries." + " Subject to deduplication, which may imply some reordering.") + parser.add_argument( + "--append-rpaths", + nargs="*", + type=Path, + help="Paths to append to all runtime paths unconditionally", + ) + parser.add_argument( + "--keep-libc", + dest="keep_libc", + action="store_true", + help="Attempt to search for and relink libc dependencies.", + ) + parser.add_argument( + "--extra-args", + # Undocumented Python argparse feature: consume all remaining arguments + # as values for this one. This means this argument should always be passed + # last. + nargs="...", + type=str, + help="Extra arguments to pass to patchelf. This argument should always come last." + ) + + print("automatically fixing dependencies for ELF files") + args = parser.parse_args() + pprint.pprint(vars(args)) + + auto_patchelf( + args.paths, + args.libs, + args.runtime_dependencies, + args.recursive, + args.ignore_missing, + append_rpaths=args.append_rpaths, + keep_libc=args.keep_libc, + extra_args=args.extra_args) + + +interpreter_path: Path = None # type: ignore +interpreter_osabi: str = None # type: ignore +interpreter_arch: str = None # type: ignore +libc_lib: Path = None # type: ignore + +if __name__ == "__main__": + nix_support = Path(os.environ['NIX_BINTOOLS']) / 'nix-support' + interpreter_path = Path((nix_support / 'dynamic-linker').read_text().strip()) + libc_lib = Path((nix_support / 'orig-libc').read_text().strip()) / 'lib' + + with open_elf(interpreter_path) as interpreter: + interpreter_osabi = get_osabi(interpreter) + interpreter_arch = get_arch(interpreter) + + if interpreter_arch and interpreter_osabi and interpreter_path and libc_lib: + main() + else: + sys.exit("Failed to parse dynamic linker (ld) properties.") diff --git a/pkgs/buda-prebuilt/vendored/auto-patchelf.sh b/pkgs/buda-prebuilt/vendored/auto-patchelf.sh new file mode 100644 index 0000000..8f010a3 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/auto-patchelf.sh @@ -0,0 +1,20 @@ +# This setup hook calls patchelf to automatically remove unneeded +# directories from the RPATH of every library or executable in every +# output. + +fixupOutputHooks+=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi') + +patchELF() { + local dir="$1" + [ -e "$dir" ] || return 0 + + echo "shrinking RPATHs of ELF executables and libraries in $dir" + + local i + while IFS= read -r -d $'\0' i; do + if [[ "$i" =~ .build-id ]]; then continue; fi + if ! isELF "$i"; then continue; fi + echo "shrinking $i" + patchelf --shrink-rpath "$i" || true + done < <(find "$dir" -type f -print0) +} diff --git a/pkgs/buda-prebuilt/vendored/boost/1.74.nix b/pkgs/buda-prebuilt/vendored/boost/1.74.nix new file mode 100644 index 0000000..f28f400 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/1.74.nix @@ -0,0 +1,15 @@ +{ callPackage, fetchurl, fetchpatch, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.74.0"; + + src = fetchurl { + urls = [ + "mirror://sourceforge/boost/boost_${builtins.replaceStrings ["."] ["_"] version}.tar.bz2" + "https://boostorg.jfrog.io/artifactory/main/release/${version}/source/boost_${builtins.replaceStrings ["."] ["_"] version}.tar.bz2" + ]; + # SHA256 from http://www.boost.org/users/history/version_1_74_0.html + sha256 = "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1"; + }; +}) + diff --git a/pkgs/buda-prebuilt/vendored/boost/cmake-paths-173.patch b/pkgs/buda-prebuilt/vendored/boost/cmake-paths-173.patch new file mode 100644 index 0000000..7b88da0 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/cmake-paths-173.patch @@ -0,0 +1,22 @@ +diff --git a/tools/boost_install/boost-install.jam b/tools/boost_install/boost-install.jam +index 4238f921e..8fc1ea269 100644 +--- a/tools/boost_install/boost-install.jam ++++ b/tools/boost_install/boost-install.jam +@@ -649,7 +649,7 @@ rule generate-cmake-config- ( target : sources * : properties * ) + "" + "# Compute the include and library directories relative to this file." + "" +- "get_filename_component(_BOOST_CMAKEDIR \"${CMAKE_CURRENT_LIST_DIR}/../\" REALPATH)" ++ "get_filename_component(_BOOST_REAL_CMAKEDIR \"${CMAKE_CURRENT_LIST_DIR}/../\" REALPATH)" + : true ; + + if [ path.is-rooted $(cmakedir) ] +@@ -668,6 +668,8 @@ rule generate-cmake-config- ( target : sources * : properties * ) + " unset(_BOOST_CMAKEDIR_ORIGINAL)" + "endif()" + "" ++ "# Assume that the installer actually did know where the libs were to be installed" ++ "get_filename_component(_BOOST_CMAKEDIR \"$(cmakedir-native)\" REALPATH)" + : true ; + } + diff --git a/pkgs/buda-prebuilt/vendored/boost/cmake-paths.patch b/pkgs/buda-prebuilt/vendored/boost/cmake-paths.patch new file mode 100644 index 0000000..b7f9014 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/cmake-paths.patch @@ -0,0 +1,21 @@ +diff --git a/tools/boost_install/boost-install.jam b/tools/boost_install/boost-install.jam +index ad19f7b55..ec6bf57ff 100644 +--- a/tools/boost_install/boost-install.jam ++++ b/tools/boost_install/boost-install.jam +@@ -587,6 +587,7 @@ rule generate-cmake-config- ( target : sources * : properties * ) + "# Compute the include and library directories relative to this file." + "" + "get_filename_component(_BOOST_CMAKEDIR \"${CMAKE_CURRENT_LIST_DIR}/../\" ABSOLUTE)" ++ "get_filename_component(_BOOST_REAL_CMAKEDIR \"${CMAKE_CURRENT_LIST_DIR}/../\" ABSOLUTE)" + : true ; + + if [ path.is-rooted $(cmakedir) ] +@@ -607,6 +608,8 @@ rule generate-cmake-config- ( target : sources * : properties * ) + " unset(_BOOST_CMAKEDIR_ORIGINAL)" + "endif()" + "" ++ "# Assume that the installer actually did know where the libs were to be installed" ++ "get_filename_component(_BOOST_CMAKEDIR \"$(cmakedir-native)\" REALPATH)" + : true ; + } + diff --git a/pkgs/buda-prebuilt/vendored/boost/darwin-no-system-python.patch b/pkgs/buda-prebuilt/vendored/boost/darwin-no-system-python.patch new file mode 100644 index 0000000..73e0910 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/darwin-no-system-python.patch @@ -0,0 +1,45 @@ +diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam +index 273b28a..2d2031e 100644 +--- a/tools/build/src/tools/python.jam ++++ b/tools/build/src/tools/python.jam +@@ -428,13 +428,7 @@ local rule windows-installed-pythons ( version ? ) + + local rule darwin-installed-pythons ( version ? ) + { +- version ?= $(.version-countdown) ; +- +- local prefix +- = [ GLOB /System/Library/Frameworks /Library/Frameworks +- : Python.framework ] ; +- +- return $(prefix)/Versions/$(version)/bin/python ; ++ return ; + } + + +@@ -890,25 +884,6 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : + + # See if we can find a framework directory on darwin. + local framework-directory ; +- if $(target-os) = darwin +- { +- # Search upward for the framework directory. +- local framework-directory = $(libraries[-1]) ; +- while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework +- { +- framework-directory = $(framework-directory:D) ; +- } +- +- if $(framework-directory:D=) = Python.framework +- { +- debug-message framework directory is \"$(framework-directory)\" ; +- } +- else +- { +- debug-message "no framework directory found; using library path" ; +- framework-directory = ; +- } +- } + + local dll-path = $(libraries) ; + diff --git a/pkgs/buda-prebuilt/vendored/boost/default.nix b/pkgs/buda-prebuilt/vendored/boost/default.nix new file mode 100644 index 0000000..1194b6f --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/default.nix @@ -0,0 +1,20 @@ +{ lib +, callPackage +, boost-build +, fetchurl +}: + +let + makeBoost = file: + lib.fix (self: + callPackage file { + boost-build = boost-build.override { + # useBoost allows us passing in src and version from + # the derivation we are building to get a matching b2 version. + useBoost = self; + }; + } + ); +in { + boost174 = makeBoost ./1.74.nix; +} diff --git a/pkgs/buda-prebuilt/vendored/boost/generic.nix b/pkgs/buda-prebuilt/vendored/boost/generic.nix new file mode 100644 index 0000000..7d8aee0 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/generic.nix @@ -0,0 +1,249 @@ +{ lib, stdenv, icu, expat, zlib, bzip2, zstd, xz, python ? null, fixDarwinDylibNames, libiconv, libxcrypt +, boost-build +, fetchpatch +, which +, toolset ? /**/ if stdenv.cc.isClang then "clang" + else if stdenv.cc.isGNU then "gcc" + else null +, enableRelease ? true +, enableDebug ? false +, enableSingleThreaded ? false +, enableMultiThreaded ? true +, enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now +, enableStatic ? !enableShared +, enablePython ? false +, enableNumpy ? false +, enableIcu ? stdenv.hostPlatform == stdenv.buildPlatform +, taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic)) +, patches ? [] +, boostBuildPatches ? [] +, useMpi ? false +, mpi +, extraB2Args ? [] + +# Attributes inherit from specific versions +, version, src +, ... +}: + +# We must build at least one type of libraries +assert enableShared || enableStatic; + +assert enableNumpy -> enablePython; + +# Boost <1.69 can't be built on linux with clang >8, because pth was removed +assert with lib; (stdenv.isLinux && toolset == "clang" && versionAtLeast stdenv.cc.version "8.0.0") -> versionAtLeast version "1.69"; + +let + + variant = lib.concatStringsSep "," + (lib.optional enableRelease "release" ++ + lib.optional enableDebug "debug"); + + threading = lib.concatStringsSep "," + (lib.optional enableSingleThreaded "single" ++ + lib.optional enableMultiThreaded "multi"); + + link = lib.concatStringsSep "," + (lib.optional enableShared "shared" ++ + lib.optional enableStatic "static"); + + runtime-link = if enableShared then "shared" else "static"; + + # To avoid library name collisions + layout = if taggedLayout then "tagged" else "system"; + + needUserConfig = stdenv.hostPlatform != stdenv.buildPlatform || useMpi || (stdenv.isDarwin && enableShared); + + b2Args = lib.concatStringsSep " " ([ + "--includedir=$dev/include" + "--libdir=$out/lib" + "-j$NIX_BUILD_CORES" + "--layout=${layout}" + "variant=${variant}" + "threading=${threading}" + "link=${link}" + "-sEXPAT_INCLUDE=${expat.dev}/include" + "-sEXPAT_LIBPATH=${expat.out}/lib" + + # TODO: make this unconditional + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform || + # required on mips; see 61d9f201baeef4c4bb91ad8a8f5f89b747e0dfe4 + (stdenv.hostPlatform.isMips && lib.versionAtLeast version "1.79")) [ + "address-model=${toString stdenv.hostPlatform.parsed.cpu.bits}" + "architecture=${if stdenv.hostPlatform.isMips64 + then if lib.versionOlder version "1.78" then "mips1" else "mips" + else if stdenv.hostPlatform.parsed.cpu.name == "s390x" then "s390x" + else toString stdenv.hostPlatform.parsed.cpu.family}" + "binary-format=${toString stdenv.hostPlatform.parsed.kernel.execFormat.name}" + "target-os=${toString stdenv.hostPlatform.parsed.kernel.name}" + + # adapted from table in boost manual + # https://www.boost.org/doc/libs/1_66_0/libs/context/doc/html/context/architectures.html + "abi=${if stdenv.hostPlatform.parsed.cpu.family == "arm" then "aapcs" + else if stdenv.hostPlatform.isWindows then "ms" + else if stdenv.hostPlatform.isMips32 then "o32" + else if stdenv.hostPlatform.isMips64n64 then "n64" + else "sysv"}" + ] ++ lib.optional (link != "static") "runtime-link=${runtime-link}" + ++ lib.optional (variant == "release") "debug-symbols=off" + ++ lib.optional (toolset != null) "toolset=${toolset}" + ++ lib.optional (!enablePython) "--without-python" + ++ lib.optional needUserConfig "--user-config=user-config.jam" + ++ lib.optional (stdenv.buildPlatform.isDarwin && stdenv.hostPlatform.isLinux) "pch=off" + ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ + "threadapi=win32" + ] ++ extraB2Args + ); + +in + +stdenv.mkDerivation { + pname = "boost"; + + inherit src version; + + patchFlags = []; + + patches = patches + ++ lib.optional stdenv.isDarwin ./darwin-no-system-python.patch + # Fix boost-context segmentation faults on ppc64 due to ABI violation + ++ lib.optional (lib.versionOlder version "1.71") (fetchpatch { + url = "https://github.com/boostorg/context/commit/2354eca9b776a6739112833f64754108cc0d1dc5.patch"; + sha256 = "067m4bjpmcanqvg28djax9a10avmdwhlpfx6gn73kbqqq70dnz29"; + stripLen = 1; + extraPrefix = "libs/context/"; + }) + ++ lib.optional (lib.versionOlder version "1.70") (fetchpatch { + # support for Mips64n64 appeared in boost-context 1.70 + url = "https://github.com/boostorg/context/commit/e3f744a1862164062d579d1972272d67bdaa9c39.patch"; + sha256 = "sha256-qjQy1b4jDsIRrI+UYtcguhvChrMbGWO0UlEzEJHYzRI="; + stripLen = 1; + extraPrefix = "libs/context/"; + }) + ++ lib.optional (lib.versionAtLeast version "1.70" && lib.versionOlder version "1.73") ./cmake-paths.patch + ++ lib.optional (lib.versionAtLeast version "1.73") ./cmake-paths-173.patch + ++ lib.optional (version == "1.77.0") (fetchpatch { + url = "https://github.com/boostorg/math/commit/7d482f6ebc356e6ec455ccb5f51a23971bf6ce5b.patch"; + relative = "include"; + sha256 = "sha256-KlmIbixcds6GyKYt1fx5BxDIrU7msrgDdYo9Va/KJR4="; + }); + + meta = with lib; { + homepage = "http://boost.org/"; + description = "Collection of C++ libraries"; + license = licenses.boost; + platforms = platforms.unix ++ platforms.windows; + badPlatforms = optionals (versionOlder version "1.73") platforms.riscv; + maintainers = with maintainers; [ hjones2199 ]; + + broken = + # boost-context lacks support for the N32 ABI on mips64. The build + # will succeed, but packages depending on boost-context will fail with + # a very cryptic error message. + stdenv.hostPlatform.isMips64n32; + }; + + passthru = { + inherit boostBuildPatches; + }; + + preConfigure = lib.optionalString useMpi '' + cat << EOF >> user-config.jam + using mpi : ${mpi}/bin/mpiCC ; + EOF + '' + # On darwin we need to add the `$out/lib` to the libraries' rpath explicitly, + # otherwise the dynamic linker is unable to resolve the reference to @rpath + # when the boost libraries want to load each other at runtime. + + lib.optionalString (stdenv.isDarwin && enableShared) '' + cat << EOF >> user-config.jam + using clang-darwin : : ${stdenv.cc.targetPrefix}c++ + : "-rpath $out/lib/" + ; + EOF + '' + # b2 has trouble finding the correct compiler and tools for cross compilation + # since it apparently ignores $CC, $AR etc. Thus we need to set everything + # in user-config.jam. To keep things simple we just set everything in an + # uniform way for clang and gcc (which works thanks to our cc-wrapper). + # We pass toolset later which will make b2 invoke everything in the right + # way -- the other toolset in user-config.jam will be ignored. + + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + cat << EOF >> user-config.jam + using gcc : cross : ${stdenv.cc.targetPrefix}c++ + : $AR + $RANLIB + ; + + using clang : cross : ${stdenv.cc.targetPrefix}c++ + : $AR + $RANLIB + ; + EOF + '' + # b2 needs to be explicitly told how to find Python when cross-compiling + + lib.optionalString enablePython '' + cat << EOF >> user-config.jam + using python : : ${python.interpreter} + : ${python}/include/python${python.pythonVersion} + : ${python}/lib + ; + EOF + ''; + + NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin + "-headerpad_max_install_names"; + + enableParallelBuilding = true; + + nativeBuildInputs = [ which boost-build ] + ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; + buildInputs = [ expat zlib bzip2 libiconv ] + ++ lib.optional (lib.versionAtLeast version "1.69") zstd + ++ [ xz ] + ++ lib.optional enableIcu icu + ++ lib.optionals enablePython [ libxcrypt python ] + ++ lib.optional enableNumpy python.pkgs.numpy; + + configureScript = "./bootstrap.sh"; + configurePlatforms = []; + dontDisableStatic = true; + dontAddStaticConfigureFlags = true; + configureFlags = [ + "--includedir=$(dev)/include" + "--libdir=$(out)/lib" + "--with-bjam=b2" # prevent bootstrapping b2 in configurePhase + ] ++ lib.optional (toolset != null) "--with-toolset=${toolset}" + ++ [ (if enableIcu then "--with-icu=${icu.dev}" else "--without-icu") ]; + + buildPhase = '' + runHook preBuild + b2 ${b2Args} + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + # boostbook is needed by some applications + mkdir -p $dev/share/boostbook + cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/ + + # Let boost install everything else + b2 ${b2Args} install + + runHook postInstall + ''; + + postFixup = '' + # Make boost header paths relative so that they are not runtime dependencies + cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ + -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \; + '' + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt") '' + $RANLIB "$out/lib/"*.a + ''; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; +} diff --git a/pkgs/buda-prebuilt/vendored/boost/pthread-stack-min-fix.patch b/pkgs/buda-prebuilt/vendored/boost/pthread-stack-min-fix.patch new file mode 100644 index 0000000..b6c85f8 --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/boost/pthread-stack-min-fix.patch @@ -0,0 +1,15 @@ +Taken from https://github.com/conan-io/conan-center-index/pull/361/files + +diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread/pthread/thread_data.hpp +index aefbeb4..bc9b136 100644 +--- a/boost/thread/pthread/thread_data.hpp ++++ b/boost/thread/pthread/thread_data.hpp +@@ -57,7 +57,7 @@ namespace boost + #else + std::size_t page_size = ::sysconf( _SC_PAGESIZE); + #endif +-#if PTHREAD_STACK_MIN > 0 ++#ifdef PTHREAD_STACK_MIN + if (size "$i.tmp" + if test -x "$i"; then chmod +x "$i.tmp"; fi + cmp -s "$i" "$i.tmp" || echo "Changed file: \"$i\"" + mv "$i.tmp" "$i" + + for hook in "${fixupHooks[@]}"; do + eval "$hook" "$i" + done + fi +done diff --git a/pkgs/buda-prebuilt/vendored/pip-install-hook.sh b/pkgs/buda-prebuilt/vendored/pip-install-hook.sh new file mode 100644 index 0000000..7a9106c --- /dev/null +++ b/pkgs/buda-prebuilt/vendored/pip-install-hook.sh @@ -0,0 +1,24 @@ +# Setup hook for pip. +echo "Sourcing pip-install-hook" + +declare -a pipInstallFlags + +pipInstallPhase() { + echo "Executing pipInstallPhase" + runHook preInstall + + mkdir -p "$out/@pythonSitePackages@" + export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH" + + pushd dist || return 1 + @pythonInterpreter@ -m pip install ./*.whl --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags + popd || return 1 + + runHook postInstall + echo "Finished executing pipInstallPhase" +} + +if [ -z "${dontUsePipInstall-}" ] && [ -z "${installPhase-}" ]; then + echo "Using pipInstallPhase" + installPhase=pipInstallPhase +fi diff --git a/pkgs/buda/default.nix b/pkgs/buda/default.nix new file mode 100644 index 0000000..508a17c --- /dev/null +++ b/pkgs/buda/default.nix @@ -0,0 +1,58 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + git, + cmake, +}: + +python3Packages.buildPythonApplication rec { + pname = "tt-buda"; + version = "0.19.3"; + pyproject = true; + + src = fetchFromGitHub { + owner = "tenstorrent"; + repo = "tt-buda"; + rev = "v${version}"; + #hash = "sha256-g5eB2roVh4t4fhM+t2QYm+3NXYM94hbwstWES2sL6hA="; + hash = "sha256-a+yamtu93AypLAXa9cj3yQ1AcizEBbmDd8fa2RNjGcQ="; + fetchSubmodules = true; + leaveDotGit = true; + }; + + build-system = [ + python3Packages.setuptools + python3Packages.wheel + ]; + + nativeBuildInputs = [ + git + cmake + ] ++ python3Packages.pybind11.propagatedNativeBuildInputs; + + buildInputs = [ + python3Packages.python # pybind python.h + ]; + + postPatch = '' + substituteInPlace compile_flags.txt third_party/budabackend/compile_flags.txt \ + --replace-fail "-I/usr/include/python3.8" "-I/usr/include/python3.8" + ''; + + dontUseCmakeConfigure = true; + + pythonImportsCheck = [ + "tt_buda" + ]; + + BACKEND_ARCH_NAME = "wormhole_b0"; + ARCH_NAME = "wormhole_b0"; + + meta = { + description = "Tenstorrent TT-BUDA Repository"; + homepage = "https://github.com/tenstorrent/tt-buda"; + license = lib.licenses.asl20; + mainProgram = "tt-buda"; + }; +} From c280cd3a8f84ff24462cb1dff83d026dc25bb255 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 8 Nov 2024 21:30:03 +0200 Subject: [PATCH 03/23] metal: empty postInstall Not needed here and fix build --- pkgs/metal/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/metal/default.nix b/pkgs/metal/default.nix index 76f5171..93e4f90 100644 --- a/pkgs/metal/default.nix +++ b/pkgs/metal/default.nix @@ -51,6 +51,8 @@ let runHook postInstall ''; + postInstall = ""; + }); # NOTE: When changing something remember to make sure the outputHash above doesn't change, or if it changes then update it. metal = llvmPackages.libcxxStdenv.mkDerivation { @@ -104,10 +106,11 @@ let cmakeFlags = [ "-DCPM_SOURCE_CACHE=${depsDir}" + # TODO: look in to fixing properly if there's a need. + "-DCMAKE_SKIP_BUILD_RPATH=ON" ]; postInstall = '' - pwd mkdir -p $out/lib cp lib/{_ttnn.so,libtt_metal.so} $out/lib ''; From bfee5bc0ff78f1c95119aa0114009c758846f8d4 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 00:32:20 +0200 Subject: [PATCH 04/23] metal: Add a small test which doesn't compile with c++ Upstream really doesn't expect this to be used outside of the whole repo --- pkgs/metal/default.nix | 45 +++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/pkgs/metal/default.nix b/pkgs/metal/default.nix index 93e4f90..4175528 100644 --- a/pkgs/metal/default.nix +++ b/pkgs/metal/default.nix @@ -12,7 +12,8 @@ sfpi, hwloc, libz, - + runCommand, + libexecinfo, }: let @@ -52,7 +53,6 @@ let ''; postInstall = ""; - }); # NOTE: When changing something remember to make sure the outputHash above doesn't change, or if it changes then update it. metal = llvmPackages.libcxxStdenv.mkDerivation { @@ -80,11 +80,9 @@ let buildInputs = [ numactl - # umd hwloc libz - ]; postUnpack = '' @@ -98,25 +96,54 @@ let ln -s ${sfpi.tt-gcc} tt_metal/third_party/sfpi/compiler ''; + ARCH_NAME = "wormhole_b0"; + preConfigure = '' - export ARCH_NAME=wormhole_b0 export TT_METAL_HOME=$(pwd) export PYTHONPATH=$(pwd) ''; cmakeFlags = [ "-DCPM_SOURCE_CACHE=${depsDir}" - # TODO: look in to fixing properly if there's a need. - "-DCMAKE_SKIP_BUILD_RPATH=ON" ]; postInstall = '' - mkdir -p $out/lib - cp lib/{_ttnn.so,libtt_metal.so} $out/lib + mkdir -p $out/{lib,include} + cp -r ../tt_metal $out/include + cp -r lib $out/lib + cp -r deps $out/deps + cp ./deps/reflect/*/reflect $out/include/ + for f in $(find "$out" -type f -name '*.so*'); do + sed -i "s|/build/source/build/lib|$out/lib|g" $f + sed -i "s|/build/source/tt_metal|$out/include/tt_metal|g" $f + sed -i 's|$ORIGIN/build/lib:||g' $f + done + ''; passthru = { inherit metal-deps; + tests = { + include = runCommand "test" { buildInputs = [ metal]; } '' + mkdir -p $out + # In the tests the paths in the includes are weird and don't use the full `tt_metal/something` paths + ${sfpi.sfpi}/compiler/bin/riscv32-unknown-elf-c++ \ + -std=c++20 \ + -mwormhole \ + -I ${libexecinfo}/include \ + -I ${metal}/include \ + -I ${metal}/include/tt_metal \ + -I ${metal}/include/tt_metal/impl \ + -I ${metal}/include/tt_metal/hw/inc/wormhole \ + -I ${metal}/include/tt_metal/hw/inc \ + -I ${metal}/include/tt_metal/third_party/umd/src/firmware/riscv/wormhole \ + -I ${metal}/include/tt_metal/hw/inc/wormhole/wormhole_b0_defines \ + -I ${metal}/include/tt_metal/third_party/umd \ + -I ${metal}/include/tt_metal/third_party/fmt \ + -o add2 ${metal.src}/tt_metal/programming_examples/add_2_integers_in_compute/add_2_integers_in_compute.cpp + mv add2 $out + ''; + }; }; }; From 29dc8c01e271c42cc8205c059976475de548988c Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 05:04:05 +0200 Subject: [PATCH 05/23] Update sfpi and add sfpi-no-lfs to prepare to update to a newer commit --- pkgs/sfpi/default.nix | 35 ++++++++++++++++++++++++++++++++--- pkgs/sfpi/tt-gcc.nix | 4 ++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/pkgs/sfpi/default.nix b/pkgs/sfpi/default.nix index fb6f1a5..0739c1d 100644 --- a/pkgs/sfpi/default.nix +++ b/pkgs/sfpi/default.nix @@ -3,13 +3,12 @@ rec { sfpi = pkgs.stdenv.mkDerivation { pname = "sfpi"; - version = "unstable-2024-09-25"; + version = "unstable-2024-10-10"; src = pkgs.fetchFromGitHub { owner = "tenstorrent-metal"; repo = "sfpi"; - # One commit before they started to use gcc 12 - rev = "08d39202f283ab9122e162bcead5b7c90014fa86"; + rev = "899b8b6c90fc3e18ad081fd556eaa1a473c8a357"; hash = "sha256-EZHUhAqn9/r02IC+TVoxfIyzEctYQKd5azcrXE5DIgg="; }; @@ -25,6 +24,36 @@ rec { mkdir -p $out/compiler/libexec bin/release.sh $out ''; + + passthru = { inherit sfpi-no-lfs; }; + }; + + + sfpi-no-lfs = pkgs.stdenv.mkDerivation { + pname = "sfpi"; + version = "unstable-2024-11-15"; + + src = pkgs.fetchFromGitHub { + owner = "tenstorrent-metal"; + repo = "sfpi"; + rev = "fcb552bc66d274fc4ffadc35eb4e6d1f20b2e6b3"; + hash = ""; + fetchSubmodules = true; + }; + + postPatch = '' + patchShebangs --build $scripts/build.sh + ''; + + buildPhase = '' + ./scripts/build.sh + ''; + + installPhase = '' + mkdir -p "$out" + cp -r ./sfpi/* "$out" + ''; + }; tt-gcc = import ./tt-gcc.nix { inherit pkgs; }; diff --git a/pkgs/sfpi/tt-gcc.nix b/pkgs/sfpi/tt-gcc.nix index f0dd667..3a91c61 100644 --- a/pkgs/sfpi/tt-gcc.nix +++ b/pkgs/sfpi/tt-gcc.nix @@ -8,10 +8,10 @@ pkgs.stdenv.mkDerivation rec { owner = "tenstorrent-metal"; repo = "sfpi-tt-gcc"; # https://github.com/tenstorrent/sfpi-tt-gcc/commits/tt-rel/gcc-12.2 - rev = "fad3c23c8972adb739ef62d2f35d770062a7cd73"; + rev = "a5c31334942e9df66427837f7268269311fdfc2e"; # this takes a while and we don't need all of them fetchSubmodules = true; - hash = "sha256-X2uVyk4uo0TuDu/2nUXk2v8A4RURvhg0MAoCssAuljI="; + hash = "sha256-1d77+6Yv3i4M7J+vUwcUuFg56wCG9oVeDt+fvBKtHPI="; }; nativeBuildInputs = with pkgs; [ From d937e5c7fa0631594e5e0e9d9e6f037c6571d797 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 22:19:43 +0200 Subject: [PATCH 06/23] Update metal --- pkgs/metal/default.nix | 68 +++++++++++---------- pkgs/metal/rpath.patch | 28 +++++++++ pkgs/metal/ttnn-template.nix | 111 +++++++++++++++++++++++++++++++++++ pkgs/sfpi/default.nix | 35 +---------- pkgs/sfpi/tt-gcc.nix | 4 +- 5 files changed, 177 insertions(+), 69 deletions(-) create mode 100644 pkgs/metal/rpath.patch create mode 100644 pkgs/metal/ttnn-template.nix diff --git a/pkgs/metal/default.nix b/pkgs/metal/default.nix index 4175528..f05d356 100644 --- a/pkgs/metal/default.nix +++ b/pkgs/metal/default.nix @@ -14,6 +14,7 @@ libz, runCommand, libexecinfo, + callPackage, }: let @@ -27,7 +28,7 @@ let dontBuild = true; - outputHash = "sha256-UOBBqIP2KKEn2pfv7l5v2Of9RoZY0+3TCEu94MQUVYo="; + outputHash = "sha256-hhLjEssXID+uiPQ3kexMCOVB6DB9m/eAVmfr2OleGXc="; outputHashAlgo = "sha256"; cmakeFlags = [ @@ -54,6 +55,7 @@ let postInstall = ""; }); + # NOTE: When changing something remember to make sure the outputHash above doesn't change, or if it changes then update it. metal = llvmPackages.libcxxStdenv.mkDerivation { pname = "tt-metal"; @@ -61,12 +63,16 @@ let src = fetchFromGitHub { owner = "tenstorrent"; repo = "tt-metal"; - rev = "0fb4249a94a99714de8f91d93d338832694c09e0"; - # this takes a while and we don't need all of them + rev = "697ccc724048108e9f11a3c9ed5171a17ac9fd9c"; + hash = "sha256-pBfJAtSyRKtU3iG2P3hVuo2LXHBFOU+3XmRkbDuDvDQ="; fetchSubmodules = true; - hash = "sha256-0tcIwaJzM75S7SFKCJ2UbfElwASpFwdySmzt2LUTT4A="; + fetchLFS = true; }; + patches = [ + ./rpath.patch + ]; + env.NIX_CFLAGS_COMPILE = "-Wno-unused-command-line-argument"; nativeBuildInputs = [ @@ -92,8 +98,15 @@ let postPatch = '' cp ${cpm-cmake}/share/cpm/CPM.cmake cmake/CPM.cmake - rm -rf tt_metal/third_party/sfpi/compiler - ln -s ${sfpi.tt-gcc} tt_metal/third_party/sfpi/compiler + + substituteInPlace tt_metal/CMakeLists.txt ttnn/CMakeLists.txt \ + --replace-fail "REPLACETHIS\"" "$out/lib\"" \ + --replace-warn "REPLACETHIS1" "$out/build/lib" + + substituteInPlace tt_metal/hw/CMakeLists.txt \ + --replace-fail "FetchContent_MakeAvailable(sfpi)" "" + mkdir -p runtime + ln -s ${sfpi.sfpi} runtime/sfpi ''; ARCH_NAME = "wormhole_b0"; @@ -108,41 +121,26 @@ let ]; postInstall = '' - mkdir -p $out/{lib,include} - cp -r ../tt_metal $out/include - cp -r lib $out/lib - cp -r deps $out/deps - cp ./deps/reflect/*/reflect $out/include/ - for f in $(find "$out" -type f -name '*.so*'); do - sed -i "s|/build/source/build/lib|$out/lib|g" $f - sed -i "s|/build/source/tt_metal|$out/include/tt_metal|g" $f - sed -i 's|$ORIGIN/build/lib:||g' $f - done + # Have to do this until cpp-ttnn-project-template is fixed + # ttnn-template> ninja: error: '/nix/store/-tt-metal-unstable-2024-10-04/build/lib/_ttnn.so', needed by 'sources/examples/sample_app/sample_app', missing and no known rule to make it + cp -r ../ $out + rm -rf $out/.cpmcache + ln -s $out/build/deps $out/.cpmcache + # Nix checks for references to /build/source so these should be different but not a different size to prevent corruption + find "$out" -type f -print0 | while IFS= read -r -d $'\0' f; do + sed -i "s|/build/source|/suild/source|g" "$f" + sed -i 's|$ORIGIN/build/lib:|$ORIGIN/suild/lib:|g' "$f" + done ''; + dontPatchELF = true; + dontStrip = true; + passthru = { inherit metal-deps; tests = { - include = runCommand "test" { buildInputs = [ metal]; } '' - mkdir -p $out - # In the tests the paths in the includes are weird and don't use the full `tt_metal/something` paths - ${sfpi.sfpi}/compiler/bin/riscv32-unknown-elf-c++ \ - -std=c++20 \ - -mwormhole \ - -I ${libexecinfo}/include \ - -I ${metal}/include \ - -I ${metal}/include/tt_metal \ - -I ${metal}/include/tt_metal/impl \ - -I ${metal}/include/tt_metal/hw/inc/wormhole \ - -I ${metal}/include/tt_metal/hw/inc \ - -I ${metal}/include/tt_metal/third_party/umd/src/firmware/riscv/wormhole \ - -I ${metal}/include/tt_metal/hw/inc/wormhole/wormhole_b0_defines \ - -I ${metal}/include/tt_metal/third_party/umd \ - -I ${metal}/include/tt_metal/third_party/fmt \ - -o add2 ${metal.src}/tt_metal/programming_examples/add_2_integers_in_compute/add_2_integers_in_compute.cpp - mv add2 $out - ''; + template = callPackage ./ttnn-template.nix { inherit metal; }; }; }; diff --git a/pkgs/metal/rpath.patch b/pkgs/metal/rpath.patch new file mode 100644 index 0000000..26d0201 --- /dev/null +++ b/pkgs/metal/rpath.patch @@ -0,0 +1,28 @@ +diff --git a/tt_metal/CMakeLists.txt b/tt_metal/CMakeLists.txt +index cba3743fbc..e580f6696c 100644 +--- a/tt_metal/CMakeLists.txt ++++ b/tt_metal/CMakeLists.txt +@@ -55,7 +55,7 @@ set_target_properties( + tt_metal + PROPERTIES + INSTALL_RPATH +- "${PROJECT_BINARY_DIR}/lib" ++ "REPLACETHIS" + ADDITIONAL_CLEAN_FILES + "${PROJECT_BINARY_DIR}/lib;${PROJECT_BINARY_DIR}/obj" + ) +diff --git a/ttnn/CMakeLists.txt b/ttnn/CMakeLists.txt +index 45ee3dd8f8..4401f51b39 100644 +--- a/ttnn/CMakeLists.txt ++++ b/ttnn/CMakeLists.txt +@@ -683,8 +683,8 @@ TT_ENABLE_UNITY_BUILD(ttnn) + #We move the library binaries to a different path rather than PROJECT_BINARY_DIR + #in the Python wheel + set(TTNN_INSTALL_RPATH +- "${PROJECT_BINARY_DIR}/lib" +- "$ORIGIN/build/lib" ++ "REPLACETHIS" ++ "REPLACETHIS1" + ) + + #Make sure library built is _ttnn.so and that it can find all it's linked libraries diff --git a/pkgs/metal/ttnn-template.nix b/pkgs/metal/ttnn-template.nix new file mode 100644 index 0000000..b98a37c --- /dev/null +++ b/pkgs/metal/ttnn-template.nix @@ -0,0 +1,111 @@ +{ + stdenv, + fetchFromGitHub, + metal, + cmake, + ninja, + git, + cacert, + python3, + numactl, + hwloc, + libz, + llvmPackages_17, + cpm-cmake, + sfpi, + +}: + +let + version = "0"; + llvmPackages = llvmPackages_17; + depsDir = "deps"; + + ttnn-template-deps = ttnn-template.overrideAttrs (previousAttrs: { + name = "ttnn-template-deps-deps-${version}.tar.gz"; + + dontBuild = true; + + outputHash = "sha256-qt3PLKE3lwqiYQq6m06V1xk1qDOyHAtGj8lw0Q99qgE="; + outputHashAlgo = "sha256"; + + cmakeFlags = [ + "-DCPM_DOWNLOAD_ALL=ON" + "-DCPM_SOURCE_CACHE=${depsDir}" + ]; + + # Infinite recursion + postUnpack = ""; + + installPhase = '' + runHook preInstall + + # Prune the `.git` directories + find ${depsDir} -name .git -type d -prune -exec rm -rf {} \;; + # Build a reproducible tar, per instructions at https://reproducible-builds.org/docs/archives/ + tar --owner=0 --group=0 --numeric-owner --format=gnu \ + --sort=name --mtime="@$SOURCE_DATE_EPOCH" \ + -czf $out \ + ${depsDir} \ + + runHook postInstall + ''; + + postInstall = ""; + }); + + ttnn-template = llvmPackages.libcxxStdenv.mkDerivation { + pname = "ttnn-template"; + version = "0"; + src = fetchFromGitHub { + owner = "tenstorrent"; + repo = "cpp-ttnn-project-template"; + rev = "702b453aa7000daa56692b7559ec77adf407828d"; + hash = "sha256-NzcZCVujJCyHQgALAewJjoWj+6bQXncONO7nRK8zSx4="; + }; + + nativeBuildInputs = [ + cmake + #ninja + python3 + # for cpm + git + cacert + ]; + + buildInputs = [ + numactl + # umd + hwloc + libz + ]; + + ARCH_NAME = "wormhole_b0"; + TT_METAL_HOME = metal; + + postUnpack = '' + mkdir -p $sourceRoot/build + tar -xf ${ttnn-template-deps} -C $sourceRoot/build + ''; + + postPatch = '' + cp ${cpm-cmake}/share/cpm/CPM.cmake cmake/CPM.cmake + + # Upstream changed these locations and removed libfmt but the template hasn't been updated yet + # https://github.com/tenstorrent/tt-metal/pull/13788 + substituteInPlace sources/sample_lib/CMakeLists.txt \ + --replace-fail '$ENV{TT_METAL_HOME}/build/lib/_ttnn.so' '${metal}/lib/_ttnn.so' \ + --replace-fail '$ENV{TT_METAL_HOME}/build/lib/libdevice.so' '${metal}/lib/libdevice.so' \ + --replace-fail '$ENV{TT_METAL_HOME}/build/lib/libfmt.so' "" \ + --replace-fail '$ENV{TT_METAL_HOME}/build/lib/libnng.so.1' '${metal}/lib/libnng.so.1.8.0' \ + + substituteInPlace sources/sample_lib/CMakeLists.txt \ + --replace-fail '$ENV{TT_METAL_HOME}/build/lib' '${metal}/lib ${metal}/build/lib' + ''; + + cmakeFlags = [ + "-DCPM_SOURCE_CACHE=${depsDir}" + ]; + }; +in +ttnn-template diff --git a/pkgs/sfpi/default.nix b/pkgs/sfpi/default.nix index 0739c1d..fb6f1a5 100644 --- a/pkgs/sfpi/default.nix +++ b/pkgs/sfpi/default.nix @@ -3,12 +3,13 @@ rec { sfpi = pkgs.stdenv.mkDerivation { pname = "sfpi"; - version = "unstable-2024-10-10"; + version = "unstable-2024-09-25"; src = pkgs.fetchFromGitHub { owner = "tenstorrent-metal"; repo = "sfpi"; - rev = "899b8b6c90fc3e18ad081fd556eaa1a473c8a357"; + # One commit before they started to use gcc 12 + rev = "08d39202f283ab9122e162bcead5b7c90014fa86"; hash = "sha256-EZHUhAqn9/r02IC+TVoxfIyzEctYQKd5azcrXE5DIgg="; }; @@ -24,36 +25,6 @@ rec { mkdir -p $out/compiler/libexec bin/release.sh $out ''; - - passthru = { inherit sfpi-no-lfs; }; - }; - - - sfpi-no-lfs = pkgs.stdenv.mkDerivation { - pname = "sfpi"; - version = "unstable-2024-11-15"; - - src = pkgs.fetchFromGitHub { - owner = "tenstorrent-metal"; - repo = "sfpi"; - rev = "fcb552bc66d274fc4ffadc35eb4e6d1f20b2e6b3"; - hash = ""; - fetchSubmodules = true; - }; - - postPatch = '' - patchShebangs --build $scripts/build.sh - ''; - - buildPhase = '' - ./scripts/build.sh - ''; - - installPhase = '' - mkdir -p "$out" - cp -r ./sfpi/* "$out" - ''; - }; tt-gcc = import ./tt-gcc.nix { inherit pkgs; }; diff --git a/pkgs/sfpi/tt-gcc.nix b/pkgs/sfpi/tt-gcc.nix index 3a91c61..f0dd667 100644 --- a/pkgs/sfpi/tt-gcc.nix +++ b/pkgs/sfpi/tt-gcc.nix @@ -8,10 +8,10 @@ pkgs.stdenv.mkDerivation rec { owner = "tenstorrent-metal"; repo = "sfpi-tt-gcc"; # https://github.com/tenstorrent/sfpi-tt-gcc/commits/tt-rel/gcc-12.2 - rev = "a5c31334942e9df66427837f7268269311fdfc2e"; + rev = "fad3c23c8972adb739ef62d2f35d770062a7cd73"; # this takes a while and we don't need all of them fetchSubmodules = true; - hash = "sha256-1d77+6Yv3i4M7J+vUwcUuFg56wCG9oVeDt+fvBKtHPI="; + hash = "sha256-X2uVyk4uo0TuDu/2nUXk2v8A4RURvhg0MAoCssAuljI="; }; nativeBuildInputs = with pkgs; [ From 31b3aa6fdc170043ecdaea2d81efa7ab69a81d04 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 23:03:48 +0200 Subject: [PATCH 07/23] systems-tools: add missing programs --- pkgs/system-tools/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/system-tools/default.nix b/pkgs/system-tools/default.nix index fa2cb62..2972358 100644 --- a/pkgs/system-tools/default.nix +++ b/pkgs/system-tools/default.nix @@ -4,7 +4,9 @@ fetchFromGitHub, makeWrapper, bash, + coreutils, pciutils, + gawk, }: # NOTE: We might not use these files if we end up doing the things it does in nix instead if possible. @@ -44,7 +46,9 @@ stdenv.mkDerivation rec { wrapProgram "$out/libexec/hugepages-setup.sh" \ --prefix PATH : ${ lib.makeBinPath [ - pciutils # for lspci + coreutils + pciutils + gawk ] } ''; From be924e46000b55ea382eee0a367d6eebee426bdd Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 23:08:43 +0200 Subject: [PATCH 08/23] Use system-tools --- flake.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index a8d0a90..9081c1b 100644 --- a/flake.nix +++ b/flake.nix @@ -94,14 +94,13 @@ }) ]; kernelParams = [ - # TODO: Use the scripts instead https://github.com/tenstorrent/tt-system-tools they work regardless of how many devices there are - # https://github.com/tenstorrent/tt-system-tools/blob/main/hugepages-setup.sh#L31 - "hugepagesz=1G" - "hugepages=4" "iommu=pt" ]; kernelModules = [ "tenstorrent" ]; }; + systemd.packages = [ + (pkgs.tt-system-tools or self.packages.${pkgs.hostPlatform.system}.system-tools) + ]; services.udev.packages = [ (pkgs.tt-udev-rules or self.packages.${pkgs.hostPlatform.system}.udev-rules) ]; From 1ae7313fad589565189750c7828bfdf3f85dbbe6 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 23:33:37 +0200 Subject: [PATCH 09/23] Add -x to hugepages-setup.sh --- pkgs/system-tools/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/system-tools/default.nix b/pkgs/system-tools/default.nix index 2972358..0d99aac 100644 --- a/pkgs/system-tools/default.nix +++ b/pkgs/system-tools/default.nix @@ -43,14 +43,17 @@ stdenv.mkDerivation rec { substituteInPlace "$out/lib/systemd/system/tenstorrent-hugepages.service" \ --replace-fail "/opt/tenstorrent/bin/hugepages-setup.sh" "$out/libexec/hugepages-setup.sh" - wrapProgram "$out/libexec/hugepages-setup.sh" \ + mv "$out/libexec/hugepages-setup.sh" "$out/libexec/.hugepages-setup.sh-wrapped" + makeWrapper ${bash}/bin/bash "$out/libexec/hugepages-setup.sh" \ --prefix PATH : ${ lib.makeBinPath [ coreutils pciutils gawk ] - } + } \ + --add-flags "-x $out/libexec/.hugepages-setup.sh-wrapped" + # add -x easier debugging ''; meta = { From 441f4dc46487e32f977bc1bdbbdfffbaabb7d0ca Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 20 Nov 2024 23:39:52 +0200 Subject: [PATCH 10/23] Add wantedBy to services --- flake.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 9081c1b..5127653 100644 --- a/flake.nix +++ b/flake.nix @@ -98,9 +98,13 @@ ]; kernelModules = [ "tenstorrent" ]; }; - systemd.packages = [ - (pkgs.tt-system-tools or self.packages.${pkgs.hostPlatform.system}.system-tools) - ]; + systemd = { + # https://github.com/NixOS/nixpkgs/issues/81138 + services.tenstorrent-hugepages.wantedBy = [ "sysinit.target" ]; + packages = [ + (pkgs.tt-system-tools or self.packages.${pkgs.hostPlatform.system}.system-tools) + ]; + }; services.udev.packages = [ (pkgs.tt-udev-rules or self.packages.${pkgs.hostPlatform.system}.udev-rules) ]; From e5c7215b904b5ca452aa1cfededcce2166cfad8b Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Nov 2024 00:23:56 +0200 Subject: [PATCH 11/23] Make /dev/tenstorrent owned by the tenstorrent group Hopefully to make the device useable without running docker with --privileged --- flake.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 5127653..cf1a07d 100644 --- a/flake.nix +++ b/flake.nix @@ -105,9 +105,13 @@ (pkgs.tt-system-tools or self.packages.${pkgs.hostPlatform.system}.system-tools) ]; }; - services.udev.packages = [ - (pkgs.tt-udev-rules or self.packages.${pkgs.hostPlatform.system}.udev-rules) - ]; + users.groups.tenstorrent = { }; + services.udev = { + #packages = [ (pkgs.tt-udev-rules or self.packages.${pkgs.hostPlatform.system}.udev-rules) ]; + extraRules = '' + KERNEL=="tenstorrent*", MODE="0666", OWNER="root", GROUP="tenstorrent" + ''; + }; }; }; From 66bf540c3ed97704c869b59f7d342f2a5046c97e Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Nov 2024 00:52:35 +0200 Subject: [PATCH 12/23] Use udev-rules See comment --- flake.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index cf1a07d..cd3840d 100644 --- a/flake.nix +++ b/flake.nix @@ -105,13 +105,15 @@ (pkgs.tt-system-tools or self.packages.${pkgs.hostPlatform.system}.system-tools) ]; }; - users.groups.tenstorrent = { }; services.udev = { - #packages = [ (pkgs.tt-udev-rules or self.packages.${pkgs.hostPlatform.system}.udev-rules) ]; - extraRules = '' - KERNEL=="tenstorrent*", MODE="0666", OWNER="root", GROUP="tenstorrent" - ''; + packages = [ (pkgs.tt-udev-rules or self.packages.${pkgs.hostPlatform.system}.udev-rules) ]; + # NOTE: passing just the group does not work currently for docker so unneeded for now so use the udev-rules package for now + # TT_METAL_HOME=$PWD docker run -v $PWD:/host --workdir /host -v /dev/hugepages-1G:/dev/hugepages-1G -v /dev/tenstorrent:/dev/tenstorrent -u :994 -v /etc/group:/etc/group:ro -it tt-metal bash + # extraRules = '' + # KERNEL=="tenstorrent*", MODE="0666", OWNER="root", GROUP="tenstorrent" + # ''; }; + # users.groups.tenstorrent = { }; }; }; From 8f850c7c6208776c0f6613cdd438cf92ffebb2ec Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 21 Nov 2024 01:06:03 +0200 Subject: [PATCH 13/23] Define hugepages mount in module --- flake.nix | 19 +++++++++++++++++++ pkgs/system-tools/default.nix | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index cd3840d..233f327 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,25 @@ systemd = { # https://github.com/NixOS/nixpkgs/issues/81138 services.tenstorrent-hugepages.wantedBy = [ "sysinit.target" ]; + # Define https://github.com/tenstorrent/tt-system-tools/blob/29ba4dc6049eef3cee4314c53720417823ffc667/dev-hugepages%5Cx2d1G.mount + # because it has bad start ordering relations with tenstorrent-hugepages.service + # or it may be that the `wantedBy` does not work correctly in mounts like it does't work in serices. + mounts = [ + { + description = "Mount hugepages at /dev/hugepages-1G for Tenstorrent ASICs"; + what = "hugetlbfs"; + where = "/dev/hugepages-1G"; + type = "hugetlbfs"; + options = "pagesize=1G,mode=0777,nosuid,nodev"; + wantedBy = [ "sysinit.target" ]; + after = [ "tenstorrent-hugepages.service" ]; + unitConfig = { + DefaultDependencies = false; + ConditionPathExists = "/sys/kernel/mm/hugepages/hugepages-1048576kB"; + ConditionCapability = "CAP_SYS_ADMIN"; + }; + } + ]; packages = [ (pkgs.tt-system-tools or self.packages.${pkgs.hostPlatform.system}.system-tools) ]; diff --git a/pkgs/system-tools/default.nix b/pkgs/system-tools/default.nix index 0d99aac..53ef49b 100644 --- a/pkgs/system-tools/default.nix +++ b/pkgs/system-tools/default.nix @@ -33,7 +33,8 @@ stdenv.mkDerivation rec { runHook preInstall install -Dm444 -t $out/lib/systemd/system/ "tenstorrent-hugepages.service" - install -Dm444 -t $out/lib/systemd/system/ 'dev-hugepages\x2d1G.mount' + # Defined in the module + #install -Dm444 -t $out/lib/systemd/system/ 'dev-hugepages\x2d1G.mount' install -Dm555 -t $out/libexec/ "hugepages-setup.sh" runHook postInstall From 9abd0fb91692abe80c46cec40e29eaff9367bdce Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 17 Dec 2024 21:39:41 +0200 Subject: [PATCH 14/23] Update metal to 0.53.0 Use prebuilt sfpi which is patched to work on NixOS and nix sandbox and elsewhere. --- flake.nix | 1 + pkgs/metal/default.nix | 8 ++++---- pkgs/sfpi/default.nix | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 233f327..dc5262d 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ udev-rules = scope.kmd.udev-rules; kmd-test = scope.kmd.test; sfpi = scope.sfpi.sfpi; + sfpi-prebuilt = scope.sfpi.prebuilt; tt-gcc = scope.sfpi.tt-gcc; smi = scope.smi; luwen = scope.luwen.luwen; diff --git a/pkgs/metal/default.nix b/pkgs/metal/default.nix index f05d356..18c0896 100644 --- a/pkgs/metal/default.nix +++ b/pkgs/metal/default.nix @@ -21,7 +21,7 @@ let llvmPackages = llvmPackages_17; depsDir = "deps"; - version = "unstable-2024-10-04"; + version = "0.53.0"; metal-deps = metal.overrideAttrs (previousAttrs: { name = "tt-metal-deps-${version}.tar.gz"; @@ -63,8 +63,8 @@ let src = fetchFromGitHub { owner = "tenstorrent"; repo = "tt-metal"; - rev = "697ccc724048108e9f11a3c9ed5171a17ac9fd9c"; - hash = "sha256-pBfJAtSyRKtU3iG2P3hVuo2LXHBFOU+3XmRkbDuDvDQ="; + rev = "154e6993aed78213446c59731e41c3617d83c1f1"; + hash = "sha256-edtlE4CVsTO4BW0PKhkN0IxdV666Tu/Y1jgZ2Exljeo="; fetchSubmodules = true; fetchLFS = true; }; @@ -106,7 +106,7 @@ let substituteInPlace tt_metal/hw/CMakeLists.txt \ --replace-fail "FetchContent_MakeAvailable(sfpi)" "" mkdir -p runtime - ln -s ${sfpi.sfpi} runtime/sfpi + ln -s ${sfpi.prebuilt} runtime/sfpi ''; ARCH_NAME = "wormhole_b0"; diff --git a/pkgs/sfpi/default.nix b/pkgs/sfpi/default.nix index fb6f1a5..4ceffbf 100644 --- a/pkgs/sfpi/default.nix +++ b/pkgs/sfpi/default.nix @@ -27,5 +27,32 @@ rec { ''; }; + prebuilt = pkgs.stdenv.mkDerivation rec { + pname = "tt-gcc"; + version = "5.0.0"; + + src = pkgs.fetchzip { + url = "https://github.com/tenstorrent/sfpi/releases/download/v5.0.0/sfpi-release.tgz"; + hash = "sha256-RBhJ6BWmvB06zWoELTumpzroHDMpNXU0/WC6elgAkW0="; + }; + + nativeBuildInputs = with pkgs; [ + autoPatchelfHook + ]; + + buildInputs = with pkgs; [ + libmpc + mpfr + gmp + zlib + expat + ]; + + installPhase = '' + cp -r . $out + ''; + + }; + tt-gcc = import ./tt-gcc.nix { inherit pkgs; }; } From fa8e1be05826e3d457f7981a6daa5f2825a14016 Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 17 Dec 2024 22:26:08 +0200 Subject: [PATCH 15/23] metal.tests.template: Install sample_app --- pkgs/metal/ttnn-template.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/metal/ttnn-template.nix b/pkgs/metal/ttnn-template.nix index b98a37c..b579093 100644 --- a/pkgs/metal/ttnn-template.nix +++ b/pkgs/metal/ttnn-template.nix @@ -103,6 +103,14 @@ let --replace-fail '$ENV{TT_METAL_HOME}/build/lib' '${metal}/lib ${metal}/build/lib' ''; + # No default install target + installPhase = '' + runHook preInstall + pwd + install -D sources/examples/sample_app/sample_app $out/bin/sample_app + runHook postInstall + ''; + cmakeFlags = [ "-DCPM_SOURCE_CACHE=${depsDir}" ]; From c1b3fac31c3db1f3bcabefaf1af15863d0e59375 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 23 Dec 2024 21:50:06 +0200 Subject: [PATCH 16/23] metal: build examples and create dirs to bind mount to --- pkgs/metal/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/metal/default.nix b/pkgs/metal/default.nix index 18c0896..b475b28 100644 --- a/pkgs/metal/default.nix +++ b/pkgs/metal/default.nix @@ -118,6 +118,7 @@ let cmakeFlags = [ "-DCPM_SOURCE_CACHE=${depsDir}" + "-DBUILD_PROGRAMMING_EXAMPLES=TRUE" ]; postInstall = '' @@ -132,6 +133,11 @@ let sed -i "s|/build/source|/suild/source|g" "$f" sed -i 's|$ORIGIN/build/lib:|$ORIGIN/suild/lib:|g' "$f" done + + # Using tt-metal tries to write to /built + # Create the built dir so a writable dir can be bind mounted to it + mkdir $out/built + mkdir $out/generated ''; dontPatchELF = true; From 8412c8bf2208544d33c8df4dddec033658eca52d Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 23 Dec 2024 22:01:45 +0200 Subject: [PATCH 17/23] smi: Disable test Fails to build because it doens't find tests because there's none --- pkgs/smi/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/smi/default.nix b/pkgs/smi/default.nix index d56cd33..9fc2209 100644 --- a/pkgs/smi/default.nix +++ b/pkgs/smi/default.nix @@ -52,4 +52,6 @@ buildPythonPackage rec { pkgs.pre-commit tools-common ]; + + dontUsePytestCheck = true; # no tests } From 24410845a0098334185f350a1fb2801e96784631 Mon Sep 17 00:00:00 2001 From: Artturin Date: Mon, 23 Dec 2024 22:03:32 +0200 Subject: [PATCH 18/23] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'flake-compat': 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04) → 'github:edolstra/flake-compat/ff81ac966bb2cae68946d5ed5fc4994f96d0ffec?narHash=sha256-NeCCThCEP3eCl2l/%2B27kNNK7QrwZB1IJCrXfrbv5oqU%3D' (2024-12-04) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/06cf0e1da4208d3766d898b7fdab6513366d45b9?narHash=sha256-S5kVU7U82LfpEukbn/ihcyNt2%2BEvG7Z5unsKW9H/yFA%3D' (2024-09-29) → 'github:NixOS/nixpkgs/d70bd19e0a38ad4790d3913bf08fcbfc9eeca507?narHash=sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ%3D' (2024-12-19) • Updated input 'utils': 'github:numtide/flake-utils/c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a?narHash=sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ%3D' (2024-09-17) → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b?narHash=sha256-l0KFg5HjrsfsO/JpG%2Br7fRrqm12kzFHyUHqHCVpMMbI%3D' (2024-11-13) --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index e5b14f2..2f764f9 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", "type": "github" }, "original": { @@ -18,11 +18,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727634051, - "narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", + "lastModified": 1734649271, + "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9", + "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507", "type": "github" }, "original": { @@ -59,11 +59,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { From ba96c32479956f1b0bba1db899bef3d3f07335dd Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 29 Jan 2025 03:53:16 +0200 Subject: [PATCH 19/23] {kmd,smi,tools-common}: Update --- README.md | 5 +++++ pkgs/kmd/default.nix | 9 ++++++--- pkgs/kmd/limits.patch | 12 ++++++++++++ pkgs/smi/default.nix | 6 +++--- pkgs/tools-common/default.nix | 6 +++--- 5 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 pkgs/kmd/limits.patch diff --git a/README.md b/README.md index 02004b0..6a490e1 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,8 @@ Testing /dev/tenstorrent/1 @ 0000:76:00.0 ``` As far as I can tell, these failures are exercised by the tests, and a clean `stdout` means there is no issue. + + +# TODO + +- [ ] Better update system diff --git a/pkgs/kmd/default.nix b/pkgs/kmd/default.nix index c819150..71914df 100644 --- a/pkgs/kmd/default.nix +++ b/pkgs/kmd/default.nix @@ -4,10 +4,10 @@ let src = pkgs.fetchFromGitHub { owner = "tenstorrent"; repo = "tt-kmd"; - rev = "715a5d76e5dbb6d8972d4aa92e8cbe3434986b9f"; - hash = "sha256-OCnGhvIDIqkQJXlIpOVnP0O9cA9J7/bz1JPAOpeDNYQ="; + rev = "refs/tags/ttkmd-${version}"; + hash = "sha256-TTd+SXUQ/RwsZB7YIc0QsE9zHBCYO3NRrCub7/K1rP4="; }; - version = "unstable-2024-09-06"; + version = "1.31"; in { kmd = pkgs.stdenv.mkDerivation { @@ -41,6 +41,9 @@ in test = pkgs.stdenv.mkDerivation { pname = "tt-kmd-test"; + # https://github.com/tenstorrent/tt-kmd/pull/37 + patches = ./limits.patch; + inherit src version; nativeBuildInputs = [ pkgs.gnumake ]; diff --git a/pkgs/kmd/limits.patch b/pkgs/kmd/limits.patch new file mode 100644 index 0000000..1f9edd1 --- /dev/null +++ b/pkgs/kmd/limits.patch @@ -0,0 +1,12 @@ +diff --git a/test/query_mappings.cpp b/test/query_mappings.cpp +index 0721485..7fe7ae4 100644 +--- a/test/query_mappings.cpp ++++ b/test/query_mappings.cpp +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + + #include diff --git a/pkgs/smi/default.nix b/pkgs/smi/default.nix index 9fc2209..b88382d 100644 --- a/pkgs/smi/default.nix +++ b/pkgs/smi/default.nix @@ -8,13 +8,13 @@ with pkgs.python3Packages; buildPythonPackage rec { pname = "tt-smi"; - version = "unstable-2024-09-27"; + version = "3.0.5"; src = pkgs.fetchFromGitHub { owner = "tenstorrent"; repo = "tt-smi"; - rev = "052f1ce49b94581710744a91939121e01c24b5f2"; - hash = "sha256-IA60unZpSWVnMnDjDIC31QtURi9nIr/F7s7PGZilPcw="; + rev = "refs/tags/v${version}"; + hash = "sha256-+Dw6F9aupe4VTWQFiNWGKMDOTmxwCW2bHuDQxWxluUc="; }; format = "pyproject"; diff --git a/pkgs/tools-common/default.nix b/pkgs/tools-common/default.nix index a8c6114..f6f1922 100644 --- a/pkgs/tools-common/default.nix +++ b/pkgs/tools-common/default.nix @@ -4,13 +4,13 @@ with pkgs.python3Packages; buildPythonPackage rec { pname = "tools-common"; - version = "unstable-2024-09-27"; + version = "1.4.12"; src = pkgs.fetchFromGitHub { owner = "tenstorrent"; repo = "tt-tools-common"; - rev = "a89b2db6d086698ab0351a820ea689b4809429a3"; - sha256 = "sha256-xeiJQkWsg9p8re2XJai0mNWuP7LwJ9faj3+Z3U/KvzI="; + rev = "refs/tags/v${version}"; + sha256 = "sha256-FKV1ojY9m5aRfnrU6LjXVcUnNAmNNXiGaUax6RE/8Vs="; }; format = "pyproject"; From 31f0cee50d0645355c8c2169e3ea066a0e9463bf Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 29 Jan 2025 19:03:14 +0200 Subject: [PATCH 20/23] {luwen,pyluwen,flash,smi}: Update and drop `pyluwen_0_1` --- flake.nix | 15 +- pkgs/flash/default.nix | 6 +- pkgs/luwen/Cargo_0_1.lock | 1037 ------------------------------------- pkgs/luwen/Cargo_0_2.lock | 703 ++++++++++++++++++------- pkgs/luwen/default.nix | 68 +-- 5 files changed, 552 insertions(+), 1277 deletions(-) delete mode 100644 pkgs/luwen/Cargo_0_1.lock diff --git a/flake.nix b/flake.nix index dc5262d..19937ab 100644 --- a/flake.nix +++ b/flake.nix @@ -31,15 +31,12 @@ { kmd = callPackages ./pkgs/kmd { inherit kernel; }; sfpi = callPackages ./pkgs/sfpi { }; - luwen = callPackage ./pkgs/luwen { }; + luwen = (callPackage ./pkgs/luwen { }).luwen; + pyluwen = (callPackage ./pkgs/luwen { }).pyluwen; tools-common = callPackage ./pkgs/tools-common { }; system-tools = callPackage ./pkgs/system-tools { }; - flash = callPackage ./pkgs/flash { - pyluwen = self.luwen.pyluwen_0_1; - }; - smi = callPackage ./pkgs/smi { - pyluwen = self.luwen.pyluwen; - }; + flash = callPackage ./pkgs/flash { }; + smi = callPackage ./pkgs/smi { }; umd = callPackage ./pkgs/umd { }; metal = callPackage ./pkgs/metal { }; @@ -55,8 +52,8 @@ sfpi-prebuilt = scope.sfpi.prebuilt; tt-gcc = scope.sfpi.tt-gcc; smi = scope.smi; - luwen = scope.luwen.luwen; - pyluwen = scope.luwen.pyluwen; + luwen = scope.luwen; + pyluwen = scope.pyluwen; tools-common = scope.tools-common; system-tools = scope.system-tools; flash = scope.flash; diff --git a/pkgs/flash/default.nix b/pkgs/flash/default.nix index 35d289c..d5f6e9e 100644 --- a/pkgs/flash/default.nix +++ b/pkgs/flash/default.nix @@ -8,13 +8,13 @@ with pkgs.python3Packages; buildPythonPackage rec { pname = "tt-flash"; - version = "unstable-2024-09-27"; + version = "3.1.1"; src = pkgs.fetchFromGitHub { owner = "tenstorrent"; repo = "tt-flash"; - rev = "4002fee1da7edfcbf09093ba23612caeca071f23"; - hash = "sha256-O6b/vS/zCjp/mrNzFEylWs0jtwdHY65nwkvn5GFridI="; + rev = "refs/tags/v${version}"; + hash = "sha256-t2B1XEOKBKxE2eQiS7pc+EemBWomMgocyk4oRDt0Q78="; }; nativeBuildInputs = [ pythonRelaxDepsHook ]; diff --git a/pkgs/luwen/Cargo_0_1.lock b/pkgs/luwen/Cargo_0_1.lock deleted file mode 100644 index 8c79257..0000000 --- a/pkgs/luwen/Cargo_0_1.lock +++ /dev/null @@ -1,1037 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitfield-struct" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0526e3752c9058af187599111a39eff3669ff8cc775063cf94709db66f0afcac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "cbindgen" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faeaa693e5a727975a79211b8f35c0cb09b031fdb6eaa4a788bc6713d01488ca" -dependencies = [ - "clap", - "heck", - "indexmap 1.9.3", - "log", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 1.0.109", - "tempfile", - "toml", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_lex", - "indexmap 1.9.3", - "strsim", - "termcolor", - "textwrap", -] - -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys", -] - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", -] - -[[package]] -name = "indicatif" -version = "0.17.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" -dependencies = [ - "console", - "instant", - "number_prefix", - "portable-atomic", - "unicode-width", -] - -[[package]] -name = "indoc" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "inventory" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" - -[[package]] -name = "itoa" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "kmdif" -version = "0.1.0" -dependencies = [ - "bitfield-struct", - "luwen-core", - "memmap2", - "nix", - "thiserror", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.153" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "luwen" -version = "0.1.0" -dependencies = [ - "bincode", - "luwen-core", - "luwen-if", - "luwen-ref", - "rand", - "serde", - "serde_yaml", -] - -[[package]] -name = "luwen-core" -version = "0.1.0" -dependencies = [ - "thiserror", -] - -[[package]] -name = "luwen-if" -version = "0.2.0" -dependencies = [ - "bincode", - "luwen-core", - "rust-embed", - "serde", - "thiserror", -] - -[[package]] -name = "luwen-ref" -version = "0.2.0" -dependencies = [ - "indicatif", - "kmdif", - "luwen-if", - "thiserror", -] - -[[package]] -name = "luwencpp" -version = "0.1.0" -dependencies = [ - "cbindgen", - "luwen-core", - "luwen-if", -] - -[[package]] -name = "memmap2" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", -] - -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "portable-atomic" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "proc-macro2" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "pyluwen" -version = "0.3.2" -dependencies = [ - "kmdif", - "luwen-core", - "luwen-if", - "luwen-ref", - "pyo3", -] - -[[package]] -name = "pyo3" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38" -dependencies = [ - "cfg-if", - "indoc", - "inventory", - "libc", - "memoffset 0.9.0", - "parking_lot", - "pyo3-build-config", - "pyo3-ffi", - "pyo3-macros", - "unindent", -] - -[[package]] -name = "pyo3-build-config" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5" -dependencies = [ - "once_cell", - "target-lexicon", -] - -[[package]] -name = "pyo3-ffi" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9" -dependencies = [ - "libc", - "pyo3-build-config", -] - -[[package]] -name = "pyo3-macros" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1" -dependencies = [ - "proc-macro2", - "pyo3-macros-backend", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "pyo3-macros-backend" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "rust-embed" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82c0bbc10308ed323529fd3c1dce8badda635aa319a5ff0e6466f33b8101e3f" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6227c01b1783cdfee1bcf844eb44594cd16ec71c35305bf1c9fb5aade2735e16" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn 2.0.48", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb0a25bfbb2d4b4402179c2cf030387d9990857ce08a32592c6238db9fa8665" -dependencies = [ - "sha2", - "walkdir", -] - -[[package]] -name = "rustix" -version = "0.38.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" -dependencies = [ - "bitflags 2.4.2", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "ryu" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.196" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.196" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "serde_json" -version = "1.0.113" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" -dependencies = [ - "indexmap 2.2.2", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "smallvec" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "target-lexicon" -version = "0.12.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" - -[[package]] -name = "tempfile" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - -[[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "unindent" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" diff --git a/pkgs/luwen/Cargo_0_2.lock b/pkgs/luwen/Cargo_0_2.lock index f7c368c..218f30d 100644 --- a/pkgs/luwen/Cargo_0_2.lock +++ b/pkgs/luwen/Cargo_0_2.lock @@ -1,12 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -19,36 +19,37 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell", + "windows-sys 0.59.0", ] [[package]] @@ -80,7 +81,7 @@ checksum = "adc0846593a56638b74e136a45610f9934c052e14761bebca6b092d5522599e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", ] [[package]] @@ -91,9 +92,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "block-buffer" @@ -104,6 +105,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + [[package]] name = "byteorder" version = "1.5.0" @@ -112,9 +119,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cbindgen" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fce8dd7fcfcbf3a0a87d8f515194b49d6135acab73e18bd380d1d93bb1a15eb" +checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" dependencies = [ "clap", "heck 0.4.1", @@ -124,7 +131,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.79", + "syn 2.0.96", "tempfile", "toml", ] @@ -143,9 +150,9 @@ checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" [[package]] name = "clap" -version = "4.5.19" +version = "4.5.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +checksum = "769b0145982b4b48713e01ec42d61614425f27b7058bda7180a3a41f30104796" dependencies = [ "clap_builder", "clap_derive", @@ -153,9 +160,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.19" +version = "4.5.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7" dependencies = [ "anstream", "anstyle", @@ -165,50 +172,62 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", - "lazy_static", "libc", + "once_cell", "unicode-width", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] +[[package]] +name = "create-ethernet-map" +version = "0.1.0" +dependencies = [ + "clap", + "luwen-core", + "luwen-if", + "luwen-ref", + "prometheus", + "prometheus_exporter", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -259,6 +278,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "drunken-monkey" version = "0.1.1" @@ -270,9 +300,9 @@ dependencies = [ [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "equivalent" @@ -282,19 +312,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fnv" @@ -329,14 +359,26 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets 0.52.6", ] [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -357,20 +399,149 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "idna" -version = "0.5.0" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] name = "indexmap" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown", @@ -378,15 +549,15 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.8" +version = "0.17.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" dependencies = [ "console", - "instant", "number_prefix", "portable-atomic", "unicode-width", + "web-time", ] [[package]] @@ -395,20 +566,14 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "inventory" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" +checksum = "3b31349d02fe60f80bbbab1a9402364cad7460626d6030494b08ac4a2075bf81" +dependencies = [ + "rustversion", +] [[package]] name = "is_terminal_polyfill" @@ -418,9 +583,19 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] [[package]] name = "lazy_static" @@ -430,9 +605,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libredox" @@ -440,15 +615,21 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "libc", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -462,13 +643,13 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "luwen" -version = "0.4.3" +version = "0.4.8" dependencies = [ "bincode", "clap", @@ -601,7 +782,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", ] [[package]] @@ -621,12 +802,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "option-ext" @@ -665,9 +843,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -677,9 +855,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "powerfmt" @@ -698,9 +876,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -711,7 +889,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "731e0d9356b0c25f16f33b5be79b1c57b562f141ebfcdb0ad8ac2c13a24293b4" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "hex", "lazy_static", "procfs-core", @@ -724,7 +902,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "hex", ] @@ -779,7 +957,7 @@ checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] name = "pyluwen" -version = "0.6.0" +version = "0.6.1" dependencies = [ "luwen-core", "luwen-if", @@ -851,9 +1029,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -885,16 +1063,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", ] [[package]] @@ -903,7 +1081,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom", + "getrandom 0.2.15", "libredox", "thiserror", ] @@ -929,7 +1107,7 @@ dependencies = [ "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.79", + "syn 2.0.96", "walkdir", ] @@ -945,22 +1123,28 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] -name = "ryu" -version = "1.0.18" +name = "rustversion" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + +[[package]] +name = "ryu" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "same-file" @@ -979,29 +1163,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" dependencies = [ "itoa", "memchr", @@ -1057,6 +1241,12 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "strsim" version = "0.11.1" @@ -1076,15 +1266,26 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "target-lexicon" version = "0.12.16" @@ -1093,12 +1294,13 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" dependencies = [ "cfg-if", "fastrand", + "getrandom 0.3.1", "once_cell", "rustix", "windows-sys 0.59.0", @@ -1106,29 +1308,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", ] [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -1147,9 +1349,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -1169,20 +1371,15 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.8.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "toml" version = "0.8.19" @@ -1219,9 +1416,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -1230,20 +1427,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", ] @@ -1266,32 +1463,17 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" [[package]] name = "unicode-width" -version = "0.1.14" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unindent" @@ -1307,15 +1489,27 @@ checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -1344,6 +1538,82 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.96", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi-util" version = "0.1.9" @@ -1362,15 +1632,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.59.0" @@ -1503,13 +1764,58 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "ad699df48212c6cc6eb4435f35500ac6fd3b9913324f938aea302022ce19d310" dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags 2.8.0", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -1528,5 +1834,48 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.96", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", ] diff --git a/pkgs/luwen/default.nix b/pkgs/luwen/default.nix index f1ecb68..a15bc7b 100644 --- a/pkgs/luwen/default.nix +++ b/pkgs/luwen/default.nix @@ -1,16 +1,24 @@ { pkgs }: +let + + # Upstream does not vendor a lock file so one has to created manually + # `cargo generate-lockfile` + version = "0.4.9"; + + src = pkgs.fetchFromGitHub { + owner = "tenstorrent"; + repo = "luwen"; + rev = "refs/tags/v${version}"; + sha256 = "sha256-K68PjccE2fBkU4RvKv8X6jKRPYqsVhKB6jU92aajLgo="; + }; + +in + { luwen = pkgs.rustPlatform.buildRustPackage rec { pname = "luwen"; - version = "unstable-2024-09-13"; - - src = pkgs.fetchFromGitHub { - owner = "tenstorrent"; - repo = "luwen"; - rev = "e4e10e95928f4b73d31ac4f41ea08cd6e3ef5573"; - sha256 = "sha256-cScaqWAyjDuvy9M2EccMfUHfDq23IWniaKeq+upHzOg="; - }; + inherit version src; postPatch = '' ln -s ${./Cargo_0_2.lock} Cargo.lock @@ -22,14 +30,7 @@ pyluwen = pkgs.python3.pkgs.buildPythonPackage rec { pname = "pyluwen"; - version = "unstable-2024-09-13"; - - src = pkgs.fetchFromGitHub { - owner = "tenstorrent"; - repo = "luwen"; - rev = "e4e10e95928f4b73d31ac4f41ea08cd6e3ef5573"; - sha256 = "sha256-cScaqWAyjDuvy9M2EccMfUHfDq23IWniaKeq+upHzOg="; - }; + inherit version src; postPatch = '' ln -s ${./Cargo_0_2.lock} Cargo.lock @@ -52,39 +53,4 @@ "pyluwen" ]; }; - - pyluwen_0_1 = pkgs.python3.pkgs.buildPythonPackage rec { - pname = "pyluwen"; - version = "v0.1.0"; - - src = pkgs.fetchFromGitHub { - owner = "tenstorrent"; - repo = "luwen"; - rev = "${version}"; - sha256 = "sha256-MyOzm3dfEkL7MsVzV51DaO+Op3+QhUzsYCTDsvYsvpk="; - }; - - postPatch = '' - ln -s ${./Cargo_0_1.lock} Cargo.lock - ''; - - buildAndTestSubdir = "crates/pyluwen"; - - format = "pyproject"; - - cargoDeps = pkgs.rustPlatform.fetchCargoTarball { - inherit src postPatch; - name = "${pname}-${version}"; - hash = "sha256-ZXcj/pzQ/tAROdmi2w+AWYBvLSEZFayizxw+BmNDj70="; - }; - - nativeBuildInputs = [ - pkgs.rustPlatform.cargoSetupHook - pkgs.rustPlatform.maturinBuildHook - ]; - - pythonImportsCheck = [ - "pyluwen" - ]; - }; } From f18aa5fee28b5b6c706774c73c2d8700acfb79f6 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 29 Jan 2025 19:32:57 +0200 Subject: [PATCH 21/23] tools-common: Use version needed by tt-smi --- pkgs/luwen/default.nix | 2 ++ pkgs/tools-common/default.nix | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/luwen/default.nix b/pkgs/luwen/default.nix index a15bc7b..0ae5065 100644 --- a/pkgs/luwen/default.nix +++ b/pkgs/luwen/default.nix @@ -4,6 +4,8 @@ let # Upstream does not vendor a lock file so one has to created manually # `cargo generate-lockfile` + # Use verson needed by tt-smi + # https://github.com/tenstorrent/tt-smi/blob/main/pyproject.toml#L30 version = "0.4.9"; src = pkgs.fetchFromGitHub { diff --git a/pkgs/tools-common/default.nix b/pkgs/tools-common/default.nix index f6f1922..dac5b00 100644 --- a/pkgs/tools-common/default.nix +++ b/pkgs/tools-common/default.nix @@ -4,13 +4,14 @@ with pkgs.python3Packages; buildPythonPackage rec { pname = "tools-common"; - version = "1.4.12"; + # https://github.com/tenstorrent/tt-smi/blob/main/pyproject.toml#L31 + version = "1.4.11"; src = pkgs.fetchFromGitHub { owner = "tenstorrent"; repo = "tt-tools-common"; rev = "refs/tags/v${version}"; - sha256 = "sha256-FKV1ojY9m5aRfnrU6LjXVcUnNAmNNXiGaUax6RE/8Vs="; + sha256 = "sha256-Q5GpT6B3pamY6bUjPbvNJ11npiR4q/6QMjRxovQ/MZ0="; }; format = "pyproject"; From 2245c9c5ea78f8579c72246b95f9125d90d16289 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 29 Jan 2025 19:41:49 +0200 Subject: [PATCH 22/23] smi: Add test --- pkgs/smi/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/smi/default.nix b/pkgs/smi/default.nix index b88382d..325e4b0 100644 --- a/pkgs/smi/default.nix +++ b/pkgs/smi/default.nix @@ -54,4 +54,10 @@ buildPythonPackage rec { ]; dontUsePytestCheck = true; # no tests + + installCheckPhase = '' + output=$($out/bin/tt-smi || true) + echo "tt-smi output: $output" + echo $output | grep -q "No Tenstorrent driver detected" + ''; } From 65d7bef16dae3f21b9b2b06cb1715a83907c9ca4 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 29 Jan 2025 20:06:14 +0200 Subject: [PATCH 23/23] {smi,tools-common}: pin textual --- pkgs/smi/default.nix | 2 +- pkgs/tools-common/default.nix | 33 ++++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/pkgs/smi/default.nix b/pkgs/smi/default.nix index 325e4b0..d2ac140 100644 --- a/pkgs/smi/default.nix +++ b/pkgs/smi/default.nix @@ -39,7 +39,6 @@ buildPythonPackage rec { propagatedBuildInputs = [ setuptools requests - textual black distro elasticsearch @@ -51,6 +50,7 @@ buildPythonPackage rec { importlib-resources pkgs.pre-commit tools-common + tools-common.textual ]; dontUsePytestCheck = true; # no tests diff --git a/pkgs/tools-common/default.nix b/pkgs/tools-common/default.nix index dac5b00..a5706e9 100644 --- a/pkgs/tools-common/default.nix +++ b/pkgs/tools-common/default.nix @@ -1,13 +1,28 @@ -{ pkgs }: +{ fetchFromGitHub, python3Packages }: -with pkgs.python3Packages; +let + # Can be unpinned once https://github.com/tenstorrent/tt-tools-common/blob/main/pyproject.toml#L32 + # is v1 + textual_0_82 = python3Packages.textual.overridePythonAttrs (old: rec { + version = "0.82.0"; + src = fetchFromGitHub { + owner = "Textualize"; + repo = "textual"; + rev = "refs/tags/v${version}"; + hash = "sha256-belpoXQ+CkTchK+FjI/Ur8v4cNgzX39xLdNfPCwaU6E="; + }; + disabledTests = old.disabledTests ++ [ + "test_selection" + ]; + }); +in -buildPythonPackage rec { +python3Packages.buildPythonPackage rec { pname = "tools-common"; # https://github.com/tenstorrent/tt-smi/blob/main/pyproject.toml#L31 version = "1.4.11"; - src = pkgs.fetchFromGitHub { + src = fetchFromGitHub { owner = "tenstorrent"; repo = "tt-tools-common"; rev = "refs/tags/v${version}"; @@ -16,7 +31,7 @@ buildPythonPackage rec { format = "pyproject"; - nativeBuildInputs = [ pythonRelaxDepsHook ]; + nativeBuildInputs = with python3Packages; [ pythonRelaxDepsHook ]; pythonRelaxDeps = [ "distro" @@ -29,14 +44,14 @@ buildPythonPackage rec { "tqdm" ]; - propagatedBuildInputs = [ + propagatedBuildInputs = with python3Packages; [ setuptools distro elasticsearch psutil pyyaml rich - textual + textual_0_82 requests jsons tqdm @@ -46,4 +61,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "tt_tools_common" ]; + + passthru = { + textual = textual_0_82; + }; }