cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

vlj
Journeyman III

Violation access with cl_event from GLsync usage

Hi,

Using R9 290X with Catalyst 14.12 on Windows 8.1 I'm trying to use OpenCL for TressFX simulation :

YAGF/tfx-ocl.cpp at master · vlj/YAGF · GitHub

The relevant part of the code is :

  int err = CL_SUCCESS;

  cl_event ev = 0;

  if (syncFirstPassRenderComplete);

    ev = clCreateEventFromGLsyncKHRCustom(context, syncFirstPassRenderComplete, &err);

  // First pass is done so sim is done too, can safely upload

  err = clEnqueueWriteBuffer(queue, ConstantSimBuffer, CL_FALSE, 0, sizeof(struct SimulationConstants), &cbuf, 0, 0, 0);

  err = clEnqueueAcquireGLObjects(queue, 1, &PosBuffer, 0, 0, 0);

  err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &PosBuffer);

  err = clSetKernelArg(kernel, 1, sizeof(cl_mem), &PreviousPos);

  err = clSetKernelArg(kernel, 2, sizeof(cl_mem), &StrandType);

  err = clSetKernelArg(kernel, 3, sizeof(cl_mem), &InitialPos);

  err = clSetKernelArg(kernel, 4, sizeof(cl_mem), &ConstantSimBuffer);

  size_t local_wg = 64;

  size_t global_wg = .5 * tfxassets.m_NumTotalHairVertices;

  err = clEnqueueNDRangeKernel(queue, kernel, 1, 0, &global_wg, &local_wg, 0, 0, 0);

  err = clEnqueueReleaseGLObjects(queue, 1, &PosBuffer, 0, 0, 0);

  clFinish(queue);

  if (syncFirstPassRenderComplete);

  {

    glDeleteSync(syncFirstPassRenderComplete);

    clReleaseEvent(ev);

  }

  return;

I'm attempting to use explicit sync between cl and GL using  clCreateEventFromGLsyncKHR by replacing

  err = clEnqueueWriteBuffer(queue, ConstantSimBuffer, CL_FALSE, 0, sizeof(struct SimulationConstants), &cbuf, 0, 0, 0);

by

  if (ev)

    err = clEnqueueWriteBuffer(queue, ConstantSimBuffer, CL_FALSE, 0, sizeof(struct SimulationConstants), &cbuf, 1, &ev, 0);

  else

    err = clEnqueueWriteBuffer(queue, ConstantSimBuffer, CL_FALSE, 0, sizeof(struct SimulationConstants), &cbuf, 0, 0, 0);

ie I'm adding a sync between last GL command that uses PosBuffer and before first opencl command so that some opencl upload/kernel can be executed while the second OpenGL fragment shader is in flight.

It works however after a couple of frame there is a crash in atigktxx.dll (Access violation reading location 0xFEEEFEEE.). I get no OpenCL or OpenGL error.

I'm not sure what's happening since I delete sync and clean cl_event after cl_finish. I tested with an event generated from an opencl call each frame and it works, I suspect the issue only happens with cl_event generated from GL sync object.

0 Likes
5 Replies
jtrudeau
Staff
Staff

Re: Violation access with cl_event from GLsync usage

With luck, one of the engineers can take a look at this next week. We have it on the radar. Just making sure everyone knows, silence != we're ignoring you.

We can't get to everything, and some of what we can cover it takes time to find a slot in the workflow to get to the issue. Which is why there's a community! And I'll take the opportunity to thank everyone who helps out, because, like you all, the AMD engineers have real jobs too.

vlj
Journeyman III

Re: Violation access with cl_event from GLsync usage

Thanks for the feedback.

0 Likes
vlj
Journeyman III

Re: Violation access with cl_event from GLsync usage

Some additional information :

With Catalyst 15.3 the issue still appears, but if I run it with CodeXL debugger I don't have crash. However "output" console in VS 2013 get spammed with :

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #3)

CodeXL - OpenGL Render Context 4 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #4)

CodeXL - OpenGL Render Context 5 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #5)

CodeXL - OpenGL Render Context 6 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #6)

CodeXL - OpenGL Render Context 7 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #7)

CodeXL - OpenGL Render Context 8 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #8)

CodeXL - OpenGL Render Context 9 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #9)

CodeXL - OpenGL Render Context 10 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #10)

CodeXL - OpenGL Render Context 11 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #11)

CodeXL - OpenGL Render Context 12 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #12)

CodeXL - OpenGL Render Context 13 Created

CodeXL - Debug String: CodeXL warning: The debugged process asked for an extension function pointer (glClientWaitSync) from one render context, but called this function pointer in another render context (context #13)

CodeXL - OpenGL Render Context 14 Created

0 Likes
gsellers
Staff
Staff

Re: Violation access with cl_event from GLsync usage

Does your application create multiple OpenGL contexts? Are you using a toolkit to set up OpenGL or is it your own code?

Thanks,

Graham

0 Likes
vlj
Journeyman III

Re: Violation access with cl_event from GLsync usage

I'm using glfw3 to create the Windows context. Since I create a GL 4.3 context I think it creates a fake context to get a pointer to wglCreateContextAttribsARB.

I use GLEW too.

0 Likes