MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / NewSync

Method NewSync

tensorflow/lite/delegates/gpu/gl/gl_sync.cc:81–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81Status GlShaderSync::NewSync(GlShaderSync* gl_sync) {
82 GlShaderSync sync;
83 RETURN_IF_ERROR(CreatePersistentBuffer(sizeof(int), &sync.flag_buffer_));
84 static const std::string* kCode = new std::string(R"(#version 310 es
85 layout(local_size_x = 1, local_size_y = 1) in;
86 layout(std430) buffer;
87 layout(binding = 0) buffer Output {
88 int elements[];
89 } output_data;
90 void main() {
91 output_data.elements[0] = 1;
92 })");
93 GlShader shader;
94 RETURN_IF_ERROR(GlShader::CompileShader(GL_COMPUTE_SHADER, *kCode, &shader));
95 RETURN_IF_ERROR(GlProgram::CreateWithShader(shader, &sync.flag_program_));
96 *gl_sync = std::move(sync);
97 return OkStatus();
98}
99
100// How it works: GPU writes a buffer and CPU checks the buffer value to be
101// changed. The buffer is accessible for writing by GPU and reading by CPU

Callers

nothing calls this directly

Calls 2

CreatePersistentBufferFunction · 0.85
OkStatusFunction · 0.85

Tested by

no test coverage detected