Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3533112rwe; Mon, 29 Aug 2022 13:58:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR743g1/k/nNAoDBiXe6ohNFiaGZAxCA5pa+bypTugdJ9Icmh2PSZ1Yb91AiHgUg3VMU6pOh X-Received: by 2002:a17:906:fe49:b0:73d:70c5:1a52 with SMTP id wz9-20020a170906fe4900b0073d70c51a52mr15375162ejb.469.1661806699438; Mon, 29 Aug 2022 13:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661806699; cv=none; d=google.com; s=arc-20160816; b=EE36SID+Fsd0atDS2Q6N81hvUDm6rMoNBI3Q9xiqU12OCXmGTECRNgCvcpgJPZ7QV+ j9khJ7wpSP8j9Ea05OStT0kUyoetz/0exfP5AKF1uXT0CSpQOP4Pv9TEa7Z0m4piAO/Y IKOOCmBRUf7BVg1yQFsyhQlMb9oNB9dFPCi5/pkMbAgygh/Yd8bydl4Qb37JYz6/ZjuZ EkKHW1U9jRkrBPCS+nmcc608ay/6pEJ8b16+iTF7Yg8cDmLNmFF1A7i0nzbyFjeXcW98 TS5L/0G7m+vjTMAxU5ITPcUKNbAASM4eWfjGKmgk1mSwwu3Jy6oKrR4Sp4bl1uiQRl/i 2kYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:dkim-signature; bh=GEtwMjD/OIVlmkpbYEiHU4MKz+tfzFSV5uKsJpcHyfY=; b=VyZaTic5qdgRWGdli52I0iPU6kLZyCQt+uWXg9xsAYjGEXqNlc7h4RljoC5cDJVRb4 xfms9wWnod2jS2p6mFEgkV11Ra4KealgDD+YDmgyDInD8PD05NiRqsqaTAinBUL2pYX3 jsvfHKoOhQmknEbNRFPJijMrA6nHhaz4G3Qd/y68336C0G1/ZZa+UD5o+gtxWQ97qqws WdkeoIgiD/BqOgCH+9U/fz3AMDQdFw1/LRZuR10w0JACQ1g5dSeVCY0psRkGzWFjHBV+ PwlksXADA3MKCb18E2a0d1xjtqviCcjDLpQu9lOns1Vzfu72CGk1RESVE4QJoICLFEX9 9rSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=SX5tThtF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eh23-20020a0564020f9700b00447a70e89e2si6981961edb.195.2022.08.29.13.57.52; Mon, 29 Aug 2022 13:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=SX5tThtF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbiH2UzN (ORCPT + 99 others); Mon, 29 Aug 2022 16:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbiH2UzB (ORCPT ); Mon, 29 Aug 2022 16:55:01 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96D541F9 for ; Mon, 29 Aug 2022 13:54:45 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id u9-20020a17090a1f0900b001fde6477464so2754079pja.4 for ; Mon, 29 Aug 2022 13:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc; bh=GEtwMjD/OIVlmkpbYEiHU4MKz+tfzFSV5uKsJpcHyfY=; b=SX5tThtFcX1rw5/i3Uy9JWlKDJA54aA6jyBep9G2KRko2X0Z5FI+0+xn59Qj3jcObj Z9ZlGq4TriU0njPRbu3reIfTnKBHArZXhvWXOYcevMPigBWBWxEWk+OCVjReJL8QMaIY MFr8xFNZlZP6YAJKGXmAT/l+3dz4SSJqkbGnGRTD0k8Z4vdneOoIW7JVBfkSvoxZA23o cAN39LPzKsrsPQESdCvmC5TBr+5bab+EOLAoPuP4P+M8hPat2oCvrRYD64Jy17vjtWlY FgRy+ZZoALrfZWs02UQi/qlb8cEp4rBjwJ60xyn5tFLjQnPwGZ/JhW3nU1u2VG/t8Az6 VHJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=GEtwMjD/OIVlmkpbYEiHU4MKz+tfzFSV5uKsJpcHyfY=; b=epd+cfYD+3oRXndo+ObnIVPoM/+gPUn3u9SklWCd8mzOB1EMYtX2cy2uD4xdx7G2Sl 0eJpsbmQgarfps2qHgV8KL9M14RZh37JxpwuESJ3uFSN6pkcKXRejAboCxjL8n1opAbv dglM0VGCXbKPGfh1BymtdhTlksjy7M3na5ZIGBZ3NVwMYhk47IFLxKtsFTquLuDc8wx9 mRD37onR7d9zdjYuL7DBm2NSC/tjKfoXaE5Rp6uXuLuG88uzRFc1QdxwmnLVFk0IRAgp AaDOWz/okqICnIbPdLNUt8cKwh2u1jcXM5wN0ckiJGctSXcJEdFmwAe1it02z9L4cjio 9K7w== X-Gm-Message-State: ACgBeo31ZaI1w1wtlRHF9VCFDTmXb5JagDXiBx2M6VYOG5MzMIsmZ1lp LityC6HiwsCBqpOd82POrC2QpA== X-Received: by 2002:a17:902:ced2:b0:16e:e19b:c5c9 with SMTP id d18-20020a170902ced200b0016ee19bc5c9mr18815203plg.136.1661806483563; Mon, 29 Aug 2022 13:54:43 -0700 (PDT) Received: from localhost ([76.146.1.42]) by smtp.gmail.com with ESMTPSA id p5-20020a17090a2c4500b001efa9e83927sm7016156pjm.51.2022.08.29.13.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 13:54:42 -0700 (PDT) From: Kevin Hilman To: Oded Gabbay Cc: Dave Airlie , Greg Kroah-Hartman , Yuji Ishikawa , Jiho Chu , Alexandre Bailon , Jason Gunthorpe , Arnd Bergmann , dri-devel , "Linux-Kernel@Vger. Kernel. Org" Subject: Re: New subsystem for acceleration devices In-Reply-To: Date: Mon, 29 Aug 2022 13:54:42 -0700 Message-ID: <7hh71uixd9.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Oded (and sorry I misspelled your name last time), Oded Gabbay writes: > On Tue, Aug 23, 2022 at 9:24 PM Kevin Hilman wrote: >> >> Hi Obed, >> >> Oded Gabbay writes: >> >> [...] >> >> > I want to update that I'm currently in discussions with Dave to figure >> > out what's the best way to move forward. We are writing it down to do >> > a proper comparison between the two paths (new accel subsystem or >> > using drm). I guess it will take a week or so. >> >> Any update on the discussions with Dave? and/or are there any plans to >> discuss this further at LPC/ksummit yet? > Hi Kevin. > > We are still discussing the details, as at least the habanalabs driver > is very complex and there are multiple parts that I need to see if and > how they can be mapped to drm. > Some of us will attend LPC so we will probably take advantage of that > to talk more about this. OK, looking forward to some more conversations at LPC. >> >> We (BayLibre) are upstreaming support for APUs on Mediatek SoCs, and are >> using the DRM-based approach. I'll also be at LPC and happy to discuss >> in person. >> >> For some context on my/our interest: back in Sept 2020 we initially >> submitted an rpmesg based driver for kernel communication[1]. After >> review comments, we rewrote that based on DRM[2] and are now using it >> for some MTK SoCs[3] and supporting our MTK customers with it. >> >> Hopefully we will get the kernel interfaces sorted out soon, but next, >> there's the userspace side of things. To that end, we're also working >> on libAPU, a common, open userspace stack. Alex Bailon recently >> presented a proposal earlier this year at Embedded Recipes in Paris >> (video[4], slides[5].) >> >> libAPU would include abstractions of the kernel interfaces for DRM >> (using libdrm), remoteproc/rpmsg, virtio etc. but also goes farther and >> proposes an open firmware for the accelerator side using >> libMetal/OpenAMP + rpmsg for communication with (most likely closed >> source) vendor firmware. Think of this like sound open firmware (SOF[6]), >> but for accelerators. > > I think your device and the habana device are very different in > nature, and it is part of what Dave and I discussed, whether these two > classes of devices can live together. I guess they can live together > in the kernel, but in the userspace, not so much imo. Yeah, for now I think focusing on how to handle both classes of devices in the kernel is the most important. > The first class is the edge inference devices (usually as part of some > SoC). I think your description of the APU on MTK SoC is a classic > example of such a device. Correct. > You usually have some firmware you load, you give it a graph and > pointers for input and output and then you just execute the graph > again and again to perform inference and just replace the inputs. > > The second class is the data-center, training accelerators, which > habana's gaudi device is classified as such. These devices usually > have a number of different compute engines, a fabric for scaling out, > on-device memory, internal MMUs and RAS monitoring requirements. Those > devices are usually operated via command queues, either through their > kernel driver or directly from user-space. They have multiple APIs for > memory management, RAS, scaling-out and command-submissions. OK, I see. >> >> We've been using this succesfully for Mediatek SoCs (which have a >> Cadence VP6 APU) and have submitted/published the code, including the >> OpenAMP[7] and libmetal[8] parts in addition to the kernel parts already >> mentioned. > What's the difference between libmetal and other open-source low-level > runtime drivers, such as oneAPI level-zero ? TBH, I'd never heard of oneAPI before, so I'm assuming it's mainly focused in the data center. libmetal/openAMP are widely used in the consumer, industrial embedded space, and heavily used by FPGAs in many market segments. > Currently we have our own runtime driver which is tightly coupled with > our h/w. For example, the method the userspace "talks" to the > data-plane firmware is very proprietary as it is hard-wired into the > architecture of the entire ASIC and how it performs deep-learning > training. Therefore, I don't see how this can be shared with other > vendors. Not because of secrecy but because it is simply not relevant > to any other ASIC. OK, makes sense. Thanks for clarifying your use case in more detail. Kevin