Skip to content

Commit

Permalink
Remove opencl 2.0 requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
Beanavil committed Jun 18, 2024
1 parent c2f6b75 commit 2cefce5
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions samples/core/blur/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,18 +1051,6 @@ int main(int argc, char *argv[])
free(name);
}

// 5) query if OpenCL driver version is 2.0
bool opencl_version_2_0 = false;
{
char *driver_version = NULL;
OCLERROR_PAR(
driver_version = cl_util_get_device_info(s.device, CL_DRIVER_VERSION, &error),
error, clean);
opencl_version_2_0 = strcmp("2.0", driver_version) ? 0 : 1;
clean:
free(driver_version);
}

/// Create image buffers
const cl_image_desc desc = { .image_type = CL_MEM_OBJECT_IMAGE2D,
.image_width = s.input_image.width,
Expand Down Expand Up @@ -1128,25 +1116,21 @@ int main(int argc, char *argv[])
error, prg);

/// Subgroup exchange in dual-pass blur
if (use_subgroup_exchange_relative && opencl_version_2_0)
if (use_subgroup_exchange_relative)
{
printf("Dual-pass subgroup relative exchange blur\n");

kernel_op[0] = '\0';
// cl_khr_subgroup_shuffle_relative requires OpenCL 2.0
strcat(kernel_op, " -cl-std=CL2.0 ");
strcat(kernel_op, "-D USE_SUBGROUP_EXCHANGE_RELATIVE ");
OCLERROR_RET(dual_pass_subgroup_exchange_box_blur(
&s, (cl_int)blur_opts.size),
error, prg);
}
if (use_subgroup_exchange && opencl_version_2_0)
if (use_subgroup_exchange)
{
printf("Dual-pass subgroup exchange blur\n");

kernel_op[0] = '\0';
// cl_khr_subgroup_shuffle requires OpenCL 2.0
strcat(kernel_op, " -cl-std=CL2.0 ");
strcat(kernel_op, "-D USE_SUBGROUP_EXCHANGE ");

OCLERROR_RET(dual_pass_subgroup_exchange_box_blur(
Expand Down Expand Up @@ -1185,26 +1169,22 @@ int main(int argc, char *argv[])
}

/// Subgroup exchange in dual-pass Gaussian blur
if (use_subgroup_exchange_relative && opencl_version_2_0)
if (use_subgroup_exchange_relative)
{
printf("Dual-pass subgroup relative exchange Gaussian blur\n");

kernel_op[0] = '\0';
// cl_khr_subgroup_shuffle_relative requires OpenCL 2.0
strcat(kernel_op, " -cl-std=CL2.0 ");
strcat(kernel_op, "-D USE_SUBGROUP_EXCHANGE_RELATIVE ");

OCLERROR_RET(dual_pass_subgroup_exchange_kernel_blur(&s, gauss_size,
gauss_kern),
error, gkrn);
}
if (use_subgroup_exchange && opencl_version_2_0)
if (use_subgroup_exchange)
{
printf("Dual-pass subgroup exchange Gaussian blur\n");

kernel_op[0] = '\0';
// cl_khr_subgroup_shuffle requires OpenCL 2.0
strcat(kernel_op, " -cl-std=CL2.0 ");
strcat(kernel_op, "-D USE_SUBGROUP_EXCHANGE ");

OCLERROR_RET(dual_pass_subgroup_exchange_kernel_blur(&s, gauss_size,
Expand Down

0 comments on commit 2cefce5

Please sign in to comment.