diff --git a/src/acc/opencl/acc_opencl.c b/src/acc/opencl/acc_opencl.c index 8d4e42b807f..f751a384488 100644 --- a/src/acc/opencl/acc_opencl.c +++ b/src/acc/opencl/acc_opencl.c @@ -274,7 +274,7 @@ int c_dbcsr_acc_init(void) { : c_dbcsr_acc_opencl_config.lock_main); c_dbcsr_acc_opencl_config.verbosity = (NULL == env_verbose ? 0 : atoi(env_verbose)); c_dbcsr_acc_opencl_config.priority = (NULL == env_priority ? /*default*/ 3 : atoi(env_priority)); - c_dbcsr_acc_opencl_config.xhints = (NULL == env_xhints ? (1 + 2) : atoi(env_xhints)); + c_dbcsr_acc_opencl_config.xhints = (NULL == env_xhints ? (1 + 2 + 4) : atoi(env_xhints)); c_dbcsr_acc_opencl_config.async = (NULL == env_async ? async_default : atoi(env_async)); c_dbcsr_acc_opencl_config.dump = (NULL == env_dump ? /*default*/ 0 : atoi(env_dump)); c_dbcsr_acc_opencl_config.debug = (NULL == env_debug ? c_dbcsr_acc_opencl_config.dump : atoi(env_debug)); diff --git a/src/acc/opencl/acc_opencl_mem.c b/src/acc/opencl/acc_opencl_mem.c index 41fc76519c0..e725f239686 100644 --- a/src/acc/opencl/acc_opencl_mem.c +++ b/src/acc/opencl/acc_opencl_mem.c @@ -190,8 +190,12 @@ int c_dbcsr_acc_host_mem_allocate(void** host_mem, size_t nbytes, void* stream) if (EXIT_SUCCESS == result) { const c_dbcsr_acc_opencl_stream_t* const str = (NULL != stream ? ACC_OPENCL_STREAM(stream) : c_dbcsr_acc_opencl_stream_default()); - void* const mapped = clEnqueueMapBuffer( - str->queue, memory, CL_TRUE /*always block*/, CL_MAP_READ | CL_MAP_WRITE, 0 /*offset*/, nbytes, 0, NULL, NULL, &result); + void* const mapped = clEnqueueMapBuffer(str->queue, memory, CL_TRUE /*always block*/, +# if defined(CL_VERSION_1_2) || defined(CL_MAP_WRITE_INVALIDATE_REGION) + (4 & c_dbcsr_acc_opencl_config.xhints) ? CL_MAP_WRITE_INVALIDATE_REGION : +# endif + (CL_MAP_READ | CL_MAP_WRITE), + 0 /*offset*/, nbytes, 0, NULL, NULL, &result); assert(EXIT_SUCCESS == result || NULL == mapped); if (EXIT_SUCCESS == result) { const uintptr_t address = (uintptr_t)mapped;