Skip to content

Commit 9a5bdee

Browse files
committed
Merge branch 'release0.11' into gold/2021
2 parents 2535e93 + eff167b commit 9a5bdee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+973
-252
lines changed

.github/workflows/conda-package.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
python: [3.8]
15+
python: [3.8, 3.9]
1616
steps:
1717
- uses: actions/checkout@v2
1818
with:
@@ -57,7 +57,7 @@ jobs:
5757

5858
strategy:
5959
matrix:
60-
python: [3.8]
60+
python: [3.8, 3.9]
6161
env:
6262
conda-bld: C:\Miniconda\conda-bld\win-64\
6363
steps:
@@ -96,7 +96,7 @@ jobs:
9696

9797
strategy:
9898
matrix:
99-
python: [3.8]
99+
python: [3.8, 3.9]
100100
experimental: [false]
101101
runner: [ubuntu-latest]
102102
# include:
@@ -151,6 +151,7 @@ jobs:
151151
run: |
152152
# echo "libintelocl.so" | tee /etc/OpenCL/vendors/intel-cpu.icd
153153
export OCL_ICD_FILENAMES=libintelocl.so
154+
export SYCL_ENABLE_HOST_DEVICE=1
154155
# clinfo -l
155156
python -m pytest --pyargs $MODULE_NAME
156157
@@ -160,7 +161,7 @@ jobs:
160161

161162
strategy:
162163
matrix:
163-
python: [3.8]
164+
python: [3.8, 3.9]
164165
experimental: [false]
165166
runner: [windows-latest]
166167
continue-on-error: ${{ matrix.experimental }}
@@ -208,15 +209,17 @@ jobs:
208209
- name: Add library
209210
run: echo "OCL_ICD_FILENAMES=C:\Miniconda\Library\lib\intelocl64.dll" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
210211
- name: Run tests
211-
run: python -m pytest --pyargs ${{ env.MODULE_NAME }}
212+
run: |
213+
set SYCL_ENABLE_HOST_DEVICE=1
214+
python -m pytest --pyargs ${{ env.MODULE_NAME }}
212215
213216
upload_linux:
214217
needs: test_linux
215218
if: ${{ github.ref == 'refs/heads/master' }}
216219
runs-on: ubuntu-latest
217220
strategy:
218221
matrix:
219-
python: [3.8]
222+
python: [3.8, 3.9]
220223
steps:
221224
- name: Download artifact
222225
uses: actions/download-artifact@v2
@@ -241,7 +244,7 @@ jobs:
241244
runs-on: windows-latest
242245
strategy:
243246
matrix:
244-
python: [3.8]
247+
python: [3.8, 3.9]
245248
steps:
246249
- name: Download artifact
247250
uses: actions/download-artifact@v2

