<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 4, 2018 at 12:27 PM Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>><br>
---<br>
src/compiler/spirv/spirv_info.h | 1 +<br>
src/compiler/spirv/spirv_info_c.py | 1 +<br>
src/compiler/spirv/spirv_to_nir.c | 9 ++++++++-<br>
src/compiler/spirv/vtn_alu.c | 4 ++--<br>
src/compiler/spirv/vtn_cfg.c | 2 ++<br>
src/compiler/spirv/vtn_private.h | 3 +++<br>
6 files changed, 17 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/spirv_info.h b/src/compiler/spirv/spirv_info.h<br>
index 121ffd2febb..a03c2ef8eb0 100644<br>
--- a/src/compiler/spirv/spirv_info.h<br>
+++ b/src/compiler/spirv/spirv_info.h<br>
@@ -28,6 +28,7 @@<br>
<br>
const char *spirv_capability_to_string(SpvCapability cap);<br>
const char *spirv_decoration_to_string(SpvDecoration dec);<br>
+const char *spirv_executionmode_to_string(SpvExecutionMode mode);<br>
const char *spirv_op_to_string(SpvOp op);<br>
<br>
#endif /* SPIRV_INFO_H */<br>
diff --git a/src/compiler/spirv/spirv_info_c.py b/src/compiler/spirv/spirv_info_c.py<br>
index ff7942bcd3a..6880d3e329d 100644<br>
--- a/src/compiler/spirv/spirv_info_c.py<br>
+++ b/src/compiler/spirv/spirv_info_c.py<br>
@@ -90,6 +90,7 @@ if __name__ == "__main__":<br>
info = [<br>
collect_data(spirv_info, "Capability"),<br>
collect_data(spirv_info, "Decoration"),<br>
+ collect_data(spirv_info, "ExecutionMode"),<br>
collect_opcodes(spirv_info),<br>
]<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c<br>
index 1a7d5b3a9bd..488c61cf1c6 100644<br>
--- a/src/compiler/spirv/spirv_to_nir.c<br>
+++ b/src/compiler/spirv/spirv_to_nir.c<br>
@@ -3771,9 +3771,16 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,<br>
break;<br>
<br>
case SpvExecutionModeVecTypeHint:<br>
- case SpvExecutionModeContractionOff:<br>
break; /* OpenCL */<br>
<br>
+ case SpvExecutionModeContractionOff:<br>
+ if (b->shader->info.stage != MESA_SHADER_KERNEL)<br>
+ vtn_warn("ExectionMode only allowed for CL-style kernels: %s",<br>
+ spirv_executionmode_to_string(mode->exec_mode));<br>
+ else<br>
+ b->exact = true;<br>
+ break;<br>
+<br>
case SpvExecutionModeStencilRefReplacingEXT:<br>
vtn_assert(b->shader->info.stage == MESA_SHADER_FRAGMENT);<br>
break;<br>
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c<br>
index dc6fedc9129..f910630acfb 100644<br>
--- a/src/compiler/spirv/vtn_alu.c<br>
+++ b/src/compiler/spirv/vtn_alu.c<br>
@@ -395,7 +395,7 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,<br>
if (glsl_type_is_matrix(vtn_src[0]->type) ||<br>
(num_inputs >= 2 && glsl_type_is_matrix(vtn_src[1]->type))) {<br>
vtn_handle_matrix_alu(b, opcode, val, vtn_src[0], vtn_src[1]);<br>
- b->nb.exact = false;<br>
+ b->nb.exact = b->exact;<br>
return;<br>
}<br>
<br>
@@ -661,5 +661,5 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,<br>
} /* default */<br>
}<br>
<br>
- b->nb.exact = false;<br>
+ b->nb.exact = b->exact;<br>
}<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index 5b3cc703f94..bc1a949fdee 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -281,6 +281,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,<br>
b->func->impl = nir_function_impl_create(func);<br>
nir_builder_init(&b->nb, func->impl);<br>
b->nb.cursor = nir_before_cf_list(&b->func->impl->body);<br>
+ b->nb.exact = b->exact;<br>
<br>
b->func_param_idx = 0;<br>
<br>
@@ -1040,6 +1041,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func,<br>
nir_builder_init(&b->nb, func->impl);<br>
b->func = func;<br>
b->nb.cursor = nir_after_cf_list(&func->impl->body);<br>
+ b->nb.exact = b->exact;<br>
b->has_loop_continue = false;<br>
b->phi_table = _mesa_hash_table_create(b, _mesa_hash_pointer,<br>
_mesa_key_pointer_equal);<br>
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h<br>
index e380d8e82ff..930beec30ef 100644<br>
--- a/src/compiler/spirv/vtn_private.h<br>
+++ b/src/compiler/spirv/vtn_private.h<br>
@@ -607,6 +607,9 @@ struct vtn_builder {<br>
<br>
bool has_loop_continue;<br>
<br>
+ /* false by default, set to true by the ContractionOff execution mode */<br>
+ bool exact;<br>
+<br>
/* when a physical memory model is choosen */<br>
bool physical_ptrs;<br>
};<br>
-- <br>
2.19.2<br>
<br>
</blockquote></div>