All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Greathouse, Joseph" <Joseph.Greathouse@amd.com>
To: Daniel Vetter <daniel@ffwll.ch>,
	"Kuehling, Felix" <Felix.Kuehling@amd.com>
Cc: "Ho, Kenny" <Kenny.Ho@amd.com>,
	"jsparks@cray.com" <jsparks@cray.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"lkaplan@cray.com" <lkaplan@cray.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"y2kenny@gmail.com" <y2kenny@gmail.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"tj@kernel.org" <tj@kernel.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"Koenig, Christian" <Christian.Koenig@amd.com>
Subject: RE: [PATCH RFC v4 14/16] drm, cgroup: Introduce lgpu as DRM cgroup resource
Date: Wed, 9 Oct 2019 18:52:03 +0000	[thread overview]
Message-ID: <CY4PR12MB17670EE9EE4A22663EB584E8F9950@CY4PR12MB1767.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20191009160652.GO16989@phenom.ffwll.local>

> From: Daniel Vetter <daniel.vetter@ffwll.ch> On Behalf Of Daniel Vetter
> Sent: Wednesday, October 9, 2019 11:07 AM
> On Wed, Oct 09, 2019 at 03:53:42PM +0000, Kuehling, Felix wrote:
> > On 2019-10-09 11:34, Daniel Vetter wrote:
> > > On Wed, Oct 09, 2019 at 03:25:22PM +0000, Kuehling, Felix wrote:
> > >> On 2019-10-09 6:31, Daniel Vetter wrote:
> > >>> On Tue, Oct 08, 2019 at 06:53:18PM +0000, Kuehling, Felix wrote:
> > >>>> The description sounds reasonable to me and maps well to the CU masking
> > >>>> feature in our GPUs.
> > >>>>
> > >>>> It would also allow us to do more coarse-grained masking for example to
> > >>>> guarantee balanced allocation of CUs across shader engines or
> > >>>> partitioning of memory bandwidth or CP pipes (if that is supported by
> > >>>> the hardware/firmware).
> > >>> Hm, so this sounds like the definition for how this cgroup is supposed to
> > >>> work is "amd CU masking" (whatever that exactly is). And the abstract
> > >>> description is just prettification on top, but not actually the real
> > >>> definition you guys want.
> > >> I think you're reading this as the opposite of what I was trying to say.
> > >> Using CU masking is one possible implementation of LGPUs on AMD
> > >> hardware. It's the one that Kenny implemented at the end of this patch
> > >> series, and I pointed out some problems with that approach. Other ways
> > >> to partition the hardware into LGPUs are conceivable. For example we're
> > >> considering splitting it along the lines of shader engines, which is
> > >> more coarse-grain and would also affect memory bandwidth available to
> > >> each partition.
> > > If this is supposed to be useful for admins then "other ways to partition
> > > the hw are conceivable" is the problem. This should be unique&clear for
> > > admins/end-users. Reading the implementation details and realizing that
> > > the actual meaning is "amd CU masking" isn't good enough by far, since
> > > that's meaningless on any other hw.
> > >
> > > And if there's other ways to implement this cgroup for amd, it's also
> > > meaningless (to sysadmins/users) for amd hw.
> > >
> > >> We could also consider partitioning pipes in our command processor,
> > >> although that is not supported by our current CP scheduler firmware.
> > >>
> > >> The bottom line is, the LGPU model proposed by Kenny is quite abstract
> > >> and allows drivers implementing it a lot of flexibility depending on the
> > >> capability of their hardware and firmware. We haven't settled on a final
> > >> implementation choice even for AMD.
> > > That abstract model of essentially "anything goes" is the problem here
> > > imo. E.g. for cpu cgroups this would be similar to allowing the bitmaks to
> > > mean "cpu core" on one machine "physical die" on the next and maybe
> > > "hyperthread unit" on the 3rd. Useless for admins.
> > >
> > > So if we have a gpu bitmaks thing that might mean a command submissio pipe
> > > on one hw (maybe matching what vk exposed, maybe not), some compute unit
> > > mask on the next and something entirely different (e.g. intel has so
> > > called GT slices with compute cores + more stuff around) on the 3rd vendor
> > > then that's not useful for admins.
> >
> > The goal is to partition GPU compute resources to eliminate as much
> > resource contention as possible between different partitions. Different
> > hardware will have different capabilities to implement this. No
> > implementation will be perfect. For example, even with CPU cores that
> > are supposedly well defined, you can still have different behaviours
> > depending on CPU cache architectures, NUMA and thermal management across
> > CPU cores. The admin will need some knowledge of their hardware
> > architecture to understand those effects that are not described by the
> > abstract model of cgroups.
> 
> That's not the point I was making. For cpu cgroups there's a very well
> defined connection between the cpu bitmasks/numbers in cgroups and the cpu
> bitmasks you use in various system calls (they match). And that stuff
> works across vendors.
> 
> We need the same for gpus.
> 
> > The LGPU model is deliberately flexible, because GPU architectures are
> > much less standardized than CPU architectures. Expecting a common model
> > that is both very specific and applicable to to all GPUs is unrealistic,
> > in my opinion.
> 
> So pure abstraction isn't useful, we need to know what these bits mean.
> Since if they e.g. mean vk pipes, then maybe I shouldn't be using those vk
> pipes in my application anymore. Or we need to define that the userspace
> driver needs to filter out any pipes that arent' accessible (if that's
> possible, no idea).
> 
> cgroups that essentially have pure hw depedent meaning aren't useful.
> Note: this is about the fundamental meaning, not about the more unclear
> isolation guarantees (which are indeed hw specific on different cpu
> platforms). We're not talking about "different gpus might have different
> amounts of shared caches bitween different bitmasks". We're talking
> "different gpus might assign completely differen meaning to these
> bitmasks".
> -Daniel
<snip>

