Skip to content

Commit 5ccad5b

Browse files
committed
Simdgroup intrinsic attributes and tweak llvm triple
1 parent 531dccd commit 5ccad5b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/metal.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ source_code(target::MetalCompilerTarget) = "text"
2626
# Metal is not supported by our LLVM builds, so we can't get a target machine
2727
llvm_machine(::MetalCompilerTarget) = nothing
2828

29-
llvm_triple(target::MetalCompilerTarget) = "air64-apple-macosx$(target.macos)"
29+
llvm_triple(target::MetalCompilerTarget) = "air64_v$(target.air.major)$(target.air.minor)-apple-macosx$(target.macos)"
3030

3131
llvm_datalayout(target::MetalCompilerTarget) =
3232
"e-p:64:64:64"*
@@ -1018,7 +1018,7 @@ function annotate_air_intrinsics!(@nospecialize(job::CompilerJob), mod::LLVM.Mod
10181018

10191019
# synchronization
10201020
if fn == "air.wg.barrier" || fn == "air.simdgroup.barrier"
1021-
add_attributes("nounwind", "convergent")
1021+
add_attributes("nounwind", "mustprogress", "convergent", "willreturn")
10221022

10231023
# atomics
10241024
elseif match(r"air.atomic.(local|global).load", fn) !== nothing
@@ -1033,6 +1033,14 @@ function annotate_air_intrinsics!(@nospecialize(job::CompilerJob), mod::LLVM.Mod
10331033
elseif match(r"^air.atomic.(local|global).(add|sub|min|max|and|or|xor)", fn) !== nothing
10341034
# TODO: "memory(argmem: readwrite)" on LLVM 16+
10351035
add_attributes("argmemonly", "nounwind")
1036+
1037+
# simdgroup
1038+
elseif match(r"air.simdgroup_matrix_8x8_multiply_accumulate", fn) !== nothing
1039+
add_attributes("convergent", "mustprogress", "nounwind", "willreturn")
1040+
elseif match(r"air.simdgroup_matrix_8x8_load", fn) !== nothing
1041+
add_attributes("convergent", "mustprogress", "nofree", "nounwind", "readonly", "willreturn")
1042+
elseif match(r"air.simdgroup_matrix_8x8_store", fn) !== nothing
1043+
add_attributes("convergent", "mustprogress", "nounwind", "willreturn", "writeonly")
10361044
end
10371045
end
10381046

0 commit comments

Comments
 (0)