Skip to content

Commit 1ef29ec

Browse files
authored
Update GPUCompiler to fix unreachable control flow. (#1951)
1 parent 8ffc4a6 commit 1ef29ec

File tree

4 files changed

+11
-20
lines changed

4 files changed

+11
-20
lines changed

Manifest.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ version = "0.1.5"
111111

112112
[[GPUCompiler]]
113113
deps = ["ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "Scratch", "TimerOutputs", "UUIDs"]
114-
git-tree-sha1 = "cb090aea21c6ca78d59672a7e7d13bd56d09de64"
114+
git-tree-sha1 = "c47730aca2381f935a52fd732190e424c507230e"
115115
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
116-
version = "0.20.3"
116+
version = "0.21.0"
117117

118118
[[InteractiveUtils]]
119119
deps = ["Markdown"]

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ CUDA_Runtime_Discovery = "0.2"
4141
CUDA_Runtime_jll = "0.6"
4242
ExprTools = "0.1"
4343
GPUArrays = "8.6"
44-
GPUCompiler = "0.20"
44+
GPUCompiler = "0.21"
4545
KernelAbstractions = "0.9.2"
4646
LLVM = "5"
4747
Preferences = "1"

lib/cudadrv/state.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ function context(dev::CuDevice)
241241
maxlog=1, _id=devidx)
242242
end
243243

244+
# warn about some known bugs
245+
if runtime_version() < v"11.5" && capability(dev) < v"7"
246+
@warn("""There are known codegen bugs on CUDA 11.4 and earlier for older GPUs like your $(name(dev)).
247+
Please use CUDA 11.5 or later, or switch to a different device.""",
248+
maxlog=1, _id=devidx)
249+
end
250+
244251
# configure the primary context
245252
pctx = CuPrimaryContext(dev)
246253
ctx = CuContext(pctx)

src/compiler/compilation.jl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,11 @@ end
8888
# (we actually only need 6.2, but NVPTX doesn't support that)
8989
ptx = v"6.3"
9090

91-
# we need to take care emitting LLVM instructions like `unreachable`, which
92-
# may result in thread-divergent control flow that older `ptxas` doesn't like.
93-
# see e.g. JuliaGPU/CUDAnative.jl#4
94-
unreachable = true
95-
if cap < v"7" || runtime_version() < v"11.3"
96-
unreachable = false
97-
end
98-
99-
# there have been issues with emitting PTX `exit` instead of `trap` as well,
100-
# see e.g. JuliaGPU/CUDA.jl#431 and NVIDIA bug #3231266 (but since switching
101-
# to the toolkit's `ptxas` that specific machine/GPU now _requires_ exit...)
102-
exitable = true
103-
if cap < v"7"
104-
exitable = false
105-
end
106-
10791
# NVIDIA bug #3600554: ptxas segfaults with our debug info, fixed in 11.7
10892
debuginfo = runtime_version() >= v"11.7"
10993

11094
# create GPUCompiler objects
111-
target = PTXCompilerTarget(; cap, ptx, debuginfo, unreachable, exitable, kwargs...)
95+
target = PTXCompilerTarget(; cap, ptx, debuginfo, kwargs...)
11296
params = CUDACompilerParams()
11397
CompilerConfig(target, params; kernel, name, always_inline)
11498
end

0 commit comments

Comments
 (0)