MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Build

Method Build

tensorflow/compiler/xla/service/gpu/gpu_hlo_schedule.cc:192–218  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

190
191/* static */
192StatusOr<std::unique_ptr<GpuHloSchedule>> GpuHloSchedule::Build(
193 const HloModule& module, const StreamAssignment& stream_assignment,
194 int64 pointer_size) {
195 std::unique_ptr<GpuHloSchedule> schedule(new GpuHloSchedule);
196
197 // Initialize thunk_launch_order_, the total order of thunk launches.
198 HloComputation* entry_computation = module.entry_computation();
199 if (stream_assignment.StreamCount() == 1) {
200 // All kernels are launched on a single stream, so there's no loss of
201 // concurrency by optimizing for minimal memory usage.
202 TF_ASSIGN_OR_RETURN(
203 HloInstructionSequence sequence,
204 ScheduleComputation(
205 entry_computation, [pointer_size](const BufferValue& buffer) {
206 return ShapeUtil::ByteSizeOf(buffer.shape(), pointer_size);
207 }));
208 schedule->thunk_launch_order_ = sequence.instructions();
209 } else {
210 // BFS tends to increase concurrency, but also increases memory usage.
211 BFSLaunchOrder(entry_computation, &schedule->thunk_launch_order_);
212 }
213
214 schedule->hlo_ordering_ = absl::make_unique<GpuHloOrdering>(
215 &module, stream_assignment, schedule->thunk_launch_order_);
216
217 return std::move(schedule);
218}
219
220} // namespace gpu
221} // namespace xla

Callers 15

TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
BuildBodyComputationMethod · 0.45
BuildWhileInstructionMethod · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45

Calls 4

BFSLaunchOrderFunction · 0.85
entry_computationMethod · 0.80
instructionsMethod · 0.80
StreamCountMethod · 0.45

Tested by 15

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
BuildBodyComputationMethod · 0.36
BuildWhileInstructionMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36