Giter Club home page Giter Club logo

Comments (11)

nsailor avatar nsailor commented on June 12, 2024 1

Just tested with Julia 1.5.1:

Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 2600 Six-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, znver1)

and the example seems to work, despite build AMDGPU warning me that the build failed.

from amdgpu.jl.

jpsamaroo avatar jpsamaroo commented on June 12, 2024 1

LLVM.jl needs to be at least 3.0, which is the release that has the appropriate changes. You should be able to run the following code if your LLVM.jl version if correct:

using LLVM, LLVM.Interop
JuliaContext() do ctx
end

from amdgpu.jl.

jpsamaroo avatar jpsamaroo commented on June 12, 2024

This is one of two possible things:

  1. Your ROCR library isn't installed, or isn't found by AMDGPU.jl (check the build logs to see if this is the case, it's called "HSA")
  2. The build logic is crap and needs fixing

I can push a fix for 2. in a few minutes.

from amdgpu.jl.

Cvikli avatar Cvikli commented on June 12, 2024

I found a code that could show I don't see any "agent" which is interesting in this case after the tutorial.

using AMDGPU
@show AMDGPU.agents()

Results:
AMDGPU.agents() = HSAAgent[]

I will look after this ROCR, didn't know it is something I need yet. Will be back with the results.

Thank you for the fast reply!

from amdgpu.jl.

jpsamaroo avatar jpsamaroo commented on June 12, 2024

AMDGPU.agents() only shows the agents that have been detected during HSA initialization; however, if HSA init fails or is skipped, then it will return an empty vector. I suspect HSA initialization is either failing or being skipped for you. #44 should fix HSA init being skipped incorrectly.

from amdgpu.jl.

Cvikli avatar Cvikli commented on June 12, 2024

With 0.2.0. Runnin the test code:

using AMDGPU
@show AMDGPU.agents()

N=32
a = rand(Float64, N)
b = rand(Float64, N)
c_cpu = a + b

a_d = AMDGPU.HSAArray(a)
b_d = AMDGPU.HSAArray(b)

c_d = similar(a_d)

function vadd!(c, a, b)
	i = workitemIdx().x
	c[i] = a[i] + b[i]
	return
end

wait(@roc groupsize=N vadd!(c_d, a_d, b_d))

The output:

AMDGPU.agents() = HSAAgent[GPU: Vega 20 [Radeon VII] (gfx906), GPU: Vega 20 [Radeon VII] (gfx906), GPU: Vega 20 [Radeon VII] (gfx906), CPU: AMD Ryzen Threadripper 1950X 16-Core Processor]
ERROR: LoadError: MethodError: no method matching JuliaContext(::AMDGPU.var"#231#233"{LLVM.Module})
Closest candidates are:
  JuliaContext() at /home/user/.julia/packages/LLVM/T8ZBA/src/interop/base.jl:8
Stacktrace:
 [1] emit_exception_user!(::LLVM.Module) at /home/user/.julia/packages/AMDGPU/nnddY/src/exceptions.jl:34
 [2] process_module! at /home/user/.julia/packages/AMDGPU/nnddY/src/compiler.jl:19 [inlined]
 [3] irgen(::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}, ::Core.MethodInstance, ::UInt64) at /home/user/.julia/packages/GPUCompiler/rABm5/src/irgen.jl:366
 [4] macro expansion at /home/user/.julia/packages/TimerOutputs/dVnaw/src/TimerOutput.jl:206 [inlined]
 [5] macro expansion at /home/user/.julia/packages/GPUCompiler/rABm5/src/driver.jl:101 [inlined]
 [6] macro expansion at /home/user/.julia/packages/TimerOutputs/dVnaw/src/TimerOutput.jl:206 [inlined]
 [7] codegen(::Symbol, ::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/user/.julia/packages/GPUCompiler/rABm5/src/driver.jl:100
 [8] emit_function!(::LLVM.Module, ::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}, ::Function, ::GPUCompiler.Runtime.RuntimeMethodInstance) at /home/user/.julia/packages/GPUCompiler/rABm5/src/rtlib.jl:77
 [9] build_runtime(::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}) at /home/user/.julia/packages/GPUCompiler/rABm5/src/rtlib.jl:117
 [10] (::GPUCompiler.var"#65#68"{GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams},String,String})() at /home/user/.julia/packages/GPUCompiler/rABm5/src/rtlib.jl:159
 [11] get!(::GPUCompiler.var"#65#68"{GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams},String,String}, ::Dict{String,LLVM.Module}, ::String) at ./dict.jl:450
 [12] load_runtime(::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}) at /home/user/.julia/packages/GPUCompiler/rABm5/src/rtlib.jl:151
 [13] codegen(::Symbol, ::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/user/.julia/packages/GPUCompiler/rABm5/src/driver.jl:96
 [14] compile(::Symbol, ::GPUCompiler.CompilerJob{GPUCompiler.GCNCompilerTarget,AMDGPU.ROCCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/user/.julia/packages/GPUCompiler/rABm5/src/driver.jl:39
 [15] compile at /home/user/.julia/packages/GPUCompiler/rABm5/src/driver.jl:35 [inlined]
 [16] _rocfunction(::GPUCompiler.FunctionSpec{typeof(vadd!),Tuple{ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global}}}; device::AMDGPU.RuntimeDevice{HSAAgent}, queue::AMDGPU.RuntimeQueue{HSAQueue}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/AMDGPU/nnddY/src/execution.jl:324
 [17] _rocfunction at /home/user/.julia/packages/AMDGPU/nnddY/src/execution.jl:321 [inlined]
 [18] check_cache(::typeof(AMDGPU._rocfunction), ::GPUCompiler.FunctionSpec{typeof(vadd!),Tuple{ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global}}}, ::UInt64; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/GPUCompiler/rABm5/src/cache.jl:24
 [19] vadd! at /home/user/repo/amd_test/tests/test_AMD.jl:20 [inlined]
 [20] cached_compilation(::typeof(AMDGPU._rocfunction), ::GPUCompiler.FunctionSpec{typeof(vadd!),Tuple{ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global}}}, ::UInt64; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/GPUCompiler/rABm5/src/cache.jl:0
 [21] cached_compilation(::Function, ::GPUCompiler.FunctionSpec{typeof(vadd!),Tuple{ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global},ROCDeviceArray{Float64,1,AMDGPU.AS.Global}}}, ::UInt64) at /home/user/.julia/packages/GPUCompiler/rABm5/src/cache.jl:40 (repeats 2 times)
 [22] rocfunction(::Function, ::Type{T} where T; name::Nothing, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/user/.julia/packages/AMDGPU/nnddY/src/execution.jl:315
 [23] rocfunction(::Function, ::Type{T} where T) at /home/user/.julia/packages/AMDGPU/nnddY/src/execution.jl:314
 [24] top-level scope at /home/user/.julia/packages/AMDGPU/nnddY/src/execution.jl:184
 [25] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1088
 [26] include_string(::Module, ::String, ::String) at ./loading.jl:1096
in expression starting at /home/user/repo/amd_test/tests/test_AMD.jl:23

Which is already a little bit better.
What do you think what do I do wrong?

from amdgpu.jl.

jpsamaroo avatar jpsamaroo commented on June 12, 2024

That error is due to having an old LLVM version, which shouldn't happen. Can you try upgrading your packages and make sure your LLVM version is >= 3.0.0?

from amdgpu.jl.

Cvikli avatar Cvikli commented on June 12, 2024

That is interesting, I had 3.0 but now I downloaded the "#master" from github:
pkg> status

Status `~/repo/amd_test/Project.toml`
  [21141c5a] AMDGPU v0.2.0 `https://github.com/JuliaGPU/AMDGPU.jl.git#master`
  [6e4b80f9] BenchmarkTools v0.5.0
  [336ed68f] CSV v0.7.7
  [159f3aea] Cairo v1.0.5
  [81a5f4ea] CatViews v1.0.0
  [944b1d66] CodecZlib v0.7.0
  [5ae59095] Colors v0.12.4
  [a81c6b42] Compose v0.9.0
  [864edb3b] DataStructures v0.17.20
  [31c24e10] Distributions v0.23.10
  [da5c29d0] EllipsisNotation v0.4.0
  [587475ba] Flux v0.8.3
  [186bb1d3] Fontconfig v0.4.0
  [59287772] Formatting v0.4.1
  [28b8d3ca] GR v0.51.0
  [2535ab7d] JSON2 v0.3.2
  [0f8b85d8] JSON3 v1.1.1
  [1902f260] Knet v1.2.3
  [929cbde3] LLVM v3.0.0 `https://github.com/maleadt/LLVM.jl.git#master`
  [093fc24a] LightGraphs v1.3.3
  [c03570c3] Memoize v0.4.3
  [47be7bcc] ORCA v0.5.0
  [e4faabce] PProf v1.1.0
  [d96e819e] Parameters v0.12.1
  [ccf2f8ad] PlotThemes v2.0.0
  [58dd65bb] Plotly v0.3.0
  [f0f68f2c] PlotlyJS v0.14.0
  [91a5bcdd] Plots v1.6.0
  [c46f51b8] ProfileView v0.6.5
  [d330b81b] PyPlot v2.9.0
  [295af30f] Revise v2.7.3
  [aa65fe97] SnoopCompile v2.1.1
  [2913bbd2] StatsBase v0.33.1
  [37f6aa50] TikzPictures v3.2.0
  [bdfc003b] TimesDates v0.2.6
  [37b6cedf] Traceur v0.3.1
  [9f7883ad] Tracker v0.2.11
  [e88e6eb3] Zygote v0.5.5
  [10745b16] Statistics

Some more:
julia> versioninfo()

Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen Threadripper 1950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, znver1)
Environment:
  JULIA_EDITOR = "/snap/code/42/usr/share/code/code"
  JULIA_NUM_THREADS = 8

The error is unchanged for me. Any other idea?
Maybe the problem is that I built the clang and installed it as the description statet somewhere to build it:
➜ build git:(5ff5319) clang --version

clang version 12.0.0 (https://github.com/RadeonOpenCompute/llvm-project.git 0e84ebbde2430d9c8628e67e957e98e46ed32df1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm/llvm/bin

Do you think this can cause this issue?

Hmm I have two clang on my computer now: One in /opt/rocm/llvm/bin and one standard. I will check if this can cause the issue.
The standard one.
➜ ~ clang --version

clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

It seems to me there are many different LLVM.
What is your clang and julia version?

from amdgpu.jl.

Cvikli avatar Cvikli commented on June 12, 2024

Which LLVM version should I update, what do you think? The julia's llvm seems to be the same to me.

from amdgpu.jl.

Cvikli avatar Cvikli commented on June 12, 2024

You are right, I can't run this 3 liner example code!

from amdgpu.jl.

jpsamaroo avatar jpsamaroo commented on June 12, 2024

@Cvikli I would recommend you retry with a fresh Julia environment, since this appears to be an issue with the version of LLVM being pulled in. Since we lower-bound LLVM to 3, and no one else can reproduce this behavior, I'm closing this issue.

from amdgpu.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.