[Mesa-dev] [PATCH 2/5] r600: remove custom and incomplete OpenCL code paths

Jan Vesely jan.vesely at rutgers.edu
Fri May 26 17:03:10 UTC 2017


On Fri, 2017-05-26 at 11:53 -0500, Aaron Watry wrote:
> On Fri, May 26, 2017 at 10:56 AM, Marek Olšák <maraeo at gmail.com> wrote:
> 
> > I think this will break r600 clover support. I don't know if anybody uses
> > it.
> > 
> 
> I just rebuild my desktop a month ago with a new Ryzen setup, which means
> that my BARTS is actually in my old machine now.  WIth the open-source
> release of the OpenCL CTS last week, I had actually been hoping to make
> some progress on r600g/radeonsi clover/libclc in the near future. It'd be a
> shame to remove that support from r600g right now.  Note that I haven't
> tested this patch yet, so I can't say whether this has broken anything at
> this point in time.

+1 for keeping r600g opencl. I still plan to work on this as $DAYJOB(or
rather $DAYSCHOOL) permits. There's a lot more work on LLVM side, so
mesa probably won't see much activity (the big parts are: private
buffers for register spilling, rat space reservation for atomics, and
images)

Jan

PS: the up to date status of piglit on Turks is here:
http://paul.rutgers.edu/~jv356/piglit/radeon-latest-5/problems.html
PS2: thanks vedran for the CC

