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

Function BufferInfosToCppExpression

tensorflow/compiler/aot/codegen.cc:349–365  ·  view source on GitHub ↗

Returns a list of C++ expressions that, when executed, will construct the BufferInfo instances in `buffer_infos`.

Source from the content-addressed store, hash-verified

347// Returns a list of C++ expressions that, when executed, will construct the
348// BufferInfo instances in `buffer_infos`.
349std::vector<string> BufferInfosToCppExpression(
350 const std::vector<BufferInfo>& buffer_infos) {
351 std::vector<string> buffer_infos_as_strings;
352 std::transform(buffer_infos.begin(), buffer_infos.end(),
353 std::back_inserter(buffer_infos_as_strings),
354 [](const BufferInfo& buffer_info) {
355 std::pair<uint64, uint64> encoded = buffer_info.Encode();
356 string encoded_second_as_str =
357 encoded.second == ~0ULL
358 ? "~0ULL"
359 : absl::StrCat(encoded.second, "ULL");
360 return absl::StrCat(
361 "::xla::cpu_function_runtime::BufferInfo({",
362 encoded.first, "ULL, ", encoded_second_as_str, "})");
363 });
364 return buffer_infos_as_strings;
365}
366} // namespace
367
368Status GenerateHeader(const CodegenOpts& opts, const tf2xla::Config& config,

Callers 1

GenerateHeaderFunction · 0.85

Calls 5

transformFunction · 0.50
StrCatFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
EncodeMethod · 0.45

Tested by

no test coverage detected