beignet-1.3.2-885423.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Description: Fix self-test fail in some conditions
  2. Reverts upstream 81755054c4c19d821e58456a1a7d601806e60e92
  3. Known triggers are Darktable and the GEGL test suite
  4. Note that this does *not* fix the other Darktable issue
  5. (https://gitlab.freedesktop.org/beignet/beignet/issues/60): beignet still
  6. needs to be blacklisted in Darktable (which it is by default).
  7. Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
  8. Bug: https://gitlab.freedesktop.org/beignet/beignet/issues/7
  9. Bug-Debian: https://bugs.debian.org/885423
  10. Forwarded: https://lists.freedesktop.org/archives/beignet/2019-January/009227.html
  11. diff --git b/backend/src/backend/gen_insn_selection_optimize.cpp a/backend/src/backend/gen_insn_selection_optimize.cpp
  12. index 07547ec4..d2e0fb9b 100644
  13. --- b/backend/src/backend/gen_insn_selection_optimize.cpp
  14. +++ a/backend/src/backend/gen_insn_selection_optimize.cpp
  15. @@ -74,7 +74,8 @@ namespace gbe
  16. const GenRegister& replacement) :
  17. insn(insn), intermedia(intermedia), replacement(replacement)
  18. {
  19. - assert(insn.opcode == SEL_OP_MOV || insn.opcode == SEL_OP_ADD);
  20. + assert(insn.opcode == SEL_OP_MOV);
  21. + assert(&(insn.src(0)) == &replacement);
  22. assert(&(insn.dst(0)) == &intermedia);
  23. this->elements = CalculateElements(intermedia, insn.state.execWidth);
  24. replacementOverwritten = false;
  25. @@ -101,7 +102,6 @@ namespace gbe
  26. void doReplacement(ReplaceInfo* info);
  27. bool CanBeReplaced(const ReplaceInfo* info, const SelectionInstruction& insn, const GenRegister& var);
  28. void cleanReplaceInfoMap();
  29. - void doNegAddOptimization(SelectionInstruction &insn);
  30. SelectionBlock &bb;
  31. const ir::Liveness::LiveOut& liveout;
  32. @@ -159,13 +159,8 @@ namespace gbe
  33. void SelBasicBlockOptimizer::addToReplaceInfoMap(SelectionInstruction& insn)
  34. {
  35. - assert(insn.opcode == SEL_OP_MOV || insn.opcode == SEL_OP_ADD);
  36. - GenRegister &src = insn.src(0);
  37. - if (insn.opcode == SEL_OP_ADD) {
  38. - if (src.file == GEN_IMMEDIATE_VALUE)
  39. - src = insn.src(1);
  40. - }
  41. -
  42. + assert(insn.opcode == SEL_OP_MOV);
  43. + const GenRegister& src = insn.src(0);
  44. const GenRegister& dst = insn.dst(0);
  45. if (src.type != dst.type || src.file != dst.file)
  46. return;
  47. @@ -254,29 +249,10 @@ namespace gbe
  48. if (insn.opcode == SEL_OP_MOV)
  49. addToReplaceInfoMap(insn);
  50. -
  51. - doNegAddOptimization(insn);
  52. }
  53. cleanReplaceInfoMap();
  54. }
  55. - /* LLVM transform Mad(a, -b, c) to
  56. - Add b, -b, 0
  57. - Mad val, a, b, c
  58. - for Gen support negtive modifier, mad(a, -b, c) is native suppoted.
  59. - Also it can be used for the same like instruction sequence.
  60. - Do it just like a: mov b, -b, so it is a Mov operation like LocalCopyPropagation
  61. - */
  62. - void SelBasicBlockOptimizer::doNegAddOptimization(SelectionInstruction &insn) {
  63. - if (insn.opcode == SEL_OP_ADD) {
  64. - GenRegister src0 = insn.src(0);
  65. - GenRegister src1 = insn.src(1);
  66. - if ((src0.negation && src1.file == GEN_IMMEDIATE_VALUE && src1.value.f == 0.0f) ||
  67. - (src1.negation && src0.file == GEN_IMMEDIATE_VALUE && src0.value.f == 0.0f))
  68. - addToReplaceInfoMap(insn);
  69. - }
  70. - }
  71. -
  72. void SelBasicBlockOptimizer::run()
  73. {
  74. for (size_t i = 0; i < MaxTries; ++i) {