Skip to content

Commit

Permalink
[cases] add eval.chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
SharzyL committed Sep 13, 2024
1 parent ab32791 commit 6610257
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ let
codegen = casesSelf.callPackage ./codegen { };
rvv_bench = casesSelf.callPackage ./rvv_bench { };
pytorch = casesSelf.callPackage ./pytorch { };
eval = casesSelf.callPackage ./eval { };
}));

# remove non-case attributes in scope
scopeStripped = {
inherit (scope) mlir intrinsic asm perf codegen rvv_bench pytorch;
inherit (scope) mlir intrinsic asm perf codegen rvv_bench pytorch eval;
};

# This derivation is for internal CI use only.
Expand Down
20 changes: 20 additions & 0 deletions tests/eval/chaining/chaining.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.text
.balign 16
.globl test

test:
vsetvli a1, zero, e8, m8, ta, ma # Set vector length for maximum available bytes, with 8-bit element size
vadd.vi v8, v8, 14

li t0, 1000
loop_start:

vadd.vv v16, v8, v8
vmul.vv v24, v16, v8 # v1 chaining from last instr
vsub.vv v24, v16, v8 # v1 chaining from last 2 instr

addi t0, t0, -1
bnez t0, loop_start

ret

35 changes: 35 additions & 0 deletions tests/eval/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ lib
, linkerScript
, makeBuilder
, findAndBuild
, t1main
, getTestRequiredFeatures
}:

let
builder = makeBuilder { casePrefix = "eval"; };
build = { caseName, sourcePath }:
builder {
inherit caseName;

src = sourcePath;

passthru.featuresRequired = getTestRequiredFeatures sourcePath;
isFp = lib.pathExists (lib.path.append sourcePath "isFp");

buildPhase = ''
runHook preBuild
$CC -T${linkerScript} \
${caseName}.S \
${t1main} \
-o $pname.elf
runHook postBuild
'';

meta.description = "test case '${caseName}', written in C assembly";
};
in
findAndBuild ./. build

0 comments on commit 6610257

Please sign in to comment.