mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
cuda: Fix lowest targetted architecture for CUDA >= 11.0
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1469 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1835>
This commit is contained in:
parent
30ee21eae3
commit
dddd0af9cd
1 changed files with 15 additions and 0 deletions
|
@ -44,9 +44,11 @@ gst_cuda_nvrtc_compile (const gchar * source)
|
||||||
{
|
{
|
||||||
nvrtcProgram prog;
|
nvrtcProgram prog;
|
||||||
nvrtcResult ret;
|
nvrtcResult ret;
|
||||||
|
CUresult curet;
|
||||||
const gchar *opts[] = { "--gpu-architecture=compute_30" };
|
const gchar *opts[] = { "--gpu-architecture=compute_30" };
|
||||||
gsize ptx_size;
|
gsize ptx_size;
|
||||||
gchar *ptx = NULL;
|
gchar *ptx = NULL;
|
||||||
|
int driverVersion;
|
||||||
|
|
||||||
g_return_val_if_fail (source != NULL, FALSE);
|
g_return_val_if_fail (source != NULL, FALSE);
|
||||||
|
|
||||||
|
@ -54,12 +56,25 @@ gst_cuda_nvrtc_compile (const gchar * source)
|
||||||
|
|
||||||
GST_TRACE ("CUDA kernel source \n%s", source);
|
GST_TRACE ("CUDA kernel source \n%s", source);
|
||||||
|
|
||||||
|
curet = CuDriverGetVersion (&driverVersion);
|
||||||
|
if (curet != CUDA_SUCCESS) {
|
||||||
|
GST_ERROR ("Failed to query CUDA Driver version, ret %d", curet);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG ("CUDA Driver Version %d.%d", driverVersion / 1000,
|
||||||
|
(driverVersion % 1000) / 10);
|
||||||
|
|
||||||
ret = NvrtcCreateProgram (&prog, source, NULL, 0, NULL, NULL);
|
ret = NvrtcCreateProgram (&prog, source, NULL, 0, NULL, NULL);
|
||||||
if (ret != NVRTC_SUCCESS) {
|
if (ret != NVRTC_SUCCESS) {
|
||||||
GST_ERROR ("couldn't create nvrtc program, ret %d", ret);
|
GST_ERROR ("couldn't create nvrtc program, ret %d", ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Starting from CUDA 11, the lowest supported architecture is 5.2 */
|
||||||
|
if (driverVersion >= 11000)
|
||||||
|
opts[0] = "--gpu-architecture=compute_52";
|
||||||
|
|
||||||
ret = NvrtcCompileProgram (prog, 1, opts);
|
ret = NvrtcCompileProgram (prog, 1, opts);
|
||||||
if (ret != NVRTC_SUCCESS) {
|
if (ret != NVRTC_SUCCESS) {
|
||||||
gsize log_size;
|
gsize log_size;
|
||||||
|
|
Loading…
Reference in a new issue