.github/workflows/generate-coverage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
3030
- name: Install Intel OneAPI
3131
run: |
32-
sudo apt-get install intel-oneapi-dpcpp-cpp-compiler
33-
sudo apt-get install intel-oneapi-tbb
32+
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp=2021.3.0-3350
33+
sudo apt-get install intel-oneapi-tbb=2021.3.0-511
3434
3535
- name: Install CMake
3636
run: |
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Build with Open Source LLVM SYCL compiler
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
install-compiler:
9+
name: Build with nightly build of DPC++ toolchain
10+
runs-on: ubuntu-20.04
11+
12+
env:
13+
OCLCPUEXP_FN: oclcpuexp-2021.12.6.0.19_rel.tar.gz
14+
FPGAEMU_FN: fpgaemu-2021.12.6.0.19_rel.tar.gz
15+
TBB_FN: oneapi-tbb-2021.4.0-lin.tgz
16+
17+
steps:
18+
- name: Cancel Previous Runs
19+
uses: styfle/[email protected]
20+
with:
21+
access_token: ${{ github.token }}
22+
23+
- name: Cache sycl bundle
24+
id: cache-sycl-bundle
25+
uses: actions/cache@v2
26+
with:
27+
path: |
28+
/home/runner/work/sycl_bundle
29+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/sycl_bundle/bundle_id.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-build-${{ env.cache-name }}-
32+
${{ runner.os }}-build-
33+
${{ runner.os }}-
34+
35+
- name: Download and install nightly and components
36+
shell: bash -l {0}
37+
run: |
38+
cd /home/runner/work
39+
mkdir -p sycl_bundle
40+
cd sycl_bundle
41+
export LATEST_LLVM_TAG=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/intel/llvm.git | tail --lines=1)
42+
export LATEST_LLVM_TAG_SHA=$(echo ${LATEST_LLVM_TAG} | awk '{print $1}')
43+
export NIGHTLY_TAG=$(python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))" \
44+
$(echo ${LATEST_LLVM_TAG} | awk '{gsub(/^refs\/tags\//, "", $2)} {print $2}'))
45+
if [[ -f bundle_id.txt && ( "$(cat bundle_id.txt)" == "${LATEST_LLVM_TAG_SHA}" ) ]]; then
46+
echo "Using cached download of ${LATEST_LLVM_TAG}"
47+
else
48+
export DOWNLOAD_URL_PREFIX=https://github.com/intel/llvm/releases/download
49+
rm -rf dpcpp-compiler.tar.gz
50+
wget ${DOWNLOAD_URL_PREFIX}/${NIGHTLY_TAG}/dpcpp-compiler.tar.gz && echo ${LATEST_LLVM_TAG_SHA} > bundle_id.txt || rm -rf bundle_id.txt
51+
[ -f ${OCLCPUEXP_FN} ] || wget ${DOWNLOAD_URL_PREFIX}/2021-07/${OCLCPUEXP_FN} || rm -rf bundle_id.txt
52+
[ -f ${FPGAEMU_FN} ] || wget ${DOWNLOAD_URL_PREFIX}/2021-07/${FPGAEMU_FN} || rm -rf bundle_id.txt
53+
[ -f ${TBB_FN} ] || wget https://github.com/oneapi-src/oneTBB/releases/download/v2021.4.0/${TBB_FN} || rm -rf bundle_id.txt
54+
rm -rf dpcpp_compiler
55+
tar xf dpcpp-compiler.tar.gz
56+
mkdir -p oclcpuexp
57+
mkdir -p fpgaemu
58+
[ -d oclcpuexp/x64 ] || tar xf ${OCLCPUEXP_FN} -C oclcpuexp
59+
[ -d fpgaemu/x64 ] || tar xf ${FPGAEMU_FN} -C fpgaemu
60+
[ -d oneapi-tbb-2021.4.0/lib ] || tar xf ${TBB_FN}
61+
mkdir -p dpcpp_compiler/lib
62+
mkdir -p dpcpp_compiler/lib/oclfpga
63+
touch dpcpp_compiler/lib/oclfpga/fpgavars.sh
64+
fi
65+
66+
- name: Install system components
67+
shell: bash -l {0}
68+
run: |
69+
sudo apt-get install cmake libtinfo5
70+
71+
- name: Setup Python
72+
uses: actions/setup-python@v2
73+
with:
74+
python-version: '3.9'
75+
architecture: x64
76+
77+
- name: Install dpctl dependencies
78+
shell: bash -l {0}
79+
run: |
80+
pip install numpy cython setuptools pytest
81+
82+
- name: Checkout repo
83+
uses: actions/checkout@v2
84+
with:
85+
fetch-depth: 0
86+
87+
- name: build dpctl
88+
shell: bash -l {0}
89+
run: |
90+
export SYCL_BUNDLE_FOLDER=/home/runner/work/sycl_bundle
91+
source ${SYCL_BUNDLE_FOLDER}/dpcpp_compiler/startup.sh
92+
export LD_LIBRARY_PATH=${SYCL_BUNDLE_FOLDER}/oclcpuexp/x64:${LD_LIBRARY_PATH}
93+
export LD_LIBRARY_PATH=${SYCL_BUNDLE_FOLDER}/fpgaemu/x64:${LD_LIBRARY_PATH}
94+
export LD_LIBRARY_PATH=${SYCL_BUNDLE_FOLDER}/oneapi-tbb-2021.4.0/lib/intel64/gcc4.8:${LD_LIBRARY_PATH}
95+
export OCL_ICD_FILENAMES=libintelocl.so:libintelocl_emu.so
96+
clang++ --version
97+
sycl-ls
98+
python setup.py develop --sycl-compiler-prefix=$(dirname $(dirname `which clang++`))
99+
python -m pytest -v dpctl/tests

conda-recipe/build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
# Workaround to Klocwork overwriting LD_LIBRARY_PATH that was modified
44
# by DPC++ compiler conda packages. Will need to be added to DPC++ compiler
55
# activation scripts.
6-
export LDFLAGS="$LDFLAGS -Wl,-rpath,$CONDA_PREFIX/lib"
6+
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib"
77

