Skip to content

Commit

Permalink
Merge pull request #3272 from alyssarosenzweig/instcountci/del-optimal
Browse files Browse the repository at this point in the history
InstructionCountCI: Remove Optimal flags
  • Loading branch information
alyssarosenzweig committed Nov 14, 2023
2 parents 1e2d059 + bd4464b commit 4a31b61
Show file tree
Hide file tree
Showing 60 changed files with 4 additions and 5,619 deletions.
17 changes: 2 additions & 15 deletions Scripts/InstructionCountParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@
@dataclass
class TestData:
name: str
optimal: int
expectedinstructioncount: int
code: bytes
instructions: list
def __init__(self, Name, Optimal, ExpectedInstructionCount, Code, Instructions):
def __init__(self, Name, ExpectedInstructionCount, Code, Instructions):
self.name = Name
self.expectedinstructioncount = ExpectedInstructionCount
self.optimal = Optimal
self.code = Code
self.instructions = Instructions

@property
def Name(self):
return self.name

@property
def Optimal(self):
return self.optimal

@property
def ExpectedInstructionCount(self):
return self.expectedinstructioncount
Expand Down Expand Up @@ -112,15 +106,10 @@ def parse_json_data(json_filepath, json_filename, json_data, output_binary_path)

for key, items in json_data["Instructions"].items():
ExpectedInstructionCount = 0
Optimal = 0
Instructions = []
if ("ExpectedInstructionCount" in items):
ExpectedInstructionCount = int(items["ExpectedInstructionCount"])

if ("Optimal" in items):
if items["Optimal"].upper() == "YES":
Optimal = 1

if ("Skip" in items):
if items["Skip"].upper() == "YES":
continue
Expand Down Expand Up @@ -163,7 +152,7 @@ def parse_json_data(json_filepath, json_filename, json_data, output_binary_path)
with open(tmp_asm_out, "rb") as tmp_asm_out_file:
binary_hex = tmp_asm_out_file.read()

TestDataMap[TestName] = TestData(key, Optimal, ExpectedInstructionCount, binary_hex, Instructions)
TestDataMap[TestName] = TestData(key, ExpectedInstructionCount, binary_hex, Instructions)

