Unverified Commit 5ef4320e authored by Nikita Popov's avatar Nikita Popov Committed by GitHub
Browse files

[IR] Remove volatile from nosync (#194391)

Volatile operations are explicitly specified as not synchronizing...

> This is not Java’s “volatile” and has no cross-thread synchronization
behavior.

... and LLVM does not model them as being synchronizing anywhere, except
the definition of this attribute, which is largely unused outside the
Attributor.

The ordering requirements of volatile operations are already fully
encoded in their memory effects (unlike what is the case for
stronger-than-monotonic atomics).

Clarify that "nosync" is specifically in the sense of
"synchronizes-with" (rather than just any cross-thread communication)
and remove volatile operations from the definition.
parent 1561e51a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -267,8 +267,8 @@ void test16() {
}
//.
// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
// CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
// CHECK: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
// CHECK: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
//.
// CHECK: [[META0:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ void test6(char x) {
}
//.
// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
// CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
// CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: write) }
//.
// CHECK: [[META0:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
+34 −35

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -197,14 +197,14 @@ kernel void device_side_enqueue(global float *a, global float *b, int i) {
//
//.
// SPIR32: attributes #[[ATTR0]] = { convergent noinline norecurse nounwind optnone denormal_fpenv(float: preservesign) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size" }
// SPIR32: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// SPIR32: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
// SPIR32: attributes #[[ATTR2]] = { convergent noinline nounwind optnone denormal_fpenv(float: preservesign) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size" }
// SPIR32: attributes #[[ATTR3:[0-9]+]] = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }
// SPIR32: attributes #[[ATTR4]] = { convergent nounwind denormal_fpenv(float: preservesign) "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// SPIR32: attributes #[[ATTR5]] = { convergent nounwind "uniform-work-group-size" }
//.
// STRICTFP: attributes #[[ATTR0]] = { convergent noinline norecurse nounwind optnone strictfp "stack-protector-buffer-size"="8" }
// STRICTFP: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
// STRICTFP: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
// STRICTFP: attributes #[[ATTR2]] = { convergent noinline nounwind optnone strictfp "stack-protector-buffer-size"="8" }
// STRICTFP: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind strictfp willreturn memory(inaccessiblemem: readwrite) }
// STRICTFP: attributes #[[ATTR4]] = { convergent nounwind "stack-protector-buffer-size"="8" }
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ kernel void assume_convergent_asm()
  __asm__ volatile("s_barrier");
}

// CHECK: attributes #0 = { nofree noinline norecurse nounwind memory(readwrite, target_mem: none)
// CHECK: attributes #0 = { nofree noinline norecurse nosync nounwind memory(readwrite, target_mem: none)
// CHECK: attributes #1 = { convergent norecurse nounwind{{[^}]*}} }
// CHECK: attributes #2 = { convergent nounwind{{[^}]*}} }
// CHECK: attributes #3 = { convergent noduplicate nounwind{{[^}]*}} }
Loading