Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
tensorflow
提交
7e8efb0f
T
tensorflow
项目概览
xxadev
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
1
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,发现更多精彩内容 >>
提交
7e8efb0f
编写于
7月 16, 2019
作者:
A
A. Unique TensorFlower
提交者:
TensorFlower Gardener
7月 16, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Configure LLVMDialect and extract pointer size.
PiperOrigin-RevId: 258361644
上级
b542d679
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
3 deletion
+32
-3
tensorflow/compiler/xla/service/mlir_gpu/BUILD
tensorflow/compiler/xla/service/mlir_gpu/BUILD
+5
-0
tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.cc
tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.cc
+20
-0
tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.h
tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.h
+7
-3
未找到文件。
tensorflow/compiler/xla/service/mlir_gpu/BUILD
浏览文件 @
7e8efb0f
...
...
@@ -39,8 +39,13 @@ cc_library(
deps
=
[
":failover_compiler"
,
"//tensorflow/compiler/xla/service:compiler"
,
"//tensorflow/compiler/xla/service/gpu:gpu_constants"
,
"//tensorflow/compiler/xla/service/gpu:ir_emission_utils"
,
"//tensorflow/compiler/xla/service/gpu:nvptx_compiler_impl"
,
"//tensorflow/compiler/xla/service/gpu:target_constants"
,
"//tensorflow/core:lib"
,
"@local_config_mlir//:IR"
,
"@local_config_mlir//:LLVMDialect"
,
],
alwayslink
=
True
,
# Contains compiler registration
)
tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.cc
浏览文件 @
7e8efb0f
...
...
@@ -15,13 +15,33 @@ limitations under the License.
#include "tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.h"
#include "mlir/LLVMIR/LLVMDialect.h" // TF:local_config_mlir
#include "tensorflow/compiler/xla/service/gpu/gpu_constants.h"
#include "tensorflow/compiler/xla/service/gpu/ir_emission_utils.h"
#include "tensorflow/compiler/xla/service/gpu/nvptx_compiler.h"
#include "tensorflow/compiler/xla/service/gpu/target_constants.h"
#include "tensorflow/compiler/xla/service/mlir_gpu/failover_compiler.h"
#include "tensorflow/core/lib/core/errors.h"
namespace
xla
{
namespace
mlir
{
using
::
mlir
::
MLIRContext
;
using
::
mlir
::
LLVM
::
LLVMDialect
;
namespace
{
int64
ConfigureLLVMModuleAndGetPointerSize
(
MLIRContext
*
context
)
{
LLVMDialect
*
dialect
=
context
->
getRegisteredDialect
<
LLVMDialect
>
();
llvm
::
Module
&
module
=
dialect
->
getLLVMModule
();
module
.
setTargetTriple
(
gpu
::
nvptx
::
kTargetTriple
);
module
.
setDataLayout
(
gpu
::
nvptx
::
kDataLayout
);
return
module
.
getDataLayout
().
getPointerSize
();
}
}
// namespace
MlirCompiler
::
MlirCompiler
()
:
pointer_size_
(
ConfigureLLVMModuleAndGetPointerSize
(
&
context_
))
{}
se
::
Platform
::
Id
MlirCompiler
::
PlatformId
()
const
{
return
stream_executor
::
cuda
::
kCudaPlatformId
;
}
...
...
tensorflow/compiler/xla/service/mlir_gpu/mlir_compiler.h
浏览文件 @
7e8efb0f
...
...
@@ -16,6 +16,7 @@ limitations under the License.
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_MLIR_GPU_MLIR_COMPILER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_MLIR_GPU_MLIR_COMPILER_H_
#include "mlir/IR/MLIRContext.h" // TF:local_config_mlir
#include "tensorflow/compiler/xla/service/compiler.h"
namespace
xla
{
...
...
@@ -26,7 +27,7 @@ namespace mlir {
// generation of a think suitable for XLAs runtime.
class
MlirCompiler
:
public
Compiler
{
public:
MlirCompiler
()
{}
MlirCompiler
()
;
se
::
Platform
::
Id
PlatformId
()
const
override
;
...
...
@@ -58,12 +59,15 @@ class MlirCompiler : public Compiler {
const
AotCompilationOptions
&
options
)
override
;
HloCostAnalysis
::
ShapeSizeFunction
ShapeSizeBytesFunction
()
const
override
{
// TODO(herhut): Get this from the LLVMDialect in MLIR.
int64
pointer_size
=
8
;
int64
pointer_size
=
pointer_size_
;
return
[
pointer_size
](
const
Shape
&
shape
)
{
return
ShapeUtil
::
ByteSizeOf
(
shape
,
pointer_size
);
};
}
private:
::
mlir
::
MLIRContext
context_
;
int64
pointer_size_
;
};
}
// namespace mlir
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录