-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for CUDA driver Graphics APIs/types used in Blender
- Loading branch information
1 parent
7e8a364
commit 7e42bca
Showing
17 changed files
with
256 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Option: --use-experimental-features=bindless_images | ||
|
||
void test(int c, CUgraphicsResource *r, CUstream s) { | ||
// Start | ||
cuGraphicsMapResources(c /*int*/, | ||
r /*CUgraphicsResource **/, | ||
s /*CUstream*/); | ||
// End | ||
} |
9 changes: 9 additions & 0 deletions
9
clang/examples/DPCT/Runtime/cuGraphicsResourceGetMappedPointer.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Option: --use-experimental-features=bindless_images | ||
|
||
void test(CUdeviceptr ptr, size_t *s, CUgraphicsResource r) { | ||
// Start | ||
cuGraphicsResourceGetMappedPointer(&ptr /*CUdeviceptr **/, | ||
s /*size_t **/, | ||
r /*CUgraphicsResource*/); | ||
// End | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Option: --use-experimental-features=bindless_images | ||
|
||
void test(int c, CUgraphicsResource *r, CUstream s) { | ||
// Start | ||
cuGraphicsUnmapResources(c /*int*/, | ||
r /*CUgraphicsResource **/, | ||
s /*CUstream*/); | ||
// End | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Option: --use-experimental-features=bindless_images | ||
|
||
void test(CUgraphicsResource r) { | ||
// Start | ||
cuGraphicsUnregisterResource(r /*CUgraphicsResource*/); | ||
// End | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2 | ||
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2 | ||
// RUN: dpct --use-experimental-features=bindless_images --format-range=none -out-root %T/cuGraphics %s --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only --std=c++14 | ||
// RUN: FileCheck --input-file %T/cuGraphics/cuGraphics.dp.cpp --match-full-lines %s | ||
// RUN: %if build_lit %{icpx -c -DNO_BUILD_TEST -fsycl %T/cuGraphics/cuGraphics.dp.cpp -o %T/cuGraphics/cuGraphics.dp.o %} | ||
|
||
#include <cuda.h> | ||
|
||
int main() { | ||
// CHECK: dpct::experimental::external_mem_wrapper_ptr resource; | ||
// CHECK-NEXT: dpct::experimental::external_mem_wrapper_ptr *resources; | ||
// CHECK-NEXT: dpct::experimental::external_mem_wrapper_ptr **resources_ptr; | ||
CUgraphicsResource resource; | ||
CUgraphicsResource *resources; | ||
CUgraphicsResource **resources_ptr; | ||
|
||
// CHECK: dpct::experimental::external_mem_wrapper_ptr resources_arr[10]; | ||
CUgraphicsResource resources_arr[10]; | ||
|
||
// CHECK: dpct::experimental::external_mem_wrapper_ptr resource1, *resources1, **resources_ptr1; | ||
CUgraphicsResource resource1, *resources1, **resources_ptr1; | ||
|
||
resources_arr[0] = resource; | ||
resources_arr[1] = resource1; | ||
|
||
CUdeviceptr pDevPtr; | ||
size_t pSize; | ||
|
||
CUstream stream; | ||
cuStreamCreate(&stream, 0); | ||
|
||
#ifdef _WIN32 | ||
// CHECK-WINDOWS: dpct::experimental::map_resources(2, resources_arr, stream); | ||
cuGraphicsMapResources(2, resources_arr, stream); | ||
|
||
// CHECK-WINDOWS: dpct::experimental::map_resources(1, &resource, stream); | ||
cuGraphicsMapResources(1, &resource, stream); | ||
#endif // _WIN32 | ||
|
||
// CHECK: resource->get_mapped_pointer(&pDevPtr, &pSize); | ||
cuGraphicsResourceGetMappedPointer(&pDevPtr, &pSize, resource); | ||
|
||
#ifdef _WIN32 | ||
// CHECK-WINDOWS: dpct::experimental::unmap_resources(2, resources_arr, stream); | ||
cuGraphicsUnmapResources(2, resources_arr, stream); | ||
|
||
// CHECK-WINDOWS: dpct::experimental::unmap_resources(1, &resource, stream); | ||
cuGraphicsUnmapResources(1, &resource, stream); | ||
#endif // _WIN32 | ||
|
||
// CHECK: delete resource; | ||
cuGraphicsUnregisterResource(resource); | ||
|
||
// CHECK: delete resource1; | ||
cuGraphicsUnregisterResource(resource1); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2 | ||
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2 | ||
// RUN: dpct --format-range=none -out-root %T/cuGraphics_default_option %s --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only --std=c++14 | ||
// RUN: FileCheck --input-file %T/cuGraphics_default_option/cuGraphics_default_option.dp.cpp --match-full-lines %s | ||
// RUN: %if build_lit %{icpx -c -DNO_BUILD_TEST -fsycl %T/cuGraphics_default_option/cuGraphics_default_option.dp.cpp -o %T/cuGraphics_default_option/cudaGraphicsResource_test.dp.o %} | ||
|
||
#ifndef NO_BUILD_TEST | ||
#include <cuda.h> | ||
|
||
int main() { | ||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of CUgraphicsResource is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
CUgraphicsResource resource, *resources; | ||
|
||
CUdeviceptr devPtr; | ||
size_t size; | ||
|
||
CUstream stream; | ||
|
||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cuGraphicsMapResources is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
cuGraphicsMapResources(2, resources, stream); | ||
|
||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cuGraphicsMapResources is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
cuGraphicsMapResources(1, &resource, stream); | ||
|
||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cuGraphicsResourceGetMappedPointer_v2 is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
cuGraphicsResourceGetMappedPointer(&devPtr, &size, resource); | ||
|
||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cuGraphicsUnmapResources is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
cuGraphicsUnmapResources(2, resources, stream); | ||
|
||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cuGraphicsUnmapResources is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
cuGraphicsUnmapResources(1, &resource, stream); | ||
|
||
// CHECK: /* | ||
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cuGraphicsUnregisterResource is not supported, please try to remigrate with option: --use-experimental-features=bindless_images. | ||
// CHECK-NEXT: */ | ||
cuGraphicsUnregisterResource(resource); | ||
|
||
return 0; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
clang/test/dpct/query_api_mapping/Driver/test_graphics_interop.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2 | ||
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2 | ||
|
||
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cuGraphicsMapResources | FileCheck %s -check-prefix=CU_GRAPHICS_MAP_RESOURCES | ||
// CU_GRAPHICS_MAP_RESOURCES: CUDA API: | ||
// CU_GRAPHICS_MAP_RESOURCES-NEXT: cuGraphicsMapResources(c /*int*/, | ||
// CU_GRAPHICS_MAP_RESOURCES-NEXT: r /*CUgraphicsResource **/, | ||
// CU_GRAPHICS_MAP_RESOURCES-NEXT: s /*CUstream*/); | ||
// CU_GRAPHICS_MAP_RESOURCES-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images): | ||
// CU_GRAPHICS_MAP_RESOURCES-NEXT: dpct::experimental::map_resources(c, r, s); | ||
|
||
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cuGraphicsResourceGetMappedPointer | FileCheck %s -check-prefix=CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER | ||
// CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER: CUDA API: | ||
// CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER-NEXT: cuGraphicsResourceGetMappedPointer(&ptr /*CUdeviceptr **/, | ||
// CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER-NEXT: s /*size_t **/, | ||
// CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER-NEXT: r /*CUgraphicsResource*/); | ||
// CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images): | ||
// CU_GRAPHICS_RESOURCE_GET_MAPPED_POINTER-NEXT: r->get_mapped_pointer(&ptr, s); | ||
|
||
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cuGraphicsUnmapResources | FileCheck %s -check-prefix=CU_GRAPHICS_UNMAP_RESOURCES | ||
// CU_GRAPHICS_UNMAP_RESOURCES: CUDA API: | ||
// CU_GRAPHICS_UNMAP_RESOURCES-NEXT: cuGraphicsUnmapResources(c /*int*/, | ||
// CU_GRAPHICS_UNMAP_RESOURCES-NEXT: r /*CUgraphicsResource **/, | ||
// CU_GRAPHICS_UNMAP_RESOURCES-NEXT: s /*CUstream*/); | ||
// CU_GRAPHICS_UNMAP_RESOURCES-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images): | ||
// CU_GRAPHICS_UNMAP_RESOURCES-NEXT: dpct::experimental::unmap_resources(c, r, s); | ||
|
||
// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cuGraphicsUnregisterResource | FileCheck %s -check-prefix=CU_GRAPHICS_UNREGISTER_RESOURCE | ||
// CU_GRAPHICS_UNREGISTER_RESOURCE: CUDA API: | ||
// CU_GRAPHICS_UNREGISTER_RESOURCE-NEXT: cuGraphicsUnregisterResource(r /*CUgraphicsResource*/); | ||
// CU_GRAPHICS_UNREGISTER_RESOURCE-NEXT: Is migrated to (with the option --use-experimental-features=bindless_images): | ||
// CU_GRAPHICS_UNREGISTER_RESOURCE-NEXT: delete r; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters