# AMDGPU.jl issues

**URL:** <https://discourse.julialang.org/t/amdgpu-jl-issues/136171>\
**Category:** Machine Learning\
**Created:** [March 12, 2026, 10:03pm UTC](https://discourse.julialang.org/t/amdgpu-jl-issues/136171 "2026-03-12T22:03:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcbritobr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jcbritobr/32/219275_2.png) [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Post date:** [March 12, 2026, 10:03pm UTC](https://discourse.julialang.org/t/amdgpu-jl-issues/136171/1 "2026-03-12T22:03:10Z")

</div>

Hello, good evening.  
Im having issue to work with amdgpu.jl and ROCM Hip. The issue happens when

```julia
	device = MLDataDevices.AMDGPUDevice() # get device.
	
    # Multilayer Perceptron:
    model = Chain(
        Dense(2 => 3, tanh),      
        BatchNorm(3),
        Dense(3 => 2)) |> device # Move data to device.

```

Worked with cuda, but for amd I cant put to work. May someone help please? Gemini cant help also.

```julia-auto
MethodError: no method matching amdgpu_array_adapt(::AMDGPUDevice{Nothing, Missing}, ::Matrix{Float32}) The function `amdgpu_array_adapt` exists, but no method is defined for this combination of argument types. Closest candidates are: amdgpu_array_adapt(::Type{T}, ::Any) where T @ AMDGPUExt [~/.julia/packages/MLDataDevices/4qHOT/ext/AMDGPUExt.jl:81](http://localhost:8888/home/jgardona/.julia/packages/MLDataDevices/4qHOT/ext/AMDGPUExt.jl#line=80)

```

---

<div class="post-metadata">

**Author:** ![jcbritobr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jcbritobr/32/219275_2.png) [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Post date:** [March 12, 2026, 10:35pm UTC](https://discourse.julialang.org/t/amdgpu-jl-issues/136171/2 "2026-03-12T22:35:07Z")

</div>

This worked for me. If somene has a solution to use the methods above, please show me.

```julia
	# Move manually:
	model = fmap(x -> x isa AbstractArray ? AMDGPU.ROCArray(x) : x, model)

```

---

<div class="post-metadata">

**Author:** ![jcbritobr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jcbritobr/32/219275_2.png) [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Post date:** [March 12, 2026, 11:39pm UTC](https://discourse.julialang.org/t/amdgpu-jl-issues/136171/3 "2026-03-12T23:39:49Z")

</div>

Here is the solution I could build. I think the issue with the code above is a bug in get\_device()/AMDGPUDevice(). Using low level functions for amd rocm worked as expected, and I have migrate the flux xor example for AMD Rocm.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/f/af006f32f5e44893f46de383d2ad4f0f7a4a9800.jpeg)

```julia
let
	noisy = rand(Float32, 2, 1000)
	truth = [xor(col[1]>0.5, col[2]>0.5) for col in eachcol(noisy)]
	target = Flux.onehotbatch(truth, [true, false])
	
	gpu(x) = fmap(AMDGPU.roc, x) 
	cpu(x) = fmap(Array, x)
	
	model = Chain(
	    Dense(2 => 3, tanh),      
	    BatchNorm(3),
	    Dense(3 => 2)) |> gpu
	
	out1 = model(noisy |> gpu)
	probs1 = softmax(out1) |> cpu
	
	loader = Flux.DataLoader((noisy, target), batchsize=64, shuffle=true);
	opt_state = Flux.setup(Flux.Adam(0.01), model)
	
	losses = []
	for epoch in 1:1_000
	    for (x_cpu, y_cpu) in loader
	        x, y = x_cpu |> gpu, y_cpu |> gpu
	        
	        loss, grads = Flux.withgradient(model) do m
	            y_hat = m(x)
	            Flux.logitcrossentropy(y_hat, y)
	        end
	        Flux.update!(opt_state, model, grads[1])
	        push!(losses, loss)  
	    end
	end
	
	out2 = model(noisy |> gpu)         
	probs2 = softmax(out2) |> cpu         
	acc = mean((probs2[1,:] .> 0.5) .== truth)
	@info "Acurácia Final: $acc"

	# Plots
	p_true = scatter(noisy[1,:], noisy[2,:], zcolor=truth, title="True")
	p_raw = scatter(noisy[1,:], noisy[2,:], zcolor=probs1[1,:], title="Untrained", clims=(0,1))
	p_done = scatter(noisy[1,:], noisy[2,:], zcolor=probs2[1,:], title="Trained")
	plosses = plot(losses; xaxis=(:log10, "iteration"), yaxis="loss", label="per batch")
	n = length(loader)
	plot!(n:n:length(losses), mean.(Iterators.partition(losses, n)),
    label="epoch mean", dpi=200)
	plot(p_true, p_raw, p_done, plosses, layout=(2,3), size=(1000,330))
end

```

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [March 17, 2026, 3:03pm UTC](https://discourse.julialang.org/t/amdgpu-jl-issues/136171/4 "2026-03-17T15:03:17Z")

</div>

This looks to be a bug with Flux.jl, not with AMDGPU.jl. It would be worth filing an issue on the Flux repo with your findings 😃

---

<div class="post-metadata">

**Author:** ![CarloLucibello](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carlolucibello/32/3278_2.png) [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Post date:** [March 22, 2026, 6:11pm UTC](https://discourse.julialang.org/t/amdgpu-jl-issues/136171/5 "2026-03-22T18:11:34Z")

</div>

Could be an issue with MLDataDevices.jl

> <https://github.com/LuxDL/Lux.jl/issues/1676>
>
> Flux's tests have been failing lately on AMDGPU due to a missing \`amdgpu\_array\_a…dapt\` method. Is there any recent change in MLDataDevices that could be causing this?
> 
> Here is a stacktrace from a buildkite run https://buildkite.com/julialang/flux-dot-jl/builds/5752/steps/canvas?sid=019cf063-452f-48bf-9dfe-c0153fbb087a#019cf063-455b-462c-a7b7-976c6d114cc1
> 
> \`\`\`
> MethodError: no method matching amdgpu\_array\_adapt(::AMDGPUDevice{Nothing, Missing}, ::Matrix{Float64})
> \--
> The function \`amdgpu\_array\_adapt\` exists, but no method is defined for this combination of argument types.
>  
> Closest candidates are:
> amdgpu\_array\_adapt(::Type{T}, ::Any) where T
> @ AMDGPUExt ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/MLDataDevices/4qHOT/ext/AMDGPUExt.jl:81
>  
> Stacktrace:
> \[1\] adapt\_storage(to::AMDGPUDevice{Nothing, Missing}, x::Matrix{Float64})
> @ AMDGPUExt ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/MLDataDevices/4qHOT/ext/AMDGPUExt.jl:90
> \[2\] adapt\_structure(to::Function, x::Matrix{Float64})
> @ Adapt ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Adapt/aYlRH/src/Adapt.jl:57
> \[3\] adapt(to::Function, x::Matrix{Float64})
> @ Adapt ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Adapt/aYlRH/src/Adapt.jl:40
> \[4\] (::Base.Fix1{typeof(Adapt.adapt), AMDGPUDevice{Nothing, Missing}})(arg::Matrix{Float64}; kws::@Kwargs{})
> @ Base ./operators.jl:1193
> \[5\] (::Functors.ExcludeWalk{Functors.DefaultWalk, Base.Fix1{typeof(Adapt.adapt), AMDGPUDevice{Nothing, Missing}}, typeof(MLDataDevices.isleaf)})(::Function, ::Matrix{Float64})
> @ Functors ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Functors/LbNAu/src/walks.jl:126
> \[6\] (::Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, Base.Fix1{typeof(Adapt.adapt), AMDGPUDevice{Nothing, Missing}}, typeof(MLDataDevices.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, Base.Fix1{typeof(Adapt.adapt), AMDGPUDevice{Nothing, Missing}}, typeof(MLDataDevices.isleaf)}, IdDict{Any, Any}}})(::Function, ::Matrix{Float64})
> @ Functors ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Functors/LbNAu/src/walks.jl:177
> \[7\] execute(::Functors.CachedWalk{Functors.ExcludeWalk{Functors.DefaultWalk, Base.Fix1{typeof(Adapt.adapt), AMDGPUDevice{Nothing, Missing}}, typeof(MLDataDevices.isleaf)}, Functors.NoKeyword, Functors.WalkCache{Any, Any, Functors.ExcludeWalk{Functors.DefaultWalk, Base.Fix1{typeof(Adapt.adapt), AMDGPUDevice{Nothing, Missing}}, typeof(MLDataDevices.isleaf)}, IdDict{Any, Any}}}, ::Matrix{Float64})
> @ Functors ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Functors/LbNAu/src/walks.jl:55
> \[8\] fmap(::Function, ::Matrix{Float64}; exclude::Function, walk::Functors.DefaultWalk, cache::IdDict{Any, Any}, prune::Functors.NoKeyword)
> @ Functors ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Functors/LbNAu/src/maps.jl:11
> \[9\] fmap
> @ ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/Functors/LbNAu/src/maps.jl:3 \[inlined\]
> \[10\] AbstractDevice
> @ ~/.cache/julia-buildkite-plugin/depots/d4264945-9bae-4dd2-a715-3cee20da2dbf/packages/MLDataDevices/4qHOT/src/public.jl:516 \[inlined\]
> \[11\] gpu
> @ /var/lib/buildkite-agent/builds/amdgpu1-luraess-com/julialang/flux-dot-jl/src/functor.jl:116 \[inlined\]
> \[12\] \\|\>(x::Matrix{Float64}, f::typeof(gpu))
> \`\`\`

now fixed
