diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70de682d6..a0ae1a3c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,8 @@ jobs: matrix: config: - blastoise + - machamp + - sandslash outputs: cache-key: ${{ steps.build.outputs.cache-key }} steps: @@ -24,25 +26,37 @@ jobs: run: | closure="$(nix build -L '.#t1.${{ matrix.config }}.release.docker-layers.final-image' --no-link --print-out-paths)" echo "path: $closure" - cp "$closure/image.tar" /tmp/t1-image.tar - echo "cache-key=$(nix hash file --base32 /tmp/t1-image.tar)" > $GITHUB_OUTPUT + cp "$closure/image.tar" /tmp/t1-${{ matrix.config }}-image.tar + echo "cache-key-${{ matrix.config }}=$(nix hash file --base32 $closure/image.tar)" > $GITHUB_OUTPUT + nix build -L '.#t1.${{ matrix.config }}.release.doc' --out-link docs - name: Upload to cache uses: actions/cache/save@v4 with: - path: /tmp/t1-image.tar - key: ${{ steps.build.outputs.cache-key }} + path: /tmp/t1-${{ matrix.config }}-image.tar + key: ${{ steps.build.outputs[format('cache-key-{0}', matrix.config)] }} + - uses: actions/upload-artifact@v4 + with: + name: docs-${{ matrix.config }}.pdf + path: | + docs/*.pdf upload: runs-on: ubuntu-latest needs: [build] + strategy: + matrix: + config: + - blastoise + - machamp + - sandslash steps: - - name: Restore from cache + - name: Restore ${{ matrix.config }} from cache uses: actions/cache/restore@v4 id: cache with: - path: /tmp/t1-image.tar + path: /tmp/t1-${{ matrix.config }}-image.tar fail-on-cache-miss: true - key: ${{ needs.build.outputs.cache-key }} + key: ${{ needs.build.outputs[format('cache-key-{0}', matrix.config)] }} - name: Login to GHCR dot IO uses: docker/login-action@v2 with: @@ -51,6 +65,6 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Load and push run: | - docker load < /tmp/t1-image.tar - docker tag t1/release:latest ghcr.io/chipsalliance/t1:latest - docker push ghcr.io/chipsalliance/t1:latest + docker load < /tmp/t1-${{ matrix.config }}-image.tar + docker tag chipsalliance/t1-${{ matrix.config }}:latest ghcr.io/chipsalliance/t1-${{ matrix.config }}:latest + docker push ghcr.io/chipsalliance/t1-${{ matrix.config }}:latest diff --git a/nix/t1/default.nix b/nix/t1/default.nix index 373155df5..e720595ec 100644 --- a/nix/t1/default.nix +++ b/nix/t1/default.nix @@ -85,9 +85,7 @@ lib.makeScope newScope rtl = innerSelf.callPackage ./rtl.nix { mlirbc = innerSelf.subsystem.mlirbc; }; }; - release = innerSelf.callPackage ./release { - ip-emulator = ip.emu-trace; - }; + release = innerSelf.callPackage ./release { }; }) ) ) diff --git a/nix/t1/release/default.nix b/nix/t1/release/default.nix index 0f80a8cd5..3b0ebe9cc 100644 --- a/nix/t1/release/default.nix +++ b/nix/t1/release/default.nix @@ -10,13 +10,13 @@ , configName , t1-script -, ip-emulator +, ip , cases , elaborateConfigJson }: lib.makeScope newScope (scope: rec { - inherit ip-emulator elaborateConfigJson; + inherit elaborateConfigJson configName; testCases = with cases; [ intrinsic.matmul @@ -34,7 +34,13 @@ lib.makeScope newScope (scope: rec { makeWrapper ${t1-script}/bin/t1-helper $out/bin/ip-emulator \ --add-flags "ipemu" \ --add-flags "--config ${elaborateConfigJson}" \ - --add-flags "--emulator-path ${ip-emulator}/bin/emulator" + --add-flags "--emulator-path ${ip.emu}/bin/emulator" + + makeWrapper ${t1-script}/bin/t1-helper $out/bin/ip-emulator-trace \ + --add-flags "ipemu" \ + --add-flags "--config ${elaborateConfigJson}" \ + --add-flags "--trace" \ + --add-flags "--emulator-path ${ip.emu-trace}/bin/emulator" ''; docker-layers = scope.callPackage ./docker-layers.nix { }; diff --git a/nix/t1/release/doc.typ b/nix/t1/release/doc.typ index 1b721c581..ad82fa9f1 100644 --- a/nix/t1/release/doc.typ +++ b/nix/t1/release/doc.typ @@ -52,6 +52,7 @@ docker run --name t1 -it -v $PWD:/workspace --rm t1/release:latest /bin/bash == What is inside + IP emulator: `/bin/ip-emulator` ++ IP emulator with trace functionality: `/bin/ip-emulator-trace` + Softmax & Linear Normalization & Matmul test cases: `/workspace/cases` == How to run some workload using IP emulator @@ -64,5 +65,5 @@ ls /workspace/cases ip-emulator --case cases/intrinsic-matmul/bin/intrinsic.matmul.elf # Get waveform trace file -ip-emulator --trace --case ... +ip-emulator-trace --case cases/intrinsic-linear_normalization/bin/intrinsic.linear_normalization.elf ``` diff --git a/nix/t1/release/docker-layers.nix b/nix/t1/release/docker-layers.nix index ce731618b..e8c164f90 100644 --- a/nix/t1/release/docker-layers.nix +++ b/nix/t1/release/docker-layers.nix @@ -13,12 +13,13 @@ , rv32-stdenv , emulator-wrapped , testCases +, configName }: let # Don't use buildImage which relies on KVM feature self = dockerTools.streamLayeredImage { - name = "t1/release"; + name = "chipsalliance/t1-${configName}"; tag = "latest"; contents = with dockerTools; [ diff --git a/script/src/Main.scala b/script/src/Main.scala index a8feca15e..1daf89e07 100644 --- a/script/src/Main.scala +++ b/script/src/Main.scala @@ -115,20 +115,21 @@ object Main: caseName: String ): os.Path = val pathTail = - if (os.exists(os.Path(caseName, os.pwd))) then + if os.exists(os.Path(caseName, os.pwd)) || os.exists(os.Path(config, os.pwd)) then // It is hard to canoncalize user specify path, so here we use date time instead - java.time.LocalDateTime + val now = java.time.LocalDateTime .now() .format( java.time.format.DateTimeFormatter.ofPattern("yy-MM-dd-HH-mm-ss") ) - else caseName + os.RelPath(now) + else os.RelPath(s"$config/$caseName") val path = if (outputDir.isEmpty) then if (outputBaseDir.isEmpty) then - os.pwd / "testrun" / s"${emuType}emu" / config / pathTail - else os.Path(outputBaseDir.get, os.pwd) / config / pathTail + os.pwd / "testrun" / s"${emuType}emu" / pathTail + else os.Path(outputBaseDir.get, os.pwd) / pathTail else os.Path(outputDir.get) os.makeDir.all(path) @@ -142,6 +143,7 @@ object Main: @main def ipemu( @arg( name = "case", + short = 'C', doc = "name alias for loading test case" ) testCase: String, @arg( @@ -206,7 +208,8 @@ object Main: doc = "Force using x86_64 as cross compiling host platform" ) forceX86: Boolean = false, @arg( - name = "dump-cycle", + name = "dump-from-cycle", + short = 'D', doc = "Specify the dump starting point" ) dumpCycle: String = "0.0", @arg(