google / ml-compiler-opt

Infrastructure for Machine Learning Guided Optimization (MLGO) in LLVM.
Apache License 2.0
612 stars 92 forks source link

questions about feature log #324

Closed 18liumin closed 9 months ago

18liumin commented 9 months ago

result = log_reader.read_log_as_sequence_examples(log_path) if len(result) != 1: return {}

Why does this code need to determine the “if len(result) != 1”?

mtrofin commented 9 months ago

I'm going to assume this is here. Inlining is treated as a module-wide problem, as opposed to for example regalloc which is per-function. So for the whole problem, we expect to get at most 1 trace. We may get 0 traces for corner-case modules that trigger no inlining decisions - like a module with 1 function, or functions that have no call sites, or callsites to functions defined in other modules, exclusively.