One thing that comes to mind is the OpenCL 1.2+ SubDevices mechanism: https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/clCreateSubDevices.html

The concept of LGPU in cgroups seems to match up nicely with an OpenCL SubDevice, at least for compute tasks. We want to divide up the device and give some configurable subset of it to the user as a logical GPU or sub-device.
 
OpenCL defines Compute Units (CUs), and any GPU vendor that runs OpenCL has some mapping of their internal compute resources to this concept of CUs. Off the top of my head (I may be misremembering some of these):
- AMD: Compute Units (CUs)
- ARM: Shader Cores (SCs)
- Intel: Execution Units (EUs)
- Nvidia: Streaming Multiprocessors (SMs)
- Qualcomm: Shader Processors (SPs)

The clCreateSubDevices() API has a variety of ways to slice and dice these compute resources across sub-devices. PARTITION_EQUALLY and PARTITION_BY_COUNTS could possibly be handled by a simple high-level mechanism that just allows you to request some percentage of the available GPU compute resources.

PARTITION_BY_AFFINITY_DOMAIN, however, splits up the CUs based on lower-level information such as what cache levels are shared or what NUMA domain a collection of CUs is in. I would argue that a runtime that wants to do this needs to know a bit about the mapping of CUs to underlying hardware resources.

A cgroup implementation that presented a CU bitmap could sit at the bottom of all three of these partitioning schemes, and more advanced ones if they come up. We might be getting side-tracked by the fact that AMD calls its resources CUs. The OpenCL (or Vulkan, etc.) concept of a Compute Unit is cross-vendor. The concept of targeting work to [Khronos-defined] Compute Units isn't AMD-specific. A bitmap of [Khronos-defined] CUs could map to any of these broad vendor compute resources.

There may be other parts of the GPU that we want to divide up -- command queue resources, pipes, render backends, etc. I'm not sure if any of those have been "standardized" between GPUs to such an extent that they make sense to put into cgroups yet -- I'm ignorant outside of the compute world. But at least the concept of CUs (or SMs, or EUs, etc.) seems to be standard across GPUs and (to me anyway) seems like a reasonable place to allows administrators, developers, users, etc. to divide up their GPUs.

And whatever mechanisms a GPU vendor may put in place to do clCreateSubDevices() could then be additionally used inside the kernel for their cgroups LGPU partitioning.

Thanks
-Joe
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-10-09 18:52 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29  6:05 [PATCH RFC v4 00/16] new cgroup controller for gpu/drm subsystem Kenny Ho
2019-08-29  6:05 ` [PATCH RFC v4 01/16] drm: Add drm_minor_for_each Kenny Ho
     [not found]   ` <20190829060533.32315-2-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-09-03  7:57     ` Daniel Vetter
2019-09-03 19:45       ` Kenny Ho
     [not found]         ` <CAOWid-dxxDhyxP2+0R0oKAk29rR-1TbMyhshR1+gbcpGJCAW6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-03 20:12           ` Daniel Vetter
     [not found]             ` <CAKMK7uEofjdVURu+meonh_YdV5eX8vfNALkW3A_+kLapCV8j+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-03 20:43               ` Kenny Ho
     [not found]                 ` <CAOWid-eUVztW4hNVpznnJRcwHcjCirGL2aS75p4OY8XoGuJqUg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-04  8:54                   ` Daniel Vetter
     [not found]                     ` <20190904085434.GF2112-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-09-05 18:27                       ` Kenny Ho