> 
> --Aaron
> 
> 
> > 
> > Marek
> > 
> > On Fri, May 26, 2017 at 5:32 PM, Emil Velikov <emil.l.velikov at gmail.com>
> > wrote:
> > 
> > > From: Emil Velikov <emil.velikov at collabora.com>
> > > 
> > > The code hasn't bee en touched in a very long time, and was never
> > > completed.
> > > 
> > > It is conditionally built only when OpenCL is selected at built time,
> > > and pulls the libamd_common static library, which in itself depends on
> > > amdgpu.
> > > 
> > > With later commit(s) we'll address the amdgpu dependency, but for now
> > > drop this partial code. If anyone is interested in reviving and beating
> > > it into shape they are welcome to git revert.
> > > 
> > > Cc: Nicolai Hähnle <nicolai.haehnle at amd.com>
> > > Cc: Marek Olšák <marek.olsak at amd.com>
> > > Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> > > ---
> > >  src/gallium/drivers/r600/Makefile.am               |  5 --
> > >  src/gallium/drivers/r600/evergreen_compute.c       | 90
> > > ----------------------
> > >  .../drivers/r600/evergreen_compute_internal.h      |  7 --
> > >  src/gallium/drivers/radeon/r600_pipe_common.h      |  2 -
> > >  4 files changed, 104 deletions(-)
> > > 
> > > diff --git a/src/gallium/drivers/r600/Makefile.am
> > > b/src/gallium/drivers/r600/Makefile.am
> > > index 21762d838d0..127e7424b74 100644
> > > --- a/src/gallium/drivers/r600/Makefile.am
> > > +++ b/src/gallium/drivers/r600/Makefile.am
> > > @@ -25,11 +25,6 @@ AM_CFLAGS += \
> > > 
> > >  endif
> > > 
> > > -if HAVE_GALLIUM_COMPUTE
> > > -AM_CFLAGS += \
> > > -       -DHAVE_OPENCL
> > > -endif
> > > -
> > >  EXTRA_DIST = \
> > >         sb/notes.markdown \
> > >         sb/sb_bc_fmt_def.inc
> > > diff --git a/src/gallium/drivers/r600/evergreen_compute.c
> > > b/src/gallium/drivers/r600/evergreen_compute.c
> > > index 37ef1058d3f..45df11296c6 100644
> > > --- a/src/gallium/drivers/r600/evergreen_compute.c
> > > +++ b/src/gallium/drivers/r600/evergreen_compute.c
> > > @@ -26,7 +26,6 @@
> > > 
> > >  #include <stdio.h>
> > >  #include <errno.h>
> > > -#include "ac_binary.h"
> > >  #include "pipe/p_defines.h"
> > >  #include "pipe/p_state.h"
> > >  #include "pipe/p_context.h"
> > > @@ -172,65 +171,6 @@ static void evergreen_cs_set_constant_buffer(struct
> > > r600_context *rctx,
> > >         rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_COMPUTE,
> > > cb_index, &cb);
> > >  }
> > > 
> > > -/* We need to define these R600 registers here, because we can't include
> > > - * evergreend.h and r600d.h.
> > > - */
> > > -#define R_028868_SQ_PGM_RESOURCES_VS                 0x028868
> > > -#define R_028850_SQ_PGM_RESOURCES_PS                 0x028850
> > > -
> > > -#ifdef HAVE_OPENCL
> > > -
> > > -static void r600_shader_binary_read_config(const struct
> > > ac_shader_binary *binary,
> > > -                                          struct r600_bytecode *bc,
> > > -                                          uint64_t symbol_offset,
> > > -                                          boolean *use_kill)
> > > -{
> > > -       unsigned i;
> > > -       const unsigned char *config =
> > > -               ac_shader_binary_config_start(binary, symbol_offset);
> > > -
> > > -       for (i = 0; i < binary->config_size_per_symbol; i+= 8) {
> > > -               unsigned reg =
> > > -                       util_le32_to_cpu(*(uint32_t*)(config + i));
> > > -               unsigned value =
> > > -                       util_le32_to_cpu(*(uint32_t*)(config + i + 4));
> > > -               switch (reg) {
> > > -               /* R600 / R700 */
> > > -               case R_028850_SQ_PGM_RESOURCES_PS:
> > > -               case R_028868_SQ_PGM_RESOURCES_VS:
> > > -               /* Evergreen / Northern Islands */
> > > -               case R_028844_SQ_PGM_RESOURCES_PS:
> > > -               case R_028860_SQ_PGM_RESOURCES_VS:
> > > -               case R_0288D4_SQ_PGM_RESOURCES_LS:
> > > -                       bc->ngpr = MAX2(bc->ngpr,
> > > G_028844_NUM_GPRS(value));
> > > -                       bc->nstack = MAX2(bc->nstack,
> > > G_028844_STACK_SIZE(value));
> > > -                       break;
> > > -               case R_02880C_DB_SHADER_CONTROL:
> > > -                       *use_kill = G_02880C_KILL_ENABLE(value);
> > > -                       break;
> > > -               case R_0288E8_SQ_LDS_ALLOC:
> > > -                       bc->nlds_dw = value;
> > > -                       break;
> > > -               }
> > > -       }
> > > -}
> > > -
> > > -static unsigned r600_create_shader(struct r600_bytecode *bc,
> > > -                                  const struct ac_shader_binary *binary,
> > > -                                  boolean *use_kill)
> > > -
> > > -{
> > > -       assert(binary->code_size % 4 == 0);
> > > -       bc->bytecode = CALLOC(1, binary->code_size);
> > > -       memcpy(bc->bytecode, binary->code, binary->code_size);
> > > -       bc->ndw = binary->code_size / 4;
> > > -
> > > -       r600_shader_binary_read_config(binary, bc, 0, use_kill);
> > > -       return 0;
> > > -}
> > > -
> > > -#endif
> > > -
> > >  static void r600_destroy_shader(struct r600_bytecode *bc)
> > >  {
> > >         FREE(bc->bytecode);
> > > @@ -241,27 +181,6 @@ static void *evergreen_create_compute_state(struct
> > > pipe_context *ctx,
> > >  {
> > >         struct r600_context *rctx = (struct r600_context *)ctx;
> > >         struct r600_pipe_compute *shader = CALLOC_STRUCT(r600_pipe_comput
> > > e);
> > > -#ifdef HAVE_OPENCL
> > > -       const struct pipe_llvm_program_header *header;
> > > -       const char *code;
> > > -       void *p;
> > > -       boolean use_kill;
> > > -
> > > -       COMPUTE_DBG(rctx->screen, "*** evergreen_create_compute_state
> > > \n");
> > > -       header = cso->prog;
> > > -       code = cso->prog + sizeof(struct pipe_llvm_program_header);
> > > -       radeon_shader_binary_init(&shader->binary);
> > > -       ac_elf_read(code, header->num_bytes, &shader->binary);
> > > -       r600_create_shader(&shader->bc, &shader->binary, &use_kill);
> > > -
> > > -       /* Upload code + ROdata */
> > > -       shader->code_bo = r600_compute_buffer_alloc_vram(rctx->screen,
> > > -                                                       shader->bc.ndw *
> > > 4);
> > > -       p = r600_buffer_map_sync_with_rings(&rctx->b, shader->code_bo,
> > > PIPE_TRANSFER_WRITE);
> > > -       //TODO: use util_memcpy_cpu_to_le32 ?
> > > -       memcpy(p, shader->bc.bytecode, shader->bc.ndw * 4);
> > > -       rctx->b.ws->buffer_unmap(shader->code_bo->buf);
> > > -#endif
> > > 
> > >         shader->ctx = rctx;
> > >         shader->local_size = cso->req_local_mem;
> > > @@ -589,15 +508,6 @@ static void evergreen_launch_grid(struct
> > > pipe_context *ctx,
> > >                                   const struct pipe_grid_info *info)
> > >  {
> > >         struct r600_context *rctx = (struct r600_context *)ctx;
> > > -#ifdef HAVE_OPENCL
> > > -       struct r600_pipe_compute *shader = rctx->cs_shader_state.shader;
> > > -       boolean use_kill;
> > > -
> > > -       rctx->cs_shader_state.pc = info->pc;
> > > -       /* Get the config information for this kernel. */
> > > -       r600_shader_binary_read_config(&shader->binary, &shader->bc,
> > > -                                  info->pc, &use_kill);
> > > -#endif
> > > 
> > >         COMPUTE_DBG(rctx->screen, "*** evergreen_launch_grid: pc = %u\n",
> > > info->pc);
> > > 
> > > diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.h
> > > b/src/gallium/drivers/r600/evergreen_compute_internal.h
> > > index 6f4be3ea57f..4c1bed909ec 100644
> > > --- a/src/gallium/drivers/r600/evergreen_compute_internal.h
> > > +++ b/src/gallium/drivers/r600/evergreen_compute_internal.h
> > > @@ -26,9 +26,6 @@
> > >  #define EVERGREEN_COMPUTE_INTERNAL_H
> > > 
> > >  #include "r600_asm.h"
> > > -#ifdef HAVE_OPENCL
> > > -#include <llvm-c/Core.h>
> > > -#endif
> > > 
> > >  struct r600_pipe_compute {
> > >         struct r600_context *ctx;
> > > @@ -41,10 +38,6 @@ struct r600_pipe_compute {
> > >         unsigned private_size;
> > >         unsigned input_size;
> > >         struct r600_resource *kernel_param;
> > > -
> > > -#ifdef HAVE_OPENCL
> > > -       LLVMContextRef llvm_ctx;
> > > -#endif
> > >  };
> > > 
> > >  struct r600_resource* r600_compute_buffer_alloc_vram(struct r600_screen
> > > *screen, unsigned size);
> > > diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h
> > > b/src/gallium/drivers/radeon/r600_pipe_common.h
> > > index b17b690faba..1fbd79d23b4 100644
> > > --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> > > +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> > > @@ -34,8 +34,6 @@
> > > 
> > >  #include <stdio.h>
> > > 
> > > -#include "amd/common/ac_binary.h"
> > > -
> > >  #include "radeon/radeon_winsys.h"
> > > 
> > >  #include "util/disk_cache.h"
> > > --
> > > 2.12.2
> > > 
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > > 
> > 
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > 
> > 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170526/b18dc513/attachment.sig>


More information about the mesa-dev mailing list