Replace LiteralUtil to Literal in compiler/plugin/executor
This commit is contained in:
parent
62fb49d314
commit
a54d43fa40
@ -36,7 +36,7 @@ static se::DeviceMemoryBase AllocateSingleOutput(sep::ExecutorExecutor* executor
|
|||||||
const Literal& literal) {
|
const Literal& literal) {
|
||||||
int64 size(xla::ShapeUtil::ByteSizeOf(literal.shape()));
|
int64 size(xla::ShapeUtil::ByteSizeOf(literal.shape()));
|
||||||
void* buf = executor->Allocate(size);
|
void* buf = executor->Allocate(size);
|
||||||
const void* src = LiteralUtil::InternalData(literal);
|
const void* src = Literal::InternalData(literal);
|
||||||
memcpy(buf, src, size);
|
memcpy(buf, src, size);
|
||||||
return se::DeviceMemoryBase(buf, size);
|
return se::DeviceMemoryBase(buf, size);
|
||||||
}
|
}
|
||||||
@ -86,11 +86,11 @@ StatusOr<se::DeviceMemoryBase> ExecutorExecutable::ExecuteOnStream(
|
|||||||
for (int64 p = 0; p < computation->num_parameters(); p++) {
|
for (int64 p = 0; p < computation->num_parameters(); p++) {
|
||||||
// Create the input literal for the parameter
|
// Create the input literal for the parameter
|
||||||
HloInstruction* param = computation->parameter_instruction(p);
|
HloInstruction* param = computation->parameter_instruction(p);
|
||||||
arg_literals.emplace_back(LiteralUtil::CreateFromShape(param->shape()));
|
arg_literals.emplace_back(Literal::CreateFromShape(param->shape()));
|
||||||
arg_literals_ptrs.push_back(arg_literals.back().get());
|
arg_literals_ptrs.push_back(arg_literals.back().get());
|
||||||
|
|
||||||
// Copy in the data from the stream_executor buffers
|
// Copy in the data from the stream_executor buffers
|
||||||
void* buffer = LiteralUtil::MutableInternalData(arg_literals.back().get());
|
void* buffer = Literal::MutableInternalData(arg_literals.back().get());
|
||||||
memcpy(buffer, arguments[p].opaque(),
|
memcpy(buffer, arguments[p].opaque(),
|
||||||
ShapeUtil::ByteSizeOf(param->shape()));
|
ShapeUtil::ByteSizeOf(param->shape()));
|
||||||
}
|
}
|
||||||
|
@ -70,13 +70,13 @@ Status ExecutorTransferManager::TransferLiteralFromDevice(
|
|||||||
}
|
}
|
||||||
|
|
||||||
*literal->mutable_shape() = device_shape;
|
*literal->mutable_shape() = device_shape;
|
||||||
LiteralUtil::Reserve(ShapeUtil::ElementsIn(device_shape), literal);
|
Literal::Reserve(ShapeUtil::ElementsIn(device_shape), literal);
|
||||||
TF_RETURN_IF_ERROR(TransferBufferFromDevice(
|
TF_RETURN_IF_ERROR(TransferBufferFromDevice(
|
||||||
executor, source, ShapeUtil::ByteSizeOf(device_shape),
|
executor, source, ShapeUtil::ByteSizeOf(device_shape),
|
||||||
LiteralUtil::MutableInternalData(literal)));
|
Literal::MutableInternalData(literal)));
|
||||||
if (!ShapeUtil::Equal(literal_shape, device_shape)) {
|
if (!ShapeUtil::Equal(literal_shape, device_shape)) {
|
||||||
literal->Swap(
|
literal->Swap(
|
||||||
LiteralUtil::Relayout(*literal, literal_shape.layout()).get());
|
Literal::Relayout(*literal, literal_shape.layout()).get());
|
||||||
}
|
}
|
||||||
TF_RET_CHECK(ShapeUtil::Equal(literal_shape, literal->shape()));
|
TF_RET_CHECK(ShapeUtil::Equal(literal_shape, literal->shape()));
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
@ -134,7 +134,7 @@ Status ExecutorTransferManager::TransferLiteralToDevice(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TransferBufferToDevice(executor, GetByteSizeRequirement(shape),
|
return TransferBufferToDevice(executor, GetByteSizeRequirement(shape),
|
||||||
LiteralUtil::InternalData(literal),
|
Literal::InternalData(literal),
|
||||||
destination);
|
destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user