Skip to content

Commit def6add

Browse files
committed
add test cases
Signed-off-by: chenwei.sun <chenwei.sun@intel.com>
1 parent 2639f40 commit def6add

8 files changed

Lines changed: 78 additions & 10 deletions

File tree

clang/examples/DPCT/Runtime/cudaBindTextureToMipmappedArray.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Option: --use-experimental-features=bindless_images
22

33
void test() {
4-
static texture<float4, 3> tex3;
5-
cudaMipmappedArray_t pMipMapArr;
64
// clang-format off
75
// Start
6+
static texture<float4, 3> tex3;
7+
cudaMipmappedArray_t pMipMapArr;
88
cudaBindTextureToMipmappedArray(tex3 /*const struct texture<T, dim, readMode>*/, pMipMapArr /*cudaMipmappedArray_const_t*/);
99
// End
1010
// clang-format on

clang/examples/DPCT/Runtime/cudaCreateSurfaceObject.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void test() {
77
cudaResourceDesc resDesc;
88
// clang-format off
99
// Start
10-
cudaCreateSurfaceObject(&surf, &resDesc);
10+
cudaCreateSurfaceObject(&surf /*cudaSurfaceObject_t* */, &resDesc /*const cudaResourceDesc* pResDesc */);
1111
// End
1212
// clang-format on
1313
}

clang/examples/DPCT/Runtime/cudaDestroySurfaceObject.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ void test() {
66
cudaSurfaceObject_t surf;
77
// clang-format off
88
// Start
9-
cudaDestroySurfaceObject(surf);
9+
cudaDestroySurfaceObject(surf /*cudaSurfaceObject_t*/);
1010
// End
1111
// clang-format on
1212
}

clang/examples/DPCT/Runtime/cudaGetSurfaceObjectResourceDesc.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void test() {
77
cudaResourceDesc resDesc;
88
// clang-format off
99
// Start
10-
cudaGetSurfaceObjectResourceDesc(&resDesc, surf);
10+
cudaGetSurfaceObjectResourceDesc(&resDesc /*cudaResourceDesc* */, surf /*cudaSurfaceObject_t*/);
1111
// End
1212
// clang-format on
1313
}

clang/examples/DPCT/Runtime/cudaGraphAddDependencies.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void test() {
88
cudaGraphNode_t node5[10];
99
// clang-format off
1010
// Start
11-
cudaGraphAddDependencies(graph, node4, node5, 10);
11+
cudaGraphAddDependencies(graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, node5 /*const cudaGraphNode_t* */, 10 /*size_t */);
1212
// End
1313
// clang-format on
1414
}

clang/examples/DPCT/Runtime/cudaGraphAddEmptyNode.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void test() {
88
cudaGraphNode_t node;
99
// clang-format off
1010
// Start
11-
cudaGraphAddEmptyNode(&node, graph, node4, 10);
11+
cudaGraphAddEmptyNode(&node /*cudaGraphNode_t* */, graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, 10 /*size_t*/);
1212
// End
1313
// clang-format on
1414
}

clang/examples/DPCT/Runtime/cudaGraphDestroy.cu

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
void test() {
66
cudaGraph_t graph;
7-
cudaGraph_t *graph2;
87
// clang-format off
98
// Start
10-
cudaGraphDestroy(graph);
11-
cudaGraphDestroy(*graph2);
9+
cudaGraphDestroy(graph /*cudaGraph_t*/);
1210
// End
1311
// clang-format on
1412
}

clang/test/dpct/query_api_mapping/Runtime/test-before12.cu

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,73 @@
3232
// CUDAUNBINDTEXTURE-NEXT: cudaUnbindTexture(ptr /*const textureReference **/);
3333
// CUDAUNBINDTEXTURE-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
3434
// CUDAUNBINDTEXTURE-NEXT: ptr->detach();
35+
36+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaBindTextureToMipmappedArray | FileCheck %s -check-prefix=cudaBindTextureToMipmappedArray
37+
// cudaBindTextureToMipmappedArray: CUDA API:
38+
// cudaBindTextureToMipmappedArray-NEXT: static texture<float4, 3> tex3;
39+
// cudaBindTextureToMipmappedArray-NEXT: cudaMipmappedArray_t pMipMapArr;
40+
// cudaBindTextureToMipmappedArray-NEXT: cudaBindTextureToMipmappedArray(tex3 /*const struct texture<T, dim, readMode>*/, pMipMapArr /*cudaMipmappedArray_const_t*/);
41+
// cudaBindTextureToMipmappedArray-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
42+
// cudaBindTextureToMipmappedArray-NEXT: dpct::experimental::bindless_image_wrapper<sycl::float4, 3> tex3;
43+
// cudaBindTextureToMipmappedArray-NEXT: dpct::experimental::image_mem_wrapper_ptr pMipMapArr;
44+
// cudaBindTextureToMipmappedArray-NEXT: tex3.attach(pMipMapArr);
45+
46+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf | FileCheck %s -check-prefix=cudaCreateChannelDescHalf
47+
// cudaCreateChannelDescHalf: CUDA API:
48+
// cudaCreateChannelDescHalf-NEXT: cudaChannelFormatDesc halfChn = cudaCreateChannelDescHalf();
49+
// cudaCreateChannelDescHalf-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
50+
// cudaCreateChannelDescHalf-NEXT: dpct::image_channel halfChn = dpct::image_channel::create<sycl::half>();
51+
52+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf1 | FileCheck %s -check-prefix=cudaCreateChannelDescHalf1
53+
// cudaCreateChannelDescHalf1: CUDA API:
54+
// cudaCreateChannelDescHalf1-NEXT: cudaChannelFormatDesc half1Chn = cudaCreateChannelDescHalf1();
55+
// cudaCreateChannelDescHalf1-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
56+
// cudaCreateChannelDescHalf1-NEXT: dpct::image_channel half1Chn = dpct::image_channel::create<sycl::half>();
57+
58+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf2 | FileCheck %s -check-prefix=cudaCreateChannelDescHalf2
59+
// cudaCreateChannelDescHalf2: CUDA API:
60+
// cudaCreateChannelDescHalf2-NEXT: cudaChannelFormatDesc half2Chn = cudaCreateChannelDescHalf2();
61+
// cudaCreateChannelDescHalf2-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
62+
// cudaCreateChannelDescHalf2-NEXT: dpct::image_channel half2Chn = dpct::image_channel::create<sycl::half2>();
63+
64+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf4 | FileCheck %s -check-prefix=cudaCreateChannelDescHalf4
65+
// cudaCreateChannelDescHalf4: CUDA API:
66+
// cudaCreateChannelDescHalf4-NEXT: cudaChannelFormatDesc half4Chn = cudaCreateChannelDescHalf4();
67+
// cudaCreateChannelDescHalf4-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
68+
// cudaCreateChannelDescHalf4-NEXT: dpct::image_channel half4Chn = dpct::image_channel::create<sycl::half4>();
69+
70+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateSurfaceObject | FileCheck %s -check-prefix=cudaCreateSurfaceObject
71+
// cudaCreateSurfaceObject: CUDA API:
72+
// cudaCreateSurfaceObject-NEXT: cudaCreateSurfaceObject(&surf /*cudaSurfaceObject_t* */, &resDesc /*const cudaResourceDesc* pResDesc */);
73+
// cudaCreateSurfaceObject-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
74+
// cudaCreateSurfaceObject-NEXT: surf = dpct::experimental::create_bindless_image(resDesc);
75+
76+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaDestroySurfaceObject | FileCheck %s -check-prefix=cudaDestroySurfaceObject
77+
// cudaDestroySurfaceObject: CUDA API:
78+
// cudaDestroySurfaceObject-NEXT: cudaDestroySurfaceObject(surf /*cudaSurfaceObject_t*/);
79+
// cudaDestroySurfaceObject-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
80+
// cudaDestroySurfaceObject-NEXT: dpct::experimental::destroy_bindless_image(surf, dpct::get_in_order_queue());
81+
82+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetSurfaceObjectResourceDesc | FileCheck %s -check-prefix=cudaGetSurfaceObjectResourceDesc
83+
// cudaGetSurfaceObjectResourceDesc: CUDA API:
84+
// cudaGetSurfaceObjectResourceDesc-NEXT: cudaGetSurfaceObjectResourceDesc(&resDesc /*cudaResourceDesc* */, surf /*cudaSurfaceObject_t*/);
85+
// cudaGetSurfaceObjectResourceDesc-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
86+
// cudaGetSurfaceObjectResourceDesc-NEXT: resDesc = dpct::experimental::get_data(surf);
87+
88+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGraphAddDependencies | FileCheck %s -check-prefix=cudaGraphAddDependencies
89+
// cudaGraphAddDependencies: CUDA API:
90+
// cudaGraphAddDependencies-NEXT: cudaGraphAddDependencies(graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, node5 /*const cudaGraphNode_t* */, 10 /*size_t */);
91+
// cudaGraphAddDependencies-NEXT: Is migrated to (with the option --use-experimental-features=graph):
92+
// cudaGraphAddDependencies-NEXT: dpct::experimental::add_dependencies(graph, node4, node5, 10);
93+
94+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGraphAddEmptyNode | FileCheck %s -check-prefix=cudaGraphAddEmptyNode
95+
// cudaGraphAddEmptyNode: CUDA API:
96+
// cudaGraphAddEmptyNode-NEXT: cudaGraphAddEmptyNode(&node /*cudaGraphNode_t* */, graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, 10 /*size_t*/);
97+
// cudaGraphAddEmptyNode-NEXT: Is migrated to (with the option --use-experimental-features=graph):
98+
// cudaGraphAddEmptyNode-NEXT: dpct::experimental::add_empty_node(&node, graph, node4, 10);
99+
100+
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGraphDestroy | FileCheck %s -check-prefix=cudaGraphDestroy
101+
// cudaGraphDestroy: CUDA API:
102+
// cudaGraphDestroy-NEXT: cudaGraphDestroy(graph /*cudaGraph_t*/);
103+
// cudaGraphDestroy-NEXT: Is migrated to (with the option --use-experimental-features=graph):
104+
// cudaGraphDestroy-NEXT: delete (graph);

0 commit comments

Comments
 (0)