Skip to content

Update gold/2021 to 0.4.0 #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
e34ad68
Rename all pxd and pyx filenames to start with _
Oct 9, 2020
55a1c82
dpctl.get_current_queue is now cimportable
oleksandr-pavlyk Oct 13, 2020
d114c8c
Use the black badge in project's README.md
PokhodenkoSA Oct 3, 2020
eb8afec
Add GitHub Actions for black
PokhodenkoSA Oct 15, 2020
6efde3d
Ignore versioneer.py from black formatting
PokhodenkoSA Oct 15, 2020
41ccd65
Format all Python code with black
PokhodenkoSA Oct 15, 2020
eadd8e5
Add ignoring revisions for blame
PokhodenkoSA Oct 15, 2020
c9ab60a
Update CONTRIBUTING.md
PokhodenkoSA Oct 15, 2020
519312f
Merge pull request #91 from PokhodenkoSA/tools/black
PokhodenkoSA Oct 15, 2020
6684c7b
Merge pull request #125 from IntelPython/expose-get-current-queue-on-…
oleksandr-pavlyk Oct 15, 2020
425d841
Merge branch 'upstream_master'
Oct 21, 2020
519b077
Add flags for fixing hardening-check (#149)
PokhodenkoSA Oct 22, 2020
d8e7104
Remove OpenCL interface (#138)
1e-to Oct 23, 2020
8c4ffbb
Merge branch 'upstream_master'
Oct 23, 2020
7d548cd
fixed filename typo in setup.py to fix build
oleksandr-pavlyk Oct 23, 2020
0714fee
Memory class exposes __sycl_usm_array_interface__
oleksandr-pavlyk Oct 21, 2020
906d77b
added memory.py to expose dpclt.memory module
oleksandr-pavlyk Oct 21, 2020
dfc0ac8
Pickling should preserve type of Python object
oleksandr-pavlyk Oct 22, 2020
eaf8574
Added comment, fixed black madness
oleksandr-pavlyk Oct 22, 2020
63b9b07
Added DPPLaligned_alloc_* functions to backend
oleksandr-pavlyk Oct 22, 2020
ec742a0
MemoryUSM* classes have have alignment option
oleksandr-pavlyk Oct 22, 2020
5df0bf6
Added DPPLQueue_Prefetch and DPPLQueue_MemAdvise
oleksandr-pavlyk Oct 22, 2020
e46f6ff
Implemented SyclQueue.prefetch, SyclQueue.mem_advise
oleksandr-pavlyk Oct 22, 2020
5a2bcf4
use numpy buffer as intermediary in copy_via_host routine
oleksandr-pavlyk Oct 23, 2020
242eb3a
added DPPLUSM_GetPointerDevice
oleksandr-pavlyk Oct 23, 2020
cebc064
Introduced tests/test_sycl_usm_interface.cpp
oleksandr-pavlyk Oct 23, 2020
2f6a01c
implemented cdef Memory.get_pointer_device
oleksandr-pavlyk Oct 23, 2020
26bf594
Extra device info (#147)
1e-to Oct 23, 2020
800e4d0
Change funcs to cpdef (#150)
1e-to Oct 23, 2020
9dbe493
Merge remote-tracking branch 'origin/master' into feature/memory-zero…
oleksandr-pavlyk Oct 23, 2020
ce554ac
Special case of zero-copy from another Memory object
oleksandr-pavlyk Oct 26, 2020
f3d1899
Implements #120
oleksandr-pavlyk Oct 26, 2020
f977746
corrected __dppl_take -> __dppl_keep in Memcpy
oleksandr-pavlyk Oct 26, 2020
5479b54
spacing fixed
oleksandr-pavlyk Oct 26, 2020
b7ab952
Added DPPLQueueMgr_GetQueueFromContextAndDevice to backend
oleksandr-pavlyk Oct 26, 2020
e9a9633
Exposed SyclQueue staticmethod to construct from context & dev.
oleksandr-pavlyk Oct 26, 2020
51fc1e6
Get buffer function now raises exception trying to access device pointer
oleksandr-pavlyk Oct 26, 2020
a4b5b1f
Fixed black
oleksandr-pavlyk Oct 26, 2020
fc5a4ed
Zero copy constructors check USM kind.
oleksandr-pavlyk Oct 26, 2020
153631f
cleaned trailing whitespace
oleksandr-pavlyk Oct 26, 2020
8367c6b
removed black trailing zero
oleksandr-pavlyk Oct 26, 2020
a95d2f2
tabs to spaces to address formatting concerns in PR
oleksandr-pavlyk Oct 26, 2020
59b078b
added doxygen @params
oleksandr-pavlyk Oct 26, 2020
7007eb9
untabified tabs to spaces
oleksandr-pavlyk Oct 26, 2020
34dfadf
fixed grammar, added note that allocation return nullptr on failure
oleksandr-pavlyk Oct 26, 2020
5bb48f2
formatting to stay within 80 chars
oleksandr-pavlyk Oct 26, 2020
3951ee6
added missing _Delete
oleksandr-pavlyk Oct 26, 2020
e73c817
deleted obsolete FIXME comment, added explanation for what the code does
oleksandr-pavlyk Oct 26, 2020
7b41388
formatting change
oleksandr-pavlyk Oct 26, 2020
efe65c4
Fixed syntax error in test_sycl_usm_interface.h
oleksandr-pavlyk Oct 26, 2020
1b3c7e4
fixed reference to filename in comment headers
oleksandr-pavlyk Oct 27, 2020
50e8503
Fixed a lapse in validation logic of `__sycl_usm_array_interface__``.
oleksandr-pavlyk Oct 27, 2020
3b06ba8
Renamed Memory class to _Memor yto reflect that it is not intended fo…
oleksandr-pavlyk Oct 27, 2020
9cd6bd8
Moved _memory.pyx, _memory.pxd to dpctl.memory submodule
oleksandr-pavlyk Oct 27, 2020
1da34fc
formatting changes per review
oleksandr-pavlyk Oct 27, 2020
8f634ec
Delete context in common_test_body
oleksandr-pavlyk Oct 27, 2020
ca6dcfb
formating: func (args) -> func(args)
oleksandr-pavlyk Oct 27, 2020
62dcdd2
added MemoryUSM* work to changelog
oleksandr-pavlyk Oct 27, 2020
692cb41
changes for CI's black to lighten up
oleksandr-pavlyk Oct 27, 2020
a7d6356
skip test_sycl_usm_array_interface for Host memory on windows
oleksandr-pavlyk Oct 28, 2020
a7ba748
with black around, forecast is overcast
oleksandr-pavlyk Oct 27, 2020
c5a31f5
Adjusted path in bld.bat
oleksandr-pavlyk Oct 28, 2020
948a67b
filled in description for @param CRef in doxygen comments for GetPoin…
oleksandr-pavlyk Oct 28, 2020
e654c1f
Work on build_for_develop.bat to bring it on par with Linux shell script
oleksandr-pavlyk Oct 28, 2020
b7fdc53
fixed type in GTEST_INCLUDE
oleksandr-pavlyk Oct 28, 2020
a05327d
further changes to build_for_devel.bat - fixed typo
oleksandr-pavlyk Oct 28, 2020
6d7375e
fixed dpcpp compilation warning on Windows
oleksandr-pavlyk Oct 28, 2020
94268cb
Merge pull request #152 from IntelPython/feature/memory-zero-copy
oleksandr-pavlyk Oct 28, 2020
2010cbb
Fix warnings in building libDPPLSyclInterface (#155)
diptorupd Oct 29, 2020
67277ab
Changes to build_for_develop.bat
oleksandr-pavlyk Oct 29, 2020
f9b406b
use abs. path for CC/CXX in build_for_develop.sh
oleksandr-pavlyk Oct 29, 2020
6153ff1
Removed logic to skip usm_host testin on Windows
oleksandr-pavlyk Oct 30, 2020
02cef01
Removed workaround as the underlying issue is fixed
oleksandr-pavlyk Oct 30, 2020
a5e3457
build_for_develop.bat use BUILD_TYPE=Release
oleksandr-pavlyk Oct 30, 2020
68da1ba
Merge pull request #158 from IntelPython/windows-build-for-develop-tweak
oleksandr-pavlyk Oct 30, 2020
4531655
Fix/minor issues (#159)
diptorupd Oct 30, 2020
61e879d
Removed NUMPY_INC, PYTHON_INC (#160)
oleksandr-pavlyk Oct 30, 2020
74613eb
Fixes to get cmake working on windows. (#161)
diptorupd Oct 30, 2020
57b26ff
Fix minor error in a python test. (#162)
diptorupd Oct 31, 2020
177a185
CMake and Gtest improvements (#163)
diptorupd Nov 2, 2020
7a87490
fixed dpct/memory/_init__.pxd
oleksandr-pavlyk Nov 2, 2020
138de94
Merge pull request #165 from IntelPython/fix-dpctl-memory-__init__-pxd
oleksandr-pavlyk Nov 2, 2020
092e00c
Sphinx and Doxygen documentation (#140)
diptorupd Nov 2, 2020
0256b8e
Update CHANGELOG.md
diptorupd Nov 2, 2020
d0202c2
Update changelog for 0.4.0
diptorupd Nov 4, 2020
38b6742
Merge tag '0.4.0' into gold/2021
PokhodenkoSA Dec 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs

# Migrate code style to Black
41ccd65e2e659aa0add0e5ab59f1a46e32cc4c46
28 changes: 28 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is a workflow to format Python code with black formatter

name: black

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master]
pull_request:
branches: [master]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "black"
black:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Set up a Python environment for use in actions
- uses: actions/setup-python@v2

# Run black code formatter
- uses: psf/black@stable
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
# Changelog
All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.4.0] - 2020-11-04
### Added
- Device descriptors "max_compute_units", "max_work_item_dimensions", "max_work_item_sizes", "max_work_group_size", "max_num_sub_groups" and "aspects" for int64 atomics inside dpctl C API and inside the dpctl.SyclDevice class.
- MemoryUSM* classes moved to `dpctl.memory` module, added support for aligned allocation, added support for `prefetch` and `mem_advise` (sychronous) methods, implemented `copy_to_host`, `copy_from_host` and `copy_from_device` methods, pickling support, and zero-copy interoperability with Python objects which implement `__sycl_usm_array_inerface__` protocol.
- Helper scripts to generate API documentation for both C API and Python.

### Fixed
- Compiler warnings when building libDPPLSyclInterface and the Cython extensions.

### Removed
- The Legacy OpenCL interface.

## [0.3.8] - 2020-10-08

### Changed
- How the initial active queue is populated inside DPPLQueueMgr.
- dpctl.SyclQueueManager only reports the number of non-host platform.
- dpctl.SyclQueueManager now raises an exception if DPCTL C API returns a nullptr instead of a valid Sycl queue.

### Fixed
- Several crashes in cases where an OpenCL or Level Zero platform is not available.
- Fix failing platform test case. (#116)
- Properly skip tests when no OpenCL devices are available.
- Add skip tests to test_sycl_usm.py
- Fix Gtests configuration.

## [0.3.7] - 2020-10-08

### Fixed
- A crash on Windows due a Level Zero driver problem. Each device was getting enumerated twice. To handle the issue, we added a temporary fix to use only first device for each device type and backend (#118).

## [0.3.6] - 2020-10-06
### Added
- Changelog was added for dpctl.
Expand Down
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
Coming soon
# Python code style

## black

We use [black](https://black.readthedocs.io/en/stable/) code formatter.

- Revision: `20.8b1` or branch `stable`.
- See configuration in `pyproject.toml`.

Run before each commit: `black .`
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

What?
====
A lightweight Python package exposing a subset of OpenCL and SYCL
functionalities.
A lightweight Python package exposing a subset of SYCL functionalities.

Requirements
============
Expand Down
99 changes: 23 additions & 76 deletions backends/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project("dpCtl - A lightweight SYCL wrapper for Python")

# The function checks is DPCPP_ROOT is valid and points to a dpcpp installation
Expand All @@ -13,7 +13,7 @@ function (check_for_dpcpp)
set (dpcpp_cmd "${DPCPP_ROOT}/bin/dpcpp")
set (dpcpp_arg "--version")
elseif(UNIX)
set (dpcpp_cmd "dpcpp")
set (dpcpp_cmd "${DPCPP_ROOT}/bin/dpcpp")
set (dpcpp_arg "--version")
else()
message(FATAL_ERROR "Unsupported system.")
Expand All @@ -38,28 +38,8 @@ function (check_for_dpcpp)
endif()
endfunction()

function (check_for_numpy_inc)
string(COMPARE EQUAL "${NUMPY_INCLUDE_DIR}" "" no_numpy_inc)
if(${no_dpcpp_root})
message(FATAL_ERROR "Set the NUMPY_INCLUDE_DIR argument providing the \
path to NumPy Headers.")
else()
message(STATUS "NUMPY_INCLUDE_DIR: ${NUMPY_INCLUDE_DIR}")
endif()

string(COMPARE EQUAL "${PYTHON_INCLUDE_DIR}" "" no_python_inc)
if(${no_dpcpp_root})
message(FATAL_ERROR "Set the PYTHON_INCLUDE_DIR argument providing the \
path to Python Headers.")
else()
message(STATUS "PYTHON_INCLUDE_DIR: ${PYTHON_INCLUDE_DIR}")
endif()
endfunction()

# Check for dpcpp in the specified DPCPP_ROOT
check_for_dpcpp()
# Check if the locations of Numpy and Python headers were provided
check_for_numpy_inc()

if(WIN32)
set(CMAKE_CXX_COMPILER:PATH "${DPCPP_ROOT}/bin/dpcpp")
Expand All @@ -68,31 +48,22 @@ if(WIN32)
message(STATUS "Resetting CXX compiler to: " ${CMAKE_CXX_COMPILER})
message(STATUS "Resetting C compiler to: " ${CMAKE_C_COMPILER})
message(STATUS "Resetting Linker to: " ${CMAKE_LINK})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations \
-fdiagnostics-color=auto -O3 \
")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qstd=c++17")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3 -DDEBUG ")
set(WARNING_FLAGS "-Wall -Wextra -Winit-self -Wunused-function -Wuninitialized -Wmissing-declarations")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -Qstd=c++17")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -ggdb3 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -ggdb3 -DDEBUG -Qstd=c++17")
elseif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-Wall -Wextra -Winit-self -Wuninitialized -Wmissing-declarations \
-fdiagnostics-color=auto -O3 \
")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3 -DDEBUG ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fsycl")
set(SDL_FLAGS "-fstack-protector -fstack-protector-all -fpic -fPIC -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fno-strict-overflow -fno-delete-null-pointer-checks")
set(WARNING_FLAGS "-Wall -Wextra -Winit-self -Wunused-function -Wuninitialized -Wmissing-declarations -fdiagnostics-color=auto")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${SDL_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${SDL_FLAGS} -std=c++17 -fsycl")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -ggdb3 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -ggdb3 -DDEBUG -std=c++17 -fsycl")
else()
message(FATAL_ERROR "Unsupported system.")
endif()


set(OpenCL_INCLUDE_DIR "${DPCPP_ROOT}/include/sycl")
set(OpenCL_LIBRARY "${DPCPP_ROOT}/lib/libOpenCL.so")

message(STATUS "OpenCL_INCLUDE_DIR: ${OpenCL_INCLUDE_DIR}")
message(STATUS "OpenCL_LIBRARY: ${OpenCL_LIBRARY}")

add_library(
DPPLSyclInterface
SHARED
Expand All @@ -108,32 +79,11 @@ add_library(
source/dppl_utils.cpp
)

# Install DPPLOpenCLInterface
add_library(
DPPLOpenCLInterface
SHARED
source/dppl_opencl_interface.c
)

# Install DPPLSyclInterface
target_include_directories(
DPPLSyclInterface
PRIVATE
${CMAKE_SOURCE_DIR}/include/
${PYTHON_INCLUDE_DIR}
${NUMPY_INCLUDE_DIR}
)

target_include_directories(
DPPLOpenCLInterface
PRIVATE
${CMAKE_SOURCE_DIR}/include/
)

target_include_directories(
DPPLOpenCLInterface
PUBLIC
${OpenCL_INCLUDE_DIR}
)

if(WIN32)
Expand All @@ -152,10 +102,6 @@ if(WIN32)
PRIVATE ${DPCPP_ROOT}/lib/sycl.lib
PRIVATE ${DPCPP_ROOT}/lib/OpenCL.lib
)
target_link_libraries(
DPPLOpenCLInterface
PRIVATE ${DPCPP_ROOT}/lib/OpenCL.lib
)
endif()

install(
Expand All @@ -165,14 +111,6 @@ install(
"${CMAKE_INSTALL_PREFIX}/lib/"
)

install(
TARGETS
DPPLOpenCLInterface
LIBRARY
DESTINATION
"${CMAKE_INSTALL_PREFIX}/lib/"
)

# Install all headers
file(GLOB HEADERS "${CMAKE_SOURCE_DIR}/include/*.h*")
foreach(HEADER ${HEADERS})
Expand All @@ -185,8 +123,17 @@ foreach(HEADER ${HEADERS})
install(FILES "${HEADER}" DESTINATION include/Support)
endforeach()

option(
BUILD_CAPI_TESTS
"Build dpctl C API google tests"
OFF
)

# Enable to build the dpCtl backend test cases
add_subdirectory(tests)
if(BUILD_CAPI_TESTS)
add_subdirectory(tests)
endif()


# Todo : Add build rules for doxygen
# maybe refer https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/
13 changes: 6 additions & 7 deletions backends/dbg_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ INSTALL_PREFIX=`pwd`/../install
rm -rf ${INSTALL_PREFIX}
export ONEAPI_ROOT=/opt/intel/oneapi
DPCPP_ROOT=${ONEAPI_ROOT}/compiler/latest/linux
PYTHON_INC=`python -c "import distutils.sysconfig; \
print(distutils.sysconfig.get_python_inc())"`
NUMPY_INC=`python -c "import numpy; print(numpy.get_include())"`

cmake \
-DCMAKE_BUILD_TYPE=Debug \
Expand All @@ -19,12 +16,14 @@ cmake \
-DDPCPP_ROOT=${DPCPP_ROOT} \
-DCMAKE_C_COMPILER:PATH=${DPCPP_ROOT}/bin/clang \
-DCMAKE_CXX_COMPILER:PATH=${DPCPP_ROOT}/bin/dpcpp \
-DPYTHON_INCLUDE_DIR=${PYTHON_INC} \
-DNUMPY_INCLUDE_DIR=${NUMPY_INC} \
-DGTEST_INCLUDE_DIR=${CONDA_PREFIX}/include/ \
-DGTEST_LIB_DIR=${CONDA_PREFIX}/lib \
-DBUILD_CAPI_TESTS=ON \
..

make V=1 -n -j 4 && make check && make install

# For more verbose tests use:
# cd tests
# ctest -V --progress --output-on-failure -j 4
# cd ..

popd
47 changes: 29 additions & 18 deletions backends/include/Support/CBindingWrapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,34 @@
///
//===----------------------------------------------------------------------===//

#pragma once
#pragma once

#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
inline ty *unwrap(ref P) { \
return reinterpret_cast<ty*>(P); \
} \
\
inline ref wrap(const ty *P) { \
return reinterpret_cast<ref>(const_cast<ty*>(P)); \
}
/*!
@brief Creates two convenience functions to reinterpret_cast an opaque
pointer to a pointer to a Sycl type and vice-versa.
*/
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
__attribute__((unused)) inline ty *unwrap(ref P) \
{ \
return reinterpret_cast<ty*>(P); \
} \
\
__attribute__((unused)) inline ref wrap(const ty *P) \
{ \
return reinterpret_cast<ref>(const_cast<ty*>(P)); \
}

#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref) \
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
\
template<typename T> \
inline T *unwrap(ref P) { \
T *Q = (T*)unwrap(P); \
assert(Q && "Invalid cast!"); \
return Q; \
}
/*!
@brief Add an overloaded unwrap to assert that a pointer can be legally
cast. @see DEFINE_SIMPLE_CONVERSION_FUNCTIONS()
*/
#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref) \
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
\
template<typename T> \
__attribute__((unused)) inline T *unwrap(ref P) \
{ \
T *Q = (T*)unwrap(P); \
assert(Q && "Invalid cast!"); \
return Q; \
}
15 changes: 14 additions & 1 deletion backends/include/dppl_data_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,30 @@ typedef signed int ssize_t;

#endif /* _MSC_VER */

/* Set defaults for constants which we cannot find. */
/*!
@brief Represents tha largest possible value of a 64 bit signed integer.
*/
#if !defined(INT64_MAX)
# define INT64_MAX 9223372036854775807LL
#endif

/*!
@brief Represents tha smallest possible value of a 64 bit signed integer.
*/
#if !defined(INT64_MIN)
# define INT64_MIN ((-INT64_MAX)-1)
#endif

/*!
@brief Represents tha largest possible value of a 64bit unsigned integer.
*/
#if !defined(UINT64_MAX)
# define UINT64_MAX 0xffffffffffffffffULL
#endif

/*!
@brief Represents a positive expression of type float.
*/
#ifndef HUGE_VALF
#define HUGE_VALF (float)HUGE_VAL
#endif
Loading