Skip to content

Commit

Permalink
[SYCLomatic] Support query mapping with older version header on windows.
Browse files Browse the repository at this point in the history
Signed-off-by: Tang, Jiajun [email protected]
  • Loading branch information
tangjj11 committed May 14, 2024
1 parent c8e02fb commit 32adeed
Show file tree
Hide file tree
Showing 30 changed files with 41 additions and 52 deletions.
36 changes: 35 additions & 1 deletion clang/lib/DPCT/DPCT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,12 @@ int runDPCT(int argc, const char **argv) {
dpctExit(MigrationSucceeded);
}
auto SourceCode = APIMapping::getAPISourceCode(QueryAPIMapping);
// #ifdef _WIN32
// static auto SourceCodeStr =
// "#define _MSC_VER 1900\n#define _LIBCUDACXX_OBJECT_FORMAT_COFF 1\n" +
// SourceCode.str();
// SourceCode = SourceCodeStr;
// #endif
if (SourceCode.empty()) {
ShowStatus(MigrationErrorNoAPIMapping);
dpctExit(MigrationErrorNoAPIMapping);
Expand Down Expand Up @@ -871,6 +877,14 @@ int runDPCT(int argc, const char **argv) {
}

Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster("-w"));
#ifdef _WIN32 // Avoid some error on windows platform.
Tool.appendArgumentsAdjuster(
getInsertArgumentAdjuster("-D_LIBCUDACXX_OBJECT_FORMAT_COFF=1"));
if (DpctGlobalInfo::getSDKVersion() <= CudaVersion::CUDA_100) {
Tool.appendArgumentsAdjuster(
getInsertArgumentAdjuster("-D_MSC_VER=1900"));
}
#endif
NoIncrementalMigration.setValue(true);
StopOnParseErr.setValue(true);
Tool.setPrintErrorMessage(false);
Expand Down Expand Up @@ -1175,8 +1189,28 @@ int runDPCT(int argc, const char **argv) {
ShowStatus(MigrationErrorAPIMappingNoCUDAHeader, QueryAPIMapping);
return MigrationErrorAPIMappingNoCUDAHeader;
}
// int ErrorNum = ErrStr.count("error:");
// llvm::outs() << ErrorNum << " ";
// ErrorNum -= ErrStr.count("unsupported Microsoft Visual "
// "Studio version! Only the versions ");
// llvm::outs() << ErrorNum << " ";
// ErrorNum -=
// ErrStr.count("requested alignment must be 8192 bytes or
// smaller");
// llvm::outs() << ErrorNum << " ";
// ErrorNum -= ErrStr.count(
// "object of type 'stored_head_type' (aka "
// "'thrust::cuda_cub::transform_input_iterator_t<bool, "
// "thrust::detail::normal_iterator<thrust::device_ptr<int>>, "
// "thrust::detail::unary_negate<(lambda at
// /tmp/temp.cu:32:13)>>') " "cannot be assigned because its copy
// assignment operator is " "implicitly deleted");
// llvm::outs() << ErrorNum << " ";
llvm::outs() << Err << "\n";
// if (ErrorNum > 0) {
ShowStatus(MigrationErrorNoAPIMapping);
dpctExit(MigrationErrorNoAPIMapping);
return MigrationErrorNoAPIMapping;
// }
}
ShowStatus(MigrationErrorFileParseError);
return MigrationErrorFileParseError;
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/Driver/test.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Initialization

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cuInit | FileCheck %s -check-prefix=CUINIT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Memory Management

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cuArrayDestroy | FileCheck %s -check-prefix=CUARRAYDESTROY
Expand Down
2 changes: 1 addition & 1 deletion clang/test/dpct/query_api_mapping/Math/test-after9.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UNSUPPORTED: cuda-8.0
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0
// UNSUPPORTED: v8.0

/// Half Precision Conversion and Data Movement

Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/Math/test.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Double Precision Intrinsics

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=__dadd_rd | FileCheck %s -check-prefix=__DADD_RD
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Double Precision Mathematical Functions

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=acos | FileCheck %s -check-prefix=ACOS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Half Precision Conversion and Data Movement

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=__float22half2_rn | FileCheck %s -check-prefix=__FLOAT22HALF2_RN
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/Math/test_simd.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// SIMD Intrinsics

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=__vabs2 | FileCheck %s -check-prefix=VABS2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Single Precision Intrinsics

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=__cosf | FileCheck %s -check-prefix=__COSF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Single Precision Mathematical Functions

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=acosf | FileCheck %s -check-prefix=ACOSF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Type Casting Intrinsics

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=__double2float_rd | FileCheck %s -check-prefix=__DOUBLE2FLOAT_RD
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=ncclGetVersion | FileCheck %s -check-prefix=ncclGetVersion
// ncclGetVersion: CUDA API:
// ncclGetVersion-NEXT: ncclGetVersion(version /*int **/);
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/NoLib/test.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=__assert_fail | FileCheck %s -check-prefix=__ASSERT_FAIL
// __ASSERT_FAIL: CUDA API:
// __ASSERT_FAIL-NEXT: __assert_fail(msg /*const char **/, file /*const char **/, line /*unsigned*/,
Expand Down
2 changes: 1 addition & 1 deletion clang/test/dpct/query_api_mapping/Runtime/test-after10.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1, cuda-9.2
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2

