Skip to content

Commit

Permalink
misc: better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
xieby1 committed Jan 10, 2025
1 parent bbc472d commit cfdb04a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
54 changes: 27 additions & 27 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,14 @@ assert lib.assertOneOf "cpt-simulator" cpt-simulator ["qemu" "nemu"];
assert lib.assertOneOf "cpt-format" cpt-format ["gz" "zstd"];
assert lib.assertMsg (cpt-simulator=="qemu" -> cpt-format=="zstd") "qemu only supports cpt-format: zstd";
let
raw = import ./raw.nix { inherit pkgs; };
raw' = import ./raw.nix { inherit pkgs; };
utils = pkgs.callPackage ./utils.nix {};
in raw.overrideScope (r-self: r-super: {
riscv64-scope = r-super.riscv64-scope.overrideScope (self: super: {
in raw'.overrideScope (deterload: raw: {
deterPkgs = raw.deterPkgs.overrideScope (self: super: {
riscv64-stdenv = super.riscv64-pkgs."${cc}Stdenv";
});

benchmarks = r-super.benchmarks.overrideScope (bmks-self: bmks-super: {
benchmarks = raw.benchmarks.overrideScope (self: super: {
spec2006 = builtins.mapAttrs (testcase: value: value.override {
inherit enableVector;
src = spec2006-src;
Expand All @@ -305,36 +305,36 @@ in raw.overrideScope (r-self: r-super: {
march = spec2006-march;
}) (lib.filterAttrs (testcase: value:
(spec2006-testcase-filter testcase) && (lib.isDerivation value))
bmks-super.spec2006);
super.spec2006);

openblas = bmks-super.openblas.override {
openblas = super.openblas.override {
TARGET = openblas-target;
};
});

build = benchmark: (r-super.build benchmark).overrideScope (b-self: b-super: {
initramfs_overlays = b-super.initramfs_overlays.override {
build = benchmark: (raw.build benchmark).overrideScope (self: super: {
initramfs_overlays = super.initramfs_overlays.override {
trapCommand = "${cpt-simulator}_trap";
inherit interactive;
};
dts = b-super.dts.override { inherit cores; };
gcpt = if cores=="1" then b-super.gcpt_single_core
else if cores=="2" then b-super.gcpt_dual_core
else b-super.gcpt;
dts = super.dts.override { inherit cores; };
gcpt = if cores=="1" then super.gcpt_single_core
else if cores=="2" then super.gcpt_dual_core
else super.gcpt;

stage1-profiling = b-super.stage1-profiling.override {
stage1-profiling = super.stage1-profiling.override {
workload_name = "miao";
intervals = cpt-intervals;
simulator = cpt-simulator;
profiling_log = "profiling.log";
smp = cores;
};
stage2-cluster = b-super.stage2-cluster.override {
stage2-cluster = super.stage2-cluster.override {
maxK = if (cpt-maxK-bmk ? "${utils.getName benchmark}")
then cpt-maxK-bmk."${utils.getName benchmark}"
else cpt-maxK;
};
stage3-checkpoint = b-super.stage3-checkpoint.override {
stage3-checkpoint = super.stage3-checkpoint.override {
workload_name = "miao";
intervals = cpt-intervals;
simulator = cpt-simulator;
Expand All @@ -343,40 +343,40 @@ in raw.overrideScope (r-self: r-super: {
smp = cores;
};

sim = b-super.sim.override { smp = cores; };
sim = super.sim.override { smp = cores; };
});

spec2006 = let tag = builtins.concatStringsSep "_" [
"spec2006"
spec2006-size
(lib.removePrefix "${r-self.riscv64-scope.riscv64-stdenv.targetPlatform.config}-" r-self.riscv64-scope.riscv64-stdenv.cc.cc.name)
(lib.removePrefix "${deterload.deterPkgs.riscv64-stdenv.targetPlatform.config}-" deterload.deterPkgs.riscv64-stdenv.cc.cc.name)
spec2006-optimize
spec2006-march
r-self.benchmarks.riscv64-libc.pname
r-self.benchmarks.riscv64-jemalloc.pname
deterload.benchmarks.riscv64-libc.pname
deterload.benchmarks.riscv64-jemalloc.pname
cpt-simulator
(utils.metricPrefix cpt-intervals)
(let suffix = lib.optionalString (builtins.any
(x: x.stage2-cluster.maxK!=cpt-maxK)
(builtins.attrValues r-super.spec2006)
(builtins.attrValues raw.spec2006)
) "x"; in"maxK${cpt-maxK}${suffix}")
"${cores}core"
spec2006-extra-tag
]; in r-super.spec2006 // (utils.wrap-l2 tag r-super.spec2006);
]; in raw.spec2006 // (utils.wrap-l2 tag raw.spec2006);

openblas = let tag = builtins.concatStringsSep "_" [
"openblas"
(lib.removePrefix "${r-self.riscv64-scope.riscv64-stdenv.targetPlatform.config}-" r-self.riscv64-scope.riscv64-stdenv.cc.cc.name)
(lib.removePrefix "${deterload.deterPkgs.riscv64-stdenv.targetPlatform.config}-" deterload.deterPkgs.riscv64-stdenv.cc.cc.name)
openblas-target
r-self.benchmarks.riscv64-libc.pname
deterload.benchmarks.riscv64-libc.pname
cpt-simulator
(utils.metricPrefix cpt-intervals)
"maxK${r-super.openblas.stage2-cluster.maxK}"
"maxK${raw.openblas.stage2-cluster.maxK}"
"${cores}core"
openblas-extra-tag
]; in utils.wrap-l1 tag r-super.openblas;
]; in utils.wrap-l1 tag raw.openblas;

nyancat = r-self.build (r-self.riscv64-scope.writeShScript "nyancat-run" {} ''
timeout 20 ${r-self.riscv64-scope.riscv64-pkgs.nyancat}/bin/nyancat -t
nyancat = deterload.build (deterload.deterPkgs.writeShScript "nyancat-run" {} ''
timeout 20 ${deterload.deterPkgs.riscv64-pkgs.nyancat}/bin/nyancat -t
'');
})
14 changes: 7 additions & 7 deletions raw.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
sha256 = "1n6gdjny8k5rwkxh6sp1iwg1y3ni1pm7lvh9sisifgjb18jdvzbm";
}) {}
}:
pkgs.lib.makeScope pkgs.lib.callPackageWith (ds/*deterload-scope itself*/: {
riscv64-scope = let callPackageDefaultThrowWith = autoArgs: fn: args:
pkgs.lib.makeScope pkgs.lib.callPackageWith (raw/*deterload-scope itself*/: {
deterPkgs = let callPackageDefaultThrowWith = autoArgs: fn: args:
let inherit (pkgs.lib) isFunction functionArgs intersectAttrs mapAttrs filterAttrs attrNames makeOverridable;
f = if isFunction fn then fn else import fn;
fargs = functionArgs f;
Expand Down Expand Up @@ -54,12 +54,12 @@ pkgs.lib.makeScope pkgs.lib.callPackageWith (ds/*deterload-scope itself*/: {
};
});

benchmarks = ds.riscv64-scope.callPackage ./benchmarks {};
benchmarks = raw.deterPkgs.callPackage ./benchmarks {};

build = ds.riscv64-scope.callPackage ./builders {};
build = raw.deterPkgs.callPackage ./builders {};

spec2006 = builtins.mapAttrs (name: benchmark: (ds.build benchmark))
(pkgs.lib.filterAttrs (n: v: (pkgs.lib.isDerivation v)) ds.benchmarks.spec2006);
spec2006 = builtins.mapAttrs (name: benchmark: (raw.build benchmark))
(pkgs.lib.filterAttrs (n: v: (pkgs.lib.isDerivation v)) raw.benchmarks.spec2006);

openblas = ds.build ds.benchmarks.openblas;
openblas = raw.build raw.benchmarks.openblas;
})

0 comments on commit cfdb04a

Please sign in to comment.