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; [email protected] > 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:[email protected]] On Behalf Of > Zhigang Gong > Sent: Wednesday, May 28, 2014 10:29 AM > To: [email protected] > 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 <[email protected]> > --- > 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 > [email protected] > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
