Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/metal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source_code(target::MetalCompilerTarget) = "text"
# Metal is not supported by our LLVM builds, so we can't get a target machine
llvm_machine(::MetalCompilerTarget) = nothing

llvm_triple(target::MetalCompilerTarget) = "air64-apple-macosx$(target.macos)"
llvm_triple(target::MetalCompilerTarget) = "air64_v$(target.air.major)$(target.air.minor)-apple-macosx$(target.macos)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what Apple does in AIR files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The air version gets appended to “air64” when -mmacosx-version-min is specified, or when a newer feature (like bfloat) is used. I can revert this and wait until we gave a feature that actually requires a newer air version is in (bfloat or logging) so that we can test if this is actually needed or not.


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

# synchronization
if fn == "air.wg.barrier" || fn == "air.simdgroup.barrier"
add_attributes("nounwind", "convergent")
add_attributes("nounwind", "mustprogress", "convergent", "willreturn")

# atomics
elseif match(r"air.atomic.(local|global).load", fn) !== nothing
Expand All @@ -1033,6 +1033,14 @@ function annotate_air_intrinsics!(@nospecialize(job::CompilerJob), mod::LLVM.Mod
elseif match(r"^air.atomic.(local|global).(add|sub|min|max|and|or|xor)", fn) !== nothing
# TODO: "memory(argmem: readwrite)" on LLVM 16+
add_attributes("argmemonly", "nounwind")

# simdgroup
elseif match(r"air.simdgroup_matrix_8x8_multiply_accumulate", fn) !== nothing
add_attributes("convergent", "mustprogress", "nounwind", "willreturn")
elseif match(r"air.simdgroup_matrix_8x8_load", fn) !== nothing
add_attributes("convergent", "mustprogress", "nofree", "nounwind", "readonly", "willreturn")
elseif match(r"air.simdgroup_matrix_8x8_store", fn) !== nothing
add_attributes("convergent", "mustprogress", "nounwind", "willreturn", "writeonly")
end
end

Expand Down
Loading