[llvm-dev] RFC: Exposing TargetTransformInfo factories from TargetMachine

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 14 23:22:13 PST 2017


Hi all,

I'd like to be able to use TargetTransformInfo to make architecture
specific code generation decisions from the XLA LLVM IR emitter[0].
However, we don't have a great way to do this today --
TargetTransformInfo is wrapped in a TargetIRAnalysis and getting the
TargetTransformInfo out of it requires something like:

  FunctionAnalysisManager DummyFAM;
  TTI = TIRA.run(F, DummyFAM);
  return *TTI;

which isn't ideal.

Given that all in-tree backends have a factory function to directly
construct a TargetTransformInfo implementation anyway, what do you
think about exposing said factory function from the TargetMachine
subclasses directly?  Something conceptually like this
https://reviews.llvm.org/D41268 but for all backends and will less
std::function?

[0]:  XLA is a machine learning focussed linear algebra compiler
https://www.tensorflow.org/performance/xla/ that uses LLVM for its CPU
and GPU backends.

-- Sanjoy


More information about the llvm-dev mailing list