@@ -158,16 +158,38 @@ urSamplerGetInfo(ur_sampler_handle_t hSampler, ur_sampler_info_t propName,
158
158
static_assert (sizeof (cl_addressing_mode) ==
159
159
sizeof (ur_sampler_addressing_mode_t ));
160
160
161
- size_t CheckPropSize = 0 ;
162
- ur_result_t Err = mapCLErrorToUR (
163
- clGetSamplerInfo (cl_adapter::cast<cl_sampler>(hSampler), SamplerInfo,
164
- propSize, pPropValue, &CheckPropSize));
165
- if (pPropValue && CheckPropSize != propSize) {
166
- return UR_RESULT_ERROR_INVALID_SIZE;
167
- }
168
- UR_RETURN_ON_FAILURE (Err);
169
- if (pPropSizeRet) {
170
- *pPropSizeRet = CheckPropSize;
161
+ ur_result_t Err = UR_RESULT_SUCCESS;
162
+ // ur_bool_t have a size of uint8_t, but cl_bool size have the size of
163
+ // uint32_t so this adjust UR_SAMPLER_INFO_NORMALIZED_COORDS info to map
164
+ // between them.
165
+ if (propName == UR_SAMPLER_INFO_NORMALIZED_COORDS) {
166
+ cl_bool normalized_coords = false ;
167
+ Err = mapCLErrorToUR (
168
+ clGetSamplerInfo (cl_adapter::cast<cl_sampler>(hSampler), SamplerInfo,
169
+ sizeof (cl_bool), &normalized_coords, nullptr ));
170
+ if (pPropValue && propSize != sizeof (ur_bool_t )) {
171
+ return UR_RESULT_ERROR_INVALID_SIZE;
172
+ }
173
+ UR_RETURN_ON_FAILURE (Err);
174
+ if (pPropValue) {
175
+ *static_cast <ur_bool_t *>(pPropValue) =
176
+ static_cast <ur_bool_t >(normalized_coords);
177
+ }
178
+ if (pPropSizeRet) {
179
+ *pPropSizeRet = sizeof (ur_bool_t );
180
+ }
181
+ } else {
182
+ size_t CheckPropSize = 0 ;
183
+ Err = mapCLErrorToUR (
184
+ clGetSamplerInfo (cl_adapter::cast<cl_sampler>(hSampler), SamplerInfo,
185
+ propSize, pPropValue, &CheckPropSize));
186
+ if (pPropValue && CheckPropSize != propSize) {
187
+ return UR_RESULT_ERROR_INVALID_SIZE;
188
+ }
189
+ UR_RETURN_ON_FAILURE (Err);
190
+ if (pPropSizeRet) {
191
+ *pPropSizeRet = CheckPropSize;
192
+ }
171
193
}
172
194
173
195
// Convert OpenCL returns to UR
0 commit comments