Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions clang/examples/DPCT/Runtime/cudaBindTextureToMipmappedArray.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Option: --use-experimental-features=bindless_images

void test() {
// clang-format off
// Start
static texture<float4, 3> tex3;
cudaMipmappedArray_t pMipMapArr;
cudaBindTextureToMipmappedArray(tex3 /*const struct texture<T, dim, readMode>*/, pMipMapArr /*cudaMipmappedArray_const_t*/);
// End
// clang-format on
}
11 changes: 11 additions & 0 deletions clang/examples/DPCT/Runtime/cudaCreateChannelDescHalf.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Option: --use-experimental-features=bindless_images

void test() {
static texture<float4, 3> tex3;
cudaMipmappedArray_t pMipMapArr;
// clang-format off
// Start
cudaChannelFormatDesc halfChn = cudaCreateChannelDescHalf();
// End
// clang-format on
}
11 changes: 11 additions & 0 deletions clang/examples/DPCT/Runtime/cudaCreateChannelDescHalf1.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Option: --use-experimental-features=bindless_images

void test() {
static texture<float4, 3> tex3;
cudaMipmappedArray_t pMipMapArr;
// clang-format off
// Start
cudaChannelFormatDesc half1Chn = cudaCreateChannelDescHalf1();
// End
// clang-format on
}
11 changes: 11 additions & 0 deletions clang/examples/DPCT/Runtime/cudaCreateChannelDescHalf2.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Option: --use-experimental-features=bindless_images

void test() {
static texture<float4, 3> tex3;
cudaMipmappedArray_t pMipMapArr;
// clang-format off
// Start
cudaChannelFormatDesc half2Chn = cudaCreateChannelDescHalf2();
// End
// clang-format on
}
11 changes: 11 additions & 0 deletions clang/examples/DPCT/Runtime/cudaCreateChannelDescHalf4.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Option: --use-experimental-features=bindless_images

void test() {
static texture<float4, 3> tex3;
cudaMipmappedArray_t pMipMapArr;
// clang-format off
// Start
cudaChannelFormatDesc half4Chn = cudaCreateChannelDescHalf4();
// End
// clang-format on
}
14 changes: 14 additions & 0 deletions clang/examples/DPCT/Runtime/cudaCreateSurfaceObject.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Option: --use-experimental-features=bindless_images
#include <cuda.h>
#include <cuda_runtime.h>

void test() {
cudaSurfaceObject_t surf;
cudaResourceDesc resDesc;
// clang-format off
// Start
cudaCreateSurfaceObject(&surf /*cudaSurfaceObject_t* */, &resDesc /*const cudaResourceDesc* */);
// End
// clang-format on
}

13 changes: 13 additions & 0 deletions clang/examples/DPCT/Runtime/cudaDestroySurfaceObject.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Option: --use-experimental-features=bindless_images
#include <cuda.h>
#include <cuda_runtime.h>

void test() {
cudaSurfaceObject_t surf;
// clang-format off
// Start
cudaDestroySurfaceObject(surf /*cudaSurfaceObject_t*/);
// End
// clang-format on
}

8 changes: 8 additions & 0 deletions clang/examples/DPCT/Runtime/cudaGetDeviceProperties_v2.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <cuda_runtime.h>

void test(int i) {
// Start
cudaDeviceProp *pd;
cudaGetDeviceProperties_v2(pd /*cudaDeviceProp* */, i /*int*/);
// End
}
14 changes: 14 additions & 0 deletions clang/examples/DPCT/Runtime/cudaGetSurfaceObjectResourceDesc.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Option: --use-experimental-features=bindless_images
#include <cuda.h>
#include <cuda_runtime.h>

void test() {
cudaSurfaceObject_t surf;
cudaResourceDesc resDesc;
// clang-format off
// Start
cudaGetSurfaceObjectResourceDesc(&resDesc /*cudaResourceDesc* */, surf /*cudaSurfaceObject_t*/);
// End
// clang-format on
}

15 changes: 15 additions & 0 deletions clang/examples/DPCT/Runtime/cudaGraphAddDependencies.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Option: --use-experimental-features=graph
#include <cuda.h>
#include <cuda_runtime.h>

void test() {
cudaGraph_t graph;
cudaGraphNode_t node4[10];
cudaGraphNode_t node5[10];
// clang-format off
// Start
cudaGraphAddDependencies(graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, node5 /*const cudaGraphNode_t* */, 10 /*size_t*/);
// End
// clang-format on
}

