dan sinclair | f1f381a | 2023-11-22 09:44:15 +0000 | [diff] [blame] | 1 | SKIP: FAILED |
| 2 | |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 3 | #include <metal_stdlib> |
| 4 | using namespace metal; |
| 5 | |
| 6 | threadgroup int a; |
| 7 | threadgroup int b; |
| 8 | threadgroup int c; |
| 9 | void uses_a() { |
| 10 | a = (a + 1); |
| 11 | } |
| 12 | void uses_b() { |
| 13 | b = (b * 2); |
| 14 | } |
| 15 | void uses_a_and_b() { |
| 16 | b = a; |
| 17 | } |
| 18 | void no_uses() { |
| 19 | } |
| 20 | void outer() { |
| 21 | a = 0; |
| 22 | uses_a(); |
| 23 | uses_a_and_b(); |
| 24 | uses_b(); |
| 25 | no_uses(); |
| 26 | } |
| 27 | kernel void main1(uint tint_local_index [[thread_index_in_threadgroup]]) { |
| 28 | if ((tint_local_index == 0u)) { |
| 29 | a = 0; |
| 30 | } |
| 31 | threadgroup_barrier(mem_flags::mem_threadgroup); |
| 32 | a = 42; |
| 33 | uses_a(); |
| 34 | } |
| 35 | kernel void main2(uint tint_local_index [[thread_index_in_threadgroup]]) { |
| 36 | if ((tint_local_index == 0u)) { |
| 37 | b = 0; |
| 38 | } |
| 39 | threadgroup_barrier(mem_flags::mem_threadgroup); |
| 40 | b = 7; |
| 41 | uses_b(); |
| 42 | } |
| 43 | kernel void main3(uint tint_local_index [[thread_index_in_threadgroup]]) { |
| 44 | if ((tint_local_index == 0u)) { |
| 45 | a = 0; |
| 46 | b = 0; |
| 47 | } |
| 48 | threadgroup_barrier(mem_flags::mem_threadgroup); |
| 49 | outer(); |
| 50 | no_uses(); |
| 51 | } |
| 52 | kernel void main4() { |
| 53 | no_uses(); |
| 54 | } |
| 55 | program_source:4:17: error: program scope variable must reside in constant address space |
| 56 | threadgroup int a; |
| 57 | ^ |
| 58 | program_source:5:17: error: program scope variable must reside in constant address space |
| 59 | threadgroup int b; |
| 60 | ^ |
| 61 | program_source:6:17: error: program scope variable must reside in constant address space |
| 62 | threadgroup int c; |
| 63 | ^ |
| 64 | program_source:26:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] |
| 65 | if ((tint_local_index == 0u)) { |
| 66 | ~~~~~~~~~~~~~~~~~^~~~~ |
| 67 | program_source:26:25: note: remove extraneous parentheses around the comparison to silence this warning |
| 68 | if ((tint_local_index == 0u)) { |
| 69 | ~ ^ ~ |
| 70 | program_source:26:25: note: use '=' to turn this equality comparison into an assignment |
| 71 | if ((tint_local_index == 0u)) { |
| 72 | ^~ |
| 73 | = |
| 74 | program_source:34:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] |
| 75 | if ((tint_local_index == 0u)) { |
| 76 | ~~~~~~~~~~~~~~~~~^~~~~ |
| 77 | program_source:34:25: note: remove extraneous parentheses around the comparison to silence this warning |
| 78 | if ((tint_local_index == 0u)) { |
| 79 | ~ ^ ~ |
| 80 | program_source:34:25: note: use '=' to turn this equality comparison into an assignment |
| 81 | if ((tint_local_index == 0u)) { |
| 82 | ^~ |
| 83 | = |
| 84 | program_source:42:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] |
| 85 | if ((tint_local_index == 0u)) { |
| 86 | ~~~~~~~~~~~~~~~~~^~~~~ |
| 87 | program_source:42:25: note: remove extraneous parentheses around the comparison to silence this warning |
| 88 | if ((tint_local_index == 0u)) { |
| 89 | ~ ^ ~ |
| 90 | program_source:42:25: note: use '=' to turn this equality comparison into an assignment |
| 91 | if ((tint_local_index == 0u)) { |
| 92 | ^~ |
| 93 | = |
| 94 | |