intel/brw: Consider pipe when comparing SWSB in tests

When tests were added, there was a single pipe (float), so there wasn't
a pipe to compare in `operator==`.  Add it there now and adjust
expectations accordingly.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31335>
This commit is contained in:
Caio Oliveira 2024-09-23 21:32:54 -07:00 committed by Marge Bot
parent b33a29f61e
commit d12950539c

View file

@ -114,17 +114,18 @@ emit_SEND(const fs_builder &bld, const brw_reg &dst,
return inst;
}
static tgl_swsb
tgl_swsb_testcase(unsigned regdist, unsigned sbid, enum tgl_sbid_mode mode)
static inline struct tgl_swsb
regdist(enum tgl_pipe pipe, unsigned d)
{
tgl_swsb swsb = tgl_swsb_sbid(mode, sbid);
swsb.regdist = regdist;
assert(d);
const struct tgl_swsb swsb = { d, pipe };
return swsb;
}
bool operator ==(const tgl_swsb &a, const tgl_swsb &b)
{
return a.mode == b.mode &&
a.pipe == b.pipe &&
a.regdist == b.regdist &&
(a.mode == TGL_SBID_NULL || a.sbid == b.sbid);
}
@ -171,7 +172,7 @@ TEST_F(scoreboard_test, RAW_inorder_inorder)
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_regdist(1));
EXPECT_EQ(instruction(block0, 2)->sched, regdist(TGL_PIPE_FLOAT, 1));
}
TEST_F(scoreboard_test, RAW_inorder_outoforder)
@ -196,7 +197,14 @@ TEST_F(scoreboard_test, RAW_inorder_outoforder)
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(2, 0, TGL_SBID_SET));
tgl_swsb expected = {
.regdist = 2,
.pipe = TGL_PIPE_FLOAT,
.mode = TGL_SBID_SET,
};
EXPECT_EQ(instruction(block0, 2)->sched, expected);
}
TEST_F(scoreboard_test, RAW_outoforder_inorder)
@ -222,7 +230,14 @@ TEST_F(scoreboard_test, RAW_outoforder_inorder)
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_sbid(TGL_SBID_SET, 0));
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(1, 0, TGL_SBID_DST));
tgl_swsb expected = {
.regdist = 1,
.pipe = TGL_PIPE_FLOAT,
.mode = TGL_SBID_DST,
};
EXPECT_EQ(instruction(block0, 2)->sched, expected);
}
TEST_F(scoreboard_test, RAW_outoforder_outoforder)
@ -304,7 +319,14 @@ TEST_F(scoreboard_test, WAR_inorder_outoforder)
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(2, 0, TGL_SBID_SET));
tgl_swsb expected = {
.regdist = 2,
.pipe = TGL_PIPE_FLOAT,
.mode = TGL_SBID_SET,
};
EXPECT_EQ(instruction(block0, 2)->sched, expected);
}
TEST_F(scoreboard_test, WAR_outoforder_inorder)
@ -387,7 +409,7 @@ TEST_F(scoreboard_test, WAW_inorder_inorder)
* short one. The pass is currently conservative about this and adding the
* annotation.
*/
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_regdist(2));
EXPECT_EQ(instruction(block0, 2)->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, WAW_inorder_outoforder)
@ -412,7 +434,14 @@ TEST_F(scoreboard_test, WAW_inorder_outoforder)
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_testcase(2, 0, TGL_SBID_SET));
tgl_swsb expected = {
.regdist = 2,
.pipe = TGL_PIPE_FLOAT,
.mode = TGL_SBID_SET,
};
EXPECT_EQ(instruction(block0, 2)->sched, expected);
}
TEST_F(scoreboard_test, WAW_outoforder_inorder)
@ -491,12 +520,12 @@ TEST_F(scoreboard_test, loop1)
bblock_t *body = v->cfg->blocks[2];
fs_inst *add = instruction(body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(1));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 1));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 0);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(1));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 1));
}
TEST_F(scoreboard_test, loop2)
@ -526,12 +555,12 @@ TEST_F(scoreboard_test, loop2)
bblock_t *body = v->cfg->blocks[2];
fs_inst *add = instruction(body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(2));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 0);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, loop3)
@ -562,12 +591,12 @@ TEST_F(scoreboard_test, loop3)
bblock_t *body = v->cfg->blocks[2];
fs_inst *add = instruction(body, 4);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(5));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 5));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 0);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(1));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 1));
}
@ -592,12 +621,12 @@ TEST_F(scoreboard_test, conditional1)
bblock_t *body = v->cfg->blocks[1];
fs_inst *add = instruction(body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(2));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *last_block = v->cfg->blocks[2];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, conditional2)
@ -624,12 +653,12 @@ TEST_F(scoreboard_test, conditional2)
bblock_t *body = v->cfg->blocks[1];
fs_inst *add = instruction(body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(5));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 5));
bblock_t *last_block = v->cfg->blocks[2];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, conditional3)
@ -656,12 +685,12 @@ TEST_F(scoreboard_test, conditional3)
bblock_t *body = v->cfg->blocks[1];
fs_inst *add = instruction(body, 3);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(5));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 5));
bblock_t *last_block = v->cfg->blocks[2];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, conditional4)
@ -688,12 +717,12 @@ TEST_F(scoreboard_test, conditional4)
bblock_t *body = v->cfg->blocks[1];
fs_inst *add = instruction(body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(2));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *last_block = v->cfg->blocks[2];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(3));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 3));
}
TEST_F(scoreboard_test, conditional5)
@ -720,17 +749,17 @@ TEST_F(scoreboard_test, conditional5)
bblock_t *then_body = v->cfg->blocks[1];
fs_inst *add = instruction(then_body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(2));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *else_body = v->cfg->blocks[2];
fs_inst *rol = instruction(else_body, 0);
EXPECT_EQ(rol->opcode, BRW_OPCODE_ROL);
EXPECT_EQ(rol->sched, tgl_swsb_regdist(2));
EXPECT_EQ(rol->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, conditional6)
@ -764,17 +793,17 @@ TEST_F(scoreboard_test, conditional6)
bblock_t *then_body = v->cfg->blocks[1];
fs_inst *add = instruction(then_body, 3);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(5));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 5));
bblock_t *else_body = v->cfg->blocks[2];
fs_inst *rol = instruction(else_body, 4);
EXPECT_EQ(rol->opcode, BRW_OPCODE_ROL);
EXPECT_EQ(rol->sched, tgl_swsb_regdist(6));
EXPECT_EQ(rol->sched, regdist(TGL_PIPE_FLOAT, 6));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, conditional7)
@ -808,17 +837,17 @@ TEST_F(scoreboard_test, conditional7)
bblock_t *then_body = v->cfg->blocks[1];
fs_inst *add = instruction(then_body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(2));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *else_body = v->cfg->blocks[2];
fs_inst *rol = instruction(else_body, 0);
EXPECT_EQ(rol->opcode, BRW_OPCODE_ROL);
EXPECT_EQ(rol->sched, tgl_swsb_regdist(2));
EXPECT_EQ(rol->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(6));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 6));
}
TEST_F(scoreboard_test, conditional8)
@ -850,7 +879,7 @@ TEST_F(scoreboard_test, conditional8)
bblock_t *then_body = v->cfg->blocks[1];
fs_inst *add = instruction(then_body, 0);
EXPECT_EQ(add->opcode, BRW_OPCODE_ADD);
EXPECT_EQ(add->sched, tgl_swsb_regdist(7));
EXPECT_EQ(add->sched, regdist(TGL_PIPE_FLOAT, 7));
/* Note that the ROL will have RegDist 2 and not 7, illustrating the
* physical CFG edge between the then-block and the else-block.
@ -858,12 +887,12 @@ TEST_F(scoreboard_test, conditional8)
bblock_t *else_body = v->cfg->blocks[2];
fs_inst *rol = instruction(else_body, 0);
EXPECT_EQ(rol->opcode, BRW_OPCODE_ROL);
EXPECT_EQ(rol->sched, tgl_swsb_regdist(2));
EXPECT_EQ(rol->sched, regdist(TGL_PIPE_FLOAT, 2));
bblock_t *last_block = v->cfg->blocks[3];
fs_inst *mul = instruction(last_block, 1);
EXPECT_EQ(mul->opcode, BRW_OPCODE_MUL);
EXPECT_EQ(mul->sched, tgl_swsb_regdist(2));
EXPECT_EQ(mul->sched, regdist(TGL_PIPE_FLOAT, 2));
}
TEST_F(scoreboard_test, gfx125_RaR_over_different_pipes)
@ -891,7 +920,7 @@ TEST_F(scoreboard_test, gfx125_RaR_over_different_pipes)
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 2)->sched, tgl_swsb_regdist(1));
EXPECT_EQ(instruction(block0, 2)->sched, regdist(TGL_PIPE_ALL, 1));
}
TEST_F(scoreboard_test, gitlab_issue_from_mr_29723)
@ -915,7 +944,7 @@ TEST_F(scoreboard_test, gitlab_issue_from_mr_29723)
ASSERT_EQ(1, block0->end_ip);
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_regdist(1));
EXPECT_EQ(instruction(block0, 1)->sched, regdist(TGL_PIPE_FLOAT, 1));
}
TEST_F(scoreboard_test, gitlab_issue_11069)
@ -939,5 +968,5 @@ TEST_F(scoreboard_test, gitlab_issue_11069)
ASSERT_EQ(1, block0->end_ip);
EXPECT_EQ(instruction(block0, 0)->sched, tgl_swsb_null());
EXPECT_EQ(instruction(block0, 1)->sched, tgl_swsb_regdist(1));
EXPECT_EQ(instruction(block0, 1)->sched, regdist(TGL_PIPE_FLOAT, 1));
}