File tree Expand file tree Collapse file tree
src/bt-no-dpct-helper-function
user_guide_samples/src/vector_add Expand file tree Collapse file tree Original file line number Diff line number Diff line change 164164 <test testName =" bt-gen-helper-function" configFile =" config/TEMPLATE_behavior_tests_win.xml" />
165165 <test testName =" bt-language-warning" configFile =" config/TEMPLATE_behavior_tests.xml" />
166166 <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" />
167168 <test testName =" cmp-cmds-linker-entry-src-files" configFile =" config/TEMPLATE_behavior_tests_lin.xml" />
168169 <test testName =" cmake_dpct_helper_compile_sycl_code" configFile =" config/TEMPLATE_behavior_tests.xml" />
169170 </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 4747
4848print ("Build done!!" )
4949if 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" )
5951else :
6052 print ("case fail" )
You can’t perform that action at this time.
0 commit comments