Skip to content

Commit

Permalink
Merge pull request #813 from pbalcer/adapters-update-v0.7.1
Browse files Browse the repository at this point in the history
[adapters] update to latest sycl (with 0.7.1 tag)
  • Loading branch information
pbalcer authored Aug 21, 2023
2 parents 12c0cdf + 31be4f4 commit f95dfbc
Show file tree
Hide file tree
Showing 56 changed files with 834 additions and 373 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
- name: Generate source from spec, check for uncommitted diff
if: matrix.os == 'ubuntu-22.04'
run: cmake --build ${{github.workspace}}/build --target check-generated

- name: Verify that each source file contains a license
run: cmake --build ${{github.workspace}}/build --target verify-licenses

- name: Build
run: cmake --build ${{github.workspace}}/build -j $(nproc)
Expand Down
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
project(unified-runtime VERSION 0.6.0)
project(unified-runtime VERSION 0.7.0)

include(GNUInstallDirs)
include(CheckCXXSourceCompiles)
Expand Down Expand Up @@ -161,6 +161,7 @@ endif()

# Obtain files for clang-format
set(format_glob)
set(license_glob)
foreach(dir examples include source test tools)
list(APPEND format_glob
"${dir}/*.h"
Expand All @@ -171,8 +172,26 @@ foreach(dir examples include source test tools)
"${dir}/**/*.hpp"
"${dir}/**/*.c"
"${dir}/**/*.cpp")
list(APPEND license_glob
"${dir}/*.yml"
"${dir}/**/*.yml"
"${dir}/*.py"
"${dir}/**/*.py"
"${dir}/**/CMakeLists.txt"
"${dir}/CMakeLists.txt"
)
endforeach()
file(GLOB_RECURSE format_src ${format_glob})
file(GLOB_RECURSE license_src ${license_glob})

# check for licence
list(FILTER license_src EXCLUDE REGEX "registry.yml")
add_custom_target(verify-licenses
COMMAND ${Python3_EXECUTABLE}
"${PROJECT_SOURCE_DIR}/scripts/verify_license.py"
"--files" ${format_src} ${license_src}
COMMENT "Verify all files contain a license."
)

# Add code formatter target
add_custom_target(cppformat)
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ $ make

List of options provided by CMake:

| Name | Description | Values | Default |
|-------------------------|--------------------------------------------------------|------------|---------|
| UR_BUILD_TESTS | Build the tests | ON/OFF | ON |
| UR_BUILD_TOOLS | Build tools | ON/OFF | ON |
| UR_FORMAT_CPP_STYLE | Format code style | ON/OFF | OFF |
| UR_DEVELOPER_MODE | Treat warnings as errors and enables additional checks | ON/OFF | OFF |
| UR_USE_ASAN | Enable AddressSanitizer | ON/OFF | OFF |
| UR_USE_TSAN | Enable ThreadSanitizer | ON/OFF | OFF |
| UR_USE_UBSAN | Enable UndefinedBehavior Sanitizer | ON/OFF | OFF |
| UR_USE_MSAN | Enable MemorySanitizer (clang only) | ON/OFF | OFF |
| UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF |
| Name | Description | Values | Default |
| - | - | - | - |
| UR_BUILD_TESTS | Build the tests | ON/OFF | ON |
| UR_BUILD_TOOLS | Build tools | ON/OFF | ON |
| UR_FORMAT_CPP_STYLE | Format code style | ON/OFF | OFF |
| UR_DEVELOPER_MODE | Treat warnings as errors and enables additional checks | ON/OFF | OFF |
| UR_USE_ASAN | Enable AddressSanitizer | ON/OFF | OFF |
| UR_USE_TSAN | Enable ThreadSanitizer | ON/OFF | OFF |
| UR_USE_UBSAN | Enable UndefinedBehavior Sanitizer | ON/OFF | OFF |
| UR_USE_MSAN | Enable MemorySanitizer (clang only) | ON/OFF | OFF |
| UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF |
| UR_CONFORMANCE_TARGET_TRIPLES | SYCL triples to build CTS device binaries for | Comma-separated list | spir64 |
| UR_BUILD_ADAPTER_L0 | Fetch and use level-zero adapter from SYCL | ON/OFF | OFF |
| UR_BUILD_ADAPTER_OPENCL | Fetch and use opencl adapter from SYCL | ON/OFF | OFF |
| UR_BUILD_ADAPTER_CUDA | Fetch and use cuda adapter from SYCL | ON/OFF | OFF |
Expand Down
30 changes: 24 additions & 6 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function(add_ur_target_compile_options name)
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>
)

