[Mesa-dev] [PATCH 1/2] i965/fs: Force promotion of src0 immediates.
Kenneth Graunke
kenneth at whitecape.org
Fri Mar 13 16:16:23 PDT 2015
Commit 36bc5f06dd22 began allowing immediates in MAD and LRP sources,
in any position. One unforeseen consequence is that opt_algebraic began
creating ADD and MUL instructions with src0 immediates.
For example,
mad(8) vgrf86:F, 1.000000f, 1.000000f, vgrf84:F
would be optimized into:
add(8) vgrf86:F, 1.000000f, vgrf84:F
which is illegal.
Fixes assert failures in steam/tiny-and-big-grandpas-leftovers/fp-19.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Last night I was importing new shaders into shader-db, and came across
a shader that hit an assertion. I started looking into it this morning,
and wrote these patches...before I caught up on mesa-dev and realized
that Tapani was also working on this. Sorry for the collision!
I think this might be a more general solution, and should allow us to
propagate immediates into src0 on all instructions, if we want to.
diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
index 7ddb253..a3657e0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
@@ -207,7 +207,8 @@ fs_visitor::opt_combine_constants()
foreach_block_and_inst(block, fs_inst, inst, cfg) {
ip++;
- if (!could_coissue(brw, inst) && !must_promote_imm(inst))
+ if (!could_coissue(brw, inst) && !must_promote_imm(inst) &&
+ !(inst->sources > 1 && inst->src[0].file == IMM))
continue;
for (int i = 0; i < inst->sources; i++) {
@@ -225,7 +226,8 @@ fs_visitor::opt_combine_constants()
imm->block = intersection;
imm->uses->push_tail(link(const_ctx, &inst->src[i]));
imm->uses_by_coissue += could_coissue(brw, inst);
- imm->must_promote = imm->must_promote || must_promote_imm(inst);
+ imm->must_promote = imm->must_promote ||
+ must_promote_imm(inst) || (i == 0 && inst->sources > 1);
imm->last_use_ip = ip;
} else {
imm = new_imm(&table, const_ctx);
@@ -235,7 +237,8 @@ fs_visitor::opt_combine_constants()
imm->uses->push_tail(link(const_ctx, &inst->src[i]));
imm->val = val;
imm->uses_by_coissue = could_coissue(brw, inst);
- imm->must_promote = must_promote_imm(inst);
+ imm->must_promote =
+ must_promote_imm(inst) || (i == 0 && inst->sources > 1);
imm->first_use_ip = ip;
imm->last_use_ip = ip;
}
--
2.2.2
More information about the mesa-dev
mailing list