Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_51669992
tensorflow
提交
9c04d7c0
T
tensorflow
项目概览
weixin_51669992
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
16
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c04d7c0
编写于
8月 08, 2019
作者:
A
A. Unique TensorFlower
提交者:
TensorFlower Gardener
8月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TFLite GPU Delegate: Extract GpuInfo structure into separate translation module.
PiperOrigin-RevId: 262480689
上级
fcfca656
变更
35
隐藏空白更改
内联
并排
Showing
35 changed file
with
185 addition
and
110 deletion
+185
-110
tensorflow/lite/delegates/gpu/BUILD
tensorflow/lite/delegates/gpu/BUILD
+1
-0
tensorflow/lite/delegates/gpu/common/BUILD
tensorflow/lite/delegates/gpu/common/BUILD
+9
-0
tensorflow/lite/delegates/gpu/common/gpu_info.cc
tensorflow/lite/delegates/gpu/common/gpu_info.cc
+1
-53
tensorflow/lite/delegates/gpu/common/gpu_info.h
tensorflow/lite/delegates/gpu/common/gpu_info.h
+3
-11
tensorflow/lite/delegates/gpu/gl/BUILD
tensorflow/lite/delegates/gpu/gl/BUILD
+19
-19
tensorflow/lite/delegates/gpu/gl/api.cc
tensorflow/lite/delegates/gpu/gl/api.cc
+1
-1
tensorflow/lite/delegates/gpu/gl/command_queue.cc
tensorflow/lite/delegates/gpu/gl/command_queue.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/command_queue.h
tensorflow/lite/delegates/gpu/gl/command_queue.h
+1
-1
tensorflow/lite/delegates/gpu/gl/compiler.cc
tensorflow/lite/delegates/gpu/gl/compiler.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/compiler.h
tensorflow/lite/delegates/gpu/gl/compiler.h
+1
-1
tensorflow/lite/delegates/gpu/gl/compiler/BUILD
tensorflow/lite/delegates/gpu/gl/compiler/BUILD
+1
-1
tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.cc
tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.h
tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.h
+1
-1
tensorflow/lite/delegates/gpu/gl/compiler_options.h
tensorflow/lite/delegates/gpu/gl/compiler_options.h
+0
-1
tensorflow/lite/delegates/gpu/gl/egl_environment.cc
tensorflow/lite/delegates/gpu/gl/egl_environment.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/egl_environment.h
tensorflow/lite/delegates/gpu/gl/egl_environment.h
+1
-1
tensorflow/lite/delegates/gpu/gl/kernels/BUILD
tensorflow/lite/delegates/gpu/gl/kernels/BUILD
+1
-1
tensorflow/lite/delegates/gpu/gl/kernels/test_util.cc
tensorflow/lite/delegates/gpu/gl/kernels/test_util.cc
+1
-1
tensorflow/lite/delegates/gpu/gl/node_shader.h
tensorflow/lite/delegates/gpu/gl/node_shader.h
+1
-1
tensorflow/lite/delegates/gpu/gl/request_gpu_info.cc
tensorflow/lite/delegates/gpu/gl/request_gpu_info.cc
+81
-0
tensorflow/lite/delegates/gpu/gl/request_gpu_info.h
tensorflow/lite/delegates/gpu/gl/request_gpu_info.h
+37
-0
tensorflow/lite/delegates/gpu/gl/runtime.cc
tensorflow/lite/delegates/gpu/gl/runtime.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/runtime.h
tensorflow/lite/delegates/gpu/gl/runtime.h
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/BUILD
tensorflow/lite/delegates/gpu/gl/workgroups/BUILD
+5
-5
tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.cc
...ite/delegates/gpu/gl/workgroups/best_effort_calculator.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h
...lite/delegates/gpu/gl/workgroups/best_effort_calculator.h
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/calculator.cc
tensorflow/lite/delegates/gpu/gl/workgroups/calculator.cc
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h
tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.cc
...e/delegates/gpu/gl/workgroups/calculator_from_metadata.cc
+4
-4
tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.h
...te/delegates/gpu/gl/workgroups/calculator_from_metadata.h
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.cc
...ow/lite/delegates/gpu/gl/workgroups/default_calculator.cc
+1
-0
tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h
...low/lite/delegates/gpu/gl/workgroups/default_calculator.h
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.cc
...ite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.cc
+1
-1
tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.h
...lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.h
+1
-1
tensorflow/lite/delegates/gpu/gl_delegate.cc
tensorflow/lite/delegates/gpu/gl_delegate.cc
+1
-0
未找到文件。
tensorflow/lite/delegates/gpu/BUILD
浏览文件 @
9c04d7c0
...
...
@@ -52,6 +52,7 @@ cc_library(
"//tensorflow/lite/delegates/gpu/gl:command_queue"
,
"//tensorflow/lite/delegates/gpu/gl:compiler"
,
"//tensorflow/lite/delegates/gpu/gl:egl_environment"
,
"//tensorflow/lite/delegates/gpu/gl:request_gpu_info"
,
"//tensorflow/lite/delegates/gpu/gl:gl_call"
,
"//tensorflow/lite/delegates/gpu/gl/converters:bhwc_to_phwc4"
,
"//tensorflow/lite/delegates/gpu/gl/converters:phwc4_to_bhwc"
,
...
...
tensorflow/lite/delegates/gpu/common/BUILD
浏览文件 @
9c04d7c0
...
...
@@ -24,6 +24,15 @@ cc_library(
hdrs
=
[
"access_type.h"
],
)
cc_library
(
name
=
"gpu_info"
,
srcs
=
[
"gpu_info.cc"
],
hdrs
=
[
"gpu_info.h"
],
deps
=
[
"@com_google_absl//absl/strings"
,
],
)
cc_library
(
name
=
"data_type"
,
srcs
=
[
"data_type.cc"
],
...
...
tensorflow/lite/delegates/gpu/
gl
/gpu_info.cc
→
tensorflow/lite/delegates/gpu/
common
/gpu_info.cc
浏览文件 @
9c04d7c0
...
...
@@ -13,19 +13,16 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/delegates/gpu/
gl
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/
common
/gpu_info.h"
#include <algorithm>
#include <cctype>
#include <string>
#include "absl/strings/ascii.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_errors.h"
#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
namespace
tflite
{
namespace
gpu
{
namespace
gl
{
namespace
{
GpuType
GetGpuType
(
const
std
::
string
&
renderer
)
{
...
...
@@ -102,54 +99,5 @@ void GetGpuModelAndType(const std::string& renderer, GpuModel* gpu_model,
*
gpu_type
==
GpuType
::
ADRENO
?
GetGpuModel
(
lowered
)
:
GpuModel
::
UNKNOWN
;
}
Status
RequestGpuInfo
(
GpuInfo
*
gpu_info
)
{
GpuInfo
info
;
const
GLubyte
*
renderer_name
=
glGetString
(
GL_RENDERER
);
if
(
renderer_name
)
{
info
.
renderer_name
=
reinterpret_cast
<
const
char
*>
(
renderer_name
);
GetGpuModelAndType
(
info
.
renderer_name
,
&
info
.
gpu_model
,
&
info
.
type
);
}
const
GLubyte
*
vendor_name
=
glGetString
(
GL_VENDOR
);
if
(
vendor_name
)
{
info
.
vendor_name
=
reinterpret_cast
<
const
char
*>
(
vendor_name
);
}
const
GLubyte
*
version_name
=
glGetString
(
GL_VERSION
);
if
(
version_name
)
{
info
.
version
=
reinterpret_cast
<
const
char
*>
(
version_name
);
}
glGetIntegerv
(
GL_MAJOR_VERSION
,
&
info
.
major_version
);
glGetIntegerv
(
GL_MINOR_VERSION
,
&
info
.
minor_version
);
GLint
extensions_count
;
glGetIntegerv
(
GL_NUM_EXTENSIONS
,
&
extensions_count
);
info
.
extensions
.
resize
(
extensions_count
);
for
(
int
i
=
0
;
i
<
extensions_count
;
++
i
)
{
info
.
extensions
[
i
]
=
std
::
string
(
reinterpret_cast
<
const
char
*>
(
glGetStringi
(
GL_EXTENSIONS
,
i
)));
}
glGetIntegerv
(
GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS
,
&
info
.
max_ssbo_bindings
);
glGetIntegerv
(
GL_MAX_COMPUTE_IMAGE_UNIFORMS
,
&
info
.
max_image_bindings
);
info
.
max_work_group_size
.
resize
(
3
);
glGetIntegeri_v
(
GL_MAX_COMPUTE_WORK_GROUP_SIZE
,
0
,
&
info
.
max_work_group_size
[
0
]);
glGetIntegeri_v
(
GL_MAX_COMPUTE_WORK_GROUP_SIZE
,
1
,
&
info
.
max_work_group_size
[
1
]);
glGetIntegeri_v
(
GL_MAX_COMPUTE_WORK_GROUP_SIZE
,
2
,
&
info
.
max_work_group_size
[
2
]);
glGetIntegerv
(
GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS
,
&
info
.
max_work_group_invocations
);
glGetIntegerv
(
GL_MAX_TEXTURE_SIZE
,
&
info
.
max_texture_size
);
glGetIntegerv
(
GL_MAX_IMAGE_UNITS
,
&
info
.
max_image_units
);
glGetIntegerv
(
GL_MAX_ARRAY_TEXTURE_LAYERS
,
&
info
.
max_array_texture_layers
);
RETURN_IF_ERROR
(
GetOpenGlErrors
());
*
gpu_info
=
info
;
return
OkStatus
();
}
}
// namespace gl
}
// namespace gpu
}
// namespace tflite
tensorflow/lite/delegates/gpu/
gl
/gpu_info.h
→
tensorflow/lite/delegates/gpu/
common
/gpu_info.h
浏览文件 @
9c04d7c0
...
...
@@ -13,17 +13,14 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_
GL
_GPU_INFO_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_
GL
_GPU_INFO_H_
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_
COMMON
_GPU_INFO_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_
COMMON
_GPU_INFO_H_
#include <string>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/status.h"
namespace
tflite
{
namespace
gpu
{
namespace
gl
{
enum
class
GpuType
{
UNKNOWN
,
MALI
,
ADRENO
,
POWERVR
,
INTEL
,
NVIDIA
};
enum
class
GpuModel
{
...
...
@@ -89,12 +86,7 @@ struct GpuInfo {
void
GetGpuModelAndType
(
const
std
::
string
&
renderer
,
GpuModel
*
gpu_model
,
GpuType
*
gpu_type
);
// This method performs multiple GL calls, therefore, egl context needs to be
// created upfront.
Status
RequestGpuInfo
(
GpuInfo
*
gpu_info
);
}
// namespace gl
}
// namespace gpu
}
// namespace tflite
#endif // TENSORFLOW_LITE_DELEGATES_GPU_
GL
_GPU_INFO_H_
#endif // TENSORFLOW_LITE_DELEGATES_GPU_
COMMON
_GPU_INFO_H_
tensorflow/lite/delegates/gpu/gl/BUILD
浏览文件 @
9c04d7c0
...
...
@@ -16,7 +16,7 @@ cc_library(
":compiler"
,
":compiler_options"
,
":gl_call"
,
":gpu_info"
,
":
request_
gpu_info"
,
":node_shader"
,
":object"
,
":object_manager"
,
...
...
@@ -48,8 +48,8 @@ cc_library(
":gl_call"
,
":gl_program"
,
":gl_sync"
,
":gpu_info"
,
":portable"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"//tensorflow/lite/delegates/gpu/common:types"
,
"@com_google_absl//absl/memory"
,
...
...
@@ -80,9 +80,9 @@ cc_library(
deps
=
[
":compiler_options"
,
":float16_conversions"
,
":gpu_info"
,
":node_shader"
,
"//tensorflow/lite/delegates/gpu/common:data_type"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:model"
,
"//tensorflow/lite/delegates/gpu/common:model_transformer"
,
"//tensorflow/lite/delegates/gpu/common:operations"
,
...
...
@@ -103,7 +103,6 @@ cc_library(
name
=
"compiler_options"
,
hdrs
=
[
"compiler_options.h"
],
deps
=
[
":gpu_info"
,
":object"
,
],
)
...
...
@@ -128,8 +127,8 @@ cc_library(
":egl_context"
,
":egl_surface"
,
":gl_call"
,
":gpu_info"
,
":portable"
,
":request_gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"@com_google_absl//absl/memory"
,
],
...
...
@@ -272,18 +271,6 @@ cc_library(
],
)
cc_library
(
name
=
"gpu_info"
,
srcs
=
[
"gpu_info.cc"
],
hdrs
=
[
"gpu_info.h"
],
deps
=
[
":gl_errors"
,
":portable"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"@com_google_absl//absl/strings"
,
],
)
flatbuffer_cc_library
(
name
=
"metadata_cc_fbs"
,
srcs
=
[
"metadata.fbs"
],
...
...
@@ -298,9 +285,9 @@ cc_library(
hdrs
=
[
"node_shader.h"
],
deps
=
[
":compiler_options"
,
":gpu_info"
,
":object"
,
":variable"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:model"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"//tensorflow/lite/delegates/gpu/common:types"
,
...
...
@@ -344,6 +331,19 @@ cc_library(
],
)
cc_library
(
name
=
"request_gpu_info"
,
srcs
=
[
"request_gpu_info.cc"
],
hdrs
=
[
"request_gpu_info.h"
],
deps
=
[
":gl_errors"
,
":portable"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"@com_google_absl//absl/strings"
,
],
)
cc_library
(
name
=
"runtime"
,
srcs
=
[
"runtime.cc"
],
...
...
@@ -356,7 +356,6 @@ cc_library(
":gl_program"
,
":gl_shader"
,
":gl_texture"
,
":gpu_info"
,
":object"
,
":object_manager"
,
":portable"
,
...
...
@@ -364,6 +363,7 @@ cc_library(
":stats"
,
":variable"
,
"//tensorflow/lite/delegates/gpu/common:data_type"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"//tensorflow/lite/delegates/gpu/common:types"
,
"//tensorflow/lite/delegates/gpu/gl/runtime:shared_buffer"
,
...
...
tensorflow/lite/delegates/gpu/gl/api.cc
浏览文件 @
9c04d7c0
...
...
@@ -31,9 +31,9 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/util.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/object.h"
#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/runtime.h"
#include "tensorflow/lite/delegates/gpu/gl/variable.h"
...
...
tensorflow/lite/delegates/gpu/gl/command_queue.cc
浏览文件 @
9c04d7c0
...
...
@@ -16,6 +16,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
#include "absl/memory/memory.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
...
...
tensorflow/lite/delegates/gpu/gl/command_queue.h
浏览文件 @
9c04d7c0
...
...
@@ -18,10 +18,10 @@ limitations under the License.
#include <memory>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
namespace
tflite
{
namespace
gpu
{
...
...
tensorflow/lite/delegates/gpu/gl/compiler.cc
浏览文件 @
9c04d7c0
...
...
@@ -24,6 +24,7 @@ limitations under the License.
#include "absl/memory/memory.h"
#include "absl/types/any.h"
#include "tensorflow/lite/delegates/gpu/common/data_type.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
...
...
tensorflow/lite/delegates/gpu/gl/compiler.h
浏览文件 @
9c04d7c0
...
...
@@ -20,11 +20,11 @@ limitations under the License.
#include <memory>
#include <unordered_set>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/compiler/BUILD
浏览文件 @
9c04d7c0
...
...
@@ -81,10 +81,10 @@ cc_library(
":preprocessor"
,
":shader_code"
,
":variable_accessor"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:model"
,
"//tensorflow/lite/delegates/gpu/common:status"
,
"//tensorflow/lite/delegates/gpu/gl:compiler_options"
,
"//tensorflow/lite/delegates/gpu/gl:gpu_info"
,
"//tensorflow/lite/delegates/gpu/gl:object"
,
"//tensorflow/lite/delegates/gpu/gl:variable"
,
"@com_google_absl//absl/strings"
,
...
...
tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.cc
浏览文件 @
9c04d7c0
...
...
@@ -18,6 +18,7 @@ limitations under the License.
#include <algorithm>
#include "absl/strings/str_cat.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/preprocessor.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.h"
...
...
tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.h
浏览文件 @
9c04d7c0
...
...
@@ -19,13 +19,13 @@ limitations under the License.
#include <string>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/compiled_node.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/object_accessor.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/object.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/compiler_options.h
浏览文件 @
9c04d7c0
...
...
@@ -16,7 +16,6 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_OPTIONS_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_OPTIONS_H_
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/object.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/egl_environment.cc
浏览文件 @
9c04d7c0
...
...
@@ -18,6 +18,7 @@ limitations under the License.
#include "absl/memory/memory.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
namespace
tflite
{
namespace
gpu
{
...
...
tensorflow/lite/delegates/gpu/gl/egl_environment.h
浏览文件 @
9c04d7c0
...
...
@@ -21,9 +21,9 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/gl/egl_context.h"
#include "tensorflow/lite/delegates/gpu/gl/egl_surface.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/portable_egl.h"
#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
namespace
tflite
{
namespace
gpu
{
...
...
tensorflow/lite/delegates/gpu/gl/kernels/BUILD
浏览文件 @
9c04d7c0
...
...
@@ -582,9 +582,9 @@ cc_library(
"//tensorflow/lite/delegates/gpu/gl:compiler_options"
,
"//tensorflow/lite/delegates/gpu/gl:egl_environment"
,
"//tensorflow/lite/delegates/gpu/gl:gl_buffer"
,
"//tensorflow/lite/delegates/gpu/gl:gpu_info"
,
"//tensorflow/lite/delegates/gpu/gl:node_shader"
,
"//tensorflow/lite/delegates/gpu/gl:object_manager"
,
"//tensorflow/lite/delegates/gpu/gl:request_gpu_info"
,
"//tensorflow/lite/delegates/gpu/gl:runtime_options"
,
"//tensorflow/lite/delegates/gpu/gl/workgroups:default_calculator"
,
"@com_google_googletest//:gtest"
,
...
...
tensorflow/lite/delegates/gpu/gl/kernels/test_util.cc
浏览文件 @
9c04d7c0
...
...
@@ -28,8 +28,8 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/gl/api.h"
#include "tensorflow/lite/delegates/gpu/gl/egl_environment.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/object_manager.h"
#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/node_shader.h
浏览文件 @
9c04d7c0
...
...
@@ -21,11 +21,11 @@ limitations under the License.
#include <string>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/model.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/object.h"
#include "tensorflow/lite/delegates/gpu/gl/variable.h"
...
...
tensorflow/lite/delegates/gpu/gl/request_gpu_info.cc
0 → 100644
浏览文件 @
9c04d7c0
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
#include <algorithm>
#include <cctype>
#include <string>
#include "absl/strings/ascii.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_errors.h"
#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
namespace
tflite
{
namespace
gpu
{
namespace
gl
{
Status
RequestGpuInfo
(
GpuInfo
*
gpu_info
)
{
GpuInfo
info
;
const
GLubyte
*
renderer_name
=
glGetString
(
GL_RENDERER
);
if
(
renderer_name
)
{
info
.
renderer_name
=
reinterpret_cast
<
const
char
*>
(
renderer_name
);
GetGpuModelAndType
(
info
.
renderer_name
,
&
info
.
gpu_model
,
&
info
.
type
);
}
const
GLubyte
*
vendor_name
=
glGetString
(
GL_VENDOR
);
if
(
vendor_name
)
{
info
.
vendor_name
=
reinterpret_cast
<
const
char
*>
(
vendor_name
);
}
const
GLubyte
*
version_name
=
glGetString
(
GL_VERSION
);
if
(
version_name
)
{
info
.
version
=
reinterpret_cast
<
const
char
*>
(
version_name
);
}
glGetIntegerv
(
GL_MAJOR_VERSION
,
&
info
.
major_version
);
glGetIntegerv
(
GL_MINOR_VERSION
,
&
info
.
minor_version
);
GLint
extensions_count
;
glGetIntegerv
(
GL_NUM_EXTENSIONS
,
&
extensions_count
);
info
.
extensions
.
resize
(
extensions_count
);
for
(
int
i
=
0
;
i
<
extensions_count
;
++
i
)
{
info
.
extensions
[
i
]
=
std
::
string
(
reinterpret_cast
<
const
char
*>
(
glGetStringi
(
GL_EXTENSIONS
,
i
)));
}
glGetIntegerv
(
GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS
,
&
info
.
max_ssbo_bindings
);
glGetIntegerv
(
GL_MAX_COMPUTE_IMAGE_UNIFORMS
,
&
info
.
max_image_bindings
);
info
.
max_work_group_size
.
resize
(
3
);
glGetIntegeri_v
(
GL_MAX_COMPUTE_WORK_GROUP_SIZE
,
0
,
&
info
.
max_work_group_size
[
0
]);
glGetIntegeri_v
(
GL_MAX_COMPUTE_WORK_GROUP_SIZE
,
1
,
&
info
.
max_work_group_size
[
1
]);
glGetIntegeri_v
(
GL_MAX_COMPUTE_WORK_GROUP_SIZE
,
2
,
&
info
.
max_work_group_size
[
2
]);
glGetIntegerv
(
GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS
,
&
info
.
max_work_group_invocations
);
glGetIntegerv
(
GL_MAX_TEXTURE_SIZE
,
&
info
.
max_texture_size
);
glGetIntegerv
(
GL_MAX_IMAGE_UNITS
,
&
info
.
max_image_units
);
glGetIntegerv
(
GL_MAX_ARRAY_TEXTURE_LAYERS
,
&
info
.
max_array_texture_layers
);
RETURN_IF_ERROR
(
GetOpenGlErrors
());
*
gpu_info
=
info
;
return
OkStatus
();
}
}
// namespace gl
}
// namespace gpu
}
// namespace tflite
tensorflow/lite/delegates/gpu/gl/request_gpu_info.h
0 → 100644
浏览文件 @
9c04d7c0
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_REQUEST_GPU_INFO_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_GL_REQUEST_GPU_INFO_H_
#include <string>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
namespace
tflite
{
namespace
gpu
{
namespace
gl
{
// This method performs multiple GL calls, therefore, egl context needs to be
// created upfront.
Status
RequestGpuInfo
(
GpuInfo
*
gpu_info
);
}
// namespace gl
}
// namespace gpu
}
// namespace tflite
#endif // TENSORFLOW_LITE_DELEGATES_GPU_GL_REQUEST_GPU_INFO_H_
tensorflow/lite/delegates/gpu/gl/runtime.cc
浏览文件 @
9c04d7c0
...
...
@@ -22,6 +22,7 @@ limitations under the License.
#include "absl/strings/str_cat.h"
#include "tensorflow/lite/delegates/gpu/common/data_type.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
...
...
tensorflow/lite/delegates/gpu/gl/runtime.h
浏览文件 @
9c04d7c0
...
...
@@ -18,13 +18,13 @@ limitations under the License.
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/status.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_shader.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/object.h"
#include "tensorflow/lite/delegates/gpu/gl/object_manager.h"
#include "tensorflow/lite/delegates/gpu/gl/runtime/shared_buffer.h"
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/BUILD
浏览文件 @
9c04d7c0
...
...
@@ -8,8 +8,8 @@ cc_library(
srcs
=
[
"calculator.cc"
],
hdrs
=
[
"calculator.h"
],
deps
=
[
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:types"
,
"//tensorflow/lite/delegates/gpu/gl:gpu_info"
,
"//tensorflow/lite/delegates/gpu/gl/compiler:shader_code"
,
],
)
...
...
@@ -20,8 +20,8 @@ cc_library(
hdrs
=
[
"default_calculator.h"
],
deps
=
[
":calculator"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:types"
,
"//tensorflow/lite/delegates/gpu/gl:gpu_info"
,
],
)
...
...
@@ -35,7 +35,7 @@ cc_library(
":default_calculator"
,
"//tensorflow/lite/delegates/gpu/gl:common_cc_fbs"
,
"//tensorflow/lite/delegates/gpu/gl:workgroups_cc_fbs"
,
"//tensorflow/lite/delegates/gpu/
gl
:gpu_info"
,
"//tensorflow/lite/delegates/gpu/
common
:gpu_info"
,
"//tensorflow/lite/delegates/gpu/gl:metadata_cc_fbs"
,
":calculator"
,
"@com_google_absl//absl/memory"
,
...
...
@@ -52,7 +52,7 @@ cc_library(
deps
=
[
":calculator"
,
":default_calculator"
,
"//tensorflow/lite/delegates/gpu/
gl
:gpu_info"
,
"//tensorflow/lite/delegates/gpu/
common
:gpu_info"
,
]
+
select
({
"//tensorflow/lite/delegates/gpu:tflite_gpu_binary_release"
:
[],
"//conditions:default"
:
[
...
...
@@ -67,9 +67,9 @@ cc_library(
hdrs
=
[
"ideal_workgroup_picker.h"
],
deps
=
[
":calculator"
,
"//tensorflow/lite/delegates/gpu/common:gpu_info"
,
"//tensorflow/lite/delegates/gpu/common:operations"
,
"//tensorflow/lite/delegates/gpu/common:shape"
,
"//tensorflow/lite/delegates/gpu/common:types"
,
"//tensorflow/lite/delegates/gpu/gl:gpu_info"
,
],
)
tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.cc
浏览文件 @
9c04d7c0
...
...
@@ -15,6 +15,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h"
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h
浏览文件 @
9c04d7c0
...
...
@@ -16,7 +16,7 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_BEST_EFFORT_CALCULATOR_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_BEST_EFFORT_CALCULATOR_H_
#include "tensorflow/lite/delegates/gpu/
gl
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/
common
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/calculator.cc
浏览文件 @
9c04d7c0
...
...
@@ -15,9 +15,9 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
namespace
tflite
{
namespace
gpu
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h
浏览文件 @
9c04d7c0
...
...
@@ -18,9 +18,9 @@ limitations under the License.
#include <memory>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
namespace
tflite
{
namespace
gpu
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.cc
浏览文件 @
9c04d7c0
...
...
@@ -20,15 +20,15 @@ limitations under the License.
#include <memory>
#include <unordered_map>
#include "absl/memory/memory.h"
#include "flatbuffers/flatbuffers.h" // TF:flatbuffers
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/metadata_generated.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups_generated.h"
#include "absl/memory/memory.h"
#include "flatbuffers/flatbuffers.h" // TF:flatbuffers
#include "tensorflow/lite/delegates/gpu/common/types.h"
#endif // TFLITE_GPU_BINARY_RELEASE
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.h
浏览文件 @
9c04d7c0
...
...
@@ -16,7 +16,7 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_CALCULATOR_FROM_METADATA_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_CALCULATOR_FROM_METADATA_H_
#include "tensorflow/lite/delegates/gpu/
gl
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/
common
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.cc
浏览文件 @
9c04d7c0
...
...
@@ -15,6 +15,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h"
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h
浏览文件 @
9c04d7c0
...
...
@@ -16,7 +16,7 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_DEFAULT_CALCULATOR_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_DEFAULT_CALCULATOR_H_
#include "tensorflow/lite/delegates/gpu/
gl
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/
common
/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.cc
浏览文件 @
9c04d7c0
...
...
@@ -18,10 +18,10 @@ limitations under the License.
#include <map>
#include <vector>
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
namespace
tflite
{
...
...
tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.h
浏览文件 @
9c04d7c0
...
...
@@ -16,10 +16,10 @@ limitations under the License.
#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_IDEAL_WORKGROUP_PICKER_H_
#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_IDEAL_WORKGROUP_PICKER_H_
#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
#include "tensorflow/lite/delegates/gpu/common/operations.h"
#include "tensorflow/lite/delegates/gpu/common/shape.h"
#include "tensorflow/lite/delegates/gpu/common/types.h"
#include "tensorflow/lite/delegates/gpu/gl/gpu_info.h"
namespace
tflite
{
namespace
gpu
{
...
...
tensorflow/lite/delegates/gpu/gl_delegate.cc
浏览文件 @
9c04d7c0
...
...
@@ -43,6 +43,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/gpu/gl/egl_environment.h"
#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
#include "tensorflow/lite/delegates/gpu/gl/kernels/registry.h"
#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
#include "tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h"
#include "tensorflow/lite/minimal_logging.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录