88
${PYTHON} setup.py clean --all
9-
INSTALL_CMD="install --sycl-compiler-prefix=$CONDA_PREFIX"
9+
INSTALL_CMD="install --sycl-compiler-prefix=$BUILD_PREFIX"
10+
11+
# Workaround for:
12+
# DPC++ launched by cmake does not see components of `dpcpp_cpp_rt`,
13+
# because conda build isolates LD_LIBRARY_PATH to only $PREFIX subfolders.
14+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$BUILD_PREFIX/lib
1015

1116
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
1217
# Install packages and assemble wheel package from built bits

dpctl-capi/CMakeLists.txt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ option(DPCTL_BUILD_CAPI_TESTS
4141

4242
# Minimum version requirement only when oneAPI dpcpp is used.
4343
if(DPCTL_DPCPP_FROM_ONEAPI)
44-
find_package(IntelSycl 2021.2.0 REQUIRED)
44+
find_package(IntelSycl 2021.3.0 REQUIRED)
4545
else()
4646
find_package(IntelSycl REQUIRED)
4747
endif()
@@ -50,6 +50,22 @@ if(DPCTL_ENABLE_LO_PROGRAM_CREATION)
5050
set(DPCTL_ENABLE_LO_PROGRAM_CREATION 1)
5151
include(GetLevelZeroHeaders)
5252
get_level_zero_headers()
53+
if (UNIX)
54+
find_library(PI_LEVEL_ZERO_LIB
55+
NAMES pi_level_zero
56+
HINTS ${IntelSycl_LIBRARY_DIR}
57+
)
58+
find_program(READELF_PROG readelf)
59+
find_program(GREP_PROG grep)
60+
execute_process(
61+
COMMAND ${READELF_PROG} -d ${PI_LEVEL_ZERO_LIB}
62+
COMMAND ${GREP_PROG} libze_loader
63+
COMMAND ${GREP_PROG} -Po "libze_loader[^\]]*"
64+
OUTPUT_VARIABLE LIBZE_LOADER_FILENAME
65+
OUTPUT_STRIP_TRAILING_WHITESPACE
66+
ERROR_STRIP_TRAILING_WHITESPACE
67+
)
68+
endif()
5369
endif()
5470

5571
configure_file(
@@ -207,11 +223,10 @@ if(DPCTL_GENERATE_COVERAGE)
207223
set(DPCTL_BUILD_CAPI_TESTS "ON")
208224
if(DPCTL_COVERAGE_REPORT_OUTPUT_DIR)
209225
set(COVERAGE_OUTPUT_DIR ${DPCTL_COVERAGE_REPORT_OUTPUT_DIR})
210-
message(STATUS "Coverage reports to be saved at ${COVERAGE_OUTPUT_DIR}")
211226
else()
212227
set(COVERAGE_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
213-
message(STATUS "Coverage reports to be saved at ${COVERAGE_OUTPUT_DIR}")
214228
endif()
229+
message(STATUS "Coverage reports to be saved at ${COVERAGE_OUTPUT_DIR}")
215230
endif()
216231

217232
# Add sub-directory to build the dpctl C API test cases

dpctl-capi/cmake/modules/FindIntelSycl.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ include(FindPackageHandleStandardArgs)
3838
# IntelSycl_ROOT to that path.
3939
if(DPCTL_DPCPP_HOME_DIR)
4040
set(IntelSycl_ROOT ${DPCTL_DPCPP_HOME_DIR})
41-
message(STATUS "Not using standard oneAPI installation, but IntelSycl at " ${IntelSycl_ROOT})
41+
if(NOT DPCTL_DPCPP_FROM_ONEAPI)
42+
message(STATUS
43+
"Not using standard oneAPI installation, but IntelSycl at "
44+
${IntelSycl_ROOT}
45+
)
46+
endif()
4247
# If DPC++ installation was not specified, check for ONEAPI_ROOT
4348
elseif(DEFINED ENV{ONEAPI_ROOT})
4449
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//===--- dpctl_string_utils.hpp - C++ to C string converted -*-C++-*- ===//
2+
//
3+
// Data Parallel Control (dpctl)
4+
//
5+
// Copyright 2020-2021 Intel Corporation
6+
//
7+
// Licensed under the Apache License, Version 2.0 (the "License");
8+
// you may not use this file except in compliance with the License.
9+
// You may obtain a copy of the License at
10+
//
11+
// http://www.apache.org/licenses/LICENSE-2.0
12+
//
13+
// Unless required by applicable law or agreed to in writing, software
14+
// distributed under the License is distributed on an "AS IS" BASIS,
15+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
// See the License for the specific language governing permissions and
17+
// limitations under the License.
18+
//
19+
//===----------------------------------------------------------------------===//
20+
///
21+
/// \file
22+
/// Helper function to convert a C++ string to a C string.
23+
//===----------------------------------------------------------------------===//
24+
#include <cstring>
25+
#include <iostream>
26+
#include <string>
27+
28+
#pragma once
29+
30+
namespace dpctl
31+
{
32+
namespace helper
33+
{
34+
/*!
35+
* @brief Convert a C++ std::string to a const char* and return the string to
36+
* caller.
37+
*
38+
* @param str A C++ string that has to be converted to a C string.
39+
* @return A const char* string representation of the C++ string.
40+
*/
41+
static inline __dpctl_give const char *
42+
cstring_from_string(const std::string &str)
43+
{
44+
char *cstr = nullptr;
45+
try {
46+
auto cstr_len = str.length() + 1;
47+
cstr = new char[cstr_len];
48+
#ifdef _WIN32
49+
strncpy_s(cstr, cstr_len, str.c_str(), cstr_len);
50+
#else
51+
std::strncpy(cstr, str.c_str(), cstr_len);
52+
#endif
53+
} catch (std::bad_alloc const &ba) {
54+
// \todo log error
55+
std::cerr << ba.what() << '\n';
56+
}
57+
58+
return cstr;
59+
}
60+
} // namespace helper
61+
} // namespace dpctl

dpctl-capi/include/Config/dpctl_config.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030

3131
/* The DPCPP version used to build dpctl */
3232
#define DPCTL_DPCPP_VERSION "@IntelSycl_VERSION@"
33+
34+
#define DPCTL_LIBZE_LOADER_FILENAME "@LIBZE_LOADER_FILENAME@"

dpctl-capi/include/dpctl_data_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
#include <inttypes.h>
3838
#include <stdint.h>
3939

40+
#ifndef __cplusplus
41+
#include <stdbool.h>
42+
#endif
43+
4044
#ifndef _MSC_VER
4145

4246
#if !defined(UINT32_MAX)

dpctl-capi/include/dpctl_sycl_device_manager.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,22 @@ DPCTL_API
7676
__dpctl_give DPCTLDeviceVectorRef
7777
DPCTLDeviceMgr_GetDevices(int device_identifier);
7878

79+
/*!
80+
* @brief Returns a set of device info attributes as a string.
81+
*
82+
* @param DRef Opaque pointer to a ``sycl::device``
83+
* @return A formatted C string capturing the following attributes:
84+
* - device name
85+
* - driver version
86+
* - vendor
87+
* - profiler support
88+
* - oneapi filter string
89+
* @ingroup DeviceManager
90+
*/
91+
DPCTL_API
92+
__dpctl_give const char *
93+
DPCTLDeviceMgr_GetDeviceInfoStr(__dpctl_keep const DPCTLSyclDeviceRef DRef);
94+
7995
/*!
8096
* @brief Returns an index on the given device in the vector returned by
8197
* #DPCTLDeviceMgr_GetDevices if found, -1 otherwise.
@@ -91,6 +107,7 @@ DPCTLDeviceMgr_GetDevices(int device_identifier);
91107
* @return If found, returns the position of the given device in the
92108
* vector that would be returned by #DPCTLDeviceMgr_GetDevices if called
93109
* with the same device_identifier argument.
110+
* @ingroup DeviceManager
94111
*/
95112
DPCTL_API
96113
int DPCTLDeviceMgr_GetPositionInDevices(__dpctl_keep DPCTLSyclDeviceRef DRef,
@@ -122,6 +139,7 @@ DPCTLDeviceMgr_GetCachedContext(__dpctl_keep const DPCTLSyclDeviceRef DRef);
122139
* the enum values or a bitwise OR-ed combination.
123140
* @return The number of available devices satisfying the condition specified
124141
* by the device_identifier bit flag.
142+
* @ingroup DeviceManager
125143
*/
126144
DPCTL_API
127145
size_t DPCTLDeviceMgr_GetNumDevices(int device_identifier);
@@ -131,6 +149,7 @@ size_t DPCTLDeviceMgr_GetNumDevices(int device_identifier);
131149
* currently supported by dpctl.
132150
*
133151
* @param DRef A #DPCTLSyclDeviceRef opaque pointer.
152+
* @ingroup DeviceManager
134153
*/
135154
DPCTL_API
136155
void DPCTLDeviceMgr_PrintDeviceInfo(__dpctl_keep const DPCTLSyclDeviceRef DRef);

0 commit comments

Comments
 (0)