Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8963 closed defect (duplicate)

Vulkan filters crash

Reported by: Paul Pacifico Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello ffmpeg team,

I tried everything to get vulkan filters works but it just always crash...

ffmpeg version N-99827-g700c0cef20

Here is my command:

ffmpeg- loglevel debug -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i testsrc2 -vf hwupload,avgblur_vulkan -f null -

And the debug log:

ffmpeg version N-99827-g700c0cef20 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
  configuration:  --disable-static --enable-shared --cc='ccache gcc' --cxx='ccache g++' --disable-autodetect --disable-debug --disable-w32threads --enable-sdl2 --enable-gpl --enable-version3 --enable-fontconfig --enable-iconv --enable-libass --enable-libdav1d --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzimg --enable-lzma --enable-zlib --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libspeex --enable-libxvid --enable-libgsm --enable-libsvtav1 --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-libopenmpt --enable-amf --enable-opencl --enable-vulkan --enable-libglslang --enable-schannel --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-libs=-liconv --shlibdir=/local64/bin-video
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.112.101 / 58.112.101
  libavformat    58. 64.100 / 58. 64.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 88.100 /  7. 88.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'vulkan=vk'.
Reading option '-filter_hw_device' ... matched as option 'filter_hw_device' (set hardware device used when filtering) with argument 'vk'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'testsrc2'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'hwupload,avgblur_vulkan'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '-' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument vulkan=vk.
[AVHWDeviceContext @ 0000026d757a8cc0] GPU listing:
[AVHWDeviceContext @ 0000026d757a8cc0]     0: Unknown AMD GPU (discrete) (0x6601)
[AVHWDeviceContext @ 0000026d757a8cc0] Using queue family 0 (total queues: 1) for graphics
[AVHWDeviceContext @ 0000026d757a8cc0]     QF 0 flags: (graphics) (compute) (transfers) (sparse)
[AVHWDeviceContext @ 0000026d757a8cc0] Using queue family 1 (total queues: 2) for compute
[AVHWDeviceContext @ 0000026d757a8cc0]     QF 1 flags: (compute) (transfers) (sparse)
[AVHWDeviceContext @ 0000026d757a8cc0] Using queue family 2 (total queues: 2) for transfers
[AVHWDeviceContext @ 0000026d757a8cc0]     QF 2 flags: (transfers) (sparse)
[AVHWDeviceContext @ 0000026d757a8cc0] Using device extension "VK_EXT_external_memory_host"
[AVHWDeviceContext @ 0000026d757a8cc0] Using device extension VK_EXT_external_memory_host
[AVHWDeviceContext @ 0000026d757a8cc0] Using device: Unknown AMD GPU
[AVHWDeviceContext @ 0000026d757a8cc0] Alignments:
[AVHWDeviceContext @ 0000026d757a8cc0]     optimalBufferCopyRowPitchAlignment: 1
[AVHWDeviceContext @ 0000026d757a8cc0]     minMemoryMapAlignment:              64
[AVHWDeviceContext @ 0000026d757a8cc0]     minImportedHostPointerAlignment:    4096
Applying option filter_hw_device (set hardware device used when filtering) with argument vk.
Successfully parsed a group of options.
Parsing a group of options: input url testsrc2.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: testsrc2.
detected 4 logical cores
[Parsed_testsrc2_0 @ 0000026d757aeec0] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[AVFilterGraph @ 0000026d77146dc0] query_formats: 2 queried, 1 merged, 0 already done, 0 delayed
[lavfi @ 0000026d771a4480] All info found
Input #0, lavfi, from 'testsrc2':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output url -.
Applying option vf (set video filters) with argument hwupload,avgblur_vulkan.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[rawvideo @ 0000026d756d7600] PACKET SIZE: 115200, STRIDE: 480
[graph 0 input from stream 0:0 @ 0000026d771c3b00] Setting 'video_size' to value '320x240'
[graph 0 input from stream 0:0 @ 0000026d771c3b00] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0000026d771c3b00] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0000026d771c3b00] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0000026d771c3b00] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0000026d771c3b00] w:320 h:240 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[AVFilterGraph @ 0000026d756d5700] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[hwupload @ 0000026d756d54c0] Surface format is yuv420p.
[Parsed_avgblur_vulkan_1 @ 0000026d771c3700] Shader avgblur_compute_hor:
1       #version 460
2       #define IS_WITHIN(v1, v2) ((v1.x < v2.x) && (v1.y < v2.y))
3
4       layout (local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
5
6       layout (set = 0, binding = 0) uniform sampler2D input_img[3];
7       layout (set = 0, binding = 1, rgba8) uniform writeonly image2D output_img[3];
8
9       #define FILTER_RADIUS (2)
10      #define INC(x) (ivec2(x, 0))
11      #define DIR(var) (var.x)
12
13      shared vec4 cache[DIR(gl_WorkGroupSize) + FILTER_RADIUS*2 + 1];
14
15      void distort(const ivec2 pos, const int idx)
16      {
17          const uint cp = DIR(gl_LocalInvocationID) + FILTER_RADIUS;
18
19          cache[cp] = texture(input_img[idx], pos);
20
21          const ivec2 loc_l = pos - INC(FILTER_RADIUS);
22          cache[cp - FILTER_RADIUS] = texture(input_img[idx], loc_l);
23
24          const ivec2 loc_h = pos + INC(DIR(gl_WorkGroupSize));
25          cache[cp + DIR(gl_WorkGroupSize)] = texture(input_img[idx], loc_h);
26
27          barrier();
28
29          vec4 sum = vec4(0);
30          for (int p = -FILTER_RADIUS; p <= FILTER_RADIUS; p++)
31              sum += cache[cp + p];
32
33          sum /= vec4(FILTER_RADIUS*2 + 1);
34          imageStore(output_img[idx], pos, sum);
35      }
36
37      void main()
38      {
39          ivec2 size;
40          const ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
41
42          size = imageSize(output_img[0]);
43          if (IS_WITHIN(pos, size)) {
44              distort(pos, 0);
45          }
46
47          size = imageSize(output_img[1]);
48          if (IS_WITHIN(pos, size)) {
49              distort(pos, 1);
50          }
51
52          size = imageSize(output_img[2]);
53          if (IS_WITHIN(pos, size)) {
54              distort(pos, 2);
55          }
56      }
[Parsed_avgblur_vulkan_1 @ 0000026d771c3700] Shader avgblur_compute_hor linked! Size: 4340 bytes

Then crash...

I know my vulkan GPU shows "Unknown" but i get the same crash on any computer (AMD or Nvidia on Windows plateform).

Thanks for all.
Paul.

Change History (2)

comment:1 by mkver, 4 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #8962.

comment:2 by mkver, 4 years ago

Keywords: vulkan crash removed
Note: See TracTickets for help on using tickets.