[Beignet] [PATCH] GBE: fix one scheduling bug for ATOMIC instruction.
Gong, Zhigang
zhigang.gong at intel.com
Tue May 27 23:37:13 PDT 2014
Maybe we need to add a getbti function for the SelectionInstruction class.
To access function or element directly is not good and may be very easy to hide bug.
> -----Original Message-----
> From: Yang, Rong R
> Sent: Wednesday, May 28, 2014 2:33 PM
> To: Gong, Zhigang; beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: RE: [Beignet] [PATCH] GBE: fix one scheduling bug for ATOMIC
> instruction.
>
> Function isRead and isWrite already return true for Atomic, but Atomic use
> insn.extra.elem for bti, load/store use insn.extra.function for bti, and Sample
> and TYPED_WRITE used other field.
> I think it is better to get correct bti when getIndex.
>
> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Zhigang Gong
> Sent: Wednesday, May 28, 2014 10:29 AM
> To: beignet at lists.freedesktop.org
> Cc: Gong, Zhigang
> Subject: [Beignet] [PATCH] GBE: fix one scheduling bug for ATOMIC instruction.
>
> Atomic instruction is both read/write instruction, we need to take care of it in
> the instruction scheduling.
>
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> ---
> backend/src/backend/gen_insn_scheduling.cpp | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/backend/src/backend/gen_insn_scheduling.cpp
> b/backend/src/backend/gen_insn_scheduling.cpp
> index 6f37ed4..578db58 100644
> --- a/backend/src/backend/gen_insn_scheduling.cpp
> +++ b/backend/src/backend/gen_insn_scheduling.cpp
> @@ -486,6 +486,10 @@ namespace gbe
> const uint32_t index = tracker.getIndex(insn.extra.function);
> tracker.addDependency(node, index, READ_AFTER_WRITE);
> }
> + if (insn.opcode == SEL_OP_ATOMIC) {
> + const uint32_t index = tracker.getIndex(insn.extra.elem);
> + tracker.addDependency(node, index, READ_AFTER_WRITE);
> + }
> //read-after-write of scratch memory
> if (insn.opcode == SEL_OP_UNSPILL_REG) {
> const uint32_t index = tracker.getIndex(0xff); @@ -519,6 +523,10
> @@ namespace gbe
> const uint32_t index = tracker.getIndex(insn.extra.function);
> tracker.addDependency(node, index, WRITE_AFTER_WRITE);
> }
> + if (insn.opcode == SEL_OP_ATOMIC) {
> + const uint32_t index = tracker.getIndex(insn.extra.elem);
> + tracker.addDependency(node, index, WRITE_AFTER_WRITE);
> + }
>
> // write-after-write in scratch memory
> if (insn.opcode == SEL_OP_SPILL_REG) { @@ -549,6 +557,10 @@
> namespace gbe
> const uint32_t index = tracker.getIndex(insn.extra.function);
> tracker.addDependency(index, node, WRITE_AFTER_READ);
> }
> + if (insn.opcode == SEL_OP_ATOMIC) {
> + const uint32_t index = tracker.getIndex(insn.extra.elem);
> + tracker.addDependency(index, node, WRITE_AFTER_READ);
> + }
>
> // write-after-read in scratch memory
> if (insn.opcode == SEL_OP_UNSPILL_REG) {
> --
> 1.8.3.2
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list