From patchwork Thu Feb 21 03:57:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 12123 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A4F974497CC for ; Thu, 21 Feb 2019 05:58:12 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 87A9268ABDA; Thu, 21 Feb 2019 05:58:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it1-f226.google.com (mail-it1-f226.google.com [209.85.166.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1D20A68A715 for ; Thu, 21 Feb 2019 05:58:06 +0200 (EET) Received: by mail-it1-f226.google.com with SMTP id r11so20490478itc.2 for ; Wed, 20 Feb 2019 19:58:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3il3k4zypRnAxAHz7bTmB7IeXgHmfI5OfqPbFmjcIz0=; b=nEclNTf7oVZ1b1jIkdvCIaORKf5l1q7Uqr1J1MnuP+IUJt2IxhhZTiSS7k0uoy+IAi /hv6AxhnG2IaBVHOMHxh/pSvuqLcWiv52vfHN0JZwdC2QzTjNKgL2VyHwg5bkegeWo7k auHzceKVNJrWWfdG9Ci7+bjtVAD+wmCuYFYuOs0oq6qKZdUjvhazqbEFvar7+clqJ9pO y/EbE8QCc0JkHbjxmUAXkDZGOAZTxDVaCh9u5EL0AXkeJehMIcUqQBmNU69wVl8JdPYT fgnwUCtphU7/BYF+XWk7t3XvwG0OviWcvYM9gL+nK12FACVh4fCS1rgAmI8heSkCoQPf Gz1g== X-Gm-Message-State: AHQUAub9jXZV6p7N8KcgfGN/YSJZC9uo2hJ2cUsOP49hJegA+2nqAHA+ JCvlc+vAzEILyY5jqmMKLChLapxQH0Xun/p5CQKT4HreAO4PrA== X-Google-Smtp-Source: AHgI3IbPZkCzTb10szM80i/Nb4WwAszNsVnwEnI/6QoBbJCZ30/0VvmYuUD7sHcmzWrkdzt/tp9OBp0yPZtT X-Received: by 2002:a02:48c6:: with SMTP id p189mr19043217jaa.89.1550721484441; Wed, 20 Feb 2019 19:58:04 -0800 (PST) Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com. [107.178.208.155]) by smtp-relay.gmail.com with ESMTPS id r194sm965436ita.10.2019.02.20.19.58.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Feb 2019 19:58:04 -0800 (PST) X-Relaying-Domain: gapps.overt.org Received: from authenticated-user (mail.overt.org [107.178.208.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id 8DA803F2C6; Wed, 20 Feb 2019 21:58:03 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1550721483; bh=pZINOhMbiikNccjBsLkOmUDb75nDiCg3v5nqXrCpAvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cfQ3fqBD1EQcGSqGtTU5PbbxMsg33YRDjEh/AfiucW4egJufJHbl96XvzT2XDjTlm iZX+4iyYz2fFOcfnW/lvDO7ZA8MD0isXnQQz3Cg3Xn2U1piO1nfpuuc5WONUkNATGb g048IJOdSiPHaGgpiXVt0xRLyvPBTH4dMBnd9kkwpDb8sO8mYYsrtXDOQE1TYhskct K8nd4j287Tl4SUULQIcWwUjvbuNNzwXtYCLu4Ukrpa9v2mEIbkDLROUyCSCs0BSr4w R3Ntnpsj6JPjyGccxIXbU5FiOikAuIZE4dSfY1mt+O2QQZcRMRSNtCeDOZyrcE5F8X FK/q7xxyWJrQw== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Feb 2019 19:57:49 -0800 Message-Id: <20190221035753.27525-2-philipl@overt.org> In-Reply-To: <20190221035753.27525-1-philipl@overt.org> References: <20190221035753.27525-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/5] configure: Add an explicit check and option for nvcc X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Philip Langdale Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The use of nvcc to compile cuda kernels is distinct from the use of cuda sdk libraries and linking against those libraries. We have previously not bothered to distinguish these two cases because all the filters that used cuda kernels also used the sdk. In the following changes, I'm going to remove the sdk dependency from those filters, but we need a way to ensure that nvcc is present and functioning, and also a way to explicitly disable its use so that the filters are not built. Note that, unlike the cuda_sdk dependency, using nvcc to compile a kernel does not cause a build to become non-free. Although nvcc is distributed with the cuda sdk, and is EULA encumbered, the compilation process we use does not introduce any EULA covered code or libraries into the build. In this sense, using nvcc is just like using any other proprietary compiler like msvc - compiling free code doesn't suddently make it non-free. There was previously some confusion on this topic, but the important distinction is that we use nvcc to generate ptx files - these are not compiled GPU binaries, but rather an intermediate assembly representation that is JIT compiled (and I think linked with certain nvidia library code) when you actually try and run the kernel. nvidia use this technique to relax machine code compatibility between hardware generations. From here, we can make two observations: * The ptx files that we include in libavfilter are aggregated rather than linked, from the perspective of the (L)GPL * No proprietary code is included with the ptx files. That code is only linked in at the final compilation step at runtime. Signed-off-by: Philip Langdale --- configure | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/configure b/configure index bf40c1dcb9..2219eb1515 100755 --- a/configure +++ b/configure @@ -322,6 +322,7 @@ External library support: --disable-amf disable AMF video encoding code [autodetect] --disable-audiotoolbox disable Apple AudioToolbox code [autodetect] --enable-cuda-sdk enable CUDA features that require the CUDA SDK [no] + --disable-cuda-nvcc disable Nvidia CUDA compiler [autodetect] --disable-cuvid disable Nvidia CUVID support [autodetect] --disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect] --disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect] @@ -1001,6 +1002,10 @@ hostcc_o(){ eval printf '%s\\n' $HOSTCC_O } +nvcc_o(){ + eval printf '%s\\n' $NVCC_O +} + test_cc(){ log test_cc "$@" cat > $TMPC @@ -1022,6 +1027,13 @@ test_objcc(){ test_cmd $objcc -Werror=missing-prototypes $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPM } +test_nvcc(){ + log test_nvcc "$@" + cat > $TMPCU + log_file $TMPCU + test_cmd $nvcc -ptx $NVCCFLAGS "$@" $NVCC_C $(nvcc_o $TMPO) $TMPCU +} + test_cpp(){ log test_cpp "$@" cat > $TMPC @@ -1786,6 +1798,7 @@ HWACCEL_AUTODETECT_LIBRARY_LIST=" audiotoolbox crystalhd cuda + cuda_nvcc cuvid d3d11va dxva2 @@ -4238,6 +4251,7 @@ tmpfile TMPCPP .cpp tmpfile TMPE $EXESUF tmpfile TMPH .h tmpfile TMPM .m +tmpfile TMPCU .cu tmpfile TMPO .o tmpfile TMPS .S tmpfile TMPSH .sh @@ -6641,6 +6655,20 @@ else nvccflags="$nvccflags -m32" fi +check_nvcc() { + log check_nvcc "$@" + disable cuda_nvcc + test_nvcc <