From 54d4d34b9680a212ef3d3db46d07b6ed6387c2a8 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 18 Apr 2019 10:09:08 -0700 Subject: [PATCH] intel/compiler: Use SIMD16 instructions in fs saturate prop unit test Will allow us to test that propagation between instructions of different exec sizes does not happen (in the next commit). The stray-looking change in intervening_dest_write is to adjust the size of the texture result to keep the test functioning identically when the instructions' exec sizes are doubled. Without the change, the texture does not overwrite the destination fully as the unit test intends. Reviewed-by: Rafael Antognolli --- .../compiler/test_fs_saturate_propagation.cpp | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/intel/compiler/test_fs_saturate_propagation.cpp b/src/intel/compiler/test_fs_saturate_propagation.cpp index 360f735220c..98d9f034d8d 100644 --- a/src/intel/compiler/test_fs_saturate_propagation.cpp +++ b/src/intel/compiler/test_fs_saturate_propagation.cpp @@ -48,7 +48,7 @@ public: nir_shader *shader) : fs_visitor(compiler, NULL, NULL, NULL, &prog_data->base, (struct gl_program *) NULL, - shader, 8, -1) {} + shader, 16, -1) {} }; @@ -110,12 +110,12 @@ TEST_F(saturate_propagation_test, basic) /* = Before = * - * 0: add(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 dst0 + * 0: add(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 dst0 * * = After = - * 0: add.sat(8) dst0 src0 src1 - * 1: mov(8) dst1 dst0 + * 0: add.sat(16) dst0 src0 src1 + * 1: mov(16) dst1 dst0 */ v->calculate_cfg(); @@ -147,9 +147,9 @@ TEST_F(saturate_propagation_test, other_non_saturated_use) /* = Before = * - * 0: add(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 dst0 - * 2: add(8) dst2 dst0 src0 + * 0: add(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 dst0 + * 2: add(16) dst2 dst0 src0 * * = After = * (no changes) @@ -184,8 +184,8 @@ TEST_F(saturate_propagation_test, predicated_instruction) /* = Before = * - * 0: (+f0) add(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 dst0 + * 0: (+f0) add(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 dst0 * * = After = * (no changes) @@ -218,8 +218,8 @@ TEST_F(saturate_propagation_test, neg_mov_sat) /* = Before = * - * 0: rndu(8) dst0 src0 - * 1: mov.sat(8) dst1 -dst0 + * 0: rndu(16) dst0 src0 + * 1: mov.sat(16) dst1 -dst0 * * = After = * (no changes) @@ -253,12 +253,12 @@ TEST_F(saturate_propagation_test, add_neg_mov_sat) /* = Before = * - * 0: add(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 -dst0 + * 0: add(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 -dst0 * * = After = - * 0: add.sat(8) dst0 -src0 -src1 - * 1: mov(8) dst1 dst0 + * 0: add.sat(16) dst0 -src0 -src1 + * 1: mov(16) dst1 dst0 */ v->calculate_cfg(); @@ -291,12 +291,12 @@ TEST_F(saturate_propagation_test, add_imm_float_neg_mov_sat) /* = Before = * - * 0: add(8) dst0 src0 1.0f - * 1: mov.sat(8) dst1 -dst0 + * 0: add(16) dst0 src0 1.0f + * 1: mov.sat(16) dst1 -dst0 * * = After = - * 0: add.sat(8) dst0 -src0 -1.0f - * 1: mov(8) dst1 dst0 + * 0: add.sat(16) dst0 -src0 -1.0f + * 1: mov(16) dst1 dst0 */ v->calculate_cfg(); @@ -329,12 +329,12 @@ TEST_F(saturate_propagation_test, mul_neg_mov_sat) /* = Before = * - * 0: mul(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 -dst0 + * 0: mul(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 -dst0 * * = After = - * 0: mul.sat(8) dst0 src0 -src1 - * 1: mov(8) dst1 dst0 + * 0: mul.sat(16) dst0 src0 -src1 + * 1: mov(16) dst1 dst0 */ v->calculate_cfg(); @@ -368,12 +368,12 @@ TEST_F(saturate_propagation_test, mad_neg_mov_sat) /* = Before = * - * 0: mad(8) dst0 src0 src1 src2 - * 1: mov.sat(8) dst1 -dst0 + * 0: mad(16) dst0 src0 src1 src2 + * 1: mov.sat(16) dst1 -dst0 * * = After = - * 0: mad.sat(8) dst0 -src0 -src1 src2 - * 1: mov(8) dst1 dst0 + * 0: mad.sat(16) dst0 -src0 -src1 src2 + * 1: mov(16) dst1 dst0 */ v->calculate_cfg(); @@ -414,12 +414,12 @@ TEST_F(saturate_propagation_test, mad_imm_float_neg_mov_sat) /* = Before = * - * 0: mad(8) dst0 1.0f -2.0f src2 - * 1: mov.sat(8) dst1 -dst0 + * 0: mad(16) dst0 1.0f -2.0f src2 + * 1: mov.sat(16) dst1 -dst0 * * = After = - * 0: mad.sat(8) dst0 -1.0f 2.0f src2 - * 1: mov(8) dst1 dst0 + * 0: mad.sat(16) dst0 -1.0f 2.0f src2 + * 1: mov(16) dst1 dst0 */ v->calculate_cfg(); @@ -455,9 +455,9 @@ TEST_F(saturate_propagation_test, mul_mov_sat_neg_mov_sat) /* = Before = * - * 0: mul(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 dst0 - * 2: mov.sat(8) dst2 -dst0 + * 0: mul(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 dst0 + * 2: mov.sat(16) dst2 -dst0 * * = After = * (no changes) @@ -497,9 +497,9 @@ TEST_F(saturate_propagation_test, mul_neg_mov_sat_neg_mov_sat) /* = Before = * - * 0: mul(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 -dst0 - * 2: mov.sat(8) dst2 -dst0 + * 0: mul(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 -dst0 + * 2: mov.sat(16) dst2 -dst0 * * = After = * (no changes) @@ -538,8 +538,8 @@ TEST_F(saturate_propagation_test, abs_mov_sat) /* = Before = * - * 0: add(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 (abs)dst0 + * 0: add(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 (abs)dst0 * * = After = * (no changes) @@ -574,14 +574,14 @@ TEST_F(saturate_propagation_test, producer_saturates) /* = Before = * - * 0: add.sat(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 dst0 - * 2: mov(8) dst2 dst0 + * 0: add.sat(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 dst0 + * 2: mov(16) dst2 dst0 * * = After = - * 0: add.sat(8) dst0 src0 src1 - * 1: mov(8) dst1 dst0 - * 2: mov(8) dst2 dst0 + * 0: add.sat(16) dst0 src0 src1 + * 1: mov(16) dst1 dst0 + * 2: mov(16) dst2 dst0 */ v->calculate_cfg(); @@ -613,14 +613,14 @@ TEST_F(saturate_propagation_test, intervening_saturating_copy) /* = Before = * - * 0: add(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 dst0 - * 2: mov.sat(8) dst2 dst0 + * 0: add(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 dst0 + * 2: mov.sat(16) dst2 dst0 * * = After = - * 0: add.sat(8) dst0 src0 src1 - * 1: mov(8) dst1 dst0 - * 2: mov(8) dst2 dst0 + * 0: add.sat(16) dst0 src0 src1 + * 1: mov(16) dst1 dst0 + * 2: mov(16) dst2 dst0 */ v->calculate_cfg(); @@ -650,14 +650,14 @@ TEST_F(saturate_propagation_test, intervening_dest_write) fs_reg src2 = v->vgrf(glsl_type::vec2_type); bld.ADD(offset(dst0, bld, 2), src0, src1); bld.emit(SHADER_OPCODE_TEX, dst0, src2) - ->size_written = 4 * REG_SIZE; + ->size_written = 8 * REG_SIZE; set_saturate(true, bld.MOV(dst1, offset(dst0, bld, 2))); /* = Before = * - * 0: add(8) dst0+2 src0 src1 - * 1: tex(8) rlen 4 dst0+0 src2 - * 2: mov.sat(8) dst1 dst0+2 + * 0: add(16) dst0+2 src0 src1 + * 1: tex(16) rlen 4 dst0+0 src2 + * 2: mov.sat(16) dst1 dst0+2 * * = After = * (no changes) @@ -696,9 +696,9 @@ TEST_F(saturate_propagation_test, mul_neg_mov_sat_mov_sat) /* = Before = * - * 0: mul(8) dst0 src0 src1 - * 1: mov.sat(8) dst1 -dst0 - * 2: mov.sat(8) dst2 dst0 + * 0: mul(16) dst0 src0 src1 + * 1: mov.sat(16) dst1 -dst0 + * 2: mov.sat(16) dst2 dst0 * * = After = * (no changes) -- 2.30.2