Reg. Linking Polly with XLA LLVM.

161 views
Skip to first unread message

Annanay Agarwal

unread,
Jun 2, 2017, 1:24:18 AM6/2/17
to XLA development
Hi xla-dev,

I am Annanay Agarwal, a student working on incorporating Polyhedral Compilation into TensorFlow through Polly in XLA.

I have written my custom bazel build file to build LLVM(in XLA) with Polly, but I am facing some issues, possibly at the linking stage. I have been trying to pass Polly specific flags to XLA but it does not recognize them. Here is how I am doing so-

TF_XLA_FLAGS="--xla_cpu_llvm_cl_opts=-polly" python mnist_softmax_xla.py --xla=true

(Executing the above command says- "Unknown flag -polly")

However, LLVM flags are being recognized:

TF_XLA_FLAGS="--xla_cpu_llvm_cl_opts=-disable-inlined-alloca-merging" python mnist_softmax_xla.py --xla=true

(The above command runs perfectly)


Any help or pointers regarding this would be great!

I have also filed a github issue that can be found here-
https://github.com/tensorflow/tensorflow/issues/10288

Thank you,

--
Annanay Agarwal
Department of CSE
IIT Hyderabad

Brian Retford

unread,
Jun 2, 2017, 1:36:30 AM6/2/17
to Annanay Agarwal, XLA development
Also as I noted on the tensorflow thread, definitely give people all the tools they need to help you. In this case if you can provide a 5-6 line process for exactly reproducing your situation, it's a lot easier for people to jump in and help you

--
You received this message because you are subscribed to the Google Groups "XLA development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xla-dev+u...@googlegroups.com.
To post to this group, send email to xla...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xla-dev/CA%2BizcZTUWK-7bmK7A1ipmbYdgE58DFsLDtbKvmd7%3Dgz400khUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Bjarke Roune

unread,
Jun 2, 2017, 8:40:37 PM6/2/17
to XLA development
I don't know the source of this particular problem, but just wanted to say that this sounds very exciting and I'll (we'll) be interested to see what kind of results you end up getting from this! I'll ask around over here if someone knows about this problem you're seeing.

David Majnemer

unread,
Jun 2, 2017, 9:30:46 PM6/2/17
to XLA development
Hi,

Have you arranged to call initializePollyPasses and registerPollyPasses?

Peter Hawkins

unread,
Jun 7, 2017, 11:12:58 PM6/7/17
to David Majnemer, XLA development
I tried to follow your instructions on Github to reproduce:
but I just get a build error from external/llvm/tools/polly/lib/External/isl/isl_config_post.h:

In file included from external/llvm/tools/polly/lib/External/isl/isl_int.h:17:0,
                 from external/llvm/tools/polly/lib/External/isl/isl_blk.h:13,
                 from external/llvm/tools/polly/lib/External/isl/isl_ctx_private.h:2,
                 from external/llvm/tools/polly/lib/External/isl/isl_local_space.c:13:
external/llvm/tools/polly/lib/External/isl/isl_config_post.h:5:5: error: token "@" is not valid in preprocessor expressions
 #if HAVE_DECL_FFS
     ^
external/llvm/tools/polly/lib/External/isl/isl_config_post.h:9:6: error: token "@" is not valid in preprocessor expressions
 #if (HAVE_DECL_FFS==0) && (HAVE_DECL___BUILTIN_FFS==1)
      ^
etc.

This is on a Ubuntu Linux machine. I didn't have time to try fixing the problem.

Are those repositories still building for you? Can you double check?


My suspicion is that David is right, and you need to explicitly call registerPollyPasses somewhere in here:

Can you give that a try?

Also, I would start with trying to run an XLA unit test, e.g. //tensorflow/compiler/xla/tests:array_elementwise_op_test_cpu

There is much less code involved and it should be easier to debug what is going on.

Peter


--
You received this message because you are subscribed to the Google Groups "XLA development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xla-dev+u...@googlegroups.com.
To post to this group, send email to xla...@googlegroups.com.

Annanay Agarwal

unread,
Jun 9, 2017, 1:55:21 AM6/9/17
to XLA development
Hi,

Thank you for responding to this, and sorry for the delay, I did not get notifications for this.

@Peter;
I have fixed this issue and other link time issues and pushed my latest code to my repositories. 

@David;

The issues have been resolved and Polly's passes are initialized in the XLA pipeline.

As the next step, I want to run a stock programs and benchmark the performance gains that Polly is bringing to XLA kernels. I want to check where Polly fails to optimize loops and the reasons for the same.
Can you guide me through the performance tuning process that is performed in XLA? 

Thank you,
Reply all
Reply to author
Forward
0 new messages