From 828d02668f05ceb0c5945f30fc127f9db6b72827 Mon Sep 17 00:00:00 2001
From: Tianqi Chen <tqchen@users.noreply.github.com>
Date: Tue, 23 Jan 2018 12:08:29 -0800
Subject: [PATCH] [OPENCL] Fix 32bit pointer size in OpenCL runtime (#809)

---
 src/runtime/opencl/opencl_module.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/runtime/opencl/opencl_module.cc b/src/runtime/opencl/opencl_module.cc
index 5a585a19c..bde7e6b27 100644
--- a/src/runtime/opencl/opencl_module.cc
+++ b/src/runtime/opencl/opencl_module.cc
@@ -254,9 +254,14 @@ PackedFunc OpenCLModuleNode::GetFunction(
   for (size_t i = 0; i < info.arg_types.size(); ++i) {
     TVMType t = info.arg_types[i];
     CHECK_EQ(t.lanes, 1U);
-    uint32_t bits = t.bits;
-    CHECK_EQ(bits % 8, 0U);
-    arg_size[i] = bits / 8;
+    if (t.code == kHandle) {
+      // specially store pointer type size in OpenCL driver
+      arg_size[i] = sizeof(void*);
+    } else {
+      uint32_t bits = t.bits;
+      CHECK_EQ(bits % 8, 0U);
+      arg_size[i] = bits / 8;
+    }
   }
   // initialize the wrapped func.
   f.Init(this, sptr_to_self, kid_map_.at(name),
-- 
GitLab