Skip to content

Commit

Permalink
[SYCLomatic #1123] Remove redundant -c flag
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed, Daiyaan <[email protected]>
  • Loading branch information
daiyaan-ahmed6 committed Jul 31, 2023
1 parent 24a6ec1 commit c1f773c
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 0 deletions.
1 change: 1 addition & 0 deletions behavior_tests/behavior_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<test testName="ngtn-database-fail" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="nominmax_bd" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="bad_input_1" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="cmp_cmds_c_opt_test" configFile="config/TEMPLATE_behavior_tests_lin.xml" />
<test testName="cmps_cl_compile_test_1" configFile="config/TEMPLATE_behavior_tests_win.xml" />
<test testName="cmps_cl_compile_test_2" configFile="config/TEMPLATE_behavior_tests_win.xml" />
<test testName="cmps_cuda_compile_test_1" configFile="config/TEMPLATE_behavior_tests_win.xml" />
Expand Down
10 changes: 10 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: one two three

one: one.cu
$(CC) -O2 --use_fast_math -DKERNEL_USE_PROFILE=1 -gencode arch=compute_${USE_SM},code=sm_${USE_SM} -DRUN_ON_GPU=1 one.cu -o one -allow-unsupported-compiler

two: two.cu
$(CC) -O2 --use_fast_math -DKERNEL_USE_PROFILE=1 -gencode arch=compute_${USE_SM},code=sm_${USE_SM} -DRUN_ON_GPU=1 two.cu

three: three.cu four.cu
$(CC) -O2 --use_fast_math -DKERNEL_USE_PROFILE=1 -gencode arch=compute_${USE_SM},code=sm_${USE_SM} -DRUN_ON_GPU=1 three.cu four.cu
22 changes: 22 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/compile_commands.json_ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"command": "nvcc -O2 -DKERNEL_USE_PROFILE=1 -DRUN_ON_GPU=1 -o one -allow-unsupported-compiler -D__CUDACC__=1 one.cu",
"directory": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test",
"file": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test/one.cu"
},
{
"command": "nvcc -c -O2 -DKERNEL_USE_PROFILE=1 -DRUN_ON_GPU=1 -D__CUDACC__=1 two.cu",
"directory": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test",
"file": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test/two.cu"
},
{
"command": "nvcc -c -O2 -DKERNEL_USE_PROFILE=1 -DRUN_ON_GPU=1 -D__CUDACC__=1 three.cu",
"directory": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test",
"file": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test/three.cu"
},
{
"command": "nvcc -c -O2 -DKERNEL_USE_PROFILE=1 -DRUN_ON_GPU=1 -D__CUDACC__=1 four.cu",
"directory": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test",
"file": "/export/users/dahmed/up/build/tools/clang/test/dpct/compile_commands_c_opt_test/Output/compile_commands_c_opt_test/four.cu"
}
]
49 changes: 49 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/do_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ====------ do_test.py---------- *- Python -* ----===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#
# ===----------------------------------------------------------------------===#
import subprocess
import platform
import os
import sys
import json

from test_utils import *

def setup_test():
change_dir(test_config.current_test)
return True

def parse_compilation_database(compilation_database_name):
if (not os.path.isfile(compilation_database_name)):
print("The compilation database is not existed, please double check\n")

with open(compilation_database_name) as compilation_database:
compilation_database_items = json.load(compilation_database)
database_source_files = []
for entry in compilation_database_items:
compilation_item = entry['file'];
database_source_files.append(os.path.basename(compilation_item))
return database_source_files

def migrate_test():
call_subprocess("intercept-build make -f Makefile CC=nvcc USE_SM=70 -B")
new_database = parse_compilation_database("compile_commands.json")
reference_database = parse_compilation_database("compile_commands.json_ref")
new_database = list(set(new_database))
reference_database = list(set(reference_database))
new_database.sort()
reference_database.sort()
if(new_database == reference_database):
return True
return False

def build_test():
return True

def run_test():
return True
4 changes: 4 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/four.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: echo
__global__ void foo(){

}
3 changes: 3 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/one.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main() {
return 0;
}
4 changes: 4 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/three.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: echo
__global__ void foo(){

}
4 changes: 4 additions & 0 deletions behavior_tests/src/cmp_cmds_c_opt_test/two.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: echo
__global__ void foo(){

}

0 comments on commit c1f773c

Please sign in to comment.