2019-09-05 18:28                       ` Kenny Ho
2019-09-05 20:06                         ` Daniel Vetter
     [not found]                           ` <CAKMK7uGSrscs-WAv0pYfcxaUGXvx7M6JYbiPHTY=1hxRbFK1sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-05 20:20                             ` Kenny Ho
2019-09-05 20:32                               ` Daniel Vetter
     [not found]                                 ` <CAKMK7uHy+GRAcpLDuz6STCBW+GNfNWr-i=ZERF3uqkO7jfynnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-05 21:26                                   ` Kenny Ho
     [not found]                                     ` <CAOWid-cRP1T2gr2U_ZN+QhS7jFM0kFTWiYy8JPPXXmGW7xBPzA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-06  9:12                                       ` Daniel Vetter
2019-09-06 15:29                     ` Tejun Heo
2019-09-06 15:36                       ` Daniel Vetter
     [not found]                         ` <CAKMK7uFQqAMB1DbiEy-o2bzr_F25My93imNcg1Qh9DHe=uWQug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-06 15:38                           ` Tejun Heo
2019-08-29  6:05 ` [PATCH RFC v4 02/16] cgroup: Introduce cgroup for drm subsystem Kenny Ho
     [not found]   ` <20190829060533.32315-3-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-10-01 14:31     ` Michal Koutný
     [not found]       ` <20191001143106.GA4749-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2019-11-29  6:00         ` Kenny Ho
2019-11-29  6:00           ` Kenny Ho
2019-11-29  6:00           ` Kenny Ho
2019-11-29  6:00           ` Kenny Ho
     [not found]           ` <CAOWid-ewvs-c-z_WW+Cx=Jaf0p8ZAwkWCkq2E8Xkj+2HvfNjaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-12-02 19:14             ` Tejun Heo
2019-12-02 19:14               ` Tejun Heo
2019-12-02 19:14               ` Tejun Heo
2019-12-02 19:14               ` Tejun Heo
2019-08-29  6:05 ` [PATCH RFC v4 03/16] drm, cgroup: Initialize drmcg properties Kenny Ho
2019-08-29  6:05 ` [PATCH RFC v4 07/16] drm, cgroup: Add total GEM buffer allocation limit Kenny Ho
     [not found]   ` <20190829060533.32315-8-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-10-01 14:30     ` Michal Koutný
2019-11-29  7:18       ` Kenny Ho
2019-11-29  7:18         ` Kenny Ho
2019-11-29  7:18         ` Kenny Ho
     [not found] ` <20190829060533.32315-1-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-08-29  6:05   ` [PATCH RFC v4 04/16] drm, cgroup: Add total GEM buffer allocation stats Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 05/16] drm, cgroup: Add peak " Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 06/16] drm, cgroup: Add GEM buffer allocation count stats Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 08/16] drm, cgroup: Add peak GEM buffer allocation limit Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 09/16] drm, cgroup: Add TTM buffer allocation stats Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 10/16] drm, cgroup: Add TTM buffer peak usage stats Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 11/16] drm, cgroup: Add per cgroup bw measure and control Kenny Ho
     [not found]     ` <20190829060533.32315-12-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-10-01 14:30       ` Michal Koutný
2019-08-29  6:05   ` [PATCH RFC v4 13/16] drm, cgroup: Allow more aggressive memory reclaim Kenny Ho
2019-08-29  7:08     ` Koenig, Christian
2019-08-29 14:07       ` Kenny Ho
     [not found]         ` <CAOWid-dzJiqjH9+=36fFYh87OKOzToMDcJZpepOWdjoXpBSF8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-08-29 14:12           ` Koenig, Christian
     [not found]             ` <f6963293-bebe-0dca-b509-799f9096ca91-5C7GfCeVMHo@public.gmane.org>
2019-08-29 14:39               ` Kenny Ho
2019-08-29  6:05   ` [PATCH RFC v4 15/16] drm, cgroup: add update trigger after limit change Kenny Ho
2019-08-31  4:28   ` [PATCH RFC v4 00/16] new cgroup controller for gpu/drm subsystem Tejun Heo
     [not found]     ` <20190831042857.GD2263813-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2019-09-03  7:55       ` Daniel Vetter
     [not found]         ` <20190903075550.GJ2112-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-09-03 18:50           ` Tejun Heo
