-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df7a8c6
commit 1f0cb47
Showing
6 changed files
with
181 additions
and
26 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
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,64 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace AsmGen | ||
{ | ||
public class MixVec512Vec256BlockRfTest : UarchTest | ||
{ | ||
// number of tiny registers | ||
private int nTiny; | ||
|
||
public MixVec512Vec256BlockRfTest(int low, int high, int step, int nTiny) | ||
{ | ||
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step); | ||
this.Prefix = "mixvec512vec256blockrf" + nTiny; | ||
this.Description = $"Mixed zmm/ymm regs - AVX-512 only, {nTiny} 256-bit then 512-bit"; | ||
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr, float *floatArr"; | ||
this.GetFunctionCallParameters = "structIterations, A, fpArr"; | ||
this.DivideTimeByCount = false; | ||
} | ||
|
||
public override bool SupportsIsa(IUarchTest.ISA isa) | ||
{ | ||
if (isa == IUarchTest.ISA.amd64) return true; | ||
return false; | ||
} | ||
|
||
public override void GenerateAsm(StringBuilder sb, IUarchTest.ISA isa) | ||
{ | ||
if (isa == IUarchTest.ISA.amd64) | ||
{ | ||
// use even numbered regs for ymm testing | ||
string initInstrs = " vmovups (%r8), %zmm1\n" + | ||
" vmovups 64(%r8), %ymm2\n" + | ||
" vmovups 128(%r8), %zmm3\n" + | ||
" vmovups 192(%r8), %ymm4\n" + | ||
" vmovups 256(%r8), %zmm5\n"; | ||
|
||
// use all zmm regs | ||
for (int i = 6; i < 32; i++) | ||
{ | ||
if ((i & 1) == 0) initInstrs += "vmovups %ymm2, %ymm" + i + "\n"; | ||
else initInstrs += "vmovups %zmm5, %zmm" + i + "\n"; | ||
} | ||
|
||
List<string> instrsList = new List<string>(); | ||
for (int i = 0; i < nTiny; i++) | ||
{ | ||
int regNum = ((i & 1) == 0) ? i & 0x1F : (i + 1) & 0x1F; | ||
instrsList.Add($" vaddps %ymm2, %ymm{regNum}, %ymm{regNum}"); | ||
} | ||
|
||
for (int i = nTiny; i < this.Counts[this.Counts.Length - 1];i++) | ||
{ | ||
int regNum = ((i & 1) == 0) ? i: (i + 1); | ||
regNum = (regNum + 1) & 0x1F; | ||
instrsList.Add($" vaddps %zmm1, %zmm{regNum}, %zmm{regNum}"); | ||
} | ||
|
||
string[] unrolledAdds = instrsList.ToArray(); | ||
UarchTestHelpers.GenerateX86AsmStructureTestFuncs(sb, this.Counts, this.Prefix, unrolledAdds, unrolledAdds, false, initInstrs); | ||
} | ||
} | ||
} | ||
} |
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,54 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace AsmGen | ||
{ | ||
public class MixVec512Vec256RfTest : UarchTest | ||
{ | ||
public MixVec512Vec256RfTest(int low, int high, int step) | ||
{ | ||
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step); | ||
this.Prefix = "mixvec512vec256rf"; | ||
this.Description = "Mixed zmm/ymm regs - AVX-512 only, alternating"; | ||
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr, float *floatArr"; | ||
this.GetFunctionCallParameters = "structIterations, A, fpArr"; | ||
this.DivideTimeByCount = false; | ||
} | ||
|
||
public override bool SupportsIsa(IUarchTest.ISA isa) | ||
{ | ||
if (isa == IUarchTest.ISA.amd64) return true; | ||
return false; | ||
} | ||
|
||
public override void GenerateAsm(StringBuilder sb, IUarchTest.ISA isa) | ||
{ | ||
if (isa == IUarchTest.ISA.amd64) | ||
{ | ||
// use even numbered regs for ymm testing | ||
string initInstrs = " vmovups (%r8), %zmm1\n" + | ||
" vmovups 64(%r8), %ymm2\n" + | ||
" vmovups 128(%r8), %zmm3\n" + | ||
" vmovups 192(%r8), %ymm4\n" + | ||
" vmovups 256(%r8), %zmm5\n"; | ||
|
||
// use all zmm regs | ||
for (int i = 6; i < 32; i++) | ||
{ | ||
if ((i & 1) == 0) initInstrs += "vmovups %ymm2, %ymm" + i + "\n"; | ||
else initInstrs += "vmovups %zmm5, %zmm" + i + "\n"; | ||
} | ||
|
||
List<string> instrsList = new List<string>(); | ||
for (int i = 1; i < 32; i++) | ||
{ | ||
if ((i & 1) == 0) instrsList.Add($" vaddps %ymm2, %ymm{i}, %ymm{i}"); | ||
else instrsList.Add($" vaddps %zmm1, %zmm{i}, %zmm{i}"); | ||
} | ||
|
||
string[] unrolledAdds = instrsList.ToArray(); | ||
UarchTestHelpers.GenerateX86AsmStructureTestFuncs(sb, this.Counts, this.Prefix, unrolledAdds, unrolledAdds, false, initInstrs); | ||
} | ||
} | ||
} | ||
} |
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