Fixture dvw_depth_views: a depth texture through a texture2d slot beside its depth2d read and comparison

An owned MSL fixture: texture2d<float> sample and gathers of green and alpha, and depth2d sample
and comparison, each through the runtime sampler at slot 0, one float4 per lane.
This commit is contained in:
Anees Iqbal committed 2026-12-03 12:51:32 -08:00
1 parent cc28d38674
commit aedc38190f
4 files changed
+411

No files matched your search

@@ -88,6 +88,7 @@ fixture dsx_int_attributes: metal: Apple metal version 32023.921 (metalfe-32023.
fixture dsx_lane_reads: metal: Apple metal version 32023.922 (metalfe-32023.922.4); macosx-sdk: 27.2 (26B118)
fixture dsx_wide_int_attributes: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture dvp_rog_coherence: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture dvw_depth_views: metal: Apple metal version 32023.922 (metalfe-32023.922.4); macosx-sdk: 27.2 (26B118)
fixture fan_clip_distances: metal: Apple metal version 32023.922 (metalfe-32023.922.4); macosx-sdk: 27.2 (26B118)
fixture fbl_fetch_blend16: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
fixture fbl_fetch_blend16_narrow: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425)
@@ -0,0 +1,186 @@
; Generated by scripts/regen-air-fixtures from dvw_depth_views.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._texture_2d_t = type opaque
%struct._sampler_t = type opaque
%struct._depth_2d_t = type opaque
; Function Attrs: argmemonly convergent mustprogress nofree nounwind willreturn
define void @dvw_sample(%struct._texture_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <4 x float> addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %2, <2 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #0 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %3, i64 %6
%8 = load <2 x float>, <2 x float> addrspace(1)* %7, align 8, !tbaa !29, !alias.scope !32, !noalias !35
%9 = tail call { <4 x float>, i8 } @air.sample_texture_2d.v4f32(%struct._texture_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #5, !alias.scope !39, !noalias !40
%10 = extractvalue { <4 x float>, i8 } %9, 0
%11 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %2, i64 %6
store <4 x float> %10, <4 x float> addrspace(1)* %11, align 16, !tbaa !29, !alias.scope !41, !noalias !42
ret void
}
; Function Attrs: argmemonly mustprogress nofree nounwind willreturn
define void @dvw_gather_green(%struct._texture_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <4 x float> addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %2, <2 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #1 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %3, i64 %6
%8 = load <2 x float>, <2 x float> addrspace(1)* %7, align 8, !tbaa !29, !alias.scope !43, !noalias !46
%9 = tail call { <4 x float>, i8 } @air.gather_texture_2d.v4f32(%struct._texture_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i32 1, i32 0) #6, !alias.scope !50, !noalias !51
%10 = extractvalue { <4 x float>, i8 } %9, 0
%11 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %2, i64 %6
store <4 x float> %10, <4 x float> addrspace(1)* %11, align 16, !tbaa !29, !alias.scope !52, !noalias !53
ret void
}
; Function Attrs: argmemonly mustprogress nofree nounwind willreturn
define void @dvw_gather_alpha(%struct._texture_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <4 x float> addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %2, <2 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #1 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %3, i64 %6
%8 = load <2 x float>, <2 x float> addrspace(1)* %7, align 8, !tbaa !29, !alias.scope !54, !noalias !57
%9 = tail call { <4 x float>, i8 } @air.gather_texture_2d.v4f32(%struct._texture_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i32 3, i32 0) #6, !alias.scope !61, !noalias !62
%10 = extractvalue { <4 x float>, i8 } %9, 0
%11 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %2, i64 %6
store <4 x float> %10, <4 x float> addrspace(1)* %11, align 16, !tbaa !29, !alias.scope !63, !noalias !64
ret void
}
; Function Attrs: argmemonly convergent mustprogress nofree nounwind willreturn
define void @dvw_depth(%struct._depth_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <4 x float> addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %2, <2 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #2 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %3, i64 %6
%8 = load <2 x float>, <2 x float> addrspace(1)* %7, align 8, !tbaa !29, !alias.scope !65, !noalias !68
%9 = tail call { float, i8 } @air.sample_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, i32 1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #5, !alias.scope !72, !noalias !73
%10 = extractvalue { float, i8 } %9, 0
%11 = insertelement <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %10, i64 0
%12 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %2, i64 %6
store <4 x float> %11, <4 x float> addrspace(1)* %12, align 16, !tbaa !29, !alias.scope !74, !noalias !75
ret void
}
; Function Attrs: argmemonly convergent mustprogress nofree nounwind willreturn
define void @dvw_compare(%struct._depth_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, <4 x float> addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %2, <2 x float> addrspace(1)* nocapture noundef readonly "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #2 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %3, i64 %6
%8 = load <2 x float>, <2 x float> addrspace(1)* %7, align 8, !tbaa !29, !alias.scope !76, !noalias !79
%9 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %0, %struct._sampler_t addrspace(2)* nocapture readonly %1, i32 1, <2 x float> %8, float 5.000000e-01, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #5, !alias.scope !83, !noalias !84
%10 = extractvalue { float, i8 } %9, 0
%11 = insertelement <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %10, i64 0
%12 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %2, i64 %6
store <4 x float> %11, <4 x float> addrspace(1)* %12, align 16, !tbaa !29, !alias.scope !85, !noalias !86
ret void
}
; Function Attrs: argmemonly convergent mustprogress nofree nounwind readonly willreturn
declare { <4 x float>, i8 } @air.sample_texture_2d.v4f32(%struct._texture_2d_t addrspace(1)* nocapture readonly, %struct._sampler_t addrspace(2)* nocapture readonly, <2 x float>, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3
; Function Attrs: argmemonly mustprogress nofree nounwind readonly willreturn
declare { <4 x float>, i8 } @air.gather_texture_2d.v4f32(%struct._texture_2d_t addrspace(1)* nocapture readonly, %struct._sampler_t addrspace(2)* nocapture readonly, <2 x float>, i1, <2 x i32>, i32, i32) local_unnamed_addr #4
; Function Attrs: argmemonly convergent mustprogress nofree nounwind readonly willreturn
declare { float, i8 } @air.sample_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly, %struct._sampler_t addrspace(2)* nocapture readonly, i32, <2 x float>, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3
; Function Attrs: argmemonly convergent mustprogress nofree nounwind readonly willreturn
declare { float, i8 } @air.sample_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly, %struct._sampler_t addrspace(2)* nocapture readonly, i32, <2 x float>, float, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3
attributes #0 = { argmemonly convergent mustprogress nofree nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "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" }
attributes #1 = { argmemonly mustprogress nofree nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "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" }
attributes #2 = { argmemonly convergent mustprogress nofree nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="64" "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" }
attributes #3 = { argmemonly convergent mustprogress nofree nounwind readonly willreturn }
attributes #4 = { argmemonly mustprogress nofree nounwind readonly willreturn }
attributes #5 = { argmemonly convergent nounwind readonly willreturn }
attributes #6 = { argmemonly nounwind readonly willreturn }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
!air.kernel = !{!9, !17, !18, !19, !22}
!air.compile_options = !{!23, !24, !25}
!llvm.ident = !{!26}
!air.version = !{!27}
!air.language_version = !{!28}
!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 (%struct._texture_2d_t addrspace(1)*, %struct._sampler_t addrspace(2)*, <4 x float> addrspace(1)*, <2 x float> addrspace(1)*, i32)* @dvw_sample, !10, !11}
!10 = !{}
!11 = !{!12, !13, !14, !15, !16}
!12 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"texture2d<float, sample>", !"air.arg_name", !"t"}
!13 = !{i32 1, !"air.sampler", !"air.location_index", i32 0, i32 1, !"air.arg_type_name", !"sampler", !"air.arg_name", !"s"}
!14 = !{i32 2, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"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", !"out"}
!15 = !{i32 3, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read", !"air.address_space", i32 1, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"float2", !"air.arg_name", !"uv"}
!16 = !{i32 4, !"air.thread_position_in_grid", !"air.arg_type_name", !"uint", !"air.arg_name", !"i"}
!17 = !{void (%struct._texture_2d_t addrspace(1)*, %struct._sampler_t addrspace(2)*, <4 x float> addrspace(1)*, <2 x float> addrspace(1)*, i32)* @dvw_gather_green, !10, !11}
!18 = !{void (%struct._texture_2d_t addrspace(1)*, %struct._sampler_t addrspace(2)*, <4 x float> addrspace(1)*, <2 x float> addrspace(1)*, i32)* @dvw_gather_alpha, !10, !11}
!19 = !{void (%struct._depth_2d_t addrspace(1)*, %struct._sampler_t addrspace(2)*, <4 x float> addrspace(1)*, <2 x float> addrspace(1)*, i32)* @dvw_depth, !10, !20}
!20 = !{!21, !13, !14, !15, !16}
!21 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d<float, sample>", !"air.arg_name", !"t"}
!22 = !{void (%struct._depth_2d_t addrspace(1)*, %struct._sampler_t addrspace(2)*, <4 x float> addrspace(1)*, <2 x float> addrspace(1)*, i32)* @dvw_compare, !10, !20}
!23 = !{!"air.compile.denorms_disable"}
!24 = !{!"air.compile.fast_math_enable"}
!25 = !{!"air.compile.framebuffer_fetch_enable"}
!26 = !{!"Apple metal version 32023.922 (metalfe-32023.922.4)"}
!27 = !{i32 2, i32 8, i32 0}
!28 = !{!"Metal", i32 4, i32 0, i32 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"omnipotent char", !31, i64 0}
!31 = !{!"Simple C++ TBAA"}
!32 = !{!33}
!33 = distinct !{!33, !34, !"air-alias-scope-arg(3)"}
!34 = distinct !{!34, !"air-alias-scopes(dvw_sample)"}
!35 = !{!36, !37, !38}
!36 = distinct !{!36, !34, !"air-alias-scope-textures"}
!37 = distinct !{!37, !34, !"air-alias-scope-samplers"}
!38 = distinct !{!38, !34, !"air-alias-scope-arg(2)"}
!39 = !{!36, !37}
!40 = !{!38, !33}
!41 = !{!38}
!42 = !{!36, !37, !33}
!43 = !{!44}
!44 = distinct !{!44, !45, !"air-alias-scope-arg(3)"}
!45 = distinct !{!45, !"air-alias-scopes(dvw_gather_green)"}
!46 = !{!47, !48, !49}
!47 = distinct !{!47, !45, !"air-alias-scope-textures"}
!48 = distinct !{!48, !45, !"air-alias-scope-samplers"}
!49 = distinct !{!49, !45, !"air-alias-scope-arg(2)"}
!50 = !{!47, !48}
!51 = !{!49, !44}
!52 = !{!49}
!53 = !{!47, !48, !44}
!54 = !{!55}
!55 = distinct !{!55, !56, !"air-alias-scope-arg(3)"}
!56 = distinct !{!56, !"air-alias-scopes(dvw_gather_alpha)"}
!57 = !{!58, !59, !60}
!58 = distinct !{!58, !56, !"air-alias-scope-textures"}
!59 = distinct !{!59, !56, !"air-alias-scope-samplers"}
!60 = distinct !{!60, !56, !"air-alias-scope-arg(2)"}
!61 = !{!58, !59}
!62 = !{!60, !55}
!63 = !{!60}
!64 = !{!58, !59, !55}
!65 = !{!66}
!66 = distinct !{!66, !67, !"air-alias-scope-arg(3)"}
!67 = distinct !{!67, !"air-alias-scopes(dvw_depth)"}
!68 = !{!69, !70, !71}
!69 = distinct !{!69, !67, !"air-alias-scope-textures"}
!70 = distinct !{!70, !67, !"air-alias-scope-samplers"}
!71 = distinct !{!71, !67, !"air-alias-scope-arg(2)"}
!72 = !{!69, !70}
!73 = !{!71, !66}
!74 = !{!71}
!75 = !{!69, !70, !66}
!76 = !{!77}
!77 = distinct !{!77, !78, !"air-alias-scope-arg(3)"}
!78 = distinct !{!78, !"air-alias-scopes(dvw_compare)"}
!79 = !{!80, !81, !82}
!80 = distinct !{!80, !78, !"air-alias-scope-textures"}
!81 = distinct !{!81, !78, !"air-alias-scope-samplers"}
!82 = distinct !{!82, !78, !"air-alias-scope-arg(2)"}
!83 = !{!80, !81}
!84 = !{!82, !77}
!85 = !{!82}
!86 = !{!80, !81, !77}
@@ -0,0 +1,182 @@
; Generated by scripts/regen-air-fixtures from dvw_depth_views.metal (llvm-dis of dvw_depth_views.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"
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: readwrite)
define void @dvw_sample(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %2, ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #0 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, ptr addrspace(1) %3, i64 %6
%8 = load <2 x float>, ptr addrspace(1) %7, align 8, !tbaa !29, !alias.scope !32, !noalias !35
%9 = tail call { <4 x float>, i8 } @air.sample_texture_2d.v4f32(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #5, !alias.scope !39, !noalias !40
%10 = extractvalue { <4 x float>, i8 } %9, 0
%11 = getelementptr inbounds <4 x float>, ptr addrspace(1) %2, i64 %6
store <4 x float> %10, ptr addrspace(1) %11, align 16, !tbaa !29, !alias.scope !41, !noalias !42
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
define void @dvw_gather_green(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %2, ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #1 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, ptr addrspace(1) %3, i64 %6
%8 = load <2 x float>, ptr addrspace(1) %7, align 8, !tbaa !29, !alias.scope !43, !noalias !46
%9 = tail call { <4 x float>, i8 } @air.gather_texture_2d.v4f32(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i32 1, i32 0) #6, !alias.scope !50, !noalias !51
%10 = extractvalue { <4 x float>, i8 } %9, 0
%11 = getelementptr inbounds <4 x float>, ptr addrspace(1) %2, i64 %6
store <4 x float> %10, ptr addrspace(1) %11, align 16, !tbaa !29, !alias.scope !52, !noalias !53
ret void
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
define void @dvw_gather_alpha(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %2, ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #1 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, ptr addrspace(1) %3, i64 %6
%8 = load <2 x float>, ptr addrspace(1) %7, align 8, !tbaa !29, !alias.scope !54, !noalias !57
%9 = tail call { <4 x float>, i8 } @air.gather_texture_2d.v4f32(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i32 3, i32 0) #6, !alias.scope !61, !noalias !62
%10 = extractvalue { <4 x float>, i8 } %9, 0
%11 = getelementptr inbounds <4 x float>, ptr addrspace(1) %2, i64 %6
store <4 x float> %10, ptr addrspace(1) %11, align 16, !tbaa !29, !alias.scope !63, !noalias !64
ret void
}
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: readwrite)
define void @dvw_depth(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %2, ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #2 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, ptr addrspace(1) %3, i64 %6
%8 = load <2 x float>, ptr addrspace(1) %7, align 8, !tbaa !29, !alias.scope !65, !noalias !68
%9 = tail call { float, i8 } @air.sample_depth_2d.f32(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, i32 1, <2 x float> %8, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #5, !alias.scope !72, !noalias !73
%10 = extractvalue { float, i8 } %9, 0
%11 = insertelement <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %10, i64 0
%12 = getelementptr inbounds <4 x float>, ptr addrspace(1) %2, i64 %6
store <4 x float> %11, ptr addrspace(1) %12, align 16, !tbaa !29, !alias.scope !74, !noalias !75
ret void
}
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: readwrite)
define void @dvw_compare(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %2, ptr addrspace(1) noundef readonly captures(none) "air-buffer-no-alias" %3, i32 noundef %4) local_unnamed_addr #2 {
%6 = zext i32 %4 to i64
%7 = getelementptr inbounds <2 x float>, ptr addrspace(1) %3, i64 %6
%8 = load <2 x float>, ptr addrspace(1) %7, align 8, !tbaa !29, !alias.scope !76, !noalias !79
%9 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none) %0, ptr addrspace(2) readonly captures(none) %1, i32 1, <2 x float> %8, float 5.000000e-01, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #5, !alias.scope !83, !noalias !84
%10 = extractvalue { float, i8 } %9, 0
%11 = insertelement <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %10, i64 0
%12 = getelementptr inbounds <4 x float>, ptr addrspace(1) %2, i64 %6
store <4 x float> %11, ptr addrspace(1) %12, align 16, !tbaa !29, !alias.scope !85, !noalias !86
ret void
}
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: read)
declare { <4 x float>, i8 } @air.sample_texture_2d.v4f32(ptr addrspace(1) readonly captures(none), ptr addrspace(2) readonly captures(none), <2 x float>, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare { <4 x float>, i8 } @air.gather_texture_2d.v4f32(ptr addrspace(1) readonly captures(none), ptr addrspace(2) readonly captures(none), <2 x float>, i1, <2 x i32>, i32, i32) local_unnamed_addr #4
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: read)
declare { float, i8 } @air.sample_depth_2d.f32(ptr addrspace(1) readonly captures(none), ptr addrspace(2) readonly captures(none), i32, <2 x float>, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3
; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: read)
declare { float, i8 } @air.sample_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none), ptr addrspace(2) readonly captures(none), i32, <2 x float>, float, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3
attributes #0 = { convergent mustprogress nofree nounwind willreturn memory(argmem: readwrite) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "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" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "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" }
attributes #2 = { convergent mustprogress nofree nounwind willreturn memory(argmem: readwrite) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="64" "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" }
attributes #3 = { convergent mustprogress nofree nounwind willreturn memory(argmem: read) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { convergent nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind willreturn memory(argmem: read) }
!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
!air.kernel = !{!9, !17, !18, !19, !22}
!air.compile_options = !{!23, !24, !25}
!llvm.ident = !{!26}
!air.version = !{!27}
!air.language_version = !{!28}
!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 @dvw_sample, !10, !11}
!10 = !{}
!11 = !{!12, !13, !14, !15, !16}
!12 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"texture2d<float, sample>", !"air.arg_name", !"t"}
!13 = !{i32 1, !"air.sampler", !"air.location_index", i32 0, i32 1, !"air.arg_type_name", !"sampler", !"air.arg_name", !"s"}
!14 = !{i32 2, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"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", !"out"}
!15 = !{i32 3, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read", !"air.address_space", i32 1, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"float2", !"air.arg_name", !"uv"}
!16 = !{i32 4, !"air.thread_position_in_grid", !"air.arg_type_name", !"uint", !"air.arg_name", !"i"}
!17 = !{ptr @dvw_gather_green, !10, !11}
!18 = !{ptr @dvw_gather_alpha, !10, !11}
!19 = !{ptr @dvw_depth, !10, !20}
!20 = !{!21, !13, !14, !15, !16}
!21 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d<float, sample>", !"air.arg_name", !"t"}
!22 = !{ptr @dvw_compare, !10, !20}
!23 = !{!"air.compile.denorms_disable"}
!24 = !{!"air.compile.fast_math_enable"}
!25 = !{!"air.compile.framebuffer_fetch_enable"}
!26 = !{!"Apple metal version 32023.922 (metalfe-32023.922.4)"}
!27 = !{i32 2, i32 8, i32 0}
!28 = !{!"Metal", i32 4, i32 0, i32 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"omnipotent char", !31, i64 0}
!31 = !{!"Simple C++ TBAA"}
!32 = !{!33}
!33 = distinct !{!33, !34, !"air-alias-scope-arg(3)"}
!34 = distinct !{!34, !"air-alias-scopes(dvw_sample)"}
!35 = !{!36, !37, !38}
!36 = distinct !{!36, !34, !"air-alias-scope-textures"}
!37 = distinct !{!37, !34, !"air-alias-scope-samplers"}
!38 = distinct !{!38, !34, !"air-alias-scope-arg(2)"}
!39 = !{!36, !37}
!40 = !{!38, !33}
!41 = !{!38}
!42 = !{!36, !37, !33}
!43 = !{!44}
!44 = distinct !{!44, !45, !"air-alias-scope-arg(3)"}
!45 = distinct !{!45, !"air-alias-scopes(dvw_gather_green)"}
!46 = !{!47, !48, !49}
!47 = distinct !{!47, !45, !"air-alias-scope-textures"}
!48 = distinct !{!48, !45, !"air-alias-scope-samplers"}
!49 = distinct !{!49, !45, !"air-alias-scope-arg(2)"}
!50 = !{!47, !48}
!51 = !{!49, !44}
!52 = !{!49}
!53 = !{!47, !48, !44}
!54 = !{!55}
!55 = distinct !{!55, !56, !"air-alias-scope-arg(3)"}
!56 = distinct !{!56, !"air-alias-scopes(dvw_gather_alpha)"}
!57 = !{!58, !59, !60}
!58 = distinct !{!58, !56, !"air-alias-scope-textures"}
!59 = distinct !{!59, !56, !"air-alias-scope-samplers"}
!60 = distinct !{!60, !56, !"air-alias-scope-arg(2)"}
!61 = !{!58, !59}
!62 = !{!60, !55}
!63 = !{!60}
!64 = !{!58, !59, !55}
!65 = !{!66}
!66 = distinct !{!66, !67, !"air-alias-scope-arg(3)"}
!67 = distinct !{!67, !"air-alias-scopes(dvw_depth)"}
!68 = !{!69, !70, !71}
!69 = distinct !{!69, !67, !"air-alias-scope-textures"}
!70 = distinct !{!70, !67, !"air-alias-scope-samplers"}
!71 = distinct !{!71, !67, !"air-alias-scope-arg(2)"}
!72 = !{!69, !70}
!73 = !{!71, !66}
!74 = !{!71}
!75 = !{!69, !70, !66}
!76 = !{!77}
!77 = distinct !{!77, !78, !"air-alias-scope-arg(3)"}
!78 = distinct !{!78, !"air-alias-scopes(dvw_compare)"}
!79 = !{!80, !81, !82}
!80 = distinct !{!80, !78, !"air-alias-scope-textures"}
!81 = distinct !{!81, !78, !"air-alias-scope-samplers"}
!82 = distinct !{!82, !78, !"air-alias-scope-arg(2)"}
!83 = !{!80, !81}
!84 = !{!82, !77}
!85 = !{!82}
!86 = !{!80, !81, !77}
@@ -0,0 +1,42 @@
// Owned fixture (written for this repository): a depth texture read through a `texture2d<float>`
// slot, beside the same texture's `depth2d` read and comparison. Each kernel samples slot 0
// through the runtime sampler at slot 0 at lane `i`'s normalized coordinate and writes one
// `float4`: the texture2d sample, its gather of green and of alpha, the depth2d sample in red
// (green, blue and alpha 0), and the depth2d comparison against 0.5 in red.
#include <metal_stdlib>
using namespace metal;
kernel void dvw_sample(texture2d<float> t [[texture(0)]], sampler s [[sampler(0)]],
device float4 *out [[buffer(0)]], device const float2 *uv [[buffer(1)]],
uint i [[thread_position_in_grid]])
{
out[i] = t.sample(s, uv[i]);
}
kernel void dvw_gather_green(texture2d<float> t [[texture(0)]], sampler s [[sampler(0)]],
device float4 *out [[buffer(0)]], device const float2 *uv [[buffer(1)]],
uint i [[thread_position_in_grid]])
{
out[i] = t.gather(s, uv[i], int2(0), component::y);
}
kernel void dvw_gather_alpha(texture2d<float> t [[texture(0)]], sampler s [[sampler(0)]],
device float4 *out [[buffer(0)]], device const float2 *uv [[buffer(1)]],
uint i [[thread_position_in_grid]])
{
out[i] = t.gather(s, uv[i], int2(0), component::w);
}
kernel void dvw_depth(depth2d<float> t [[texture(0)]], sampler s [[sampler(0)]],
device float4 *out [[buffer(0)]], device const float2 *uv [[buffer(1)]],
uint i [[thread_position_in_grid]])
{
out[i] = float4(t.sample(s, uv[i]), 0.0f, 0.0f, 0.0f);
}
kernel void dvw_compare(depth2d<float> t [[texture(0)]], sampler s [[sampler(0)]],
device float4 *out [[buffer(0)]], device const float2 *uv [[buffer(1)]],
uint i [[thread_position_in_grid]])
{
out[i] = float4(t.sample_compare(s, uv[i], 0.5f), 0.0f, 0.0f, 0.0f);
}