/// Stream Management

Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/Runtime/test.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Device Management

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaDeviceGetAttribute | FileCheck %s -check-prefix=CUDADEVICEGETATTRIBUTE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

/// Memory Management

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaArrayGetInfo | FileCheck %s -check-prefix=CUDAARRAYGETINFO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// UNSUPPORTED: system-windows
// UNSUPPORTED: cuda-8.0
// UNSUPPORTED: v8.0

Expand Down
2 changes: 1 addition & 1 deletion clang/test/dpct/query_api_mapping/cuBLAS/blas_9_2.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0
// UNSUPPORTED: v8.0, v9.0, v9.1

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasCgemmBatched | FileCheck %s -check-prefix=cublasCgemmBatched
// cublasCgemmBatched: CUDA API:
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part1.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasZdscal | FileCheck %s -check-prefix=cublasZdscal
// cublasZdscal: CUDA API:
// cublasZdscal-NEXT: cublasZdscal(handle /*cublasHandle_t*/, n /*int*/, alpha /*const double **/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part2.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasDotEx | FileCheck %s -check-prefix=cublasDotEx
// cublasDotEx: CUDA API:
// cublasDotEx-NEXT: cublasDotEx(handle /*cublasHandle_t*/, n /*int*/, x /*const void **/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part3.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasDgeam | FileCheck %s -check-prefix=cublasDgeam
// cublasDgeam: CUDA API:
// cublasDgeam-NEXT: cublasDgeam(handle /*cublasHandle_t*/, transa /*cublasOperation_t*/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part4.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasZgerc | FileCheck %s -check-prefix=cublasZgerc
// cublasZgerc: CUDA API:
// cublasZgerc-NEXT: cublasZgerc(handle /*cublasHandle_t*/, m /*int*/, n /*int*/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part5.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasDsyr | FileCheck %s -check-prefix=cublasDsyr
// cublasDsyr: CUDA API:
// cublasDsyr-NEXT: cublasDsyr(handle /*cublasHandle_t*/, upper_lower /*cublasFillMode_t*/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part6.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasCsscal | FileCheck %s -check-prefix=cublasCsscal
// cublasCsscal: CUDA API:
// cublasCsscal-NEXT: cublasCsscal(handle /*cublasHandle_t*/, n /*int*/, alpha /*const float **/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part7.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasZher2k | FileCheck %s -check-prefix=cublasZher2k
// cublasZher2k: CUDA API:
// cublasZher2k-NEXT: cublasZher2k(handle /*cublasHandle_t*/, upper_lower /*cublasFillMode_t*/,
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuBLAS/blas_part8.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cublasSgemmStridedBatched | FileCheck %s -check-prefix=cublasSgemmStridedBatched
// cublasSgemmStridedBatched: CUDA API:
// cublasSgemmStridedBatched-NEXT: cublasSgemmStridedBatched(
Expand Down
2 changes: 0 additions & 2 deletions clang/test/dpct/query_api_mapping/cuFFT/lit_cuFFT.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cufftExecZ2Z | FileCheck %s -check-prefix=cufftExecZ2Z
// cufftExecZ2Z: CUDA API:
// cufftExecZ2Z-NEXT: cufftHandle plan;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/dpct/query_api_mapping/cuRAND/test.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UNSUPPORTED: cuda-8.0
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0
// UNSUPPORTED: v8.0

/// Host API

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0
// UNSUPPORTED: v8.0, v9.0, v9.1

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusolverDnSpotrsBatched | FileCheck %s -check-prefix=cusolverDnSpotrsBatched
// cusolverDnSpotrsBatched: CUDA API:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// UNSUPPORTED: cuda-8.0, cuda-9.0, cuda-9.1
// UNSUPPORTED: v8.0, v9.0, v9.1, v9.2, v10.0
// UNSUPPORTED: v8.0, v9.0, v9.1

// RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusolverDnCunmtr | FileCheck %s -check-prefix=cusolverDnCunmtr
// cusolverDnCunmtr: CUDA API:
Expand Down

0 comments on commit 32adeed

Please sign in to comment.