amdgpu: amdgpu_device_initialize failed.

"Zeus Panchenko" <[email protected]>
Newsgroups gmane.os.freebsd.devel.x11
Organization I.B.S. LLC
Message-ID <[email protected]>
greetings,

any tool with opencl support doesn't work for me, please advise

---[ quotation start ]-------------------------------------------
amdgpu_device_initialize: AMDGPU_INFO_ACCEL_WORKING = 0
amdgpu: amdgpu_device_initialize failed.
do_winsys_init: DRM version is 3.23.0 but this driver is only compatible with 2.12.0 (kernel 3.2) or later.
---[ quotation end   ]-------------------------------------------

I see this with clinfo, darktable and test code (quoted at the end)

here is what I have:

> uname
FreeBSD 12.1-RELEASE-p1 GENERIC

> pkg info
clover-18.3.2_5
drm-fbsd12.0-kmod-4.16.g20191120
drm-kmod-g20190710
gpu-firmware-kmod-g20191015
ocl-icd-2.2.12
opencl-2.2_1



---[ clinfo quotation start ]-------------------------------------------
amdgpu_device_initialize: AMDGPU_INFO_ACCEL_WORKING = 0
amdgpu: amdgpu_device_initialize failed.
do_winsys_init: DRM version is 3.23.0 but this driver is only compatible with 2.12.0 (kernel 3.2) or later.
Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 18.3.2
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Clover
  clCreateContext(NULL, ...) [default]            No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  No devices found in platform

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.12
  ICD loader Profile                              OpenCL 2.2
        NOTE:   your OpenCL library declares to support OpenCL 2.2,
                but it seems to support up to OpenCL 2.1 only.
---[ clinfo quotation end   ]-------------------------------------------



---[ `pciconf -lv` quotation start ]-------------------------------------------
vgapci0@pci0:2:0:0:     class=0x030000 card=0x22fe1458 chip=0x699f1002 rev=0xc7 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X]'
    class      = display
    subclass   = VGA
hdac0@pci0:2:0:1:       class=0x040300 card=0xaae01458 chip=0xaae01002 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Baffin HDMI/DP Audio [Radeon RX 550 640SP / RX 560/560X]'
    class      = multimedia
    subclass   = HDA
---[ `pciconf -lv` quotation end   ]-------------------------------------------



---[ kldstat quotation start ]-------------------------------------------
16    1 0xffffffff82c21000   253e84 amdgpu.ko
17    2 0xffffffff82e75000    769f0 drm.ko
18    5 0xffffffff82eec000    10eb0 linuxkpi.ko
19    4 0xffffffff82efd000    12f30 linuxkpi_gplv2.ko
22    1 0xffffffff82f21000     80db amdgpu_polaris12_mc_bin.ko
23    1 0xffffffff82f2a000     4421 amdgpu_polaris12_pfp_2_bin.ko
24    1 0xffffffff82f2f000     441f amdgpu_polaris12_me_2_bin.ko
25    1 0xffffffff82f34000     241f amdgpu_polaris12_ce_2_bin.ko
26    1 0xffffffff82f37000     429d amdgpu_polaris12_rlc_bin.ko
27    1 0xffffffff82f3c000    40431 amdgpu_polaris12_mec_2_bin.ko
28    1 0xffffffff82f7d000    40433 amdgpu_polaris12_mec2_2_bin.ko
29    1 0xffffffff82fbe000     331f amdgpu_polaris12_sdma_bin.ko
30    1 0xffffffff82fc2000     3321 amdgpu_polaris12_sdma1_bin.ko
31    1 0xffffffff82fc6000    5bbfd amdgpu_polaris12_uvd_bin.ko
32    1 0xffffffff83022000    28d1d amdgpu_polaris12_vce_bin.ko
33    1 0xffffffff8304b000    1fedd amdgpu_polaris12_smc_bin.ko
---[ kldstat quotation end   ]-------------------------------------------



