Skip to content

Commit 2abcdd8

Browse files
authored
[CUDA] Add support for CUDA surfaces (#132883)
This adds support for all the surface read and write calls to clang. It extends the pattern used for textures to surfaces too. I tested this by generating all the various permutations of the calls and argument types in a python script, compiling them with both clang and nvcc, and comparing the generated ptx for equivilence. They all agree, ignoring register allocation, and some places where Clang picks different memory write instructions. An example kernel is: ``` __global__ void testKernel(cudaSurfaceObject_t surfObj, int x, float2* result) { *result = surf1Dread<float2>(surfObj, x, cudaBoundaryModeZero); } ``` --------- Signed-off-by: Austin Schuh <[email protected]>
1 parent 9a5b0f3 commit 2abcdd8

File tree

5 files changed

+3816
-2
lines changed

5 files changed

+3816
-2
lines changed

clang/lib/Headers/__clang_cuda_runtime_wrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ __host__ __device__ void __nv_tex_surf_handler(const char *name, T *ptr,
384384
// will continue to fail as it does now.
385385
#endif // CUDA_VERSION
386386
#endif // __cplusplus >= 201103L && CUDA_VERSION >= 9000
387+
#include "surface_indirect_functions.h"
387388
#include "texture_fetch_functions.h"
388389
#include "texture_indirect_functions.h"
389390

0 commit comments

Comments
 (0)