Skip to content

Commit 9f29f4c

Browse files
authored
[SYCLomatic] Enable Windows platform for behavior_test cmake_dpct_compile_sycl_code (#570)
Signed-off-by: chenwei.sun <[email protected]>
1 parent db1b52e commit 9f29f4c

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

behavior_tests/behavior_tests.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
<test testName="bt-language-warning" configFile="config/TEMPLATE_behavior_tests.xml" />
165165
<test testName="bt-check-unexpected-message" configFile="config/TEMPLATE_behavior_tests.xml" />
166166
<test testName="cmp-cmds-linker-entry-src-files" configFile="config/TEMPLATE_behavior_tests_lin.xml" />
167-
<test testName="cmake_dpct_compile_sycl_code" configFile="config/TEMPLATE_behavior_tests_lin.xml" />
167+
<test testName="cmake_dpct_compile_sycl_code" configFile="config/TEMPLATE_behavior_tests.xml" />
168168
</tests>
169169

170170
</suite>

behavior_tests/src/cmake_dpct_compile_sycl_code/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#
77
#===----------------------------------------------------------------------===//
88

9-
cmake_minimum_required(VERSION 3.23)
9+
cmake_minimum_required(VERSION 3.10)
1010

11-
project(cmake_ptx LANGUAGES CXX)
11+
project(cmake_ptx NONE)
1212
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl")
1313
find_program(
1414
dpct_bin_path
@@ -22,13 +22,13 @@ dpct_compile_sycl_code(cuda_ptx_files jit.dp.cpp)
2222

2323
set(_generated_files "")
2424
add_custom_command(
25-
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/app
26-
COMMAND icpx -fsycl -o ${CMAKE_CURRENT_BINARY_DIR}/app
25+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/app.run
26+
COMMAND icpx -fsycl -o ${CMAKE_CURRENT_BINARY_DIR}/app.run
2727
${CMAKE_SOURCE_DIR}/kernel_library.cpp.dp.cpp
2828
DEPENDS ${CMAKE_SOURCE_DIR}/kernel_library.cpp.dp.cpp
29-
COMMENT "Generating app")
29+
COMMENT "Generating app.run")
3030

31-
list(APPEND _generated_files ${CMAKE_CURRENT_BINARY_DIR}/app)
31+
list(APPEND _generated_files ${CMAKE_CURRENT_BINARY_DIR}/app.run)
3232

3333
set(_copy_files "")
3434
add_custom_command(

behavior_tests/src/cmake_dpct_compile_sycl_code/do_test.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,26 @@ def setup_test():
2121
def migrate_test():
2222
# clean previous migration output
2323
if (os.path.exists("build")):
24-
shutil.rmtree("build")
25-
call_subprocess(" mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=icpx ../ && make")
26-
return os.path.exists(os.path.join("build", "app"))
24+
shutil.rmtree("build")
25+
26+
ret = call_subprocess("mkdir build")
27+
if not ret:
28+
print("Error to create build folder:", test_config.command_output)
29+
30+
ret = change_dir("build")
31+
if not ret:
32+
print("Error to go to build folder:", test_config.command_output)
33+
34+
ret = call_subprocess("cmake -G \"Unix Makefiles\" -DCMAKE_CXX_COMPILER=icpx ../")
35+
if not ret:
36+
print("Error to run cmake configure:", test_config.command_output)
37+
38+
ret = call_subprocess("make")
39+
if not ret:
40+
print("Error to run build process:", test_config.command_output)
41+
42+
return os.path.exists("app.run")
2743
def build_test():
2844
return True
2945
def run_test():
30-
change_dir("build")
31-
return call_subprocess(os.path.join(os.path.curdir, "app"))
46+
return call_subprocess("./app.run")

0 commit comments

Comments
 (0)