nixos-rocm / nixos-rocm

NixOS support for the ROCm graphics stack (rocm.github.io)
Other
83 stars 14 forks source link

Upstream OpenCL support not working in unstable #61

Open YellowOnion opened 3 years ago

YellowOnion commented 3 years ago

configuration.nix:


  hardware.opengl = {
    driSupport32Bit = true;
    extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
    setLdLibraryPath = true;
    extraPackages = with pkgs; [ rocm-opencl-icd rocm-opencl-runtime rocm-runtime ];
  };
$   nix-shell -p rocm-opencl-runtime --run clinfo
Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.0 AMD-APP (3241.0)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback 
  Platform Extensions function suffix             AMD

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  No platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   No platform
  clCreateContext(NULL, ...) [default]            No platform
  clCreateContext(NULL, ...) [other]              
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_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
acowley commented 3 years ago

Hello! Are you saying that nixpkgs unstable OpenCL is not working, or that you are using this overlay? What hardware? Kernel?

For general low-level debugging, the upstream ROCm repositories are worth digging through. There you can find recommendations about checking system logs to determine if the hardware is getting picked up by amdgpu.

YellowOnion commented 3 years ago

I'm using a RX580, with the bcache 5.9 kernel, amdgpu is working fine, I'm just using nixos, not this overlay, I figured I might get some better support here, I've been playing games at decent performance using both OpenGL and vulkan, so the hardware is detected.

Is there a flag that might not be enabled in the bcache kernel that breaks rocm support?

$ lsmod | grep amd
amdgpu               6402048  65
iommu_v2               20480  1 amdgpu
gpu_sched              40960  1 amdgpu
edac_mce_amd           32768  0
ttm                   122880  1 amdgpu
drm_kms_helper        258048  1 amdgpu
drm                   618496  21 gpu_sched,drm_kms_helper,amdgpu,ttm
i2c_algo_bit           16384  1 amdgpu
backlight              24576  4 video,asus_wmi,amdgpu,drm
i2c_core               98304  5 drm_kms_helper,i2c_algo_bit,amdgpu,i2c_piix4,drm
gpio_amdpt             20480  0
gpio_generic           20480  1 gpio_amdpt
pinctrl_amd            32768  0
kvm_amd               102400  0
kvm                   831488  1 kvm_amd

Is it because I'm missing kfd?

acowley commented 3 years ago

I don’t know anything about the bcachefs kernel, unfortunately, but here’s a shot in the dark: I needed to tweak the NixOS kernel configuration way back when to get rocm working properly. It’s conceivable these options are not set properly for you.