File tree Expand file tree Collapse file tree 4 files changed +67
-9
lines changed
src/bt-no-dpct-helper-function
user_guide_samples/src/vector_add Expand file tree Collapse file tree 4 files changed +67
-9
lines changed Original file line number Diff line number Diff line change 164
164
<test testName =" bt-gen-helper-function" configFile =" config/TEMPLATE_behavior_tests_win.xml" />
165
165
<test testName =" bt-language-warning" configFile =" config/TEMPLATE_behavior_tests.xml" />
166
166
<test testName =" bt-check-unexpected-message" configFile =" config/TEMPLATE_behavior_tests.xml" />
167
+ <test testName =" bt-no-dpct-helper-function" configFile =" config/TEMPLATE_behavior_tests.xml" />
167
168
<test testName =" cmp-cmds-linker-entry-src-files" configFile =" config/TEMPLATE_behavior_tests_lin.xml" />
168
169
<test testName =" cmake_dpct_helper_compile_sycl_code" configFile =" config/TEMPLATE_behavior_tests.xml" />
169
170
</tests >
Original file line number Diff line number Diff line change
1
+ # ====------ do_test.py---------- *- Python -* ----===##
2
+ #
3
+ # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ # See https://llvm.org/LICENSE.txt for license information.
5
+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ #
7
+ #
8
+ # ===----------------------------------------------------------------------===#
9
+ import subprocess
10
+ import platform
11
+ import os
12
+ import sys
13
+
14
+ from test_utils import *
15
+
16
+ def setup_test ():
17
+ change_dir (test_config .current_test )
18
+ return True
19
+
20
+ def migrate_test ():
21
+ call_subprocess (test_config .CT_TOOL + " --out-root=./sycl test.cu --cuda-include-path=" + test_config .include_path )
22
+ return True
23
+ def build_test ():
24
+ with open ("./sycl/test.dp.cpp" , "r" ) as f :
25
+ # check migrated code content
26
+ content = f .read ()
27
+ if "dpct::" in content :
28
+ print ("the migrated code should not contain 'dpct::':" )
29
+ print (content )
30
+ print ("case fail" )
31
+ return False
32
+ else :
33
+ print ("case pass" )
34
+ return True
35
+
36
+ def run_test ():
37
+ return True
38
+
Original file line number Diff line number Diff line change
1
+ // ====------ test.cu---------- *- CUDA -* ----===////
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //
8
+ // ===----------------------------------------------------------------------===//
9
+
10
+ #include < cuda_runtime.h>
11
+
12
+ __global__ void VectorAddKernel (float * A, float * B, float * C)
13
+ {
14
+ A[threadIdx .x ] = threadIdx .x + 1 .0f ;
15
+ B[threadIdx .x ] = threadIdx .x + 1 .0f ;
16
+ C[threadIdx .x ] = A[threadIdx .x ] + B[threadIdx .x ];
17
+ }
18
+
19
+ void foo () {
20
+ float *d_A, *d_B, *d_C;
21
+ int vector_size = 100 ;
22
+ cudaMalloc (&d_A, vector_size*sizeof (float ));
23
+ cudaMalloc (&d_B, vector_size*sizeof (float ));
24
+ cudaMalloc (&d_C, vector_size*sizeof (float ));
25
+
26
+ VectorAddKernel<<<1 , vector_size>>> (d_A, d_B, d_C);
27
+ }
Original file line number Diff line number Diff line change 47
47
48
48
print ("Build done!!" )
49
49
if subprocess .check_output (out_exe , shell = run_shell ).decode ().replace ("\r \n " , "\n " )== result .decode ():
50
- with open (default_out_root + "/vector_add.dp.cpp" , "r" ) as f :
51
- # check migrated code content
52
- content = f .read ()
53
- if "dpct::" in content :
54
- print ("the migrated code should not contain 'dpct::':" )
55
- print (content )
56
- print ("case fail" )
57
- else :
58
- print ("case pass" )
50
+ print ("case pass" )
59
51
else :
60
52
print ("case fail" )
You can’t perform that action at this time.
0 commit comments