[Mesa-dev] [PATCH 2/3] radeon/compute: Implement PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS
Tom Stellard
tom at stellard.net
Tue Jun 10 12:23:50 PDT 2014
On Tue, Jun 10, 2014 at 08:36:05PM +0200, Bruno Jimenez wrote:
> On Tue, 2014-06-10 at 14:10 -0400, Tom Stellard wrote:
> > On Thu, Jun 05, 2014 at 08:39:29PM +0200, Bruno Jimenez wrote:
> > >
> > > With a couple of changes, it applied cleanly to 3.14.5 (Arch's stable).
> > > And with the attached patch as #2 for my series I can get the correct
> > > number of compute units for my CEDAR.
> > >
> > > But I don't know how or where I should add this new query param, given
> > > that it hasn't been added to the kernel yet. For now I have hardcoded
> > > the '0x20'.
> > >
> > > Thanks for all Alex!
> > > Bruno
> > >
> > >
> >
> > > From d2f37842171fdaff2a31d756c15479fc56646153 Mon Sep 17 00:00:00 2001
> > > From: =?UTF-8?q?Bruno=20Jim=C3=A9nez?= <brunojimen at gmail.com>
> > > Date: Thu, 5 Jun 2014 20:01:56 +0200
> > > Subject: [PATCH 2/3] radeon/compute: Implement
> > > PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS
> > >
> > > ---
> > > src/gallium/drivers/radeon/r600_pipe_common.c | 7 +++++++
> > > src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 4 ++++
> > > src/gallium/winsys/radeon/drm/radeon_winsys.h | 1 +
> > > 3 files changed, 12 insertions(+)
> > >
> > > diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> > > index 70c4d1a..e7d33a0 100644
> > > --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> > > +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> > > @@ -519,6 +519,13 @@ static int r600_get_compute_param(struct pipe_screen *screen,
> > > }
> > > return sizeof(uint32_t);
> > >
> > > + case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS:
> > > + if (ret) {
> > > + uint32_t *max_compute_units = ret;
> > > + *max_compute_units = rscreen->info.max_compute_units;
> > > + }
> > > + return sizeof(uint32_t);
> > > +
> > > default:
> > > fprintf(stderr, "unknown PIPE_COMPUTE_CAP %d\n", param);
> > > return 0;
> > > diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> > > index e54e79e..124f6fa 100644
> > > --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> > > +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> > > @@ -382,6 +382,10 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
> > > radeon_get_drm_value(ws->fd, RADEON_INFO_MAX_PIPES, NULL,
> > > &ws->info.r600_max_pipes);
> > >
> > > + /* RADEON_INFO_ACTIVE_CU_COUNT == 0x20 */
> >
> > This should be a define at the top of the file, just like we do with the
> > other RADEON_INFO_* values.
>
> Hi,
>
> This was a bit of a proof of concept that we could do the query and that
> it worked.
>
> I'm afraid that the other RADEON_INFO_* values were removed with this
> commit:
>
> commit 34564c875357a5d0a1f103f29949eafc2f8e1b35
> Author: Marek Olšák <marek.olsak at amd.com>
> Date: Fri Apr 4 20:18:37 2014 +0200
>
> winsys/radeon: remove definitions already present in radeon_drm.h
>
> Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
> Reviewed-by: Christian König <christian.koenig at amd.com>
>
> Also, I have seen this morning that the corresponding kernel patch has
> been proposed for kernel 3.16:
> http://lists.freedesktop.org/archives/dri-devel/2014-June/061483.html
> So we really won't be able to do this query until this patch lands.
>
> Anyway, I will change the patch so that RADEON_INFO_ACTIVE_CU_COUNT is
> at the top of the file as proposed.
>
Thanks, you should also add this same define to libdrm:
include/drm/radeon_drm.h
-Tom
> Thanks!
> Bruno
>
> >
> > -Tom
> >
> > > + radeon_get_drm_value(ws->fd, 0x20, NULL,
> > > + &ws->info.max_compute_units);
> > > +
> > > if (radeon_get_drm_value(ws->fd, RADEON_INFO_SI_TILE_MODE_ARRAY, NULL,
> > > ws->info.si_tile_mode_array)) {
> > > ws->info.si_tile_mode_array_valid = TRUE;
> > > diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
> > > index 2d13550..6df1987 100644
> > > --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
> > > +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
> > > @@ -198,6 +198,7 @@ struct radeon_info {
> > > uint32_t gart_size;
> > > uint32_t vram_size;
> > > uint32_t max_sclk;
> > > + uint32_t max_compute_units;
> > >
> > > uint32_t drm_major; /* version */
> > > uint32_t drm_minor;
> > > --
> > > 2.0.0
> > >
> >
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
>
>
More information about the mesa-dev
mailing list