diff --git a/crates/metal2vulkan-air/src/canon/tests/unbound_immediates.rs b/crates/metal2vulkan-air/src/canon/tests/unbound_immediates.rs index c77bc49ff..3aae2e0ce 100644 --- a/crates/metal2vulkan-air/src/canon/tests/unbound_immediates.rs +++ b/crates/metal2vulkan-air/src/canon/tests/unbound_immediates.rs @@ -134,7 +134,9 @@ fn binding_a_callers_flags_does_no_work_of_its_own() { #[test] fn a_fence_whose_flags_its_callers_flags_compute_binds_after_folding() { // OpenCL C's `mem_fence(flags)` as Metal's compiler leaves it: CLK_GLOBAL_MEM_FENCE (2) - // becomes `mem_device` (1) by reversing the two flag bits, an `i2` operation. + // becomes `mem_device` (1) by reversing the two flag bits, an `i2` operation, and the fence's + // order is acq_rel (4), as Apple's OpenCL compiler writes `mem_fence` (the probe + // opencl_operand_encodings, job m3-max-76799). let body = "define void @k(ptr addrspace(1) %x) #0 {\n\ \x20 store i32 1, ptr addrspace(1) %x, align 4\n\ \x20 tail call fastcc void @fence(i32 2)\n\ @@ -144,7 +146,7 @@ fn a_fence_whose_flags_its_callers_flags_compute_binds_after_folding() { \x20 %t = trunc i32 %flags to i2\n\ \x20 %r = tail call i2 @llvm.bitreverse.i2(i2 %t)\n\ \x20 %m = zext i2 %r to i32\n\ - \x20 tail call void @air.atomic.fence(i32 %m, i32 3, i32 1) #2\n\ + \x20 tail call void @air.atomic.fence(i32 %m, i32 4, i32 1) #2\n\ \x20 ret void\n}\n\ declare void @air.atomic.fence(i32, i32, i32) #2\n\ declare i2 @llvm.bitreverse.i2(i2) #3\n\ @@ -161,7 +163,7 @@ fn a_fence_whose_flags_its_callers_flags_compute_binds_after_folding() { let entry = entry.expect("specialized"); let fence = Sync::Fence { flags: flags(1), - order: MemoryOrder::from_raw(3).expect("order"), + order: MemoryOrder::from_raw(4).expect("order"), scope: ThreadScope::from_raw(1).expect("scope"), }; assert_eq!(syncs(&entry), [fence]); diff --git a/crates/metal2vulkan-runtime/src/tests/opencl_barriers.rs b/crates/metal2vulkan-runtime/src/tests/opencl_barriers.rs index ae1aa2a51..c599ccf48 100644 --- a/crates/metal2vulkan-runtime/src/tests/opencl_barriers.rs +++ b/crates/metal2vulkan-runtime/src/tests/opencl_barriers.rs @@ -79,12 +79,14 @@ const BARRIER_THREE: &str = "define internal fastcc void @_Z7barrierj(i32 %0) #2 ret void\n}\n\ declare void @air.wg.barrier(i32, i32, i32) #4\n"; -/// `mem_fence(flags)`: `air.atomic.fence` of the flags' two bits reversed, out of line. +/// `mem_fence(flags)`: `air.atomic.fence` of the flags' two bits reversed, out of line, its order +/// acq_rel (4), as Apple's OpenCL compiler writes `mem_fence` (the probe +/// opencl_operand_encodings, job m3-max-76799). const FENCE: &str = "define internal fastcc void @_Z9mem_fencej(i32 %0) #2 {\n\ %2 = trunc i32 %0 to i2\n\ %3 = tail call i2 @llvm.bitreverse.i2(i2 %2)\n\ %4 = zext i2 %3 to i32\n\ - tail call void @air.atomic.fence(i32 %4, i32 3, i32 1) #5\n\ + tail call void @air.atomic.fence(i32 %4, i32 4, i32 1) #5\n\ ret void\n}\n\ declare void @air.atomic.fence(i32, i32, i32) #5\n\ declare i2 @llvm.bitreverse.i2(i2) #9\n"; diff --git a/crates/metal2vulkan-runtime/src/tests/opencl_kernels.rs b/crates/metal2vulkan-runtime/src/tests/opencl_kernels.rs index b15be85e7..6883f7fbd 100644 --- a/crates/metal2vulkan-runtime/src/tests/opencl_kernels.rs +++ b/crates/metal2vulkan-runtime/src/tests/opencl_kernels.rs @@ -111,7 +111,9 @@ attributes #3 = { convergent nounwind }\n\ !2 = !{!3}\n"; /// `x[i] = 1`, `@fence(2)` (its flags `bitreverse.i2` of the parameter's low bits, as OpenCL C's -/// `mem_fence(CLK_GLOBAL_MEM_FENCE)` becomes `mem_device`), `x[i] = 2`. +/// `mem_fence(CLK_GLOBAL_MEM_FENCE)` becomes `mem_device`, its order acq_rel (4), as Apple's +/// OpenCL compiler writes `mem_fence`: the probe opencl_operand_encodings, job m3-max-76799), +/// `x[i] = 2`. const FENCE: &str = "define void @store2(ptr addrspace(1) nocapture %x) #3 {\n\ %id = tail call i32 @air.get_global_id.i32(i32 0)\n\ %i = zext i32 %id to i64\n\ @@ -124,7 +126,7 @@ define internal fastcc void @fence(i32 %flags) #2 {\n\ %t = trunc i32 %flags to i2\n\ %r = tail call i2 @llvm.bitreverse.i2(i2 %t)\n\ %m = zext i2 %r to i32\n\ - tail call void @air.atomic.fence(i32 %m, i32 3, i32 1) #1\n\ + tail call void @air.atomic.fence(i32 %m, i32 4, i32 1) #1\n\ ret void\n}\n\ declare void @air.atomic.fence(i32, i32, i32) #1\n\ declare i2 @llvm.bitreverse.i2(i2) #9\n\