if (CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_definitions(${name} PRIVATE -D_FORTIFY_SOURCE=2)
endif()
Expand All @@ -84,27 +83,46 @@ function(add_ur_target_compile_options name)
/MD$<$<CONFIG:Debug>:d>
/GS
)
add_link_options(

if(UR_DEVELOPER_MODE)
target_compile_options(${name} PRIVATE /WX /GS)
endif()
endif()
endfunction()

function(add_ur_target_link_options name)
if(NOT MSVC)
if (NOT APPLE)
target_link_options(${name} PRIVATE "LINKER:-z,relro,-z,now")
endif()
elseif(MSVC)
target_link_options(${name} PRIVATE
/DYNAMICBASE
/HIGHENTROPYVA
/ALLOWISOLATION
/NXCOMPAT
)
endif()
endfunction()

if(UR_DEVELOPER_MODE)
target_compile_options(${name} PRIVATE /WX /GS)
endif()
function(add_ur_target_exec_options name)
if(MSVC)
target_link_options(${name} PRIVATE
/ALLOWISOLATION
)
endif()
endfunction()

function(add_ur_executable name)
add_executable(${name} ${ARGN})
add_ur_target_compile_options(${name})
add_ur_target_exec_options(${name})
add_ur_target_link_options(${name})
endfunction()

function(add_ur_library name)
add_library(${name} ${ARGN})
add_ur_target_compile_options(${name})
add_ur_target_link_options(${name})
endfunction()

include(FetchContent)
Expand Down
53 changes: 3 additions & 50 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@file ur.py
@version v0.6-r0
@version v0.7-r0
"""
import platform
Expand Down Expand Up @@ -569,7 +569,8 @@ def __str__(self):
## ::UR_MAJOR_VERSION and ::UR_MINOR_VERSION
class ur_api_version_v(IntEnum):
_0_6 = UR_MAKE_VERSION( 0, 6 ) ## version 0.6
CURRENT = UR_MAKE_VERSION( 0, 6 ) ## latest known version
_0_7 = UR_MAKE_VERSION( 0, 7 ) ## version 0.7
CURRENT = UR_MAKE_VERSION( 0, 7 ) ## latest known version

class ur_api_version_t(c_int):
def __str__(self):
Expand Down Expand Up @@ -2263,53 +2264,6 @@ def __str__(self):
###############################################################################
__use_win_types = "Windows" == platform.uname()[0]

###############################################################################
## @brief Function-pointer for urLoaderConfigCreate
if __use_win_types:
_urLoaderConfigCreate_t = WINFUNCTYPE( ur_result_t, POINTER(ur_loader_config_handle_t) )
else:
_urLoaderConfigCreate_t = CFUNCTYPE( ur_result_t, POINTER(ur_loader_config_handle_t) )

###############################################################################
## @brief Function-pointer for urLoaderConfigRetain
if __use_win_types:
_urLoaderConfigRetain_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t )
else:
_urLoaderConfigRetain_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t )

###############################################################################
## @brief Function-pointer for urLoaderConfigRelease
if __use_win_types:
_urLoaderConfigRelease_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t )
else:
_urLoaderConfigRelease_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t )

###############################################################################
## @brief Function-pointer for urLoaderConfigGetInfo
if __use_win_types:
_urLoaderConfigGetInfo_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t, ur_loader_config_info_t, c_size_t, c_void_p, POINTER(c_size_t) )
else:
_urLoaderConfigGetInfo_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t, ur_loader_config_info_t, c_size_t, c_void_p, POINTER(c_size_t) )

###############################################################################
## @brief Function-pointer for urLoaderConfigEnableLayer
if __use_win_types:
_urLoaderConfigEnableLayer_t = WINFUNCTYPE( ur_result_t, ur_loader_config_handle_t, c_char_p )
else:
_urLoaderConfigEnableLayer_t = CFUNCTYPE( ur_result_t, ur_loader_config_handle_t, c_char_p )


###############################################################################
## @brief Table of LoaderConfig functions pointers
class ur_loader_config_dditable_t(Structure):
_fields_ = [
("pfnCreate", c_void_p), ## _urLoaderConfigCreate_t
("pfnRetain", c_void_p), ## _urLoaderConfigRetain_t
("pfnRelease", c_void_p), ## _urLoaderConfigRelease_t
("pfnGetInfo", c_void_p), ## _urLoaderConfigGetInfo_t
("pfnEnableLayer", c_void_p) ## _urLoaderConfigEnableLayer_t
]

###############################################################################
## @brief Function-pointer for urPlatformGet
if __use_win_types:
Expand Down Expand Up @@ -3791,7 +3745,6 @@ class ur_device_dditable_t(Structure):
###############################################################################
class ur_dditable_t(Structure):
_fields_ = [
("LoaderConfig", ur_loader_config_dditable_t),
("Platform", ur_platform_dditable_t),
("Context", ur_context_dditable_t),
("Event", ur_event_dditable_t),
Expand Down
5 changes: 3 additions & 2 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* @file ur_api.h
* @version v0.6-r0
* @version v0.7-r0
*
*/
#ifndef UR_API_H_INCLUDED
Expand Down Expand Up @@ -1021,7 +1021,8 @@ urPlatformGetInfo(
/// ::UR_MAJOR_VERSION and ::UR_MINOR_VERSION
typedef enum ur_api_version_t {
UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), ///< version 0.6
UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 6), ///< latest known version
UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), ///< version 0.7
UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 7), ///< latest known version
/// @cond
UR_API_VERSION_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down
2 changes: 1 addition & 1 deletion include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
* @file ur_ddi.h
* @version v0.6-r0
* @version v0.7-r0
*
*/
#ifndef UR_DDI_H_INCLUDED
Expand Down
2 changes: 1 addition & 1 deletion scripts/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Intel One API Unified Runtime API"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v0.6
PROJECT_NUMBER = v0.7

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
7 changes: 5 additions & 2 deletions scripts/YaML.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,13 @@ std::function<void(void*)> ur_callback_t;
* A handle requires the following scalar fields: {`desc`, `name`}
- `desc` will be used as the handles's description comment
- `name` must be a unique ISO-C standard identifier, start with `$` tag, be snake_case and end with `_handle_t`
* A handle may take the following optional scalar fields: {`class`, `alias`, `condition`, `ordinal`, `version`}
* A handle may take the following optional scalar fields: {`class`, `alias`, `condition`, `ordinal`, `version`, `loader_only`}
- `class` will be used to scope the handles declaration within the specified C++ class
- `alias` will be used to declare the handle as an alias of another handle; specifically, aliases in another namespace
- `condition` will be used as a C/C++ preprocessor `#if` conditional expression
- `ordinal` will be used to override the default order (in which they appear) the handles appears within its section; `default="1000"`
- `version` will be used to define the minimum API version in which the handles will appear; `default="1.0"` This will also affect the order in which the handles appears within its section.
- `loader_only` will be used to decide whether the handle can be instantiated and managed only by the loader.
* A handle may take the following optional field which can be a scalar, a sequence of scalars or scalars to sequences: {`details`}
- `details` will be used as the handle's detailed comment

Expand Down Expand Up @@ -599,12 +600,14 @@ class ur_name_t(Structure):
* A function requires the following scalar fields: {`desc`, `name`}
- `desc` will be used as the function's description comment
- `name` must be a unique ISO-C standard identifier, and be PascalCase
* A function may take the following optional scalar fields: {`class`, `decl`, `condition`, `ordinal`, `version`}
* A function may take the following optional scalar fields: {`class`, `decl`, `condition`, `ordinal`, `version`, `loader_only`}
- `class` will be used to scope the function declaration within the specified C++ class
- `decl` will be used to specify the function's linkage as one of the following: {`static`}
- `condition` will be used as a C/C++ preprocessor `#if` conditional expression
- `ordinal` will be used to override the default order (in which they appear) the function appears within its section; `default="1000"`
- `version` will be used to define the minimum API version in which the function will appear; `default="1.0"` This will also affect the order in which the function appears within its section and class.
- `loader_only` will be used to decide whether the function will only be implemented by the loader and not appear in the adapters
interface.
* A function requires the following sequence of mappings: {`params`}
- A param requires the following scalar fields: {`desc`, `type`, `name`}
+ `desc` will be used as the params's description comment
Expand Down
1 change: 1 addition & 0 deletions scripts/core/EXP-COMMAND-BUFFER.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Changelog
| Revision | Changes |
+===========+=======================================================+
| 1.0 | Initial Draft |
+-----------+-------------------------------------------------------+
| 1.1 | add function definitions for buffer read and write |
+-----------+-------------------------------------------------------+

Expand Down
1 change: 1 addition & 0 deletions scripts/core/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ value: uint8_t
type: handle
desc: "Handle of a loader config object"
class: $xLoaderConfig
loader_only: True
name: "$x_loader_config_handle_t"
--- #--------------------------------------------------------------------------
type: handle
Expand Down
9 changes: 9 additions & 0 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#
# Copyright (C) 2023 Intel Corporation
#
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# See YaML.md for syntax definition
#
--- #--------------------------------------------------------------------------
type: header
desc: "Bindless Images Extension APIs"
Expand Down
9 changes: 9 additions & 0 deletions scripts/core/exp-usm-import-release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#
# Copyright (C) 2023 Intel Corporation
#
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# See YaML.md for syntax definition
#
--- #--------------------------------------------------------------------------
type: header
desc: "Intel $OneApi USM Import/Release Extension APIs"
Expand Down
3 changes: 3 additions & 0 deletions scripts/core/platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ etors:
- name: "0_6"
value: "$X_MAKE_VERSION( 0, 6 )"
desc: "version 0.6"
- name: "0_7"
value: "$X_MAKE_VERSION( 0, 7 )"
desc: "version 0.7"
--- #--------------------------------------------------------------------------
type: function
desc: "Returns the API version supported by the specified platform"
Expand Down
5 changes: 5 additions & 0 deletions scripts/core/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ etors:
type: function
desc: "Create a loader config object."
class: $xLoaderConfig
loader_only: True
name: Create
decl: static
params:
Expand All @@ -41,6 +42,7 @@ params:
type: function
desc: "Get a reference to the loader config object."
class: $xLoaderConfig
loader_only: True
name: Retain
decl: static
details:
Expand All @@ -55,6 +57,7 @@ params:
type: function
desc: "Release config handle."
class: $xLoaderConfig
loader_only: True
name: Release
decl: static
details:
Expand All @@ -80,6 +83,7 @@ etors:
type: function
desc: "Retrieves various information about the loader."
class: $xLoaderConfig
loader_only: True
name: GetInfo
decl: static
details:
Expand Down Expand Up @@ -122,6 +126,7 @@ returns:
type: function
desc: "Enable a layer for the specified loader config."
class: $xLoaderConfig
loader_only: True
name: EnableLayer
decl: static
params:
Expand Down
Loading

0 comments on commit f95dfbc

Please sign in to comment.