[Mesa-dev] [PATCH v2 1/2] gallium: Add PIPE_SHADER_CAP_FP16
Nicolai Hähnle
nhaehnle at gmail.com
Wed Sep 13 15:07:37 UTC 2017
On 08.09.2017 00:03, Jan Vesely wrote:
> Denotes native half precision float operations capability
> v2: PIPE_CAP_HALFS -> PIPE_SHADER_CAP_FP16
> fix indentation
>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> ---
> I modeled this after PIPE_SHARED_CAP_INTEGERS, but I might have missed
> a spot.
>
> src/gallium/auxiliary/gallivm/lp_bld_limits.h | 2 ++
> src/gallium/auxiliary/tgsi/tgsi_exec.h | 2 ++
> src/gallium/docs/source/screen.rst | 2 ++
> src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 +
> src/gallium/drivers/freedreno/freedreno_screen.c | 2 ++
> src/gallium/drivers/i915/i915_screen.c | 1 +
> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 2 ++
> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +
> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 +
> src/gallium/drivers/r300/r300_screen.c | 2 ++
> src/gallium/drivers/r600/r600_pipe.c | 1 +
> src/gallium/drivers/radeonsi/si_pipe.c | 1 +
> src/gallium/drivers/svga/svga_screen.c | 6 ++++++
> src/gallium/drivers/vc4/vc4_screen.c | 1 +
> src/gallium/drivers/virgl/virgl_screen.c | 1 +
> src/gallium/include/pipe/p_defines.h | 1 +
> 16 files changed, 27 insertions(+)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_limits.h b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
> index 354e2a46b1..e8cc04a2f9 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_limits.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
> @@ -118,6 +118,8 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
> return 1;
> case PIPE_SHADER_CAP_INTEGERS:
> return 1;
> + case PIPE_SHADER_CAP_FP16:
> + return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> return PIPE_MAX_SAMPLERS;
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
> index 9d7e65f2c5..346848cddf 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
> @@ -511,6 +511,8 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
> return 1;
> case PIPE_SHADER_CAP_INTEGERS:
> return 1;
> + case PIPE_SHADER_CAP_FP16:
> + return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> return PIPE_MAX_SAMPLERS;
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 93d94a48e6..80e63ce14b 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -470,6 +470,8 @@ MOV OUT[0], CONST[0][3] # copy vector 3 of constbuf 0
> BGNSUB, ENDSUB, CAL, and RET, including RET in the main block.
> * ``PIPE_SHADER_CAP_INTEGERS``: Whether integer opcodes are supported.
> If unsupported, only float opcodes are supported.
> +* ``PIPE_SHADER_CAP_FP16``: Whether half precision floating-point opcodes are supported.
> + If unsupported, half precision ops need to be lowered to full precision.
> * ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: The maximum number of texture
> samplers.
> * ``PIPE_SHADER_CAP_PREFERRED_IR``: Preferred representation of the
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index f400e423de..1e49f60701 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -427,6 +427,7 @@ etna_screen_get_shader_param(struct pipe_screen *pscreen,
> case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
> return VIV_FEATURE(screen, chipMinorFeatures0, HAS_SQRT_TRIG);
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index b26f67e4e2..46ad5ec9d2 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -526,6 +526,8 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen,
> if (glsl120)
> return 0;
> return is_ir3(screen) ? 1 : 0;
> + case PIPE_SHADER_CAP_FP16:
> + return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> return 16;
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index e700e294da..f3427f794d 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -157,6 +157,7 @@ i915_get_shader_param(struct pipe_screen *screen,
> case PIPE_SHADER_CAP_SUBROUTINES:
> return 0;
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 72f886c911..1ea33edc41 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -313,6 +313,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen,
> case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
> case PIPE_SHADER_CAP_SUBROUTINES:
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> @@ -361,6 +362,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen,
> case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
> case PIPE_SHADER_CAP_SUBROUTINES:
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 0f25cd5fed..efbe4c8df8 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -344,6 +344,7 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen,
> return 1;
> case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
> return 1;
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_SUBROUTINES:
> return 0; /* please inline, or provide function declarations */
> case PIPE_SHADER_CAP_INTEGERS:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index f64ac2625d..da43cac6d3 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -404,6 +404,7 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen,
> case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD:
> + case PIPE_SHADER_CAP_FP16:
> return 0;
> case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS:
> return NVC0_MAX_BUFFERS;
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index ff68ffd7bc..617ec0195a 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -353,6 +353,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen,
> case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
> case PIPE_SHADER_CAP_SUBROUTINES:
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> @@ -412,6 +413,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen,
> case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
> case PIPE_SHADER_CAP_SUBROUTINES:
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 9844add605..162a9f2545 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -569,6 +569,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen,
> case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
> return 1;
> case PIPE_SHADER_CAP_SUBROUTINES:
> + case PIPE_SHADER_CAP_FP16:
> return 0;
> case PIPE_SHADER_CAP_INTEGERS:
> case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index ca2e055a90..3799b21810 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -741,6 +741,7 @@ static int si_get_shader_param(struct pipe_screen* pscreen,
> case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
> case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
> case PIPE_SHADER_CAP_INTEGERS:
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> case PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS:
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index ef3e07ea38..58289e114d 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -518,6 +518,8 @@ vgpu9_get_shader_param(struct pipe_screen *screen,
> return 0;
> case PIPE_SHADER_CAP_INTEGERS:
> return 0;
> + case PIPE_SHADER_CAP_FP16:
> + return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> return 16;
> @@ -579,6 +581,8 @@ vgpu9_get_shader_param(struct pipe_screen *screen,
> return 0;
> case PIPE_SHADER_CAP_INTEGERS:
> return 0;
> + case PIPE_SHADER_CAP_FP16:
> + return 0;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> return 0;
> @@ -674,6 +678,8 @@ vgpu10_get_shader_param(struct pipe_screen *screen,
> case PIPE_SHADER_CAP_SUBROUTINES:
> case PIPE_SHADER_CAP_INTEGERS:
> return TRUE;
> + case PIPE_SHADER_CAP_FP16:
> + return FALSE;
> case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
> return SVGA3D_DX_MAX_SAMPLERS;
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index e206456f24..dab902520b 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -406,6 +406,7 @@ vc4_screen_get_shader_param(struct pipe_screen *pscreen,
> return 0;
> case PIPE_SHADER_CAP_INTEGERS:
> return 1;
> + case PIPE_SHADER_CAP_FP16:
> case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
> case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index 68d74adadd..e61a7098aa 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -334,6 +334,7 @@ virgl_get_shader_param(struct pipe_screen *screen,
> return 4096 * sizeof(float[4]);
> case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD:
> case PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS:
> + case PIPE_SHADER_CAP_FP16:
> default:
> return 0;
> }
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index da7d5da734..6811aaefc9 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -830,6 +830,7 @@ enum pipe_shader_cap
> PIPE_SHADER_CAP_INDIRECT_CONST_ADDR,
> PIPE_SHADER_CAP_SUBROUTINES, /* BGNSUB, ENDSUB, CAL, RET */
> PIPE_SHADER_CAP_INTEGERS,
> + PIPE_SHADER_CAP_FP16,
> PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS,
> PIPE_SHADER_CAP_PREFERRED_IR,
> PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED,
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list