Skip to content

Commit 23978b4

Browse files
[SYCL] Implement proper queries for aspect::ext_oneapi_srgb (#9243)
Plugins that don't support functionality must report false, not PI_INVALD_VALUE.
1 parent 68e13d4 commit 23978b4

File tree

7 files changed

+34
-6
lines changed

7 files changed

+34
-6
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,11 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
21052105
return getInfo<pi_bool>(param_value_size, param_value, param_value_size_ret,
21062106
false);
21072107
}
2108+
case PI_DEVICE_INFO_IMAGE_SRGB: {
2109+
// The sRGB images are not supported on CUDA.
2110+
return getInfo<pi_bool>(param_value_size, param_value, param_value_size_ret,
2111+
false);
2112+
}
21082113

21092114
// TODO: Investigate if this information is available on CUDA.
21102115
case PI_DEVICE_INFO_PCI_ADDRESS:
@@ -2114,7 +2119,6 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
21142119
case PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
21152120
case PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
21162121
case PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
2117-
case PI_DEVICE_INFO_IMAGE_SRGB:
21182122
return PI_ERROR_INVALID_VALUE;
21192123

21202124
default:

sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,9 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
816816
case PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT:
817817
// The mem-channel buffer property is not supported on the ESIMD emulator.
818818
return ReturnValue(pi_bool{false});
819+
case PI_DEVICE_INFO_IMAGE_SRGB:
820+
// The sRGB images are not supported on the ESIMD emulator.
821+
return ReturnValue(pi_bool{false});
819822

820823
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS)
821824
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_IL_VERSION)
@@ -829,7 +832,6 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
829832
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE)
830833
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE)
831834
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_MAX_MEM_BANDWIDTH)
832-
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_IMAGE_SRGB)
833835
CASE_PI_UNSUPPORTED(PI_DEVICE_INFO_ATOMIC_64)
834836
CASE_PI_UNSUPPORTED(PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES)
835837
CASE_PI_UNSUPPORTED(PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES)

sycl/plugins/hip/pi_hip.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,11 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
19601960
return getInfo<pi_bool>(param_value_size, param_value, param_value_size_ret,
19611961
false);
19621962
}
1963+
case PI_DEVICE_INFO_IMAGE_SRGB: {
1964+
// The sRGB images are not supported on HIP device.
1965+
return getInfo<pi_bool>(param_value_size, param_value, param_value_size_ret,
1966+
false);
1967+
}
19631968

19641969
// TODO: Investigate if this information is available on HIP.
19651970
case PI_DEVICE_INFO_PCI_ADDRESS:
@@ -1971,7 +1976,6 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
19711976
case PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
19721977
case PI_DEVICE_INFO_MAX_MEM_BANDWIDTH:
19731978
case PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS:
1974-
case PI_DEVICE_INFO_IMAGE_SRGB:
19751979
setErrorMessage("HIP backend does not support this query",
19761980
PI_ERROR_INVALID_ARG_VALUE);
19771981
return PI_ERROR_PLUGIN_SPECIFIC_ERROR;

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,9 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
788788
case PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT:
789789
InfoType = (ur_device_info_t)UR_EXT_DEVICE_INFO_MEM_CHANNEL_SUPPORT;
790790
break;
791+
case PI_DEVICE_INFO_IMAGE_SRGB:
792+
InfoType = (ur_device_info_t)UR_DEVICE_INFO_IMAGE_SRGB;
793+
break;
791794
default:
792795
return PI_ERROR_UNKNOWN;
793796
};

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ ur_result_t urDeviceGetInfo(
10151015
}
10161016
case UR_EXT_DEVICE_INFO_MEM_CHANNEL_SUPPORT:
10171017
return ReturnValue(pi_bool{false});
1018+
case UR_DEVICE_INFO_IMAGE_SRGB:
1019+
return ReturnValue(pi_bool{false});
10181020

10191021
// TODO: Implement.
10201022
default:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
3+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
4+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
5+
6+
#include <sycl/sycl.hpp>
7+
8+
int main() {
9+
sycl::queue q;
10+
// Ensure that plugins that don't implement the support can still handle the
11+
// aspect query.
12+
std::ignore = q.get_device().has(sycl::aspect::ext_oneapi_srgb);
13+
return 0;
14+
}

sycl/test-e2e/Basic/image/srgba-read.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
44

5-
// XFAIL: level_zero
6-
// UNSUPPORTED: cuda
7-
// UNSUPPORTED: hip
5+
// Only opencl plugin has implemented the supoort.
6+
// REQUIRES: opencl
87

98
#include <iostream>
109
#include <sycl/sycl.hpp>

0 commit comments

Comments
 (0)