Skip to content

Commit c7954e8

Browse files
committed
[NNlibAMDGPUExt] Load MIOpen module only if MIOpen is available
1 parent 5a1c42c commit c7954e8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

ext/NNlibAMDGPUExt/NNlibAMDGPUExt.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module NNlibAMDGPUExt
22

33
using Adapt
44
using AMDGPU
5-
using AMDGPU.MIOpen
65
using ChainRulesCore
76
using NNlib
87
using NNlib: BatchedAdjoint, BatchedTranspose, BatchedAdjOrTrans
@@ -53,9 +52,15 @@ function nnlib_padding(dims)
5352
pd[1:2:end]
5453
end
5554

56-
include("conv.jl")
57-
include("pool.jl")
58-
include("softmax.jl")
59-
include("activations.jl")
55+
@static if AMDGPU.functional(:MIOpen)
56+
using AMDGPU.MIOpen
57+
58+
include("conv.jl")
59+
include("pool.jl")
60+
include("softmax.jl")
61+
include("activations.jl")
62+
else
63+
@warn "ROCm MIOpen is not available for AMDGPU. NNlib has limited functionality for AMDGPU."
64+
end
6065

6166
end

0 commit comments

Comments
 (0)