Skip to content

Commit 82fe477

Browse files
authored
Metal: Work around function attribute changes in LLVM 16. (#564)
1 parent ed8c3a8 commit 82fe477

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GPUCompiler"
22
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
33
authors = ["Tim Besard <tim.besard@gmail.com>"]
4-
version = "0.26.3"
4+
version = "0.26.4"
55

66
[deps]
77
ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04"

src/metal.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,12 @@ function annotate_air_intrinsics!(@nospecialize(job::CompilerJob), mod::LLVM.Mod
10691069
attrs = function_attributes(f)
10701070
function add_attributes(names...)
10711071
for name in names
1072+
if LLVM.version() >= v"16" && name in ["argmemonly", "inaccessiblememonly",
1073+
"inaccessiblemem_or_argmemonly",
1074+
"readnone", "readonly", "writeonly"]
1075+
# XXX: workaround for changes from https://reviews.llvm.org/D135780
1076+
continue
1077+
end
10721078
push!(attrs, EnumAttribute(name, 0))
10731079
end
10741080
changed = true
@@ -1080,12 +1086,16 @@ function annotate_air_intrinsics!(@nospecialize(job::CompilerJob), mod::LLVM.Mod
10801086

10811087
# atomics
10821088
elseif match(r"air.atomic.(local|global).load", fn) !== nothing
1083-
add_attributes("argmemonly", "nounwind", "readonly")
1089+
# TODO: "memory(argmem: read)" on LLVM 16+
1090+
add_attributes("argmemonly", "readonly", "nounwind")
10841091
elseif match(r"air.atomic.(local|global).store", fn) !== nothing
1085-
add_attributes("argmemonly", "nounwind", "writeonly")
1092+
# TODO: "memory(argmem: write)" on LLVM 16+
1093+
add_attributes("argmemonly", "writeonly", "nounwind")
10861094
elseif match(r"air.atomic.(local|global).(xchg|cmpxchg)", fn) !== nothing
1095+
# TODO: "memory(argmem: readwrite)" on LLVM 16+
10871096
add_attributes("argmemonly", "nounwind")
10881097
elseif match(r"^air.atomic.(local|global).(add|sub|min|max|and|or|xor)", fn) !== nothing
1098+
# TODO: "memory(argmem: readwrite)" on LLVM 16+
10891099
add_attributes("argmemonly", "nounwind")
10901100
end
10911101
end

0 commit comments

Comments
 (0)