Skip to content

Commit

Permalink
Merge branch 'SYCLomatic' into enable_back
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiweij1 authored Aug 30, 2023
2 parents f018c2c + 8cf37ba commit 5bd40b1
Show file tree
Hide file tree
Showing 25 changed files with 1,447 additions and 13 deletions.
3 changes: 2 additions & 1 deletion behavior_tests/behavior_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<test testName="change-filename-extension" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="check-device-unsupport-aspect" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="check-windows-version" configFile="config/TEMPLATE_behavior_tests_win.xml" />
<test testName="query-api-mapping" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="query-api-mapping" configFile="config/TEMPLATE_behavior_tests_after_11.5.xml" />
<test testName="ngt-invalid-experimental-features" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="ngt-UDR-path" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="ngt-UDR-keyword" configFile="config/TEMPLATE_behavior_tests.xml" />
Expand All @@ -154,6 +154,7 @@
<test testName="bt-gen-helper-function" configFile="config/TEMPLATE_behavior_tests_win.xml" />
<test testName="bt-language-warning" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="bt-check-unexpected-message" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="cmp-cmds-linker-entry-src-files" configFile="config/TEMPLATE_behavior_tests_lin.xml" />
</tests>

</suite>
11 changes: 11 additions & 0 deletions behavior_tests/config/TEMPLATE_behavior_tests_after_11.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<test driverID="test_behavior" name="TEMPLATE">
<description>test</description>
<files>
<file path="src/${testName}" />
</files>
<rules>
<platformRule OSFamily="Windows" kit="CUDA11.6" kitRange="OLDER" runOnThisPlatform="false"/>
</rules>
</test>
51 changes: 51 additions & 0 deletions behavior_tests/src/cmp-cmds-linker-entry-src-files/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#===============================================================================
# User Options
#===============================================================================

# Compiler can be set below, or via environment variable
CC = nvcc
OPTIMIZE = yes
DEBUG = no
ARCH = sm_60

#===============================================================================
# Program name & source code list
#===============================================================================

program = main

#===============================================================================
# Sets Flags
#===============================================================================

# Standard Flags
CFLAGS := $(EXTRA_CFLAGS) -std=c++14 -Xcompiler -Wall -arch=$(ARCH)

# Linker Flags
LDFLAGS =

# Debug Flags
ifeq ($(DEBUG),yes)
CFLAGS += -g -DDEBUG
LDFLAGS += -g
endif

# Optimization Flags
ifeq ($(OPTIMIZE),yes)
CFLAGS += -O3
endif
#===============================================================================
# Targets to Build
#===============================================================================

$(program): one.o two.o three.c four.c
$(CC) $(CFLAGS) one.o two.o three.c four.c -o $@ $(LDFLAGS)

%.o: %.cu
$(CC) $(CFLAGS) -c $< -o $@

clean:
rm -rf $(program) *.o *.bmp *.bin

run: $(program)
./$(program)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"command": "nvcc -c -std=c++14 -Wall --cuda-gpu-arch=sm_60 -O3 -o one.o -D__CUDACC__=1 one.cu",
"directory": "${TEST_DIRECTORY}",
"file": "${TEST_DIRECTORY}/one.cu"
},
{
"command": "nvcc -c -std=c++14 -Wall --cuda-gpu-arch=sm_60 -O3 -o two.o -D__CUDACC__=1 two.cu",
"directory": "${TEST_DIRECTORY}",
"file": "${TEST_DIRECTORY}/two.cu"
},
{
"command": "nvcc -c -std=c++14 -Wall --cuda-gpu-arch=sm_60 -O3 -D__CUDACC__=1 -o four.o four.c",
"directory": "${TEST_DIRECTORY}",
"file": "${TEST_DIRECTORY}/four.c"
},
{
"command": "nvcc -c -std=c++14 -Wall --cuda-gpu-arch=sm_60 -O3 -D__CUDACC__=1 -o three.o three.c",
"directory": "${TEST_DIRECTORY}",
"file": "${TEST_DIRECTORY}/three.c"
},
{
"command": "nvcc -std=c++14 -Wall --cuda-gpu-arch=sm_60 -O3 one.o two.o -o main -D__CUDACC__=1 four.o three.o",
"directory": "${TEST_DIRECTORY}"
}
]
59 changes: 59 additions & 0 deletions behavior_tests/src/cmp-cmds-linker-entry-src-files/do_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ====------ 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 filecmp
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")
test_dir = os.path.join(os.getcwd())
ref_cmp_db_file = open(test_dir+"/compile_commands.json_ref", "rt")
cmp_cmds = ref_cmp_db_file.read()
cmp_cmds = cmp_cmds.replace('${TEST_DIRECTORY}', test_dir)
ref_cmp_db_file.close()
ref_cmp_db_file = open(test_dir+"/compile_commands.json_ref", "wt")
ref_cmp_db_file.write(cmp_cmds)
ref_cmp_db_file.close()

result = filecmp.cmp(test_dir+"/compile_commands.json",
test_dir+"/compile_commands.json_ref", shallow=False)

return result


def build_test():
return True


def run_test():
return True
4 changes: 4 additions & 0 deletions behavior_tests/src/cmp-cmds-linker-entry-src-files/four.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: echo 0
void foo4(){

}
6 changes: 6 additions & 0 deletions behavior_tests/src/cmp-cmds-linker-entry-src-files/one.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>

int main() {

return 0;
}
4 changes: 4 additions & 0 deletions behavior_tests/src/cmp-cmds-linker-entry-src-files/three.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: echo 0
void foo3(){

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

}
1 change: 1 addition & 0 deletions features/config/TEMPLATE_ccl_api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<optlevelRule excludeOptlevelNameString="usmnone" />
</files>
<rules>
<optlevelRule excludeOptlevelNameString="cpu" />
<optlevelRule excludeOptlevelNameString="cuda_backend" />
</rules>
</test>
Expand Down
8 changes: 8 additions & 0 deletions features/config/TEMPLATE_driverArray.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<test driverID="test_feature" name="TEMPLATE">
<description>test</description>
<files>
<file path="feature_case/driverArray/driverArray.cu" />
</files>
</test>
8 changes: 8 additions & 0 deletions features/config/TEMPLATE_driverMemset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<test driverID="test_feature" name="TEMPLATE">
<description>test</description>
<files>
<file path="feature_case/driverMemset/driverMemset.cu" />
</files>
</test>
12 changes: 12 additions & 0 deletions features/config/TEMPLATE_match.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<test driverID="test_feature" name="TEMPLATE">
<description>test</description>
<files>
<file path="feature_case/match/${testName}.cu" />
</files>
<rules>
<platformRule OSFamily="Linux" kit="CUDA9.2" kitRange="OLDER" runOnThisPlatform="false"/>
<platformRule OSFamily="Windows" kit="CUDA9.2" kitRange="OLDER" runOnThisPlatform="false"/>
</rules>
</test>
13 changes: 13 additions & 0 deletions features/config/TEMPLATE_thrust_operator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>

<test driverID="test_feature" name="TEMPLATE">
<description>test</description>
<files>
<file path="feature_case/thrust/${testName}.cu" />
</files>
<rules>
<platformRule OSFamily="Linux" kit="CUDA10.0" kitRange="OLDER" runOnThisPlatform="false"/>
<platformRule OSFamily="Windows" kit="CUDA10.0" kitRange="OLDER" runOnThisPlatform="false"/>
<optlevelRule excludeOptlevelNameString="cuda_backend" />
</rules>
</test>
Loading

0 comments on commit 5bd40b1

Please sign in to comment.