Skip to content

Commit

Permalink
ocl: speedup host-memory allocation on GH200 (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp authored Sep 13, 2024
1 parent 43f8eef commit cef934d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/acc/opencl/acc_opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 6 additions & 2 deletions src/acc/opencl/acc_opencl_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cef934d

Please sign in to comment.