blob: 68b6e2b62db3461a1e253c5030634ad92b5ee902 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
//TEST:SIMPLE(filecheck=METAL): -target metal
//TEST:SIMPLE(filecheck=METALLIB): -target metallib
//TEST(compute, metal):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -output-using-type
// Test that we can specailize mutable parameters based on the argument
// address space when generating code for Metal.
//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
// CHECK-DAG: void Test_out_param{{.*}}(int thread* value{{.*}})
// CHECK-DAG: void Test_out_param{{.*}}(int threadgroup* value{{.*}})
// CHECK-DAG: void Test_out_param{{.*}}(int {{.*}}, KernelContext{{.*}} thread* {{.*}})
// CHECK-DAG: void Test_out_param_wrapper{{.*}}(int {{.*}}, KernelContext{{.*}} thread* {{.*}})
// CHECK-DAG: void Test_out_param_wrapper{{.*}}(int thread* value{{.*}})
// CHECK-DAG: void Test_out_param_wrapper{{.*}}(int threadgroup* value{{.*}})
// METAL-DAG: void Test_out_param{{.*}}(int thread* value{{.*}})
// METAL-DAG: void Test_out_param{{.*}}(int threadgroup* value{{.*}})
// METAL-DAG: void Test_out_param_wrapper{{.*}}(int thread* value{{.*}})
// METAL-DAG: void Test_out_param_wrapper{{.*}}(int threadgroup* value{{.*}})
void Test_out_param(out int value)
{
value = 1;
}
void Test_out_param_wrapper(out int value)
{
Test_out_param(value);
}
[numthreads(1,1,1)]
void computeMain()
{
// METALLIB: define void @computeMain
int value = 0;
Test_out_param_wrapper(value);
outputBuffer[0] = value;
Test_out_param_wrapper(outputBuffer[1]);
static groupshared int sharedValue[2];
Test_out_param_wrapper(sharedValue[0]);
outputBuffer[2] = sharedValue[0];
outputBuffer[0]++;
// BUF: 2
// BUF: 1
// BUF: 1
}
|