Skip to content

Commit

Permalink
[script] fix multiple issue for backend
Browse files Browse the repository at this point in the history
* [mlirbc] add new elaborate target subsystememu
* [script] fix ratio issue
* [script] remove subsystememu script
* [script] fix build issue
* [ci] bump delete-artifact
  • Loading branch information
Avimitin committed Apr 23, 2024
1 parent 26c55a7 commit a586986
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 66 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,17 @@ jobs:
else
echo "No cycle change detect"
fi
- uses: geekyeggo/delete-artifact@v4
- uses: geekyeggo/delete-artifact@v5
with:
# test-reports has been used, it can be deleted
name: test-reports-*

clean-after-cancelled:
name: "Clean test reports [CANCELLED]"
name: "Clean test reports [ON CANCELLED]"
if: ${{ cancelled() }}
runs-on: [self-hosted, linux, nixos]
needs: [run-testcases]
steps:
- uses: geekyeggo/delete-artifact@v4
- uses: geekyeggo/delete-artifact@v5
with:
name: test-reports-*
2 changes: 1 addition & 1 deletion nix/t1/mlirbc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}:

assert lib.assertMsg
(lib.elem target [ "ip" "ipemu" "subsystem" ])
(lib.elem target [ "ip" "ipemu" "subsystem" "subsystememu" ])
"Unknown elaborate target ${target}";

let
Expand Down
2 changes: 1 addition & 1 deletion nix/t1/rtl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let
"--lowering-options=verifLabels,omitVersionComment"
"--strip-debug-info"
];
fixupFilelist = lib.elem mlirbc.elaborateTarget [ "ipemu" ];
fixupFilelist = lib.elem mlirbc.elaborateTarget [ "ipemu" "subsystememu" ];
in
stdenvNoCC.mkDerivation {
name = "t1-${mlirbc.elaborateConfig}-${mlirbc.elaborateTarget}-rtl";
Expand Down
2 changes: 2 additions & 0 deletions script/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

, metals
, mill
, graalvm-ce
}:

let
Expand Down Expand Up @@ -48,6 +49,7 @@ let

nativeBuildInputs = [
mill
graalvm-ce

makeWrapper
passthru.millDeps.setupHook
Expand Down
64 changes: 3 additions & 61 deletions script/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ object Main:
s"Can't use $dumpCycle as ratio, use 0 as waveform dump start point"
)
0
else if ratio == 0.0 then
0
else
val cycleRecordFilePath =
os.pwd / ".github" / "cases" / config / "default.json"
Expand Down Expand Up @@ -340,69 +342,9 @@ object Main:
Logger.info(s"Emulator log save to ${emulatorLogPath}")

if (trace.value) then
Logger.info(s"Trace file save to ${outputPath} / trace.fst")
Logger.info(s"Trace file save to ${outputPath}/wave.fst")
end ipemu

@main def subsystememu(
@arg(
name = "case",
short = 'c',
doc = "name alias for loading test case"
) testCase: String,
@arg(
name = "config",
short = 'c',
doc = "configuration name"
) config: String,
@arg(
name = "trace",
short = 't',
doc = "use emulator with trace support"
) trace: Flag,
@arg(
name = "trace-file",
doc = "Output path of the trace file"
) traceFile: Option[String],
@arg(
doc = "Force using x86_64 as cross compiling host platform"
) forceX86: Boolean = false,
@arg(
name = "out-dir",
doc = "path to save wave file and perf result file"
) outDir: Option[String],
@arg(
name = "base-out-dir",
doc = "save result files in {base_out_dir}/{config}/{case}/{run_config}"
) baseOutDir: Option[String],
@arg(
name = "emulator-path",
doc = "path to emulator"
) emulatorPath: Option[String]
): Unit =
val caseElfPath = resolveTestElfPath(config, testCase, forceX86)
val outputPath =
prepareOutputDir(outDir, baseOutDir, config, "subsystem", testCase)
val emulator = if (!emulatorPath.isEmpty) then
val emuPath = os.Path(emulatorPath.get, os.pwd)
if (!os.exists(emuPath)) then
sys.error(s"No emulator found at path: ${emulatorPath.get}")
emuPath
else resolveEmulatorPath(config, "subsystem", trace.value)

val emuArgs =
Seq(s"+init_file=${caseElfPath}") ++ optionals(
trace.value,
Seq(s"+trace_file=${
if (traceFile.isDefined) then os.Path(traceFile.get, os.pwd)
else outputPath / "trace.fst"
}")
)
os.proc(emuArgs).call()

if (trace.value) then
Logger.info(s"Trace file save to ${outputPath} / trace.fst")
end subsystememu

@main def listConfig(): Unit =
os.proc(
Seq(
Expand Down

0 comments on commit a586986

Please sign in to comment.