Skip to content

Commit

Permalink
[Bindless][Exp] Add device queries for sampled image fetch
Browse files Browse the repository at this point in the history
Added the following queries for device capabilities of fetching sampled
images:

- DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP
- DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP
- DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP
- DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP
- DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP
- DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP
  • Loading branch information
przemektmalon committed Apr 4, 2024
1 parent 3609afc commit a3be144
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 195 deletions.
396 changes: 204 additions & 192 deletions include/ur_api.h

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2546,6 +2546,24 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) {
case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP:
os << "UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP";
break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP:
os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP";
break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP:
os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP";
break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP:
os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP";
break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP:
os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP";
break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP:
os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP";
break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP:
os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -4150,6 +4168,78 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP: {
const ur_bool_t *tptr = (const ur_bool_t *)ptr;
if (sizeof(ur_bool_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
os << (const void *)(tptr) << " (";

os << *tptr;

os << ")";
} break;
default:
os << "unknown enumerator";
return UR_RESULT_ERROR_INVALID_ENUMERATION;
Expand Down
8 changes: 8 additions & 0 deletions scripts/core/EXP-BINDLESS-IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ Enums
* ${X}_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP
* ${X}_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP
* ${X}_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP
* ${X}_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP
* ${X}_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP
* ${X}_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP
* ${X}_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP
* ${X}_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP
* ${X}_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP

* ${x}_command_t
* ${X}_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP
Expand Down Expand Up @@ -184,6 +190,8 @@ Changelog
+------------------------------------------------------------------------+
| 9.0 | Remove layered image properties struct. |
+------------------------------------------------------------------------+
| 10.0 | Added device queries for sampled image fetch capabilities. |
+----------+-------------------------------------------------------------+

Contributors
--------------------------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ etors:
- name: INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP
value: "0x200F"
desc: "[$x_bool_t] returns true if the device supports exporting internal event resources"
- name: BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP
value: "0x2010"
desc: "[$x_bool_t] returns true if the device is capable of fetching USM backed 1D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP
value: "0x2011"
desc: "[$x_bool_t] returns true if the device is capable of fetching non-USM backed 1D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP
value: "0x2012"
desc: "[$x_bool_t] returns true if the device is capable of fetching USM backed 2D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP
value: "0x2013"
desc: "[$x_bool_t] returns true if the device is capable of fetching non-USM backed 2D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP
value: "0x2014"
desc: "[$x_bool_t] returns true if the device is capable of fetching USM backed 3D sampled image data."
- name: BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP
value: "0x2015"
desc: "[$x_bool_t] returns true if the device is capable of fetching non-USM backed 3D sampled image data."
--- #--------------------------------------------------------------------------
type: enum
extend: true
Expand Down
24 changes: 24 additions & 0 deletions source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,30 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
// CUDA does not support exporting semaphores or events.
return ReturnValue(false);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP: {
// CUDA does support fetching 1D USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP: {
// CUDA does not support fetching 1D non-USM sampled image data.
return ReturnValue(false);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP: {
// CUDA does support fetching 2D USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP: {
// CUDA does support fetching 2D non-USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP: {
// CUDA does not support 3D USM sampled textures
return ReturnValue(false);
}
case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP: {
// CUDA does support fetching 3D non-USM sampled image data.
return ReturnValue(true);
}
case UR_DEVICE_INFO_DEVICE_ID: {
int Value = 0;
UR_CHECK_ERROR(cuDeviceGetAttribute(
Expand Down
2 changes: 1 addition & 1 deletion source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGetInfo(
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}

if (UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName) {
if (UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP < propName) {
return UR_RESULT_ERROR_INVALID_ENUMERATION;
}

Expand Down
2 changes: 1 addition & 1 deletion source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ ur_result_t UR_APICALL urDeviceGetSelected(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName`
/// + `::UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
2 changes: 1 addition & 1 deletion source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ ur_result_t UR_APICALL urDeviceGetSelected(
/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE
/// + `NULL == hDevice`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP < propName`
/// + `::UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP < propName`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
Expand Down
18 changes: 18 additions & 0 deletions tools/urinfo/urinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,5 +378,23 @@ inline void printDeviceInfos(ur_device_handle_t hDevice,
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_USM_EXP);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(
hDevice, UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP);
}
} // namespace urinfo

0 comments on commit a3be144

Please sign in to comment.