From aec49509b8d053dfd9a3ef9838895bed50508227 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 20 Mar 2019 10:22:26 +0100 Subject: [PATCH] Make sure -T does not come in inflict with FIXED_LOCAL_SIZE --- src/modules/module_03200.c | 29 ++++++++++++++++++----------- src/modules/module_09000.c | 17 ++++++++++++----- src/modules/module_18600.c | 17 ++++++++++++----- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/modules/module_03200.c b/src/modules/module_03200.c index 3f6c57ced..c20a99347 100644 --- a/src/modules/module_03200.c +++ b/src/modules/module_03200.c @@ -89,20 +89,27 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else { - u32 overhead = 0; - - if (device_param->device_vendor_id == VENDOR_ID_NV) + if (user_options->kernel_threads_chgd == true) { - // note we need to use device_param->device_local_mem_size - 4 because opencl jit returns with: - // Entry function '...' uses too much shared data (0xc004 bytes, 0xc000 max) - // on my development system. no clue where the 4 bytes are spent. - // I did some research on this and it seems to be related with the datatype. - // For example, if i used u8 instead, there's only 1 byte wasted. - - overhead = 4; + fixed_local_size = user_options->kernel_threads; } + else + { + u32 overhead = 0; - fixed_local_size = (device_param->device_local_mem_size - overhead) / 4096; + if (device_param->device_vendor_id == VENDOR_ID_NV) + { + // note we need to use device_param->device_local_mem_size - 4 because opencl jit returns with: + // Entry function '...' uses too much shared data (0xc004 bytes, 0xc000 max) + // on my development system. no clue where the 4 bytes are spent. + // I did some research on this and it seems to be related with the datatype. + // For example, if i used u8 instead, there's only 1 byte wasted. + + overhead = 4; + } + + fixed_local_size = (device_param->device_local_mem_size - overhead) / 4096; + } } hc_asprintf (&jit_build_options, "-D FIXED_LOCAL_SIZE=%u", fixed_local_size); diff --git a/src/modules/module_09000.c b/src/modules/module_09000.c index 2ecfae886..a9cf2ff40 100644 --- a/src/modules/module_09000.c +++ b/src/modules/module_09000.c @@ -82,14 +82,21 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else { - u32 overhead = 0; - - if (device_param->device_vendor_id == VENDOR_ID_NV) + if (user_options->kernel_threads_chgd == true) { - overhead = 4; + fixed_local_size = user_options->kernel_threads; } + else + { + u32 overhead = 0; - fixed_local_size = (device_param->device_local_mem_size - overhead) / 4096; + if (device_param->device_vendor_id == VENDOR_ID_NV) + { + overhead = 4; + } + + fixed_local_size = (device_param->device_local_mem_size - overhead) / 4096; + } } hc_asprintf (&jit_build_options, "-D FIXED_LOCAL_SIZE=%u", fixed_local_size); diff --git a/src/modules/module_18600.c b/src/modules/module_18600.c index 6614e46e8..faf8f5626 100644 --- a/src/modules/module_18600.c +++ b/src/modules/module_18600.c @@ -74,14 +74,21 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else { - u32 overhead = 0; - - if (device_param->device_vendor_id == VENDOR_ID_NV) + if (user_options->kernel_threads_chgd == true) { - overhead = 4; + fixed_local_size = user_options->kernel_threads; } + else + { + u32 overhead = 0; - fixed_local_size = (device_param->device_local_mem_size - overhead) / 4096; + if (device_param->device_vendor_id == VENDOR_ID_NV) + { + overhead = 4; + } + + fixed_local_size = (device_param->device_local_mem_size - overhead) / 4096; + } } hc_asprintf (&jit_build_options, "-D FIXED_LOCAL_SIZE=%u", fixed_local_size);