[PATCH] D11774: [NVPTX] Use LDG for pointer induction variables

Bjarke Hammersholt Roune broune at google.com
Wed Aug 5 13:14:51 PDT 2015


broune added inline comments.

================
Comment at: test/CodeGen/NVPTX/load-with-non-coherent-cache.ll:216
@@ +215,3 @@
+
+; Without interprocedural analysis, we can only know that the parameter is
+; global and never written to from a kernel function.
----------------
We also don't know that the parameter is global. "only" applies to both sides of the "and", so the statement is that we don't know either one of those, since @notkernel is not a kernel function. A more detailed way of stating what I'm getting at:

In order to know that a parameter is a global pointer from within a non-kernel function, we would have to do inter-procedural analysis to see where the values for that parameter come from. This present function is not a kernel function, and we don't do inter-procedural analysis (and it doesn't have any callers anyway), so we cannot infer that it is global in this case. Thus we cannot use LDG.

The same statement applies if you replace "global pointer" with "never written to".

"never written to" is intended to include everything that happens for the duration of the kernel call (not just this function call), though I suppose "never" actually covers more than that, so I clarified it in the comment.

================
Comment at: test/CodeGen/NVPTX/load-with-non-coherent-cache.ll:222
@@ +221,3 @@
+; SM35: ld.f32
+define void @notkernel(float * noalias readonly %from, float * %to) {
+  %1 = load float, float * %from
----------------
The meaning of the test is to capture what actually happens for a device function, where there are currently two independent reasons that LDG cannot be used.

Though it's a good suggestion to have a test where the parameter is explicitly marked as global, so I added that. Thanks for the suggestion.


http://reviews.llvm.org/D11774





More information about the llvm-commits mailing list