Fixtures: split_store_tail, a row of floats written four at a time with its tail guarded

Our own MSL of the shape a guest kernel writes its output in: thread gid reads in[gid] (a float4)
and writes its lanes to a float buffer at element row * w + col, col = (gid % d) * 4. sst_split
stores the first lane in one block and the other three in the block its branch takes where
col | 3 is inside the row (else the next two, else the next one); sst_block stores the four in
one block. Apple's compiler keeps the four scalar stores, at add i32 %i, 1 / 2 / 3, zext to i64.
The element's byte offset is a multiple of 16 only where w is.

Companions from scripts/regen-air-fixtures (job m3-max-80214 on the M3: Metal 32023.922, SDK
27.2). The engine inventory gets its four rows, written as ok on every profile, and the golden
printout under tests/air_input comes from bless_engine_goldens on the M3 (m3-max-80509); the
golden hashes are left to the bless on development.
This commit is contained in:
Anees Iqbal committed 2026-12-02 16:24:49 -08:00
1 parent 6a922c4ea2
commit 2005dae350
6 files changed
+664

No files matched your search

@@ -379,6 +379,7 @@ fixture snapshot_discard: metal: Apple metal version 32023.922 (metalfe-32023.92
fixture snapshot_select: metal: Apple metal version 32023.922 (metalfe-32023.922.4); macosx-sdk: 27.2 (26B118)
fixture spc_bool_index: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture spc_num_samples: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture split_store_tail: metal: Apple metal version 32023.922 (metalfe-32023.922.4); macosx-sdk: 27.2 (26B118)
fixture sps2_residency_probes: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture spse_address_probes: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture spse_array_probes: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
@@ -0,0 +1,193 @@
; Generated by scripts/regen-air-fixtures from split_store_tail.metal (typed pointers; xcrun metal-as reassembles it). Do not edit.
; ModuleID = '-'
source_filename = "-"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
target triple = "air64_v28-apple-macosx26.0.0"
%struct.sst_args = type { i32, i32 }
; Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn
define void @sst_split(<4 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %0, float addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %1, %struct.sst_args addrspace(2)* nocapture noundef readonly align 4 dereferenceable(8) "air-buffer-no-alias" %2, i32 noundef %3) local_unnamed_addr #0 {
%5 = getelementptr inbounds %struct.sst_args, %struct.sst_args addrspace(2)* %2, i64 0, i32 1
%6 = load i32, i32 addrspace(2)* %5, align 4, !tbaa !24, !alias.scope !29, !noalias !32
%7 = urem i32 %3, %6
%8 = shl i32 %7, 2
%9 = getelementptr inbounds %struct.sst_args, %struct.sst_args addrspace(2)* %2, i64 0, i32 0
%10 = load i32, i32 addrspace(2)* %9, align 4, !tbaa !35, !alias.scope !29, !noalias !32
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %57
12: ; preds = %4
%13 = udiv i32 %3, %6
%14 = zext i32 %3 to i64
%15 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %0, i64 %14
%16 = load <4 x float>, <4 x float> addrspace(1)* %15, align 16, !tbaa !36, !alias.scope !37, !noalias !38
%17 = mul i32 %13, %10
%18 = add i32 %17, %8
%19 = extractelement <4 x float> %16, i64 0
%20 = zext i32 %18 to i64
%21 = getelementptr inbounds float, float addrspace(1)* %1, i64 %20
store float %19, float addrspace(1)* %21, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%22 = or i32 %8, 3
%23 = icmp ult i32 %22, %10
br i1 %23, label %24, label %37
24: ; preds = %12
%25 = extractelement <4 x float> %16, i64 1
%26 = add i32 %18, 1
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds float, float addrspace(1)* %1, i64 %27
store float %25, float addrspace(1)* %28, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%29 = extractelement <4 x float> %16, i64 2
%30 = add i32 %18, 2
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds float, float addrspace(1)* %1, i64 %31
store float %29, float addrspace(1)* %32, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%33 = extractelement <4 x float> %16, i64 3
%34 = add i32 %18, 3
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds float, float addrspace(1)* %1, i64 %35
store float %33, float addrspace(1)* %36, align 4, !tbaa !39, !alias.scope !41, !noalias !42
br label %57
37: ; preds = %12
%38 = or i32 %8, 2
%39 = icmp ult i32 %38, %10
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = extractelement <4 x float> %16, i64 1
%42 = add i32 %18, 1
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds float, float addrspace(1)* %1, i64 %43
store float %41, float addrspace(1)* %44, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%45 = extractelement <4 x float> %16, i64 2
%46 = add i32 %18, 2
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds float, float addrspace(1)* %1, i64 %47
store float %45, float addrspace(1)* %48, align 4, !tbaa !39, !alias.scope !41, !noalias !42
br label %57
49: ; preds = %37
%50 = or i32 %8, 1
%51 = icmp ult i32 %50, %10
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = add i32 %18, 1
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds float, float addrspace(1)* %1, i64 %54
%56 = extractelement <4 x float> %16, i64 1
store float %56, float addrspace(1)* %55, align 4, !tbaa !39, !alias.scope !41, !noalias !42
br label %57
57: ; preds = %24, %49, %52, %40, %4
ret void
}
; Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind willreturn
define void @sst_block(<4 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %0, float addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %1, %struct.sst_args addrspace(2)* nocapture noundef readonly align 4 dereferenceable(8) "air-buffer-no-alias" %2, i32 noundef %3) local_unnamed_addr #0 {
%5 = getelementptr inbounds %struct.sst_args, %struct.sst_args addrspace(2)* %2, i64 0, i32 1
%6 = load i32, i32 addrspace(2)* %5, align 4, !tbaa !24, !alias.scope !43, !noalias !46
%7 = urem i32 %3, %6
%8 = shl i32 %7, 2
%9 = or i32 %8, 3
%10 = getelementptr inbounds %struct.sst_args, %struct.sst_args addrspace(2)* %2, i64 0, i32 0
%11 = load i32, i32 addrspace(2)* %10, align 4, !tbaa !35, !alias.scope !43, !noalias !46
%12 = icmp ult i32 %9, %11
br i1 %12, label %13, label %35
13: ; preds = %4
%14 = udiv i32 %3, %6
%15 = zext i32 %3 to i64
%16 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %0, i64 %15
%17 = load <4 x float>, <4 x float> addrspace(1)* %16, align 16, !tbaa !36, !alias.scope !49, !noalias !50
%18 = mul i32 %14, %11
%19 = add i32 %18, %8
%20 = extractelement <4 x float> %17, i64 0
%21 = zext i32 %19 to i64
%22 = getelementptr inbounds float, float addrspace(1)* %1, i64 %21
store float %20, float addrspace(1)* %22, align 4, !tbaa !39, !alias.scope !51, !noalias !52
%23 = extractelement <4 x float> %17, i64 1
%24 = add i32 %19, 1
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds float, float addrspace(1)* %1, i64 %25
store float %23, float addrspace(1)* %26, align 4, !tbaa !39, !alias.scope !51, !noalias !52
%27 = extractelement <4 x float> %17, i64 2
%28 = add i32 %19, 2
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds float, float addrspace(1)* %1, i64 %29
store float %27, float addrspace(1)* %30, align 4, !tbaa !39, !alias.scope !51, !noalias !52
%31 = extractelement <4 x float> %17, i64 3
%32 = add i32 %19, 3
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds float, float addrspace(1)* %1, i64 %33
store float %31, float addrspace(1)* %34, align 4, !tbaa !39, !alias.scope !51, !noalias !52
br label %35
35: ; preds = %4, %13
ret void
}
attributes #0 = { argmemonly mustprogress nofree norecurse nosync nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
!air.kernel = !{!9, !17}
!air.compile_options = !{!18, !19, !20}
!llvm.ident = !{!21}
!air.version = !{!22}
!air.language_version = !{!23}
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 2]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 7, !"frame-pointer", i32 2}
!3 = !{i32 7, !"air.max_device_buffers", i32 31}
!4 = !{i32 7, !"air.max_constant_buffers", i32 31}
!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31}
!6 = !{i32 7, !"air.max_textures", i32 128}
!7 = !{i32 7, !"air.max_read_write_textures", i32 8}
!8 = !{i32 7, !"air.max_samplers", i32 16}
!9 = !{void (<4 x float> addrspace(1)*, float addrspace(1)*, %struct.sst_args addrspace(2)*, i32)* @sst_split, !10, !11}
!10 = !{}
!11 = !{!12, !13, !14, !16}
!12 = !{i32 0, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 1, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 16, !"air.arg_type_name", !"float4", !"air.arg_name", !"in"}
!13 = !{i32 1, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"float", !"air.arg_name", !"out"}
!14 = !{i32 2, !"air.buffer", !"air.buffer_size", i32 8, !"air.location_index", i32 2, i32 1, !"air.read", !"air.address_space", i32 2, !"air.struct_type_info", !15, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"sst_args", !"air.arg_name", !"a"}
!15 = !{i32 0, i32 4, i32 0, !"uint", !"w", i32 4, i32 4, i32 0, !"uint", !"d"}
!16 = !{i32 3, !"air.thread_position_in_grid", !"air.arg_type_name", !"uint", !"air.arg_name", !"gid"}
!17 = !{void (<4 x float> addrspace(1)*, float addrspace(1)*, %struct.sst_args addrspace(2)*, i32)* @sst_block, !10, !11}
!18 = !{!"air.compile.denorms_disable"}
!19 = !{!"air.compile.fast_math_enable"}
!20 = !{!"air.compile.framebuffer_fetch_enable"}
!21 = !{!"Apple metal version 32023.922 (metalfe-32023.922.4)"}
!22 = !{i32 2, i32 8, i32 0}
!23 = !{!"Metal", i32 4, i32 0, i32 0}
!24 = !{!25, !26, i64 4}
!25 = !{!"_ZTS8sst_args", !26, i64 0, !26, i64 4}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C++ TBAA"}
!29 = !{!30}
!30 = distinct !{!30, !31, !"air-alias-scope-arg(2)"}
!31 = distinct !{!31, !"air-alias-scopes(sst_split)"}
!32 = !{!33, !34}
!33 = distinct !{!33, !31, !"air-alias-scope-arg(0)"}
!34 = distinct !{!34, !31, !"air-alias-scope-arg(1)"}
!35 = !{!25, !26, i64 0}
!36 = !{!27, !27, i64 0}
!37 = !{!33}
!38 = !{!34, !30}
!39 = !{!40, !40, i64 0}
!40 = !{!"float", !27, i64 0}
!41 = !{!34}
!42 = !{!33, !30}
!43 = !{!44}
!44 = distinct !{!44, !45, !"air-alias-scope-arg(2)"}
!45 = distinct !{!45, !"air-alias-scopes(sst_block)"}
!46 = !{!47, !48}
!47 = distinct !{!47, !45, !"air-alias-scope-arg(0)"}
!48 = distinct !{!48, !45, !"air-alias-scope-arg(1)"}
!49 = !{!47}
!50 = !{!48, !44}
!51 = !{!48}
!52 = !{!47, !44}
@@ -0,0 +1,193 @@
; Generated by scripts/regen-air-fixtures from split_store_tail.metal (llvm-dis of split_store_tail.air). Do not edit.
; ModuleID = '<stdin>'
source_filename = "-"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
target triple = "air64_v28-apple-macosx26.0.0"
%struct.sst_args = type { i32, i32 }
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @sst_split(ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %0, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %1, ptr addrspace(2) noundef readonly align 4 captures(none) dereferenceable(8) "air-buffer-no-alias" %2, i32 noundef %3) local_unnamed_addr #0 {
%5 = getelementptr inbounds %struct.sst_args, ptr addrspace(2) %2, i64 0, i32 1
%6 = load i32, ptr addrspace(2) %5, align 4, !tbaa !24, !alias.scope !29, !noalias !32
%7 = urem i32 %3, %6
%8 = shl i32 %7, 2
%9 = getelementptr inbounds %struct.sst_args, ptr addrspace(2) %2, i64 0, i32 0
%10 = load i32, ptr addrspace(2) %9, align 4, !tbaa !35, !alias.scope !29, !noalias !32
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %57
12: ; preds = %4
%13 = udiv i32 %3, %6
%14 = zext i32 %3 to i64
%15 = getelementptr inbounds <4 x float>, ptr addrspace(1) %0, i64 %14
%16 = load <4 x float>, ptr addrspace(1) %15, align 16, !tbaa !36, !alias.scope !37, !noalias !38
%17 = mul i32 %13, %10
%18 = add i32 %17, %8
%19 = extractelement <4 x float> %16, i64 0
%20 = zext i32 %18 to i64
%21 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %20
store float %19, ptr addrspace(1) %21, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%22 = or i32 %8, 3
%23 = icmp ult i32 %22, %10
br i1 %23, label %24, label %37
24: ; preds = %12
%25 = extractelement <4 x float> %16, i64 1
%26 = add i32 %18, 1
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %27
store float %25, ptr addrspace(1) %28, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%29 = extractelement <4 x float> %16, i64 2
%30 = add i32 %18, 2
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %31
store float %29, ptr addrspace(1) %32, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%33 = extractelement <4 x float> %16, i64 3
%34 = add i32 %18, 3
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %35
store float %33, ptr addrspace(1) %36, align 4, !tbaa !39, !alias.scope !41, !noalias !42
br label %57
37: ; preds = %12
%38 = or i32 %8, 2
%39 = icmp ult i32 %38, %10
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = extractelement <4 x float> %16, i64 1
%42 = add i32 %18, 1
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %43
store float %41, ptr addrspace(1) %44, align 4, !tbaa !39, !alias.scope !41, !noalias !42
%45 = extractelement <4 x float> %16, i64 2
%46 = add i32 %18, 2
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %47
store float %45, ptr addrspace(1) %48, align 4, !tbaa !39, !alias.scope !41, !noalias !42
br label %57
49: ; preds = %37
%50 = or i32 %8, 1
%51 = icmp ult i32 %50, %10
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = add i32 %18, 1
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %54
%56 = extractelement <4 x float> %16, i64 1
store float %56, ptr addrspace(1) %55, align 4, !tbaa !39, !alias.scope !41, !noalias !42
br label %57
57: ; preds = %52, %49, %40, %24, %4
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
define void @sst_block(ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %0, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %1, ptr addrspace(2) noundef readonly align 4 captures(none) dereferenceable(8) "air-buffer-no-alias" %2, i32 noundef %3) local_unnamed_addr #0 {
%5 = getelementptr inbounds %struct.sst_args, ptr addrspace(2) %2, i64 0, i32 1
%6 = load i32, ptr addrspace(2) %5, align 4, !tbaa !24, !alias.scope !43, !noalias !46
%7 = urem i32 %3, %6
%8 = shl i32 %7, 2
%9 = or i32 %8, 3
%10 = getelementptr inbounds %struct.sst_args, ptr addrspace(2) %2, i64 0, i32 0
%11 = load i32, ptr addrspace(2) %10, align 4, !tbaa !35, !alias.scope !43, !noalias !46
%12 = icmp ult i32 %9, %11
br i1 %12, label %13, label %35
13: ; preds = %4
%14 = udiv i32 %3, %6
%15 = zext i32 %3 to i64
%16 = getelementptr inbounds <4 x float>, ptr addrspace(1) %0, i64 %15
%17 = load <4 x float>, ptr addrspace(1) %16, align 16, !tbaa !36, !alias.scope !49, !noalias !50
%18 = mul i32 %14, %11
%19 = add i32 %18, %8
%20 = extractelement <4 x float> %17, i64 0
%21 = zext i32 %19 to i64
%22 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %21
store float %20, ptr addrspace(1) %22, align 4, !tbaa !39, !alias.scope !51, !noalias !52
%23 = extractelement <4 x float> %17, i64 1
%24 = add i32 %19, 1
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %25
store float %23, ptr addrspace(1) %26, align 4, !tbaa !39, !alias.scope !51, !noalias !52
%27 = extractelement <4 x float> %17, i64 2
%28 = add i32 %19, 2
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %29
store float %27, ptr addrspace(1) %30, align 4, !tbaa !39, !alias.scope !51, !noalias !52
%31 = extractelement <4 x float> %17, i64 3
%32 = add i32 %19, 3
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds float, ptr addrspace(1) %1, i64 %33
store float %31, ptr addrspace(1) %34, align 4, !tbaa !39, !alias.scope !51, !noalias !52
br label %35
35: ; preds = %13, %4
ret void
}
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
!air.kernel = !{!9, !17}
!air.compile_options = !{!18, !19, !20}
!llvm.ident = !{!21}
!air.version = !{!22}
!air.language_version = !{!23}
!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 2]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 7, !"frame-pointer", i32 2}
!3 = !{i32 7, !"air.max_device_buffers", i32 31}
!4 = !{i32 7, !"air.max_constant_buffers", i32 31}
!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31}
!6 = !{i32 7, !"air.max_textures", i32 128}
!7 = !{i32 7, !"air.max_read_write_textures", i32 8}
!8 = !{i32 7, !"air.max_samplers", i32 16}
!9 = !{ptr @sst_split, !10, !11}
!10 = !{}
!11 = !{!12, !13, !14, !16}
!12 = !{i32 0, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 1, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 16, !"air.arg_type_name", !"float4", !"air.arg_name", !"in"}
!13 = !{i32 1, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"float", !"air.arg_name", !"out"}
!14 = !{i32 2, !"air.buffer", !"air.buffer_size", i32 8, !"air.location_index", i32 2, i32 1, !"air.read", !"air.address_space", i32 2, !"air.struct_type_info", !15, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"sst_args", !"air.arg_name", !"a"}
!15 = !{i32 0, i32 4, i32 0, !"uint", !"w", i32 4, i32 4, i32 0, !"uint", !"d"}
!16 = !{i32 3, !"air.thread_position_in_grid", !"air.arg_type_name", !"uint", !"air.arg_name", !"gid"}
!17 = !{ptr @sst_block, !10, !11}
!18 = !{!"air.compile.denorms_disable"}
!19 = !{!"air.compile.fast_math_enable"}
!20 = !{!"air.compile.framebuffer_fetch_enable"}
!21 = !{!"Apple metal version 32023.922 (metalfe-32023.922.4)"}
!22 = !{i32 2, i32 8, i32 0}
!23 = !{!"Metal", i32 4, i32 0, i32 0}
!24 = !{!25, !26, i64 4}
!25 = !{!"_ZTS8sst_args", !26, i64 0, !26, i64 4}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C++ TBAA"}
!29 = !{!30}
!30 = distinct !{!30, !31, !"air-alias-scope-arg(2)"}
!31 = distinct !{!31, !"air-alias-scopes(sst_split)"}
!32 = !{!33, !34}
!33 = distinct !{!33, !31, !"air-alias-scope-arg(0)"}
!34 = distinct !{!34, !31, !"air-alias-scope-arg(1)"}
!35 = !{!25, !26, i64 0}
!36 = !{!27, !27, i64 0}
!37 = !{!33}
!38 = !{!34, !30}
!39 = !{!40, !40, i64 0}
!40 = !{!"float", !27, i64 0}
!41 = !{!34}
!42 = !{!33, !30}
!43 = !{!44}
!44 = distinct !{!44, !45, !"air-alias-scope-arg(2)"}
!45 = distinct !{!45, !"air-alias-scopes(sst_block)"}
!46 = !{!47, !48}
!47 = distinct !{!47, !45, !"air-alias-scope-arg(0)"}
!48 = distinct !{!48, !45, !"air-alias-scope-arg(1)"}
!49 = !{!47}
!50 = !{!48, !44}
!51 = !{!48}
!52 = !{!47, !44}
@@ -0,0 +1,55 @@
// Owned fixture: a row of `float`s written four at a time from a `float4`, its tail guarded.
// Thread `gid` reads `in[gid]` and writes it to `out` at element `row * w + col`, where `row` is
// `gid / d` and `col` is `(gid % d) * 4`: the first lane unconditionally, then the other three
// where `col | 3` is inside the row, else the next two, else the next one. `sst_split` holds the
// first store in one block and the three others in the block its branch takes when all four fit;
// `sst_block` writes the four in one block. The element's byte offset is a multiple of 16 only
// where `w` is a multiple of 4 or the row is even with `w` 2 mod 4.
#include <metal_stdlib>
using namespace metal;
struct sst_args {
uint w;
uint d;
};
kernel void sst_split(device const float4 *in [[buffer(0)]],
device float *out [[buffer(1)]],
constant sst_args &a [[buffer(2)]],
uint gid [[thread_position_in_grid]]) {
uint row = gid / a.d;
uint col = (gid % a.d) << 2;
if (col >= a.w) {
return;
}
float4 v = in[gid];
uint i = row * a.w + col;
out[i] = v.x;
if ((col | 3) < a.w) {
out[i + 1] = v.y;
out[i + 2] = v.z;
out[i + 3] = v.w;
} else if ((col | 2) < a.w) {
out[i + 1] = v.y;
out[i + 2] = v.z;
} else if ((col | 1) < a.w) {
out[i + 1] = v.y;
}
}
kernel void sst_block(device const float4 *in [[buffer(0)]],
device float *out [[buffer(1)]],
constant sst_args &a [[buffer(2)]],
uint gid [[thread_position_in_grid]]) {
uint row = gid / a.d;
uint col = (gid % a.d) << 2;
if ((col | 3) >= a.w) {
return;
}
float4 v = in[gid];
uint i = row * a.w + col;
out[i] = v.x;
out[i + 1] = v.y;
out[i + 2] = v.z;
out[i + 3] = v.w;
}
@@ -0,0 +1,218 @@
target triple = "air64_v28-apple-macosx26.0.0"
source_filename = "-"
; datalayout DataLayout { endian: Little, pointers: {0: PointerSpec { size_bits: 64, abi_bits: 64, pref_bits: 64, index_bits: 64 }}, ints: {1: AlignSpec { abi_bits: 8, pref_bits: 8 }, 8: AlignSpec { abi_bits: 8, pref_bits: 8 }, 16: AlignSpec { abi_bits: 16, pref_bits: 16 }, 32: AlignSpec { abi_bits: 32, pref_bits: 32 }, 64: AlignSpec { abi_bits: 64, pref_bits: 64 }}, floats: {16: AlignSpec { abi_bits: 16, pref_bits: 16 }, 32: AlignSpec { abi_bits: 32, pref_bits: 32 }, 64: AlignSpec { abi_bits: 64, pref_bits: 64 }, 128: AlignSpec { abi_bits: 128, pref_bits: 128 }}, vectors: {16: AlignSpec { abi_bits: 16, pref_bits: 16 }, 24: AlignSpec { abi_bits: 32, pref_bits: 32 }, 32: AlignSpec { abi_bits: 32, pref_bits: 32 }, 48: AlignSpec { abi_bits: 64, pref_bits: 64 }, 64: AlignSpec { abi_bits: 64, pref_bits: 64 }, 96: AlignSpec { abi_bits: 128, pref_bits: 128 }, 128: AlignSpec { abi_bits: 128, pref_bits: 128 }, 192: AlignSpec { abi_bits: 256, pref_bits: 256 }, 256: AlignSpec { abi_bits: 256, pref_bits: 256 }, 512: AlignSpec { abi_bits: 512, pref_bits: 512 }, 1024: AlignSpec { abi_bits: 1024, pref_bits: 1024 }}, aggregate: AlignSpec { abi_bits: 0, pref_bits: 64 }, native_ints: [8, 16, 32], stack_align_bits: None, alloca_space: 0, program_space: 0, globals_space: 0, mangling: None, fn_ptr_align: None, non_integral: [] }
%t5 = type void (ptr addrspace(1), ptr addrspace(1), ptr addrspace(2), i32)
%t7 = type [2 x i32]
%t9 = type { i32, i32 } ; "struct.sst_args"
c4 = %t7 [27, 2]
define %t5 @f0 "sst_split" memory(ModRef, NoModRef, NoModRef) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a0( Ref nocapture "air-buffer-no-alias"="" ) %a1( Mod nocapture "air-buffer-no-alias"="" ) %a2( align 4 dereferenceable(8) Ref nocapture "air-buffer-no-alias"="" ) {
bb0:
%i0 = getelementptr inbounds %t9, %a2, i64 0, i32 1
%i1 = load i32, %i0, align 4
%i2 = urem i32 %a3, %i1
%i3 = shl i32 %i2, i32 2
%i4 = getelementptr inbounds %t9, %a2, i64 0, i32 0
%i5 = load i32, %i4, align 4
%i6 = icmp ult %i3, %i5
br %i6, bb1, bb7
bb1:
%i8 = udiv i32 %a3, %i1
%i9 = zext %a3 to i64
%i10 = getelementptr inbounds <4 x float>, %a0, %i9
%i11 = load <4 x float>, %i10, align 16
%i12 = mul i32 %i8, %i5
%i13 = add i32 %i12, %i3
%i14 = extractelement %i11, i64 0
%i15 = zext %i13 to i64
%i16 = getelementptr inbounds float, %a1, %i15
store %i14, %i16, align 4
%i18 = or i32 %i3, i32 3
%i19 = icmp ult %i18, %i5
br %i19, bb2, bb3
bb2:
%i21 = extractelement %i11, i64 1
%i22 = add i32 %i13, i32 1
%i23 = zext %i22 to i64
%i24 = getelementptr inbounds float, %a1, %i23
store %i21, %i24, align 4
%i26 = extractelement %i11, i64 2
%i27 = add i32 %i13, i32 2
%i28 = zext %i27 to i64
%i29 = getelementptr inbounds float, %a1, %i28
store %i26, %i29, align 4
%i31 = extractelement %i11, i64 3
%i32 = add i32 %i13, i32 3
%i33 = zext %i32 to i64
%i34 = getelementptr inbounds float, %a1, %i33
store %i31, %i34, align 4
br bb7
bb3:
%i37 = or i32 %i3, i32 2
%i38 = icmp ult %i37, %i5
br %i38, bb4, bb5
bb4:
%i40 = extractelement %i11, i64 1
%i41 = add i32 %i13, i32 1
%i42 = zext %i41 to i64
%i43 = getelementptr inbounds float, %a1, %i42
store %i40, %i43, align 4
%i45 = extractelement %i11, i64 2
%i46 = add i32 %i13, i32 2
%i47 = zext %i46 to i64
%i48 = getelementptr inbounds float, %a1, %i47
store %i45, %i48, align 4
br bb7
bb5:
%i51 = or i32 %i3, i32 1
%i52 = icmp ult %i51, %i5
br %i52, bb6, bb7
bb6:
%i54 = add i32 %i13, i32 1
%i55 = zext %i54 to i64
%i56 = getelementptr inbounds float, %a1, %i55
%i57 = extractelement %i11, i64 1
store %i57, %i56, align 4
br bb7
bb7:
ret void
}
define %t5 @f1 "sst_block" memory(ModRef, NoModRef, NoModRef) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins"="" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" %a0( Ref nocapture "air-buffer-no-alias"="" ) %a1( Mod nocapture "air-buffer-no-alias"="" ) %a2( align 4 dereferenceable(8) Ref nocapture "air-buffer-no-alias"="" ) {
bb0:
%i0 = getelementptr inbounds %t9, %a2, i64 0, i32 1
%i1 = load i32, %i0, align 4
%i2 = urem i32 %a3, %i1
%i3 = shl i32 %i2, i32 2
%i4 = or i32 %i3, i32 3
%i5 = getelementptr inbounds %t9, %a2, i64 0, i32 0
%i6 = load i32, %i5, align 4
%i7 = icmp ult %i4, %i6
br %i7, bb1, bb2
bb1:
%i9 = udiv i32 %a3, %i1
%i10 = zext %a3 to i64
%i11 = getelementptr inbounds <4 x float>, %a0, %i10
%i12 = load <4 x float>, %i11, align 16
%i13 = mul i32 %i9, %i6
%i14 = add i32 %i13, %i3
%i15 = extractelement %i12, i64 0
%i16 = zext %i14 to i64
%i17 = getelementptr inbounds float, %a1, %i16
store %i15, %i17, align 4
%i19 = extractelement %i12, i64 1
%i20 = add i32 %i14, i32 1
%i21 = zext %i20 to i64
%i22 = getelementptr inbounds float, %a1, %i21
store %i19, %i22, align 4
%i24 = extractelement %i12, i64 2
%i25 = add i32 %i14, i32 2
%i26 = zext %i25 to i64
%i27 = getelementptr inbounds float, %a1, %i26
store %i24, %i27, align 4
%i29 = extractelement %i12, i64 3
%i30 = add i32 %i14, i32 3
%i31 = zext %i30 to i64
%i32 = getelementptr inbounds float, %a1, %i31
store %i29, %i32, align 4
br bb2
bb2:
ret void
}
!md0 = !"SDK Version"
!md1 = !"wchar_size"
!md2 = !"frame-pointer"
!md3 = !"air.max_device_buffers"
!md4 = !"air.max_constant_buffers"
!md5 = !"air.max_threadgroup_buffers"
!md6 = !"air.max_textures"
!md7 = !"air.max_read_write_textures"
!md8 = !"air.max_samplers"
!md9 = !"air.buffer"
!md10 = !"air.location_index"
!md11 = !"air.read"
!md12 = !"air.address_space"
!md13 = !"air.arg_type_size"
!md14 = !"air.arg_type_align_size"
!md15 = !"air.arg_type_name"
!md16 = !"float4"
!md17 = !"air.arg_name"
!md18 = !"in"
!md19 = !"air.read_write"
!md20 = !"float"
!md21 = !"out"
!md22 = !"air.buffer_size"
!md23 = !"air.struct_type_info"
!md24 = !"uint"
!md25 = !"w"
!md26 = !"d"
!md27 = !"sst_args"
!md28 = !"a"
!md29 = !"air.thread_position_in_grid"
!md30 = !"gid"
!md31 = !"air.compile.denorms_disable"
!md32 = !"air.compile.fast_math_enable"
!md33 = !"air.compile.framebuffer_fetch_enable"
!md34 = !"Apple metal version 32023.922 (metalfe-32023.922.4)"
!md35 = !"Metal"
!md36 = !"_ZTS8sst_args"
!md37 = !"int"
!md38 = !"omnipotent char"
!md39 = !"Simple C++ TBAA"
!md40 = !"air-alias-scope-arg(2)"
!md41 = !"air-alias-scope-arg(1)"
!md42 = !"air-alias-scope-arg(0)"
!md43 = i32 2
!md44 = %t7 c4
!md45 = i32 1
!md46 = i32 4
!md47 = i32 7
!md48 = i32 31
!md49 = i32 128
!md50 = i32 8
!md51 = i32 16
!md52 = ptr addrspace(0) @f0
!md53 = i32 0
!md54 = i32 3
!md55 = ptr addrspace(0) @f1
!md56 = i64 0
!md57 = i64 4
!md58 = !{!md43, !md0, !md44}
!md59 = !{!md45, !md1, !md46}
!md60 = !{!md47, !md2, !md43}
!md61 = !{!md47, !md3, !md48}
!md62 = !{!md47, !md4, !md48}
!md63 = !{!md47, !md5, !md48}
!md64 = !{!md47, !md6, !md49}
!md65 = !{!md47, !md7, !md50}
!md66 = !{!md47, !md8, !md51}
!md67 = !{}
!md68 = !{!md53, !md9, !md10, !md53, !md45, !md11, !md12, !md45, !md13, !md51, !md14, !md51, !md15, !md16, !md17, !md18}
!md69 = !{!md45, !md9, !md10, !md45, !md45, !md19, !md12, !md45, !md13, !md46, !md14, !md46, !md15, !md20, !md17, !md21}
!md70 = !{!md53, !md46, !md53, !md24, !md25, !md46, !md46, !md53, !md24, !md26}
!md71 = !{!md43, !md9, !md22, !md50, !md10, !md43, !md45, !md11, !md12, !md43, !md23, !md70, !md13, !md50, !md14, !md46, !md15, !md27, !md17, !md28}
!md72 = !{!md54, !md29, !md15, !md24, !md17, !md30}
!md73 = !{!md68, !md69, !md71, !md72}
!md74 = !{!md52, !md67, !md73}
!md75 = !{!md55, !md67, !md73}
!md76 = !{!md31}
!md77 = !{!md32}
!md78 = !{!md33}
!md79 = !{!md34}
!md80 = !{!md43, !md50, !md53}
!md81 = !{!md35, !md46, !md53, !md53}
!md82 = !{!md39}
!md83 = !{!md38, !md82, !md56}
!md84 = !{!md37, !md83, !md56}
!md85 = !{!md36, !md84, !md56, !md84, !md57}
!md86 = !{!md85, !md84, !md57}
!md87 = !{!md85, !md84, !md56}
!md88 = !{!md83, !md83, !md56}
!md89 = !{!md20, !md83, !md56}
!md90 = !{!md89, !md89, !md56}
!"llvm.module.flags" = !{!md58, !md59, !md60, !md61, !md62, !md63, !md64, !md65, !md66}
!"air.kernel" = !{!md74, !md75}
!"air.compile_options" = !{!md76, !md77, !md78}
!"llvm.ident" = !{!md79}
!"air.version" = !{!md80}
!"air.language_version" = !{!md81}
@@ -3050,6 +3050,10 @@ engine/spc_bool_index.air.ll spc_bool_index ok ok ok ok ok ok ok ok ok ok ok ok
engine/spc_bool_index.ll spc_bool_index ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/spc_num_samples.air.ll spc_num_samples ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/spc_num_samples.ll spc_num_samples ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/split_store_tail.air.ll sst_split ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/split_store_tail.air.ll sst_block ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/split_store_tail.ll sst_split ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/split_store_tail.ll sst_block ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/sps2_residency_probes.air.ll sps2_residency_probes ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/sps2_residency_probes.ll sps2_residency_probes ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
engine/spse_address_probes.air.ll spse_address_probes ok ok ok ok ok ok ok ok ok ok ok ok ok ok ok
Can't render this file because it is too large.