Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU] Add explicit pointer casts in OpenCL kernels for clang 22 (#39713)

Andrew Kwangwoong Park3042b45f9274
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/pa_kv_cache_update_ref.cl b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/pa_kv_cache_update_ref.cl
index a9b34f67102..1890fc5e893 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/pa_kv_cache_update_ref.cl
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/pa_kv_cache_update_ref.cl
@@ -100,7 +100,7 @@ inline void FUNC(quantize_and_save_per_token)(__global const INPUT0_TYPE* in_dat
out_data[offset] = res;
}
- INPUT0_TYPE* comp_ptr = out_data + comp_offset;
+ INPUT0_TYPE* comp_ptr = (INPUT0_TYPE*)(out_data + comp_offset);
if (sglid == 0) {
comp_ptr[token_pos_in_block] = 1.0 / scale;
comp_ptr[PAGED_ATTENTION_BLOCK_SIZE + token_pos_in_block] = zp;
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/paged_attention_opt.cl b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/paged_attention_opt.cl
index 6e742235cd6..43cbfba7ca1 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/paged_attention_opt.cl
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/paged_attention_opt.cl
@@ -342,7 +342,7 @@ KERNEL(pa_sdpa_opt)(
const uint key_block_offset = block_offset;
const uint hidden_stride = SUBGROUP_SIZE;
const uint key_comp_offset = key_block_offset + phys_k_head_size * PAGED_ATTENTION_BLOCK_SIZE;
- INPUT0_TYPE* key_comp_ptr = key_cache + key_comp_offset;
+ INPUT0_TYPE* key_comp_ptr = (INPUT0_TYPE*)(key_cache + key_comp_offset);
INPUT0_TYPE comp_scale = key_comp_ptr[0 + sglid];
INPUT0_TYPE comp_zp = key_comp_ptr[PAGED_ATTENTION_BLOCK_SIZE + sglid];
#endif
@@ -774,7 +774,7 @@ KERNEL(pa_sdpa_opt)(
INPUT0_TYPE comp_zp = my_token_comp_ptr[1];
#else
const uint value_comp_offset = packed_block_offset + phys_v_head_size * PAGED_ATTENTION_BLOCK_SIZE;
- INPUT0_TYPE* value_comp_ptr = value_cache + value_comp_offset;
+ INPUT0_TYPE* value_comp_ptr = (INPUT0_TYPE*)(value_cache + value_comp_offset);
INPUT0_TYPE comp_scale = value_comp_ptr[0 + sglid];
INPUT0_TYPE comp_zp = value_comp_ptr[PAGED_ATTENTION_BLOCK_SIZE + sglid];
#endif
@@ -909,7 +909,7 @@ KERNEL(pa_sdpa_opt)(
INPUT0_TYPE comp_zp = my_token_comp_ptr[1];
#elif IS_KV_COMPRESSED && !IS_INT4_COMPRESSED
const uint value_comp_offset = block_offset + V_HEAD_SIZE * PAGED_ATTENTION_BLOCK_SIZE;
- INPUT0_TYPE* value_comp_ptr = value_cache + value_comp_offset;
+ INPUT0_TYPE* value_comp_ptr = (INPUT0_TYPE*)(value_cache + value_comp_offset);
INPUT0_TYPE comp_scale = value_comp_ptr[0 + sglid];
INPUT0_TYPE comp_zp = value_comp_ptr[PAGED_ATTENTION_BLOCK_SIZE + sglid];
#endif
diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_mmad_bfyx_to_b_fs_yx_fsv32.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_mmad_bfyx_to_b_fs_yx_fsv32.cl
index f33dabc6b0a..4b3d9138ed1 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_mmad_bfyx_to_b_fs_yx_fsv32.cl
+++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/convolution_gpu_mmad_bfyx_to_b_fs_yx_fsv32.cl
@@ -180,9 +180,9 @@ KERNEL(convolution_mmad_bfyx_to_b_fs_yx_fsv32)(
}
slm_block[c + lid] = AS_PACKED_IN_TYPE(src);
#elif INPUT0_LAYOUT_B_FS_YX_FSV4
- const __global uint* ptr = input + input_offset
+ const __global uint* ptr = (const __global uint*)(input + input_offset
+ (kh * DILATION_SIZE_Y + INPUT0_PAD_BEFORE_SIZE_Y) * input_y_pitch
- + (x_chunk + lid + INPUT0_PAD_BEFORE_SIZE_X) * input_x_pitch;
+ + (x_chunk + lid + INPUT0_PAD_BEFORE_SIZE_X) * input_x_pitch);
PACKED_IN_TYPE src = AS_PACKED_IN_TYPE(ptr[0]);
slm_block[c + lid] = src;
#endif
@@ -211,9 +211,9 @@ KERNEL(convolution_mmad_bfyx_to_b_fs_yx_fsv32)(
}
slm_block_tail[lid] = AS_PACKED_IN_TYPE(src);
#elif INPUT0_LAYOUT_B_FS_YX_FSV4
- const __global uint* ptr = input + input_offset
+ const __global uint* ptr = (const __global uint*)(input + input_offset
+ (kh * DILATION_SIZE_Y + INPUT0_PAD_BEFORE_SIZE_Y) * input_y_pitch
- + (x_chunk + lid + INPUT0_PAD_BEFORE_SIZE_X) * input_x_pitch;
+ + (x_chunk + lid + INPUT0_PAD_BEFORE_SIZE_X) * input_x_pitch);
PACKED_IN_TYPE src = AS_PACKED_IN_TYPE(ptr[0]);
slm_block_tail[lid] = src;
#endif