15 changes: 15 additions & 0 deletions clang/examples/DPCT/Runtime/cudaGraphAddEmptyNode.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Option: --use-experimental-features=graph
#include <cuda.h>
#include <cuda_runtime.h>

void test() {
cudaGraph_t graph;
cudaGraphNode_t node4[10];
cudaGraphNode_t node;
// clang-format off
// Start
cudaGraphAddEmptyNode(&node /*cudaGraphNode_t* */, graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, 10 /*size_t*/);
// End
// clang-format on
}

13 changes: 13 additions & 0 deletions clang/examples/DPCT/Runtime/cudaGraphDestroy.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Option: --use-experimental-features=graph
#include <cuda.h>
#include <cuda_runtime.h>

void test() {
cudaGraph_t graph;
// clang-format off
// Start
cudaGraphDestroy(graph /*cudaGraph_t*/);
// End
// clang-format on
}

9 changes: 9 additions & 0 deletions clang/test/dpct/query_api_mapping/Runtime/test-after111.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2, cuda-10.0, cuda-10.1, cuda-10.2, cuda-11.0, cuda-11.1
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0, v10.1, v10.2, v11.0, v11.1

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaEventRecordWithFlags | FileCheck %s -check-prefix=cudaEventRecordWithFlags
// cudaEventRecordWithFlags: CUDA API:
// cudaEventRecordWithFlags-NEXT: cudaEventRecordWithFlags(event /*cudaEvent_t*/, stream /*cudaStream_t*/,
// cudaEventRecordWithFlags-NEXT: cudaEventRecordDefault /*unsigned int*/);
// cudaEventRecordWithFlags-NEXT: Is migrated to (with the option --enable-profiling):
// cudaEventRecordWithFlags-NEXT: dpct::sync_barrier(event /*cudaEvent_t*/, stream /*unsigned int*/);
10 changes: 10 additions & 0 deletions clang/test/dpct/query_api_mapping/Runtime/test-after12.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// UNSUPPORTED: cuda-8.0, cuda-9.1, cuda-9.2, cuda-10.0, cuda-10.1, cuda-10.2, cuda-11.0, cuda-11.1, cuda-11.2, cuda-11.3, cuda-11.4, cuda-11.5, cuda-11.6, cuda-11.7, cuda-11.8
// UNSUPPORTED: v8.0, v9.1, v9.2, v10.0, v10.1, v10.2, v11.0, v11.1, v11.2, v11.3, v11.4, v11.5, v11.6, v11.7, v11.8

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetDeviceProperties_v2 | FileCheck %s -check-prefix=cudaGetDeviceProperties_v2
// cudaGetDeviceProperties_v2: CUDA API:
// cudaGetDeviceProperties_v2-NEXT: cudaDeviceProp *pd;
// cudaGetDeviceProperties_v2-NEXT: cudaGetDeviceProperties_v2(pd /*cudaDeviceProp* */, i /*int*/);
// cudaGetDeviceProperties_v2-NEXT: Is migrated to:
// cudaGetDeviceProperties_v2-NEXT: dpct::device_info *pd;
// cudaGetDeviceProperties_v2-NEXT: dpct::get_device(i).get_device_info(*pd);
70 changes: 70 additions & 0 deletions clang/test/dpct/query_api_mapping/Runtime/test-before12.cu
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,73 @@
// CUDAUNBINDTEXTURE-NEXT: cudaUnbindTexture(ptr /*const textureReference **/);
// CUDAUNBINDTEXTURE-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// CUDAUNBINDTEXTURE-NEXT: ptr->detach();

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaBindTextureToMipmappedArray | FileCheck %s -check-prefix=cudaBindTextureToMipmappedArray
// cudaBindTextureToMipmappedArray: CUDA API:
// cudaBindTextureToMipmappedArray-NEXT: static texture<float4, 3> tex3;
// cudaBindTextureToMipmappedArray-NEXT: cudaMipmappedArray_t pMipMapArr;
// cudaBindTextureToMipmappedArray-NEXT: cudaBindTextureToMipmappedArray(tex3 /*const struct texture<T, dim, readMode>*/, pMipMapArr /*cudaMipmappedArray_const_t*/);
// cudaBindTextureToMipmappedArray-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaBindTextureToMipmappedArray-NEXT: dpct::experimental::bindless_image_wrapper<sycl::float4, 3> tex3;
// cudaBindTextureToMipmappedArray-NEXT: dpct::experimental::image_mem_wrapper_ptr pMipMapArr;
// cudaBindTextureToMipmappedArray-NEXT: tex3.attach(pMipMapArr);

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf | FileCheck %s -check-prefix=cudaCreateChannelDescHalf
// cudaCreateChannelDescHalf: CUDA API:
// cudaCreateChannelDescHalf-NEXT: cudaChannelFormatDesc halfChn = cudaCreateChannelDescHalf();
// cudaCreateChannelDescHalf-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaCreateChannelDescHalf-NEXT: dpct::image_channel halfChn = dpct::image_channel::create<sycl::half>();

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf1 | FileCheck %s -check-prefix=cudaCreateChannelDescHalf1
// cudaCreateChannelDescHalf1: CUDA API:
// cudaCreateChannelDescHalf1-NEXT: cudaChannelFormatDesc half1Chn = cudaCreateChannelDescHalf1();
// cudaCreateChannelDescHalf1-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaCreateChannelDescHalf1-NEXT: dpct::image_channel half1Chn = dpct::image_channel::create<sycl::half>();

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf2 | FileCheck %s -check-prefix=cudaCreateChannelDescHalf2
// cudaCreateChannelDescHalf2: CUDA API:
// cudaCreateChannelDescHalf2-NEXT: cudaChannelFormatDesc half2Chn = cudaCreateChannelDescHalf2();
// cudaCreateChannelDescHalf2-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaCreateChannelDescHalf2-NEXT: dpct::image_channel half2Chn = dpct::image_channel::create<sycl::half2>();

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateChannelDescHalf4 | FileCheck %s -check-prefix=cudaCreateChannelDescHalf4
// cudaCreateChannelDescHalf4: CUDA API:
// cudaCreateChannelDescHalf4-NEXT: cudaChannelFormatDesc half4Chn = cudaCreateChannelDescHalf4();
// cudaCreateChannelDescHalf4-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaCreateChannelDescHalf4-NEXT: dpct::image_channel half4Chn = dpct::image_channel::create<sycl::half4>();

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaCreateSurfaceObject | FileCheck %s -check-prefix=cudaCreateSurfaceObject
// cudaCreateSurfaceObject: CUDA API:
// cudaCreateSurfaceObject-NEXT: cudaCreateSurfaceObject(&surf /*cudaSurfaceObject_t* */, &resDesc /*const cudaResourceDesc* */);
// cudaCreateSurfaceObject-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaCreateSurfaceObject-NEXT: surf = dpct::experimental::create_bindless_image(resDesc);

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaDestroySurfaceObject | FileCheck %s -check-prefix=cudaDestroySurfaceObject
// cudaDestroySurfaceObject: CUDA API:
// cudaDestroySurfaceObject-NEXT: cudaDestroySurfaceObject(surf /*cudaSurfaceObject_t*/);
// cudaDestroySurfaceObject-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaDestroySurfaceObject-NEXT: dpct::experimental::destroy_bindless_image(surf, dpct::get_in_order_queue());

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetSurfaceObjectResourceDesc | FileCheck %s -check-prefix=cudaGetSurfaceObjectResourceDesc
// cudaGetSurfaceObjectResourceDesc: CUDA API:
// cudaGetSurfaceObjectResourceDesc-NEXT: cudaGetSurfaceObjectResourceDesc(&resDesc /*cudaResourceDesc* */, surf /*cudaSurfaceObject_t*/);
// cudaGetSurfaceObjectResourceDesc-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images):
// cudaGetSurfaceObjectResourceDesc-NEXT: resDesc = dpct::experimental::get_data(surf);

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGraphAddDependencies | FileCheck %s -check-prefix=cudaGraphAddDependencies
// cudaGraphAddDependencies: CUDA API:
// cudaGraphAddDependencies-NEXT: cudaGraphAddDependencies(graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, node5 /*const cudaGraphNode_t* */, 10 /*size_t*/);
// cudaGraphAddDependencies-NEXT: Is migrated to (with the option --use-experimental-features=graph):
// cudaGraphAddDependencies-NEXT: dpct::experimental::add_dependencies(graph, node4, node5, 10);

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGraphAddEmptyNode | FileCheck %s -check-prefix=cudaGraphAddEmptyNode
// cudaGraphAddEmptyNode: CUDA API:
// cudaGraphAddEmptyNode-NEXT: cudaGraphAddEmptyNode(&node /*cudaGraphNode_t* */, graph /*cudaGraph_t*/, node4 /*const cudaGraphNode_t* */, 10 /*size_t*/);
// cudaGraphAddEmptyNode-NEXT: Is migrated to (with the option --use-experimental-features=graph):
// cudaGraphAddEmptyNode-NEXT: dpct::experimental::add_empty_node(&node, graph, node4, 10);

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGraphDestroy | FileCheck %s -check-prefix=cudaGraphDestroy
// cudaGraphDestroy: CUDA API:
// cudaGraphDestroy-NEXT: cudaGraphDestroy(graph /*cudaGraph_t*/);
// cudaGraphDestroy-NEXT: Is migrated to (with the option --use-experimental-features=graph):
// cudaGraphDestroy-NEXT: delete (graph);
6 changes: 0 additions & 6 deletions clang/test/dpct/query_api_mapping/Runtime/test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,3 @@
// CUDAPROFILERSTOP-NEXT: cudaProfilerStop();
// CUDAPROFILERSTOP-NEXT: The API is Removed.
// CUDAPROFILERSTOP-EMPTY:
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaEventRecordWithFlags | FileCheck %s -check-prefix=cudaEventRecordWithFlags
// cudaEventRecordWithFlags: CUDA API:
// cudaEventRecordWithFlags-NEXT: cudaEventRecordWithFlags(event /*cudaEvent_t*/, stream /*cudaStream_t*/,
// cudaEventRecordWithFlags-NEXT: cudaEventRecordDefault /*unsigned int*/);
// cudaEventRecordWithFlags-NEXT: Is migrated to (with the option --enable-profiling):
// cudaEventRecordWithFlags-NEXT: dpct::sync_barrier(event /*cudaEvent_t*/, stream /*unsigned int*/);
12 changes: 12 additions & 0 deletions clang/test/dpct/query_api_mapping/test_all.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1424,11 +1424,18 @@
// CHECK-NEXT: cudaBindTexture
// CHECK-NEXT: cudaBindTexture2D
// CHECK-NEXT: cudaBindTextureToArray
// CHECK-NEXT: cudaBindTextureToMipmappedArray
// CHECK-NEXT: cudaCreateChannelDesc
// CHECK-NEXT: cudaCreateChannelDescHalf
// CHECK-NEXT: cudaCreateChannelDescHalf1
// CHECK-NEXT: cudaCreateChannelDescHalf2
// CHECK-NEXT: cudaCreateChannelDescHalf4
// CHECK-NEXT: cudaCreateSurfaceObject
// CHECK-NEXT: cudaCreateTextureObject
// CHECK-NEXT: cudaCtxResetPersistingL2Cache
// CHECK-NEXT: cudaDestroyExternalMemory
// CHECK-NEXT: cudaDestroyExternalSemaphore
// CHECK-NEXT: cudaDestroySurfaceObject
// CHECK-NEXT: cudaDestroyTextureObject
// CHECK-NEXT: cudaDeviceCanAccessPeer
// CHECK-NEXT: cudaDeviceDisablePeerAccess
Expand Down Expand Up @@ -1465,14 +1472,19 @@
// CHECK-NEXT: cudaGetDevice
// CHECK-NEXT: cudaGetDeviceCount
// CHECK-NEXT: cudaGetDeviceProperties
// CHECK-NEXT: cudaGetDeviceProperties_v2
// CHECK-NEXT: cudaGetErrorName
// CHECK-NEXT: cudaGetErrorString
// CHECK-NEXT: cudaGetLastError
// CHECK-NEXT: cudaGetMipmappedArrayLevel
// CHECK-NEXT: cudaGetSurfaceObjectResourceDesc
// CHECK-NEXT: cudaGetSymbolAddress
// CHECK-NEXT: cudaGetSymbolSize
// CHECK-NEXT: cudaGetTextureObjectResourceDesc
// CHECK-NEXT: cudaGetTextureObjectTextureDesc
// CHECK-NEXT: cudaGraphAddDependencies
// CHECK-NEXT: cudaGraphAddEmptyNode
// CHECK-NEXT: cudaGraphDestroy
// CHECK-NEXT: cudaGraphicsD3D11RegisterResource
// CHECK-NEXT: cudaGraphicsMapResources
// CHECK-NEXT: cudaGraphicsResourceGetMappedMipmappedArray
Expand Down
Loading