|
14 | 14 | #include "event.hpp"
|
15 | 15 | #include "logger/ur_logger.hpp"
|
16 | 16 |
|
| 17 | +#include <hip/hip_runtime.h> |
17 | 18 | #include <sstream>
|
18 | 19 |
|
19 | 20 | int getAttribute(ur_device_handle_t Device, hipDeviceAttribute_t Attribute) {
|
@@ -785,6 +786,145 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
|
785 | 786 | return ReturnValue(int32_t{1});
|
786 | 787 | }
|
787 | 788 |
|
| 789 | + case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: { |
| 790 | + // On HIP bindless images are implemented but support is device-dependent. |
| 791 | + return ReturnValue( |
| 792 | + static_cast<ur_bool_t>(hDevice->supportsHardwareImages())); |
| 793 | + } |
| 794 | + case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: { |
| 795 | + // On HIP bindless images can be backed by shared (managed) USM. |
| 796 | + return ReturnValue( |
| 797 | + static_cast<ur_bool_t>(hDevice->supportsHardwareImages())); |
| 798 | + } |
| 799 | + case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { |
| 800 | + // On HIP 1D bindless image USM is supported, but sampling is not. |
| 801 | + // More specifically, image creation from with sampler using linear |
| 802 | + // filtering is unstable and somtimes passes while other times returns |
| 803 | + // unsupported error code. |
| 804 | + return ReturnValue( |
| 805 | + static_cast<ur_bool_t>(hDevice->supportsHardwareImages())); |
| 806 | + } |
| 807 | + case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: { |
| 808 | + // On HIP 2D bindless image USM is supported, but sampling is not. |
| 809 | + // More specifically, image creation from with sampler using linear |
| 810 | + // filtering is unstable and somtimes passes while other times returns |
| 811 | + // unsupported error code. |
| 812 | + return ReturnValue( |
| 813 | + static_cast<ur_bool_t>(hDevice->supportsHardwareImages())); |
| 814 | + } |
| 815 | + case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: { |
| 816 | + int32_t tex_pitch_align{0}; |
| 817 | + UR_CHECK_ERROR(hipDeviceGetAttribute( |
| 818 | + &tex_pitch_align, hipDeviceAttributeTexturePitchAlignment, |
| 819 | + hDevice->get())); |
| 820 | + detail::ur::assertion(tex_pitch_align >= 0); |
| 821 | + return ReturnValue(static_cast<uint32_t>(tex_pitch_align)); |
| 822 | + } |
| 823 | + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: { |
| 824 | + // Default values due to non-existent hipamd queries for linear sizes. |
| 825 | + constexpr uint32_t MaxLinearWidth{1}; |
| 826 | + return ReturnValue(MaxLinearWidth); |
| 827 | + } |
| 828 | + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: { |
| 829 | + // Default values due to non-existent hipamd queries for linear sizes. |
| 830 | + constexpr uint32_t MaxLinearHeight{1}; |
| 831 | + return ReturnValue(MaxLinearHeight); |
| 832 | + } |
| 833 | + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: { |
| 834 | + // Default values due to non-existent hipamd queries for linear sizes. |
| 835 | + constexpr uint32_t MaxLinearPitch{1}; |
| 836 | + return ReturnValue(MaxLinearPitch); |
| 837 | + } |
| 838 | + case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: { |
| 839 | + // HIP supports mipmaps. |
| 840 | + // TODO: DPC++ doesn't implement the required mipmap builtins for SYCL. |
| 841 | + return ReturnValue(ur_bool_t{false}); |
| 842 | + } |
| 843 | + case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: { |
| 844 | + // HIP supports anisotropic filtering. |
| 845 | + // TODO: DPC++ doesn't implement the required mipmap builtins for SYCL. |
| 846 | + return ReturnValue(ur_bool_t{false}); |
| 847 | + } |
| 848 | + case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: { |
| 849 | + // HIP has no query for this, but documentation states max value is 16. |
| 850 | + constexpr float MaxAnisotropy{16.f}; |
| 851 | + return ReturnValue(MaxAnisotropy); |
| 852 | + } |
| 853 | + case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: { |
| 854 | + // HIP supports creation of images from individual mipmap levels. |
| 855 | + // TODO: DPC++ doesn't implement the required mipmap builtins for SYCL. |
| 856 | + return ReturnValue(ur_bool_t{false}); |
| 857 | + } |
| 858 | + |
| 859 | + case UR_DEVICE_INFO_EXTERNAL_MEMORY_IMPORT_SUPPORT_EXP: { |
| 860 | + // Importing external memory is supported, but there are current |
| 861 | + // issues in the HIP runtime due to which mapping the external array memory |
| 862 | + // does not work at the moment. Linear/buffer memory mapping is supported. |
| 863 | + return ReturnValue(ur_bool_t{false}); |
| 864 | + } |
| 865 | + case UR_DEVICE_INFO_EXTERNAL_SEMAPHORE_IMPORT_SUPPORT_EXP: { |
| 866 | + // HIP supports importing external semaphores. |
| 867 | + // TODO: Importing external semaphores should be supported in the adapter, |
| 868 | + // but there are still current issues as not all related tests are passing. |
| 869 | + return ReturnValue(ur_bool_t{false}); |
| 870 | + } |
| 871 | + case UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP: { |
| 872 | + // HIP supports cubemaps. |
| 873 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 874 | + return ReturnValue(ur_bool_t{false}); |
| 875 | + } |
| 876 | + case UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP: { |
| 877 | + // HIP supports cubemap seamless filtering. |
| 878 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 879 | + return ReturnValue(ur_bool_t{false}); |
| 880 | + } |
| 881 | + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP: { |
| 882 | + // HIP does support fetching 1D USM sampled image data. |
| 883 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 884 | + return ReturnValue(ur_bool_t{false}); |
| 885 | + } |
| 886 | + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP: { |
| 887 | + // HIP does not support fetching 1D non-USM sampled image data. |
| 888 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 889 | + return ReturnValue(ur_bool_t{false}); |
| 890 | + } |
| 891 | + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP: { |
| 892 | + // HIP does support fetching 2D USM sampled image data. |
| 893 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 894 | + return ReturnValue(ur_bool_t{false}); |
| 895 | + } |
| 896 | + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP: { |
| 897 | + // HIP does support fetching 2D non-USM sampled image data. |
| 898 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 899 | + return ReturnValue(ur_bool_t{false}); |
| 900 | + } |
| 901 | + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP: { |
| 902 | + // HIP does support fetching 3D non-USM sampled image data. |
| 903 | + // TODO: DPC++ doesn't implement the required builtins for SYCL. |
| 904 | + return ReturnValue(ur_bool_t{false}); |
| 905 | + } |
| 906 | + case UR_DEVICE_INFO_IMAGE_ARRAY_SUPPORT_EXP: { |
| 907 | + // TODO: Our HIP adapter implements image arrays but DPC++ end-to-end |
| 908 | + // testing currently fails due to various runtime errors that could be |
| 909 | + // arch-specific driver support, as well missing builtins. Hence, this |
| 910 | + // feature is marked unsupported until those issues are resolved. |
| 911 | + return ReturnValue(ur_bool_t{false}); |
| 912 | + } |
| 913 | + case UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP: { |
| 914 | + // HIP does not support unique addressing per dimension |
| 915 | + return ReturnValue(ur_bool_t{false}); |
| 916 | + } |
| 917 | + case UR_DEVICE_INFO_BINDLESS_SAMPLE_1D_USM_EXP: { |
| 918 | + // HIP does support sampling 1D USM sampled image data. |
| 919 | + return ReturnValue( |
| 920 | + static_cast<ur_bool_t>(hDevice->supportsHardwareImages())); |
| 921 | + } |
| 922 | + case UR_DEVICE_INFO_BINDLESS_SAMPLE_2D_USM_EXP: { |
| 923 | + // HIP does support sampling 2D USM sampled image data. |
| 924 | + return ReturnValue( |
| 925 | + static_cast<ur_bool_t>(hDevice->supportsHardwareImages())); |
| 926 | + } |
| 927 | + |
788 | 928 | case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS: {
|
789 | 929 | return ReturnValue(ur_bool_t{false});
|
790 | 930 | }
|
|
0 commit comments