Skip to content

Commit

Permalink
config: rename weave wrap-l2 and add prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
xieby1 committed Dec 13, 2024
1 parent ee3bfdb commit 29f5afe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ in raw.overrideScope (r-self: r-super: {
size = spec2006-size;
};
})) bare;
in bare-overrided // (r-super.tools.weave bare-overrided);
in bare-overrided // (r-super.tools.wrap-l2 "spec2006_ref_gcc_1410_O3_flto_rv64gc_zba_zbb_zbc_zbs_qemu_1core" bare-overrided);

openblas = r-super.openblas.overrideScope ( self: super: {
benchmark = super.benchmark.override { inherit enableVector; };
Expand Down
25 changes: 19 additions & 6 deletions raw.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,31 @@ pkgs.lib.makeScope pkgs.lib.callPackageWith (ds/*deterload-scope itself*/: {

build = ds.riscv64-scope.callPackage ./builders {};
tools = {
/*weave {a={x=drv0;y=drv1;z=drv2;}; b={x=drv3;y=drv4;z=drv5;}; c={x=drv6;y=drv7;z=drv8;};}
returns {x=linkFarm [drv0 drv3 drv6]; y=linkFarm [drv1 drv4 drv7]; z=linkFarm [drv2 drv5 drv8];}*/
weave = attrs-drvs: let
/*string -> set -> set:
wrap-l2 prefix {
a={x=drv0; y=drv1; z=drv2; w=0;};
b={x=drv3; y=drv4; z=drv5; w=1;};
c={x=drv6; y=drv7; z=drv8; w=2;};
}
returns {
x=linkFarm "${prefix}_x" [drv0 drv3 drv6];
y=linkFarm "${prefix}_y" [drv1 drv4 drv7];
z=linkFarm "${prefix}_z" [drv2 drv5 drv8];
}*/
wrap-l2 = prefix: attrs-drvs: let
/*mapToAttrs (name: {inherit name; value=...}) ["a", "b", "c", ...]
returns {x=value0; b=value1; c=value2; ...} */
mapToAttrs = func: list: builtins.listToAttrs (builtins.map func list);
/*attrDrvNames {a={x=drv0;y=drv1;z=drv2;w=0;}; b={x=drv3;y=drv4;z=drv5;w=1;}; c={x=drv6;y=drv7;z=drv8;w=2;};}
/*attrDrvNames {
a={x=drv0; y=drv1; z=drv2; w=0;};
b={x=drv3; y=drv4; z=drv5; w=1;};
c={x=drv6; y=drv7; z=drv8; w=2;};
}
returns ["x" "y" "z"] */
attrDrvNames = set: builtins.attrNames (filterDrvs (builtins.head (builtins.attrValues set)));
in mapToAttrs (name/*represents the name in builders/default.nix, like img, cpt, ...*/: {
inherit name;
value = pkgs.linkFarm name (
value = pkgs.linkFarm "${prefix}_${name}" (
pkgs.lib.mapAttrsToList (testCase: buildResult: {
name = testCase;
path = buildResult."${name}";
Expand All @@ -60,7 +73,7 @@ pkgs.lib.makeScope pkgs.lib.callPackageWith (ds/*deterload-scope itself*/: {
spec2006 = let
benchmarks = ds.riscv64-scope.callPackage ./benchmarks/spec2006 {};
bare = builtins.mapAttrs (name: benchmark: (ds.build benchmark)) (filterDrvs benchmarks);
in bare // (ds.tools.weave bare);
in bare // (ds.tools.wrap-l2 "spec2006_raw" bare);

openblas = let
benchmark = ds.riscv64-scope.callPackage ./benchmarks/openblas {};
Expand Down

0 comments on commit 29f5afe

Please sign in to comment.