Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wux_labs
Tensorflow
提交
e3d9d1e0
T
Tensorflow
项目概览
wux_labs
/
Tensorflow
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e3d9d1e0
编写于
9月 12, 2023
作者:
A
A. Unique TensorFlower
提交者:
TensorFlower Gardener
9月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Eliminate never called function and unused data members.
PiperOrigin-RevId: 564748979
上级
d4e9abaf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
75 deletion
+45
-75
third_party/xla/xla/stream_executor/plugin_registry.cc
third_party/xla/xla/stream_executor/plugin_registry.cc
+44
-60
third_party/xla/xla/stream_executor/plugin_registry.h
third_party/xla/xla/stream_executor/plugin_registry.h
+1
-15
未找到文件。
third_party/xla/xla/stream_executor/plugin_registry.cc
浏览文件 @
e3d9d1e0
...
...
@@ -76,22 +76,18 @@ tsl::Status PluginRegistry::RegisterFactoryInternal(
}
(
*
factories
)[
plugin_id
]
=
factory
;
plugin_names_
[
plugin_id
]
=
plugin_name
;
return
::
tsl
::
OkStatus
();
}
template
<
typename
FACTORY_TYPE
>
tsl
::
StatusOr
<
FACTORY_TYPE
>
PluginRegistry
::
GetFactoryInternal
(
PluginId
plugin_id
,
const
std
::
map
<
PluginId
,
FACTORY_TYPE
>&
factories
,
const
std
::
map
<
PluginId
,
FACTORY_TYPE
>&
generic_
factories
)
const
{
PluginId
plugin_id
,
const
std
::
map
<
PluginId
,
FACTORY_TYPE
>&
factories
)
const
{
auto
iter
=
factories
.
find
(
plugin_id
);
if
(
iter
==
factories
.
end
())
{
iter
=
generic_factories
.
find
(
plugin_id
);
if
(
iter
==
generic_factories
.
end
())
{
return
tsl
::
Status
(
absl
::
StatusCode
::
kNotFound
,
absl
::
StrFormat
(
"Plugin ID %p not registered."
,
plugin_id
));
}
return
tsl
::
Status
(
absl
::
StatusCode
::
kNotFound
,
absl
::
StrFormat
(
"Plugin ID %p not registered."
,
plugin_id
));
}
return
iter
->
second
;
...
...
@@ -162,60 +158,48 @@ bool PluginRegistry::HasFactory(Platform::Id platform_id,
}
}
return
HasFactory
(
generic_factories_
,
plugin_kind
,
plugin_id
)
;
return
false
;
}
// Explicit instantiations to support types exposed in user/public API.
#define EMIT_PLUGIN_SPECIALIZATIONS(FACTORY_TYPE, FACTORY_VAR, PLUGIN_STRING) \
template tsl::StatusOr<PluginRegistry::FACTORY_TYPE> \
PluginRegistry::GetFactoryInternal<PluginRegistry::FACTORY_TYPE>( \
PluginId plugin_id, \
const std::map<PluginId, PluginRegistry::FACTORY_TYPE>& factories, \
const std::map<PluginId, PluginRegistry::FACTORY_TYPE>& \
generic_factories) const; \
\
template tsl::Status \
PluginRegistry::RegisterFactoryInternal<PluginRegistry::FACTORY_TYPE>( \
PluginId plugin_id, const std::string& plugin_name, \
PluginRegistry::FACTORY_TYPE factory, \
std::map<PluginId, PluginRegistry::FACTORY_TYPE>* factories); \
\
template <> \
tsl::Status PluginRegistry::RegisterFactory<PluginRegistry::FACTORY_TYPE>( \
Platform::Id platform_id, PluginId plugin_id, const std::string& name, \
PluginRegistry::FACTORY_TYPE factory) { \
return RegisterFactoryInternal(plugin_id, name, factory, \
&factories_[platform_id].FACTORY_VAR); \
} \
\
template <> \
tsl::Status PluginRegistry::RegisterFactoryForAllPlatforms< \
PluginRegistry::FACTORY_TYPE>(PluginId plugin_id, \
const std::string& name, \
PluginRegistry::FACTORY_TYPE factory) { \
return RegisterFactoryInternal(plugin_id, name, factory, \
&generic_factories_.FACTORY_VAR); \
} \
\
template <> \
tsl::StatusOr<PluginRegistry::FACTORY_TYPE> PluginRegistry::GetFactory( \
Platform::Id platform_id, PluginId plugin_id) { \
if (plugin_id == PluginConfig::kDefault) { \
plugin_id = default_factories_[platform_id].FACTORY_VAR; \
\
if (plugin_id == kNullPlugin) { \
return tsl::Status( \
absl::StatusCode::kFailedPrecondition, \
"No suitable " PLUGIN_STRING \
" plugin registered. Have you linked in a " PLUGIN_STRING \
"-providing plugin?"); \
} else { \
VLOG(2) << "Selecting default " PLUGIN_STRING " plugin, " \
<< plugin_names_[plugin_id]; \
} \
} \
return GetFactoryInternal(plugin_id, factories_[platform_id].FACTORY_VAR, \
generic_factories_.FACTORY_VAR); \
#define EMIT_PLUGIN_SPECIALIZATIONS(FACTORY_TYPE, FACTORY_VAR, PLUGIN_STRING) \
template tsl::StatusOr<PluginRegistry::FACTORY_TYPE> \
PluginRegistry::GetFactoryInternal<PluginRegistry::FACTORY_TYPE>( \
PluginId plugin_id, \
const std::map<PluginId, PluginRegistry::FACTORY_TYPE>& factories) \
const; \
\
template tsl::Status \
PluginRegistry::RegisterFactoryInternal<PluginRegistry::FACTORY_TYPE>( \
PluginId plugin_id, const std::string& plugin_name, \
PluginRegistry::FACTORY_TYPE factory, \
std::map<PluginId, PluginRegistry::FACTORY_TYPE>* factories); \
\
template <> \
tsl::Status PluginRegistry::RegisterFactory<PluginRegistry::FACTORY_TYPE>( \
Platform::Id platform_id, PluginId plugin_id, const std::string& name, \
PluginRegistry::FACTORY_TYPE factory) { \
return RegisterFactoryInternal(plugin_id, name, factory, \
&factories_[platform_id].FACTORY_VAR); \
} \
\
template <> \
tsl::StatusOr<PluginRegistry::FACTORY_TYPE> PluginRegistry::GetFactory( \
Platform::Id platform_id, PluginId plugin_id) { \
if (plugin_id == PluginConfig::kDefault) { \
plugin_id = default_factories_[platform_id].FACTORY_VAR; \
\
if (plugin_id == kNullPlugin) { \
return tsl::Status( \
absl::StatusCode::kFailedPrecondition, \
"No suitable " PLUGIN_STRING \
" plugin registered. Have you linked in a " PLUGIN_STRING \
"-providing plugin?"); \
} else { \
VLOG(2) << "Selecting default " PLUGIN_STRING " plugin"; \
} \
} \
return GetFactoryInternal(plugin_id, factories_[platform_id].FACTORY_VAR); \
}
EMIT_PLUGIN_SPECIALIZATIONS
(
BlasFactory
,
blas
,
"BLAS"
);
...
...
third_party/xla/xla/stream_executor/plugin_registry.h
浏览文件 @
e3d9d1e0
...
...
@@ -62,13 +62,6 @@ class PluginRegistry {
tsl
::
Status
RegisterFactory
(
Platform
::
Id
platform_id
,
PluginId
plugin_id
,
const
std
::
string
&
name
,
FactoryT
factory
);
// Registers the specified factory as usable by _all_ platform types.
// Reports errors just as RegisterFactory.
template
<
typename
FactoryT
>
tsl
::
Status
RegisterFactoryForAllPlatforms
(
PluginId
plugin_id
,
const
std
::
string
&
name
,
FactoryT
factory
);
// Potentially sets the plugin identified by plugin_id to be the default
// for the specified platform and plugin kind. If this routine is called
// multiple types for the same PluginKind, the PluginId given in the last call
...
...
@@ -114,8 +107,7 @@ class PluginRegistry {
// Actually performs the work of factory retrieval.
template
<
typename
FactoryT
>
tsl
::
StatusOr
<
FactoryT
>
GetFactoryInternal
(
PluginId
plugin_id
,
const
std
::
map
<
PluginId
,
FactoryT
>&
factories
,
const
std
::
map
<
PluginId
,
FactoryT
>&
generic_factories
)
const
;
PluginId
plugin_id
,
const
std
::
map
<
PluginId
,
FactoryT
>&
factories
)
const
;
// Returns true if the specified plugin has been registered with the specified
// platform factories. Unlike the other overload of this method, this does
...
...
@@ -129,15 +121,9 @@ class PluginRegistry {
// The set of registered factories, keyed by platform ID.
std
::
map
<
Platform
::
Id
,
PluginFactories
>
factories_
;
// Plugins supported for all platform kinds.
PluginFactories
generic_factories_
;
// The sets of default factories, keyed by platform ID.
std
::
map
<
Platform
::
Id
,
DefaultFactories
>
default_factories_
;
// Lookup table for plugin names.
std
::
map
<
PluginId
,
std
::
string
>
plugin_names_
;
SE_DISALLOW_COPY_AND_ASSIGN
(
PluginRegistry
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录