---[ dmesg quotation start ]-------------------------------------------
[drm] amdgpu kernel modesetting enabled.
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] initializing kernel modesetting (POLARIS12 0x1002:0x699F 0x1458:0x22FE 0xC7).
[drm] register mmio base: 0xFBB80000
[drm] register mmio size: 262144
[drm] PCI I/O BAR is not found.
[drm] probing gen 2 caps for device 8086:340a = 3b3d02/0
[drm] probing mlw for device 1002:699f = 400883
[drm] UVD is enabled in VM mode
[drm] UVD ENC is enabled in VM mode
[drm] VCE enabled in VM mode
ATOM BIOS: xxx-xxx-xxx
[drm] vm size is 64 GB, 2 levels, block size is 10-bit, fragment size is 9-bit
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_mc.bin
drmn0: VRAM: 2048M 0x000000F400000000 - 0x000000F47FFFFFFF (2048M used)
drmn0: GTT: 256M 0x0000000000000000 - 0x000000000FFFFFFF
Failed to add WC MTRR for [0xd0000000-0xdfffffff]: -22; performance may suffer
[drm] Detected VRAM RAM=2048M, BAR=256M
[drm] RAM width 128bits GDDR5
[TTM] Zone  kernel: Available graphics memory: 12556822 kiB
[TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[TTM] Initializing pool allocator
[drm] amdgpu: 2048M of VRAM memory ready
[drm] amdgpu: 3072M of GTT memory ready.
i_size_write unimplemented
[drm] GART: num cpu pages 65536, num gpu pages 65536
[drm] PCIE GART of 256M enabled (table at 0x000000F400040000).
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
[drm] Connector DP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DP-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector DVI-D-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DVI-D-1
[drm]   - kern.vt.fb.default_mode
[drm] AMDGPU Display Connectors
[drm] Connector 0:
[drm]   DP-1
[drm]   HPD5
[drm]   DDC: 0x4868 0x4868 0x4869 0x4869 0x486a 0x486a 0x486b 0x486b
[drm]   Encoders:
[drm]     DFP1: INTERNAL_UNIPHY1
[drm] Connector 1:
[drm]   HDMI-A-1
[drm]   HPD3
[drm]   DDC: 0x4874 0x4874 0x4875 0x4875 0x4876 0x4876 0x4877 0x4877
[drm]   Encoders:
[drm]     DFP2: INTERNAL_UNIPHY1
[drm] Connector 2:
[drm]   DVI-D-1
[drm]   HPD4
[drm]   DDC: 0x4878 0x4878 0x4879 0x4879 0x487a 0x487a 0x487b 0x487b
[drm]   Encoders:
[drm]     DFP3: INTERNAL_UNIPHY
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_pfp_2.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_me_2.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_ce_2.bin
[drm] Chained IB support enabled!
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_rlc.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_mec_2.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_mec2_2.bin
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_sdma.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_sdma1.bin
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_uvd.bin
[drm] Found UVD firmware Version: 1.130 Family ID: 16
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_vce.bin
[drm] Found VCE firmware Version: 53.26 Binary ID: 3
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris12_smc.bin
[drm] UVD and UVD ENC initialized successfully.
[drm] VCE initialized successfully.
[drm] fb mappable at 0xD0568000
[drm] vram apper at 0xD0000000
[drm] size 8294400
[drm] fb depth is 24
[drm]    pitch is 7680
VT: Replacing driver "vga" with new "fb".
start FB_INFO:
type=11 height=1080 width=1920 depth=32
cmsize=16 size=8294400
pbase=0xd0568000 vbase=0xfffff800d0568000
name=drmn0 flags=0x0 stride=7680 bpp=32
cmap[0]=0 cmap[1]=7f0000 cmap[2]=7f00 cmap[3]=c4a000
end FB_INFO
drmn0: fb0: amdgpudrmfb frame buffer device
i_size_write unimplemented
[drm] Initialized amdgpu 3.23.0 20150101 for drmn0 on minor 0
---[ dmesg quotation end   ]-------------------------------------------



test code
built with:
g++ -ggdb -I/usr/local/include -o cl-hello-world.o cl-hello-world.c  -lOpenCL

debug follows

---[ cl-hello-world.c quotation start ]-------------------------------------------
// -*- mode: c; mode: follow -*-
// stolen from https://subscription.packtpub.com/book/application_development/9781849692342/1/ch01lvl1sec12/an-example-of-opencl-program

#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#define VECTOR_SIZE 1024

//OpenCL kernel which is run for every work item created.
const char *saxpy_kernel =
"__kernel                                   \n"
"void saxpy_kernel(float alpha,     \n"
"                  __global float *A,       \n"
"                  __global float *B,       \n"
"                  __global float *C)       \n"
"{                                          \n"
"    //Get the index of the work-item       \n"
"    int index = get_global_id(0);          \n"
"    C[index] = alpha* A[index] + B[index]; \n"
"}                                          \n";

int main(void) {
  int i;

  printf("\n\nHELLO CL WORLD!\n\n");

  // Allocate space for vectors A, B and C
  float alpha = 2.0;
  float *A = (float*)malloc(sizeof(float)*VECTOR_SIZE);
  float *B = (float*)malloc(sizeof(float)*VECTOR_SIZE);
  float *C = (float*)malloc(sizeof(float)*VECTOR_SIZE);
  for(i = 0; i < VECTOR_SIZE; i++)
  {
    A[i] = i;
    B[i] = VECTOR_SIZE - i;
    C[i] = 0;
  }

  // Get platform and device information
  cl_platform_id * platforms = NULL;
  cl_uint     num_platforms;
  //Set up the Platform
  cl_int clStatus = clGetPlatformIDs(0, NULL, &num_platforms);
  platforms = (cl_platform_id *)
  malloc(sizeof(cl_platform_id)*num_platforms);
  clStatus = clGetPlatformIDs(num_platforms, platforms, NULL);

  //Get the devices list and choose the device you want to run on
  cl_device_id     *device_list = NULL;
  cl_uint           num_devices;

  clStatus = clGetDeviceIDs( platforms[0], CL_DEVICE_TYPE_GPU, 0,NULL, &num_devices);
  device_list = (cl_device_id *) 
  malloc(sizeof(cl_device_id)*num_devices);
  clStatus = clGetDeviceIDs( platforms[0],CL_DEVICE_TYPE_GPU, num_devices, device_list, NULL);

  // Create one OpenCL context for each device in the platform
  cl_context context;
  context = clCreateContext( NULL, num_devices, device_list, NULL, NULL, &clStatus);

  // Create a command queue
  cl_command_queue command_queue = clCreateCommandQueue(context, device_list[0], 0, &clStatus);

  // Create memory buffers on the device for each vector
  cl_mem A_clmem = clCreateBuffer(context, CL_MEM_READ_ONLY,VECTOR_SIZE * sizeof(float), NULL, &clStatus);
  cl_mem B_clmem = clCreateBuffer(context, CL_MEM_READ_ONLY,VECTOR_SIZE * sizeof(float), NULL, &clStatus);
  cl_mem C_clmem = clCreateBuffer(context, CL_MEM_WRITE_ONLY,VECTOR_SIZE * sizeof(float), NULL, &clStatus);
  
  // Copy the Buffer A and B to the device
  clStatus = clEnqueueWriteBuffer(command_queue, A_clmem, CL_TRUE, 0, VECTOR_SIZE * sizeof(float), A, 0, NULL, NULL);
  clStatus = clEnqueueWriteBuffer(command_queue, B_clmem, CL_TRUE, 0, VECTOR_SIZE * sizeof(float), B, 0, NULL, NULL);
  
  return 0;
}
---[ cl-hello-world.c quotation end   ]-------------------------------------------



---[ gdb bt full quotation start ]-------------------------------------------
Reading symbols from cl-hello-world.o...
[New LWP 102222]
Core was generated by `./cl-hello-world.o'.
Program terminated with signal SIGBUS, Bus error.
#0  0x0000000800651d5e in clCreateContext (properties=0x0, num_devices=8, devices=0x807364280, pfn_notify=0x0, user_data=0x0, errcode_ret=0x7fffffffe850) at ocl_icd_loader.c:929
929       RETURN(((struct _cl_device_id *)devices[0])
(gdb) bt full
#0  0x0000000800651d5e in clCreateContext (properties=0x0, num_devices=8, devices=0x807364280, pfn_notify=0x0, user_data=0x0, errcode_ret=0x7fffffffe850) at ocl_icd_loader.c:929
        ret = 0x0
        i = 0
#1  0x0000000000400c20 in main () at cl-hello-world.c:63
        i = 1024
        alpha = 2
        A = 0x800646000
        B = 0x800647000
        C = 0x800f31000
        platforms = 0x80063a088
        num_platforms = 1
        clStatus = -1
        device_list = 0x807364280
        num_devices = 8
        context = 0x800c46e02 <atexit+50>
        command_queue = 0x7fffffffe8b0
        A_clmem = 0x0
        B_clmem = 0x7fffffffe928
        C_clmem = 0x0
(gdb) 
---[ gdb bt full quotation end   ]-------------------------------------------


-- 
Zeus V. Panchenko				jid:[email protected]
IT Dpt., I.B.S. LLC					  GMT+2 (EET)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-x11
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.