os.remove(tmp_asm)
os.remove(tmp_asm_out)
Expand All @@ -181,7 +170,6 @@ def parse_json_data(json_filepath, json_filename, json_data, output_binary_path)
# };
# struct TestInfo {
# char InstName[128];
# uint64_t Optimal;
# int64_t ExpectedInstructionCount;
# uint64_t CodeSize;
# uint64_t x86InstCount;
Expand All @@ -208,7 +196,6 @@ def parse_json_data(json_filepath, json_filename, json_data, output_binary_path)
# Add each test
for key, item in TestDataMap.items():
MemData += struct.pack('128s', item.Name.encode("ascii"))
MemData += struct.pack('Q', item.Optimal)
MemData += struct.pack('q', item.ExpectedInstructionCount)
MemData += struct.pack('Q', len(item.Code))
MemData += struct.pack('Q', len(item.Instructions))
Expand Down
5 changes: 2 additions & 3 deletions Source/Tools/CodeSizeValidation/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ void AssertHandler(char const *Message) {

struct TestInfo {
char TestInst[128];
uint64_t Optimal;
int64_t ExpectedInstructionCount;
uint64_t CodeSize;
uint64_t x86InstCount;
Expand Down Expand Up @@ -276,8 +275,8 @@ static bool TestInstructions(FEXCore::Context::Context *CTX, FEXCore::Core::Inte

LogMan::Msg::IFmt("Testing instruction '{}': {} host instructions", CurrentTest->TestInst, INSTStats->first.HostCodeInstructions);

// Show the code if we know the implementation isn't optimal or if the count of instructions changed to something we didn't expect.
bool ShouldShowCode = CurrentTest->Optimal == 0 ||
// Show the code if the count of instructions changed to something we didn't expect.
bool ShouldShowCode =
INSTStats->first.HostCodeInstructions != CurrentTest->ExpectedInstructionCount;

if (ShouldShowCode) {
Expand Down
10 changes: 0 additions & 10 deletions unittests/InstructionCountCI/AFP/H0F3A.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"Instructions": {
"roundss xmm0, xmm1, 00000000b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"Nearest rounding",
"0x66 0x0f 0x3a 0x0a"
Expand All @@ -23,7 +22,6 @@
},
"roundss xmm0, xmm1, 00000001b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"-inf rounding",
"0x66 0x0f 0x3a 0x0a"
Expand All @@ -34,7 +32,6 @@
},
"roundss xmm0, xmm1, 00000010b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"+inf rounding",
"0x66 0x0f 0x3a 0x0a"
Expand All @@ -45,7 +42,6 @@
},
"roundss xmm0, xmm1, 00000011b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"truncate rounding",
"0x66 0x0f 0x3a 0x0a"
Expand All @@ -56,7 +52,6 @@
},
"roundss xmm0, xmm1, 00000100b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"host rounding mode rounding",
"0x66 0x0f 0x3a 0x0a"
Expand All @@ -67,7 +62,6 @@
},
"roundsd xmm0, xmm1, 00000000b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"Nearest rounding",
"0x66 0x0f 0x3a 0x0b"
Expand All @@ -78,7 +72,6 @@
},
"roundsd xmm0, xmm1, 00000001b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"-inf rounding",
"0x66 0x0f 0x3a 0x0b"
Expand All @@ -89,7 +82,6 @@
},
"roundsd xmm0, xmm1, 00000010b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"+inf rounding",
"0x66 0x0f 0x3a 0x0b"
Expand All @@ -100,7 +92,6 @@
},
"roundsd xmm0, xmm1, 00000011b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"truncate rounding",
"0x66 0x0f 0x3a 0x0b"
Expand All @@ -111,7 +102,6 @@
},
"roundsd xmm0, xmm1, 00000100b": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"host rounding mode rounding",
"0x66 0x0f 0x3a 0x0b"
Expand Down
2 changes: 0 additions & 2 deletions unittests/InstructionCountCI/AFP/SVE256/Secondary.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"Instructions": {
"cvtpi2ps xmm0, [rax]": {
"ExpectedInstructionCount": 2,
"Optimal": "Yes",
"Comment": [
"0x0f 0x2a"
],
Expand All @@ -22,7 +21,6 @@
},
"cvtpi2ps xmm0, mm0": {
"ExpectedInstructionCount": 2,
"Optimal": "Yes",
"Comment": [
"0x0f 0x2a"
],
Expand Down
22 changes: 0 additions & 22 deletions unittests/InstructionCountCI/AFP/SVE256/Secondary_REP.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"Instructions": {
"cvtsi2ss xmm0, eax": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x2a"
],
Expand All @@ -21,7 +20,6 @@
},
"cvtsi2ss xmm0, dword [rax]": {
"ExpectedInstructionCount": 2,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x2a"
],
Expand All @@ -32,7 +30,6 @@
},
"cvtsi2ss xmm0, qword [rax]": {
"ExpectedInstructionCount": 2,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x2a"
],
Expand All @@ -43,15 +40,13 @@
},
"sqrtss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": "0xf3 0x0f 0x51",
"ExpectedArm64ASM": [
"fsqrt s16, s17"
]
},
"rsqrtss xmm0, xmm1": {
"ExpectedInstructionCount": 3,
"Optimal": "Yes",
"Comment": [
"FEAT_FPRES could make this more optimal",
"0xf3 0x0f 0x52"
Expand All @@ -64,7 +59,6 @@
},
"rcpss xmm0, xmm1": {
"ExpectedInstructionCount": 2,
"Optimal": "Yes",
"Comment": [
"FEAT_FPRES could make this more optimal",
"0xf3 0x0f 0x53"
Expand All @@ -76,7 +70,6 @@
},
"addss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x58"
],
Expand All @@ -86,7 +79,6 @@
},
"mulss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x59"
],
Expand All @@ -96,15 +88,13 @@
},
"cvtss2sd xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": "0xf3 0x0f 0x5a",
"ExpectedArm64ASM": [
"fcvt d16, s17"
]
},
"cvtss2sd xmm0, [rax]": {
"ExpectedInstructionCount": 2,
"Optimal": "Yes",
"Comment": "0xf3 0x0f 0x5a",
"ExpectedArm64ASM": [
"ldr d2, [x4]",
Expand All @@ -113,7 +103,6 @@
},
"subss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x5c"
],
Expand All @@ -123,7 +112,6 @@
},
"minss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x5d"
],
Expand All @@ -133,7 +121,6 @@
},
"divss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x5e"
],
Expand All @@ -143,7 +130,6 @@
},
"maxss xmm0, xmm1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0x5f"
],
Expand All @@ -153,7 +139,6 @@
},
"cmpss xmm0, xmm1, 0": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -163,7 +148,6 @@
},
"cmpss xmm0, xmm1, 1": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -173,7 +157,6 @@
},
"cmpss xmm0, xmm1, 2": {
"ExpectedInstructionCount": 1,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -183,7 +166,6 @@
},
"cmpss xmm0, xmm1, 3": {
"ExpectedInstructionCount": 6,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -198,7 +180,6 @@
},
"cmpss xmm0, xmm1, 4": {
"ExpectedInstructionCount": 4,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -211,7 +192,6 @@
},
"cmpss xmm0, xmm1, 5": {
"ExpectedInstructionCount": 3,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -223,7 +203,6 @@
},
"cmpss xmm0, xmm1, 6": {
"ExpectedInstructionCount": 3,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand All @@ -235,7 +214,6 @@
},
"cmpss xmm0, xmm1, 7": {
"ExpectedInstructionCount": 5,
"Optimal": "Yes",
"Comment": [
"0xf3 0x0f 0xc2"
],
Expand Down

0 comments on commit 4a31b61

Please sign in to comment.