Using AMDGPU.jl with an AMD APU

I was trying AMDGPU.jl with an AMD APU. I was convinced that ROCm did not support APU’s, but this thread gave me hope that it might work.

I have a desktop with a Ryzen 4750G APU. I am running linux (Kubuntu 21.10 with a 5.17 kernel), with Julia version 1.7.3, AMDGPU.jl v0.3.3

So far, I have not been successful.

I get the following warning:

julia> using AMDGPU
┌ Warning: HSA runtime has not been built, runtime functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: Failed to initialize HSA runtime, status code: 4104
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:187
┌ Warning: ld.lld was not found, compilation functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:201
┌ Warning: ROCm-Device-Libs were not found, device intrinsics will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:215
┌ Warning: HIP library has not been built, HIP integration will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:231
┌ Warning: rocRAND_jll failed to load, RNG functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: false
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:245

If I try to build the package, I get:

(@v1.7) pkg> build AMDGPU
    Building AMDGPU → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/24cb88a8b763e4fe3c0be7eb3cc43505541b8581/build.log`
Precompiling project...
  ✓ AMDGPU
  1 dependency successfully precompiled in 8 seconds (180 already precompiled)
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version

If I test the package,

(@v1.7) pkg> test AMDGPU

I obtain:

     Testing Running tests...
┌ Warning: HSA runtime has not been built, runtime functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: Failed to initialize HSA runtime, status code: 4104
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:187
┌ Warning: ld.lld was not found, compilation functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:201
┌ Warning: ROCm-Device-Libs were not found, device intrinsics will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:215
┌ Warning: HIP library has not been built, HIP integration will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: unknown
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:231
┌ Warning: rocRAND_jll failed to load, RNG functionality will be unavailable.
│ Please run Pkg.build("AMDGPU") and reload AMDGPU.
│ Reason: false
└ @ AMDGPU ~/.julia/packages/AMDGPU/PtNLZ/src/AMDGPU.jl:245
AMDGPU: Test Failed at /home/bamorim/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:37
  Expression: AMDGPU.functional()
Stacktrace:
 [1] macro expansion
   @ ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/Test/src/Test.jl:445 [inlined]
 [2] macro expansion
   @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:37 [inlined]
 [3] macro expansion
   @ ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
 [4] top-level scope
   @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:33
AMDGPU: Error During Test at /home/bamorim/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:31
  Got exception outside of a @test
  AssertionError: AMDGPU.functional()
  Stacktrace:
   [1] macro expansion
     @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:38 [inlined]
   [2] macro expansion
     @ ~/julia/julia-1.7.3/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
   [3] top-level scope
     @ ~/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:33
   [4] include(fname::String)
     @ Base.MainInclude ./client.jl:451
   [5] top-level scope
     @ none:6
   [6] eval
     @ ./boot.jl:373 [inlined]
   [7] exec_options(opts::Base.JLOptions)
     @ Base ./client.jl:268
   [8] _start()
     @ Base ./client.jl:495
Test Summary: | Pass  Fail  Error  Total
AMDGPU        |   43     1      1     45
  Core        |   43                  43
ERROR: LoadError: Some tests did not pass: 43 passed, 1 failed, 1 errored, 0 broken.
in expression starting at /home/bamorim/.julia/packages/AMDGPU/PtNLZ/test/runtests.jl:31
ERROR: Package AMDGPU errored during testing

Has anyone encountered this before?

What permissions are on /dev/kfd and /dev/dri/*? This error often comes from having insufficient permissions to open those devices with read+write access.

Thank you for your reply. These are the premissions of those files/folders:

(base) bamorim@bamorim-AMD-4750g:/dev$ ls -l kfd
crw-rw---- 1 root render 510, 0 jun  2 10:38 kfd
(base) bamorim@bamorim-AMD-4750g:/dev$ ls -l dri
total 0
drwxr-xr-x  2 root root         80 jun  2 10:38 by-path
crw-rw----+ 1 root video  226,   0 jun  2 10:38 card0
crw-rw----+ 1 root render 226, 128 jun  2 10:38 renderD128

Do you have both the video and render groups assigned to your user? If so, these look fine to me.

That was probably the problem. My user was not listed as a member of the video and render groups. I added my user to those groups and the warnings went away!

Thanks a lot @jpsamaroo !

Now its time to explore how things work with the APU.