Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XLA:GPU] let GpuTransferManager take different StreamExecutor and LLVM Compiler #20759

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions tensorflow/compiler/xla/service/gpu/gpu_transfer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ namespace gpu {
// TODO(b/30467474) Once GPU infeed implementation settles, consider
// folding back the cpu and gpu infeed implementations into a generic
// one if possible.
GpuTransferManager::GpuTransferManager()
: GenericTransferManager(
se::cuda::kCudaPlatformId,
/*pointer_size=*/llvm::DataLayout(gpu::GpuCompiler::kDataLayout)
.getPointerSize(0 /* default address space */)) {}
GpuTransferManager::GpuTransferManager(se::Platform::Id id,
unsigned pointer_size)
: GenericTransferManager(id, pointer_size) {}

Status GpuTransferManager::TransferLiteralToInfeed(
se::StreamExecutor* executor, const LiteralSlice& literal) {
Expand Down Expand Up @@ -179,13 +177,16 @@ Status GpuTransferManager::TransferLiteralFromOutfeed(
} // namespace gpu
} // namespace xla

static std::unique_ptr<xla::TransferManager> CreateGpuTransferManager() {
return xla::MakeUnique<xla::gpu::GpuTransferManager>();
static std::unique_ptr<xla::TransferManager> CreateNVPTXTransferManager() {
return xla::MakeUnique<xla::GpuTransferManager>(
/*id=*/ stream_executor::cuda::kCudaPlatformId,
/*pointer_size=*/ llvm::DataLayout(xla::gpu::GpuCompiler::kDataLayout)
.getPointerSize(0 /* default address space */));
}

static bool InitModule() {
xla::TransferManager::RegisterTransferManager(
stream_executor::cuda::kCudaPlatformId, &CreateGpuTransferManager);
stream_executor::cuda::kCudaPlatformId, &CreateNVPTXTransferManager);
return true;
}
static bool module_initialized = InitModule();
2 changes: 1 addition & 1 deletion tensorflow/compiler/xla/service/gpu/gpu_transfer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace gpu {
// handles GPU-specific infeed.
class GpuTransferManager : public GenericTransferManager {
public:
GpuTransferManager();
GpuTransferManager(se::Platform::Id id, unsigned pointer_size);
~GpuTransferManager() override {}

Status TransferLiteralToInfeed(se::StreamExecutor* executor,
Expand Down