Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
---

Hi,

this is the alternative (power of 2) approach to hadling kernel args,
as discussed in this thread:
http://lists.freedesktop.org/archives/mesa-dev/2014-April/thread.html#58209

Jan

 src/gallium/state_trackers/clover/llvm/invocation.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index a81bdf8..8e5b49b 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -64,6 +64,7 @@
 
 #include "pipe/p_state.h"
 #include "util/u_memory.h"
+#include "util/u_math.h"
 
 #include <iostream>
 #include <iomanip>
@@ -309,6 +310,9 @@ namespace {
 
             llvm::Type *arg_type = arg.getType();
             unsigned arg_size = TD.getTypeStoreSize(arg_type);
+            if (!util_is_power_of_two(arg_size)) {
+              arg_size = util_next_power_of_two(arg_size);
+            }
 
             llvm::Type *target_type = arg_type->isIntegerTy() ?
                TD.getSmallestLegalIntType(mod->getContext(), arg_size * 8) :
-- 
1.9.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to