Skip to content

cuda clang: Move nvptx-surface.cu test to CodeGenCUDA #134758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025
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
194 changes: 0 additions & 194 deletions clang/test/CodeGen/Inputs/cuda.h

This file was deleted.

169 changes: 169 additions & 0 deletions clang/test/CodeGenCUDA/Inputs/cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,172 @@ extern "C" cudaError_t cudaLaunchKernel_ptsz(const void *func, dim3 gridDim,
#endif

extern "C" __device__ int printf(const char*, ...);

struct char1 {
char x;
__host__ __device__ char1(char x = 0) : x(x) {}
};
struct char2 {
char x, y;
__host__ __device__ char2(char x = 0, char y = 0) : x(x), y(y) {}
};
struct char4 {
char x, y, z, w;
__host__ __device__ char4(char x = 0, char y = 0, char z = 0, char w = 0) : x(x), y(y), z(z), w(w) {}
};

struct uchar1 {
unsigned char x;
__host__ __device__ uchar1(unsigned char x = 0) : x(x) {}
};
struct uchar2 {
unsigned char x, y;
__host__ __device__ uchar2(unsigned char x = 0, unsigned char y = 0) : x(x), y(y) {}
};
struct uchar4 {
unsigned char x, y, z, w;
__host__ __device__ uchar4(unsigned char x = 0, unsigned char y = 0, unsigned char z = 0, unsigned char w = 0) : x(x), y(y), z(z), w(w) {}
};

struct short1 {
short x;
__host__ __device__ short1(short x = 0) : x(x) {}
};
struct short2 {
short x, y;
__host__ __device__ short2(short x = 0, short y = 0) : x(x), y(y) {}
};
struct short4 {
short x, y, z, w;
__host__ __device__ short4(short x = 0, short y = 0, short z = 0, short w = 0) : x(x), y(y), z(z), w(w) {}
};

struct ushort1 {
unsigned short x;
__host__ __device__ ushort1(unsigned short x = 0) : x(x) {}
};
struct ushort2 {
unsigned short x, y;
__host__ __device__ ushort2(unsigned short x = 0, unsigned short y = 0) : x(x), y(y) {}
};
struct ushort4 {
unsigned short x, y, z, w;
__host__ __device__ ushort4(unsigned short x = 0, unsigned short y = 0, unsigned short z = 0, unsigned short w = 0) : x(x), y(y), z(z), w(w) {}
};

struct int1 {
int x;
__host__ __device__ int1(int x = 0) : x(x) {}
};
struct int2 {
int x, y;
__host__ __device__ int2(int x = 0, int y = 0) : x(x), y(y) {}
};
struct int4 {
int x, y, z, w;
__host__ __device__ int4(int x = 0, int y = 0, int z = 0, int w = 0) : x(x), y(y), z(z), w(w) {}
};

struct uint1 {
unsigned x;
__host__ __device__ uint1(unsigned x = 0) : x(x) {}
};
struct uint2 {
unsigned x, y;
__host__ __device__ uint2(unsigned x = 0, unsigned y = 0) : x(x), y(y) {}
};
struct uint3 {
unsigned x, y, z;
__host__ __device__ uint3(unsigned x = 0, unsigned y = 0, unsigned z = 0) : x(x), y(y), z(z) {}
};
struct uint4 {
unsigned x, y, z, w;
__host__ __device__ uint4(unsigned x = 0, unsigned y = 0, unsigned z = 0, unsigned w = 0) : x(x), y(y), z(z), w(w) {}
};

struct longlong1 {
long long x;
__host__ __device__ longlong1(long long x = 0) : x(x) {}
};
struct longlong2 {
long long x, y;
__host__ __device__ longlong2(long long x = 0, long long y = 0) : x(x), y(y) {}
};
struct longlong4 {
long long x, y, z, w;
__host__ __device__ longlong4(long long x = 0, long long y = 0, long long z = 0, long long w = 0) : x(x), y(y), z(z), w(w) {}
};

struct ulonglong1 {
unsigned long long x;
__host__ __device__ ulonglong1(unsigned long long x = 0) : x(x) {}
};
struct ulonglong2 {
unsigned long long x, y;
__host__ __device__ ulonglong2(unsigned long long x = 0, unsigned long long y = 0) : x(x), y(y) {}
};
struct ulonglong4 {
unsigned long long x, y, z, w;
__host__ __device__ ulonglong4(unsigned long long x = 0, unsigned long long y = 0, unsigned long long z = 0, unsigned long long w = 0) : x(x), y(y), z(z), w(w) {}
};

struct float1 {
float x;
__host__ __device__ float1(float x = 0) : x(x) {}
};
struct float2 {
float x, y;
__host__ __device__ float2(float x = 0, float y = 0) : x(x), y(y) {}
};
struct float4 {
float x, y, z, w;
__host__ __device__ float4(float x = 0, float y = 0, float z = 0, float w = 0) : x(x), y(y), z(z), w(w) {}
};

struct double1 {
double x;
__host__ __device__ double1(double x = 0) : x(x) {}
};
struct double2 {
double x, y;
__host__ __device__ double2(double x = 0, double y = 0) : x(x), y(y) {}
};
struct double4 {
double x, y, z, w;
__host__ __device__ double4(double x = 0, double y = 0, double z = 0, double w = 0) : x(x), y(y), z(z), w(w) {}
};

typedef unsigned long long cudaTextureObject_t;
typedef unsigned long long cudaSurfaceObject_t;

enum cudaTextureReadMode {
cudaReadModeNormalizedFloat,
cudaReadModeElementType
};

enum cudaSurfaceBoundaryMode {
cudaBoundaryModeZero,
cudaBoundaryModeClamp,
cudaBoundaryModeTrap
};

enum {
cudaTextureType1D,
cudaTextureType2D,
cudaTextureType3D,
cudaTextureTypeCubemap,
cudaTextureType1DLayered,
cudaTextureType2DLayered,
cudaTextureTypeCubemapLayered
};

struct textureReference { };
template <class T, int texType = cudaTextureType1D,
enum cudaTextureReadMode mode = cudaReadModeElementType>
struct __attribute__((device_builtin_texture_type)) texture
: public textureReference {};

struct surfaceReference { int desc; };

template <typename T, int dim = 1>
struct __attribute__((device_builtin_surface_type)) surface : public surfaceReference {};
4 changes: 2 additions & 2 deletions clang/test/CodeGenCUDA/correctly-rounded-div.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "Inputs/cuda.h"

typedef __attribute__(( ext_vector_type(4) )) float float4;
typedef __attribute__(( ext_vector_type(4) )) float floatvec4;

// COMMON-LABEL: @_Z11spscalardiv
// COMMON: fdiv{{.*}},
Expand All @@ -22,7 +22,7 @@ __device__ float spscalardiv(float a, float b) {
// COMMON: fdiv{{.*}},
// NCRDIV: !fpmath ![[MD]]
// CRDIV-NOT: !fpmath
__device__ float4 spvectordiv(float4 a, float4 b) {
__device__ floatvec4 spvectordiv(floatvec4 a, floatvec4 b) {
return a / b;
}

Expand Down
Loading
Loading