2019-09-03 19:23             ` Kenny Ho
2019-09-03 19:48             ` Daniel Vetter
     [not found]               ` <CAKMK7uE5Bj-3cJH895iqnLpwUV+GBDM1Y=n4Z4A3xervMdJKXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-06 15:23                 ` Tejun Heo
     [not found]                   ` <20190906152320.GM2263813-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2019-09-06 15:34                     ` Daniel Vetter
     [not found]                       ` <CAKMK7uEXP7XLFB2aFU6+E0TH_DepFRkfCoKoHwkXtjZRDyhHig-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-06 15:45                         ` Tejun Heo
     [not found]                           ` <20190906154539.GP2263813-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2019-09-10 11:54                             ` Michal Hocko
     [not found]                               ` <20190910115448.GT2063-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2019-09-10 16:03                                 ` Tejun Heo
2019-09-10 17:25                                   ` Michal Hocko
2019-09-17 12:21                               ` Daniel Vetter
2019-08-29  6:05 ` [PATCH RFC v4 12/16] drm, cgroup: Add soft VRAM limit Kenny Ho
2019-08-29  6:05 ` [PATCH RFC v4 14/16] drm, cgroup: Introduce lgpu as DRM cgroup resource Kenny Ho
     [not found]   ` <20190829060533.32315-15-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-10-08 18:53     ` Kuehling, Felix
     [not found]       ` <b3d2b3c1-8854-10ca-3e39-b3bef35bdfa9-5C7GfCeVMHo@public.gmane.org>
2019-10-09 10:31         ` Daniel Vetter
     [not found]           ` <20191009103153.GU16989-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-10-09 15:08             ` Kenny Ho
     [not found]               ` <CAOWid-fLurBT6-h5WjQsEPA+dq1fgfWztbyZuLV4ypmWH8SC9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-09 15:23                 ` Daniel Vetter
2019-10-09 15:25           ` Kuehling, Felix
2019-10-09 15:25             ` Kuehling, Felix
     [not found]             ` <ee873e89-48fd-c4c9-1ce0-73965f4ad2ba-5C7GfCeVMHo@public.gmane.org>
2019-10-09 15:34               ` Daniel Vetter
2019-10-09 15:34                 ` Daniel Vetter
     [not found]                 ` <20191009153429.GI16989-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-10-09 15:53                   ` Kuehling, Felix
     [not found]                     ` <c7812af4-7ec4-02bb-ff4c-21dd114cf38e-5C7GfCeVMHo@public.gmane.org>
2019-10-09 16:06                       ` Daniel Vetter
2019-10-09 18:52                         ` Greathouse, Joseph [this message]
     [not found]                           ` <CY4PR12MB17670EE9EE4A22663EB584E8F9950-rpdhrqHFk07NeWpHaHeGuQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-10-09 19:07                             ` Daniel Vetter
2019-10-11 17:12                         ` tj
     [not found]                           ` <20191011171247.GC18794-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2019-11-29 20:10                             ` Felix Kuehling
2019-11-29 20:10                               ` Felix Kuehling
2019-11-29 20:10                               ` Felix Kuehling
2019-11-29 20:10                               ` Felix Kuehling
2019-08-29  6:05 ` [PATCH RFC v4 16/16] drm/amdgpu: Integrate with DRM cgroup Kenny Ho
     [not found]   ` <20190829060533.32315-17-Kenny.Ho-5C7GfCeVMHo@public.gmane.org>
2019-10-08 19:11     ` Kuehling, Felix
2019-10-08 19:11       ` Kuehling, Felix
     [not found]       ` <04abdc58-ae30-a13d-e7dc-f1020a1400b9-5C7GfCeVMHo@public.gmane.org>
2019-11-29  5:59         ` Kenny Ho
2019-11-29  5:59           ` Kenny Ho
2019-12-02 22:05           ` Greathouse, Joseph
2019-12-03 16:02             ` Kenny Ho
2019-09-03  8:02 ` [PATCH RFC v4 00/16] new cgroup controller for gpu/drm subsystem Daniel Vetter
     [not found]   ` <20190903080217.GL2112-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-09-03  8:24     ` Koenig, Christian
2019-09-03  9:19       ` Daniel Vetter
2019-09-03 19:30         ` Kenny Ho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR12MB17670EE9EE4A22663EB584E8F9950@CY4PR12MB1767.namprd12.prod.outlook.com \
    --to=joseph.greathouse@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Kenny.Ho@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=cgroups@vger.kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsparks@cray.com \
    --cc=lkaplan@cray.com \
    --cc=tj@kernel.org \
    --cc=y2kenny@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.