[Mesa-dev] [PATCH 6/6] radv: partially enable VK_KHR_shader_float16_int8

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Apr 1 16:03:54 UTC 2019


hmm, okay, r-b then.

On Mon, Apr 1, 2019 at 5:24 PM Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
>
> On 4/1/19 5:22 PM, Bas Nieuwenhuizen wrote:
> > On Mon, Apr 1, 2019 at 4:15 PM Samuel Pitoiset
> > <samuel.pitoiset at gmail.com> wrote:
> >> Only 8-bit integers for now, float16 requires a bit more work.
> >>
> >> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> >> ---
> >>   src/amd/vulkan/radv_device.c      | 8 ++++++++
> >>   src/amd/vulkan/radv_extensions.py | 1 +
> >>   src/amd/vulkan/radv_shader.c      | 1 +
> >>   3 files changed, 10 insertions(+)
> >>
> >> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> >> index d26557fd449..ffec7cfdb19 100644
> >> --- a/src/amd/vulkan/radv_device.c
> >> +++ b/src/amd/vulkan/radv_device.c
> >> @@ -902,6 +902,14 @@ void radv_GetPhysicalDeviceFeatures2(
> >>                          features->storagePushConstant8 = enabled;
> >>                          break;
> >>                  }
> >> +               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR: {
> >> +                       VkPhysicalDeviceFloat16Int8FeaturesKHR *features =
> >> +                               (VkPhysicalDeviceFloat16Int8FeaturesKHR*)ext;
> >> +                       bool enabled = pdevice->rad_info.chip_class >= VI;
> >> +                       features->shaderFloat16 = VK_FALSE;
> >> +                       features->shaderInt8 = enabled;
> >> +                       break;
> >> +               }
> >>                  default:
> >>                          break;
> >>                  }
> >> diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
> >> index 79562ff6e97..4b118b4ba82 100644
> >> --- a/src/amd/vulkan/radv_extensions.py
> >> +++ b/src/amd/vulkan/radv_extensions.py
> >> @@ -82,6 +82,7 @@ EXTENSIONS = [
> >>       Extension('VK_KHR_relaxed_block_layout',              1, True),
> >>       Extension('VK_KHR_sampler_mirror_clamp_to_edge',      1, True),
> >>       Extension('VK_KHR_shader_draw_parameters',            1, True),
> >> +    Extension('VK_KHR_shader_float16_int8',               1, 'device->rad_info.chip_class >= VI'),
> > Why only VI+? float16 I understand, but int8 should be universal, no?
>
> Because it's untested, and also because I plan to enable 16bit integer
> for SI/CIK at the same time.
>
> >
> >>       Extension('VK_KHR_storage_buffer_storage_class',      1, True),
> >>       Extension('VK_KHR_surface',                          25, 'RADV_HAS_SURFACE'),
> >>       Extension('VK_KHR_surface_protected_capabilities',    1, 'RADV_HAS_SURFACE'),
> >> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> >> index f905dfd9e5b..d3d073d1db8 100644
> >> --- a/src/amd/vulkan/radv_shader.c
> >> +++ b/src/amd/vulkan/radv_shader.c
> >> @@ -251,6 +251,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
> >>                                  .trinary_minmax = true,
> >>                                  .variable_pointers = true,
> >>                                  .storage_8bit = true,
> >> +                               .int8 = true,
> >>                          },
> >>                          .ubo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT, 2),
> >>                          .ssbo_ptr_type = glsl_vector_type(GLSL_TYPE_UINT, 2),
> >> --
> >> 2.21.0
> >>
> >> _______________________________________________
> >> mesa-dev mailing list
> >> mesa-dev at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list