-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Avimitin <[email protected]>
- Loading branch information
Showing
4 changed files
with
77 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ stdenvNoCC | ||
, lib | ||
|
||
, espresso | ||
, circt | ||
|
||
, elaborateConfigJson | ||
, elaborator | ||
, configName | ||
, target | ||
, use-binder ? false | ||
}: | ||
|
||
assert lib.assertMsg | ||
(lib.elem target [ "ip" "ipemu" "subsystem" "subsystememu" ]) | ||
"Unknown elaborate target ${target}"; | ||
|
||
let | ||
elaborateArgs = lib.filter (s: s != "") [ | ||
"--ip-config" | ||
# Can't use `toString` here, or due to some shell escape issue, Java nio cannot find the path | ||
"${elaborateConfigJson}" | ||
"--target-dir" | ||
(if use-binder then (placeholder "out") else "elaborate") | ||
(lib.optionalString (use-binder) "--binder-mlirbc-out") | ||
(lib.optionalString (use-binder) "${target}-${configName}") | ||
]; | ||
in | ||
stdenvNoCC.mkDerivation { | ||
name = "t1-${target}-${configName}-elaborate"; | ||
|
||
nativeBuildInputs = [ espresso circt ]; | ||
|
||
passthru = { | ||
elaborateTarget = target; | ||
elaborateConfig = configName; | ||
}; | ||
|
||
buildCommand = '' | ||
mkdir -p elaborate $out | ||
${elaborator}/bin/elaborator ${target} ${lib.escapeShellArgs elaborateArgs} | ||
'' + lib.optionalString (!use-binder) '' | ||
firtool elaborate/*.fir \ | ||
--annotation-file elaborate/*.anno.json \ | ||
--emit-bytecode \ | ||
--parse-only \ | ||
-o $out/${target}-${configName}.mlirbc | ||
''; | ||
|
||
meta.description = "Parsed only MLIR Bytecode file for ${target} with config ${configName}."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,28 @@ | ||
{ stdenvNoCC | ||
, lib | ||
|
||
, espresso | ||
, circt | ||
|
||
, elaborateConfigJson | ||
, elaborator | ||
, configName | ||
, target | ||
, use-binder ? false | ||
, elaborate | ||
}: | ||
|
||
assert lib.assertMsg | ||
(lib.elem target [ "ip" "ipemu" "subsystem" "subsystememu" ]) | ||
"Unknown elaborate target ${target}"; | ||
|
||
let | ||
elaborateArgs = lib.filter (s: s != "") [ | ||
"--ip-config" | ||
# Can't use `toString` here, or due to some shell escape issue, Java nio cannot find the path | ||
"${elaborateConfigJson}" | ||
"--target-dir" | ||
(if use-binder then (placeholder "out") else "elaborate") | ||
(lib.optionalString (use-binder) "--binder-mlirbc-out") | ||
(lib.optionalString (use-binder) "${target}-${configName}") | ||
]; | ||
uniqueName = "${elaborate.elaborateTarget}-${elaborate.elaborateConfig}"; | ||
in | ||
stdenvNoCC.mkDerivation { | ||
name = "t1-${target}-${configName}-mlirbc"; | ||
name = "t1-${uniqueName}-mlirbc"; | ||
|
||
nativeBuildInputs = [ espresso circt ]; | ||
nativeBuildInputs = [ circt ]; | ||
|
||
passthru = { | ||
elaborateTarget = target; | ||
elaborateConfig = configName; | ||
}; | ||
inherit (elaborate) passthru; | ||
|
||
buildCommand = '' | ||
mkdir -p elaborate $out | ||
mkdir $out | ||
${elaborator}/bin/elaborator ${target} ${lib.escapeShellArgs elaborateArgs} | ||
'' + lib.optionalString (!use-binder) '' | ||
firtool elaborate/*.fir \ | ||
--annotation-file elaborate/*.anno.json \ | ||
firtool ${elaborate}/${uniqueName}.mlirbc \ | ||
--emit-bytecode \ | ||
-O=debug \ | ||
--preserve-values=named \ | ||
--output-annotation-file=mfc.anno.json \ | ||
--lowering-options=verifLabels \ | ||
--emit-bytecode \ | ||
--parse-only \ | ||
-o $out/${target}-${configName}.mlirbc | ||
--output-final-mlir=$out/${uniqueName}-lowered.mlirbc | ||
''; | ||
|
||
meta.description = "Elaborated MLIR Bytecode file for ${target} with config ${configName}."; | ||
meta.description = "Lowered MLIR Bytecode file (${uniqueName})."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters