[Mesa-dev] [PATCH 1/2] gallium: Add PIPE_CAP_HALFS

Jan Vesely jan.vesely at rutgers.edu
Mon Sep 4 14:35:55 UTC 2017


On Mon, 2017-09-04 at 15:56 +0200, Nicolai Hähnle wrote:
> On 02.09.2017 02:55, Jan Vesely wrote:
> > Denotes native half precision float operations capability
> > 
> > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> > ---
> > I can change the spelling to HALVES, but simplified english sounded more
> > appropriate.
> > 
> >   src/gallium/docs/source/screen.rst               | 1 +
> >   src/gallium/drivers/etnaviv/etnaviv_screen.c     | 1 +
> >   src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
> >   src/gallium/drivers/i915/i915_screen.c           | 1 +
> >   src/gallium/drivers/llvmpipe/lp_screen.c         | 1 +
> >   src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
> >   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           | 1 +
> >   src/gallium/drivers/r600/r600_pipe.c             | 1 +
> >   src/gallium/drivers/radeonsi/si_pipe.c           | 1 +
> >   src/gallium/drivers/softpipe/sp_screen.c         | 1 +
> >   src/gallium/drivers/svga/svga_screen.c           | 1 +
> >   src/gallium/drivers/swr/swr_screen.cpp           | 1 +
> >   src/gallium/drivers/vc4/vc4_screen.c             | 1 +
> >   src/gallium/drivers/virgl/virgl_screen.c         | 1 +
> >   src/gallium/include/pipe/p_defines.h             | 1 +
> >   17 files changed, 17 insertions(+)
> > 
> > diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> > index be14ddd0c0..e27a0e8325 100644
> > --- a/src/gallium/docs/source/screen.rst
> > +++ b/src/gallium/docs/source/screen.rst
> > @@ -370,6 +370,7 @@ The integer capabilities:
> >   * ``PIPE_CAP_TGSI_MUL_ZERO_WINS``: Whether TGSI shaders support the
> >     ``TGSI_PROPERTY_MUL_ZERO_WINS`` shader property.
> >   * ``PIPE_CAP_DOUBLES``: Whether double precision floating-point operations
> > +* ``PIPE_CAP_HALFS``: Whether half precision floating-point operations
> >     are supported.
> 
> This is awfully vague without more context. *How* are half-precision 
> floating-point operations supported?

I followed PIPE_CAP_DOUBLES here, so I think it's intentional. my
understanding is that it denotes that pipe driver wants to get FP16
operations in the IR.
Ideally it would mean that the target supports fp16 instructions, but
for example clang enables cl_khr_fp16 for all GCN hw even if 16 bit
types are only legal for VI+.

Jan

> 
> Cheers,
> Nicolai
> 
> 
> >   * ``PIPE_CAP_INT64``: Whether 64-bit integer operations are supported.
> >   * ``PIPE_CAP_INT64_DIVMOD``: Whether 64-bit integer division/modulo
> > diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> > index f400e423de..9b4ff5bbf9 100644
> > --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> > +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> > @@ -248,6 +248,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> >      case PIPE_CAP_TGSI_FS_FBFETCH:
> >      case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >      case PIPE_CAP_DOUBLES:
> > +   case PIPE_CAP_HALFS:
> >      case PIPE_CAP_INT64:
> >      case PIPE_CAP_INT64_DIVMOD:
> >      case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> > index b26f67e4e2..949c79cfa0 100644
> > --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> > +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> > @@ -309,6 +309,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> >   	case PIPE_CAP_TGSI_FS_FBFETCH:
> >   	case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >   	case PIPE_CAP_DOUBLES:
> > +	case PIPE_CAP_HALFS:
> >   	case PIPE_CAP_INT64:
> >   	case PIPE_CAP_INT64_DIVMOD:
> >   	case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> > index e700e294da..d4ca6d6dfc 100644
> > --- a/src/gallium/drivers/i915/i915_screen.c
> > +++ b/src/gallium/drivers/i915/i915_screen.c
> > @@ -300,6 +300,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
> >      case PIPE_CAP_TGSI_FS_FBFETCH:
> >      case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >      case PIPE_CAP_DOUBLES:
> > +   case PIPE_CAP_HALFS:
> >      case PIPE_CAP_INT64:
> >      case PIPE_CAP_INT64_DIVMOD:
> >      case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> > index 32a405088f..a3ba042733 100644
> > --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> > +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> > @@ -359,6 +359,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >      case PIPE_CAP_BINDLESS_TEXTURE:
> >      case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
> >      case PIPE_CAP_MEMOBJ:
> > +   case PIPE_CAP_HALFS:
> >         return 0;
> >      }
> >      /* should only get here on unhandled cases */
> > diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > index 72f886c911..084bc887ee 100644
> > --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > @@ -209,6 +209,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> >      case PIPE_CAP_TGSI_FS_FBFETCH:
> >      case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >      case PIPE_CAP_DOUBLES:
> > +   case PIPE_CAP_HALFS:
> >      case PIPE_CAP_INT64:
> >      case PIPE_CAP_INT64_DIVMOD:
> >      case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > index 0f25cd5fed..6b40515748 100644
> > --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > @@ -264,6 +264,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> >      case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
> >      case PIPE_CAP_TGSI_FS_FBFETCH:
> >      case PIPE_CAP_DOUBLES:
> > +   case PIPE_CAP_HALFS:
> >      case PIPE_CAP_INT64:
> >      case PIPE_CAP_INT64_DIVMOD:
> >      case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE:
> > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > index f64ac2625d..feb21e71f8 100644
> > --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > @@ -304,6 +304,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> >      case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
> >      case PIPE_CAP_QUERY_SO_OVERFLOW:
> >      case PIPE_CAP_MEMOBJ:
> > +   case PIPE_CAP_HALFS:
> >         return 0;
> >   
> >      case PIPE_CAP_VENDOR_ID:
> > diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> > index ff68ffd7bc..5f952ffa5d 100644
> > --- a/src/gallium/drivers/r300/r300_screen.c
> > +++ b/src/gallium/drivers/r300/r300_screen.c
> > @@ -231,6 +231,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> >           case PIPE_CAP_TGSI_FS_FBFETCH:
> >           case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >           case PIPE_CAP_DOUBLES:
> > +	case PIPE_CAP_HALFS:
> >           case PIPE_CAP_INT64:
> >           case PIPE_CAP_INT64_DIVMOD:
> >           case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> > index 023f1b4bd1..f3acc37296 100644
> > --- a/src/gallium/drivers/r600/r600_pipe.c
> > +++ b/src/gallium/drivers/r600/r600_pipe.c
> > @@ -388,6 +388,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> >   	case PIPE_CAP_NATIVE_FENCE_FD:
> >   	case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
> >   	case PIPE_CAP_TGSI_FS_FBFETCH:
> > +	case PIPE_CAP_HALFS:
> >   	case PIPE_CAP_INT64:
> >   	case PIPE_CAP_INT64_DIVMOD:
> >   	case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> > index 18d5806ac8..d8f7b3db59 100644
> > --- a/src/gallium/drivers/radeonsi/si_pipe.c
> > +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> > @@ -479,6 +479,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> >   	case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
> >   	case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
> >   	case PIPE_CAP_DOUBLES:
> > +	case PIPE_CAP_HALFS:
> >   	case PIPE_CAP_TGSI_TEX_TXF_LZ:
> >   	case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
> >   	case PIPE_CAP_BINDLESS_TEXTURE:
> > diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> > index 2988095eec..68bc43d8e2 100644
> > --- a/src/gallium/drivers/softpipe/sp_screen.c
> > +++ b/src/gallium/drivers/softpipe/sp_screen.c
> > @@ -310,6 +310,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >      case PIPE_CAP_BINDLESS_TEXTURE:
> >      case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
> >      case PIPE_CAP_MEMOBJ:
> > +   case PIPE_CAP_HALFS:
> >         return 0;
> >      case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
> >         return 4;
> > diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> > index ef3e07ea38..35ac530965 100644
> > --- a/src/gallium/drivers/svga/svga_screen.c
> > +++ b/src/gallium/drivers/svga/svga_screen.c
> > @@ -438,6 +438,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >      case PIPE_CAP_TGSI_FS_FBFETCH:
> >      case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >      case PIPE_CAP_DOUBLES:
> > +   case PIPE_CAP_HALFS:
> >      case PIPE_CAP_INT64:
> >      case PIPE_CAP_INT64_DIVMOD:
> >      case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> > index cc8d9955b8..ae13d37a27 100644
> > --- a/src/gallium/drivers/swr/swr_screen.cpp
> > +++ b/src/gallium/drivers/swr/swr_screen.cpp
> > @@ -342,6 +342,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >      case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
> >      case PIPE_CAP_QUERY_SO_OVERFLOW:
> >      case PIPE_CAP_MEMOBJ:
> > +   case PIPE_CAP_HALFS:
> >         return 0;
> >   
> >      case PIPE_CAP_VENDOR_ID:
> > diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> > index e206456f24..0d1b16669a 100644
> > --- a/src/gallium/drivers/vc4/vc4_screen.c
> > +++ b/src/gallium/drivers/vc4/vc4_screen.c
> > @@ -250,6 +250,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> >           case PIPE_CAP_TGSI_FS_FBFETCH:
> >           case PIPE_CAP_TGSI_MUL_ZERO_WINS:
> >           case PIPE_CAP_DOUBLES:
> > +	case PIPE_CAP_HALFS:
> >           case PIPE_CAP_INT64:
> >           case PIPE_CAP_INT64_DIVMOD:
> >           case PIPE_CAP_TGSI_TEX_TXF_LZ:
> > diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> > index 68d74adadd..7ab7c3b09d 100644
> > --- a/src/gallium/drivers/virgl/virgl_screen.c
> > +++ b/src/gallium/drivers/virgl/virgl_screen.c
> > @@ -260,6 +260,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >      case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
> >      case PIPE_CAP_TGSI_BALLOT:
> >      case PIPE_CAP_DOUBLES:
> > +   case PIPE_CAP_HALFS:
> >      case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
> >      case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
> >      case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
> > diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> > index da7d5da734..2699b066fe 100644
> > --- a/src/gallium/include/pipe/p_defines.h
> > +++ b/src/gallium/include/pipe/p_defines.h
> > @@ -760,6 +760,7 @@ enum pipe_cap
> >      PIPE_CAP_TGSI_FS_FBFETCH,
> >      PIPE_CAP_TGSI_MUL_ZERO_WINS,
> >      PIPE_CAP_DOUBLES,
> > +   PIPE_CAP_HALFS,
> >      PIPE_CAP_INT64,
> >      PIPE_CAP_INT64_DIVMOD,
> >      PIPE_CAP_TGSI_TEX_TXF_LZ,
> > 
> 
> 

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170904/b7b8bf4f/attachment-0001.sig>


More information about the mesa-dev mailing list