[Beignet] [PATCH] Test case for missing global barrier functionality

Zhigang Gong zhigang.gong at linux.intel.com
Wed Jun 12 23:16:01 PDT 2013


We only support local barrier currently. It should fail for your test
case, as your test case rely on global barrier.

  DECL_PATTERN(SyncInstruction)
  {
    INLINE bool emitOne(Selection::Opaque &sel, const ir::SyncInstruction &insn) const
    {
      using namespace ir;
      const uint32_t params = insn.getParameters();
      GBE_ASSERTM(params == syncLocalBarrier,
                  "Only barrier(CLK_LOCAL_MEM_FENCE) is supported right now "
                  "for the synchronization primitives");

On Mon, Jun 10, 2013 at 08:55:47AM +0200, Dag Lem wrote:
> The attached test currently fails - I hope someone will take up the
> gauntlet ;-)
> 
> I also see another problem with global memory - using a larger chunk
> of global memory as temporary storage per work item (e.g. 64KB) seems
> to trigger read/write inconsistency within each work item (reading
> back zeros after having written non-zeros).
The reason is that we only hard code the per lane stack size to 1KB.
You can find the related code at file backend/context.cpp:

  void Context::buildStack(void) {
    const auto &stackUse = dag->getUse(ir::ocl::stackptr);
    if (stackUse.size() == 0)  // no stack is used if stackptr is unused
      return;
    // Be sure that the stack pointer is set
    GBE_ASSERT(this->kernel->getCurbeOffset(GBE_CURBE_STACK_POINTER, 0) >= 0);
    this->kernel->stackSize = 1*KB; // XXX compute that in a better way
  }

It seems I need to add something to the TODO items. Thanks for reporting the
problems. I will push your unit test case latter, but will not enable it currently.

> Dag Lem (1):
>   utests: Add test case for global memory barrier
> 
>  kernels/compiler_global_memory_barrier.cl |  5 +++++
>  utests/CMakeLists.txt                     |  1 +
>  utests/compiler_global_memory_barrier.cpp | 27 +++++++++++++++++++++++++++
>  3 files changed, 33 insertions(+)
>  create mode 100644 kernels/compiler_global_memory_barrier.cl
>  create mode 100644 utests/compiler_global_memory_barrier.cpp
> 
> -- 
> 1.8.1.4
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list