From 4e2b5fff40238740da0fc409db96031d842a5d65 Mon Sep 17 00:00:00 2001 From: willyborn Date: Mon, 26 Oct 2020 23:01:41 +0100 Subject: [PATCH 1/2] Max parameter length is now fetched from device. Values for opencl parameter maximum length were hardcoded. The maximum is now requested at the device, so that the correct value for all devices is used. --- src/backend/opencl/Array.cpp | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/backend/opencl/Array.cpp b/src/backend/opencl/Array.cpp index 23da2f086b..b82ea25753 100644 --- a/src/backend/opencl/Array.cpp +++ b/src/backend/opencl/Array.cpp @@ -320,27 +320,13 @@ kJITHeuristics passesJitHeuristics(Node *root_node) { constexpr size_t base_param_size = sizeof(T *) + sizeof(KParam) + (3 * sizeof(uint)); - // This is the maximum size of the params that can be allowed by the - // CUDA platform. - constexpr size_t max_nvidia_param_size = (4096 - base_param_size); - constexpr size_t max_amd_param_size = (3520 - base_param_size); - - // This value is really for the Intel HD Graphics platform. The CPU - // platform seems like it can handle unlimited parameters but the - // compile times become very large. - constexpr size_t max_intel_igpu_param_size = - (1024 - 256 - base_param_size); - - size_t max_param_size = 0; - if (isNvidia) { - max_param_size = max_nvidia_param_size; - } else if (isAmd) { - max_param_size = max_amd_param_size; - } else if (isIntel && getDeviceType() == CL_DEVICE_TYPE_GPU) { - max_param_size = max_intel_igpu_param_size; - } else { - max_param_size = 8192; - } + const cl::Device &device = getDevice(); + size_t max_param_size = device.getInfo(); + // typical values: + // NVIDIA = 4096 + // AMD = 3520 (AMD A10 iGPU = 1024) + // Intel iGPU = 1024 + max_param_size -= base_param_size; struct tree_info { size_t total_buffer_size; From 0f161f205b10a42c18a64d20cec4b07abb16445c Mon Sep 17 00:00:00 2001 From: willyborn Date: Mon, 2 Nov 2020 17:27:27 +0100 Subject: [PATCH 2/2] Removed isAmd & isNvidia, since they are no longer used. --- src/backend/opencl/Array.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/backend/opencl/Array.cpp b/src/backend/opencl/Array.cpp index b82ea25753..9d8f2f99ea 100644 --- a/src/backend/opencl/Array.cpp +++ b/src/backend/opencl/Array.cpp @@ -300,10 +300,6 @@ kJITHeuristics passesJitHeuristics(Node *root_node) { auto platform = getActivePlatform(); // The Apple platform can have the nvidia card or the AMD card - bool isNvidia = - platform == AFCL_PLATFORM_NVIDIA || platform == AFCL_PLATFORM_APPLE; - bool isAmd = - platform == AFCL_PLATFORM_AMD || platform == AFCL_PLATFORM_APPLE; bool isIntel = platform == AFCL_PLATFORM_INTEL; /// Intels param_size limit is much smaller than the other platforms