diff --git a/libdevice/CMakeLists.txt b/libdevice/CMakeLists.txt index d96c4fe69201d..2b8660ebaa99f 100644 --- a/libdevice/CMakeLists.txt +++ b/libdevice/CMakeLists.txt @@ -8,7 +8,13 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ) -if(EXISTS ${FETCHCONTENT_BASE_DIR}/unified-runtime-src) +set(UR_INTREE_SOURCE_DIR "${LLVM_SOURCE_DIR}/../unified-runtime") +cmake_path(NORMAL_PATH UR_INTREE_SOURCE_DIR OUTPUT_VARIABLE UR_INTREE_SOURCE_DIR) + +if(IS_DIRECTORY "${UR_INTREE_SOURCE_DIR}") + set(UR_SANITIZER_INCLUDE_DIR + ${UR_INTREE_SOURCE_DIR}/source/loader/layers/sanitizer) +elseif(EXISTS ${FETCHCONTENT_BASE_DIR}/unified-runtime-src) set(UR_SANITIZER_INCLUDE_DIR ${FETCHCONTENT_BASE_DIR}/unified-runtime-src/source/loader/layers/sanitizer) elseif(EXISTS ${SYCL_UR_SOURCE_DIR}) diff --git a/sycl/cmake/modules/FetchUnifiedRuntime.cmake b/sycl/cmake/modules/FetchUnifiedRuntime.cmake index b782b017191ed..a61cd975fea60 100644 --- a/sycl/cmake/modules/FetchUnifiedRuntime.cmake +++ b/sycl/cmake/modules/FetchUnifiedRuntime.cmake @@ -75,7 +75,19 @@ cmake_path(NORMAL_PATH UR_INTREE_SOURCE_DIR OUTPUT_VARIABLE UR_INTREE_SOURCE_DIR if(IS_DIRECTORY "${UR_INTREE_SOURCE_DIR}") set(UR_INTREE_BINARY_DIR ${LLVM_BINARY_DIR}/unified-runtime) - add_subdirectory(${UR_INTREE_SOURCE_DIR} ${UR_INTREE_BINARY_DIR}) + set(UNIFIED_RUNTIME_SOURCE_DIR + "${UR_INTREE_SOURCE_DIR}" CACHE PATH + "Path to Unified Runtime Headers" FORCE) + set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") + # Due to the use of dependentloadflag and no installer for UMF and hwloc we need + # to link statically on windows + if(WIN32) + set(UMF_BUILD_SHARED_LIBRARY OFF CACHE INTERNAL "Build UMF shared library") + set(UMF_LINK_HWLOC_STATICALLY ON CACHE INTERNAL "static HWLOC") + else() + set(UMF_DISABLE_HWLOC ${SYCL_UMF_DISABLE_HWLOC} CACHE INTERNAL "Disable hwloc for UMF") + endif() + add_subdirectory(${UNIFIED_RUNTIME_SOURCE_DIR} ${UR_INTREE_BINARY_DIR}) elseif(SYCL_UR_USE_FETCH_CONTENT) include(FetchContent) diff --git a/unified-runtime/.clang-format b/unified-runtime/.clang-format new file mode 100644 index 0000000000000..f8a1ce65a4b88 --- /dev/null +++ b/unified-runtime/.clang-format @@ -0,0 +1,4 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +... diff --git a/unified-runtime/.editorconfig b/unified-runtime/.editorconfig new file mode 100644 index 0000000000000..947ca03d41c5a --- /dev/null +++ b/unified-runtime/.editorconfig @@ -0,0 +1,15 @@ +[*] +indent_style = space +indent_size = 2 + +[*.py] +indent_size = 4 + +[scripts/core/*] +indent_size = 4 + +[CMakeLists.txt] +indent_size = 4 + +[*.cmake] +indent_size = 4 diff --git a/unified-runtime/.gitattributes b/unified-runtime/.gitattributes new file mode 100644 index 0000000000000..176a458f94e0e --- /dev/null +++ b/unified-runtime/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/unified-runtime/.github/scripts/get_system_info.sh b/unified-runtime/.github/scripts/get_system_info.sh new file mode 100755 index 0000000000000..8301c990997db --- /dev/null +++ b/unified-runtime/.github/scripts/get_system_info.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# 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 + +# get_system_info.sh - Script for printing system info + +function check_L0_version { + if command -v dpkg &> /dev/null; then + dpkg -l | grep level-zero && return + fi + + if command -v rpm &> /dev/null; then + rpm -qa | grep level-zero && return + fi + + if command -v zypper &> /dev/null; then + zypper se level-zero && return + fi + + echo "level-zero not installed" +} + +function system_info { + echo "**********system_info**********" + cat /etc/os-release | grep -oP "PRETTY_NAME=\K.*" + cat /proc/version + echo "**********SYCL-LS**********" + source /opt/intel/oneapi/setvars.sh + sycl-ls + echo "**********VGA**********" + lspci | grep VGA + echo "**********CUDA Version**********" + if command -v nvidia-smi &> /dev/null; then + nvidia-smi + else + echo "CUDA not installed" + fi + echo "**********L0 Version**********" + check_L0_version + echo "**********ROCm Version**********" + if command -v rocminfo &> /dev/null; then + rocminfo + else + echo "ROCm not installed" + fi + echo "**********/proc/cmdline**********" + cat /proc/cmdline + echo "**********CPU info**********" + lscpu + echo "**********/proc/meminfo**********" + cat /proc/meminfo + echo "**********build/bin/urinfo**********" + $(dirname "$(readlink -f "$0")")/../../build/bin/urinfo --no-linear-ids --verbose || true + echo "******OpenCL*******" + # The driver version of OpenCL Graphics is the compute-runtime version + clinfo || echo "OpenCL not installed" + echo "**********list-environment**********" + echo "PATH=$PATH" + echo + echo "CPATH=$CPATH" + echo + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" + echo + echo "LIBRARY_PATH=$LIBRARY_PATH" + echo + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + echo + echo "******list-build-system-versions*******" + gcc --version 2>/dev/null || true + echo + clang --version 2>/dev/null || true + echo + make --version 2>/dev/null || true + echo "**********/proc/modules**********" + cat /proc/modules + echo "***************installed-packages***************" + # Instructions below will return some minor errors, as they are dependent on the Linux distribution. + zypper se --installed-only 2>/dev/null || true + apt list --installed 2>/dev/null || true + yum list installed 2>/dev/null || true +} + +# Call the function above to print system info. +system_info diff --git a/unified-runtime/.gitignore b/unified-runtime/.gitignore new file mode 100644 index 0000000000000..89736ad22a60f --- /dev/null +++ b/unified-runtime/.gitignore @@ -0,0 +1,92 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj +*.exp +*.pdb +*.log +*.tlog +*.ilk +*.idb +*.CopyComplete +*.pyc +*.tmp + +# Precompiled Headers +*.gch +*.pch +*.ipch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Project files +*.sln +*.vcproj +*.vcxproj +*.pyproj +*.suo +*.db +*.opendb +*.user +*.filters +.vs/ +.idea/ + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Debug files +scripts/**/*.json + +# Python cache +__pycache__/ +*.py[cod] + +# Generated docs +docs/ + +# Build files +/build*/ +out/ + +# irepo files +.irepo + +# ci deps +.deps + +# third_party files +/third_party/*/ + + +# VS CMake settings +/CMakeSettings.json + +# Temporary files +*.~vsdx + +# IDE Files +/.vscode +/.devcontainer + +# External content +*/**/external + +# VS clangd +/.cache +/compile_commands.json diff --git a/unified-runtime/.trivyignore b/unified-runtime/.trivyignore new file mode 100644 index 0000000000000..63749166bc961 --- /dev/null +++ b/unified-runtime/.trivyignore @@ -0,0 +1,6 @@ +# Docs: https://aquasecurity.github.io/trivy/latest/docs/configuration/filtering/#trivyignore + +# In docker files: +# HEALTHCHECK is not required for development, nor in CI (failed docker = failed CI). +# We're not hosting any application with usage of the dockers. +AVD-DS-0026 diff --git a/unified-runtime/CHANGELOG.md b/unified-runtime/CHANGELOG.md new file mode 100644 index 0000000000000..73ac29eb0a6ee --- /dev/null +++ b/unified-runtime/CHANGELOG.md @@ -0,0 +1,4 @@ +# Unified Runtime changelog + +## v.X.X.X +* Placeholder for first release diff --git a/unified-runtime/CMakeLists.txt b/unified-runtime/CMakeLists.txt new file mode 100644 index 0000000000000..51136050ab75e --- /dev/null +++ b/unified-runtime/CMakeLists.txt @@ -0,0 +1,389 @@ +# Copyright (C) 2022-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 + +cmake_minimum_required(VERSION 3.20.0 FATAL_ERROR) +project(unified-runtime VERSION 0.12.0) + +# Check if unified runtime is built as a standalone project. +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR UR_STANDALONE_BUILD) + set(UR_STANDALONE_BUILD TRUE) +endif() + +include(GNUInstallDirs) +include(CheckCXXSourceCompiles) +include(CMakePackageConfigHelpers) +include(CTest) + +# Build Options +option(UR_BUILD_EXAMPLES "Build example applications." ON) +option(UR_BUILD_TESTS "Build unit tests." ON) +option(UR_BUILD_TOOLS "build ur tools" ON) +option(UR_FORMAT_CPP_STYLE "format code style of C++ sources" OFF) +option(UR_DEVELOPER_MODE "treats warnings as errors" OFF) +option(UR_ENABLE_FAST_SPEC_MODE "enable fast specification generation mode" OFF) +option(UR_USE_ASAN "enable AddressSanitizer" OFF) +option(UR_USE_UBSAN "enable UndefinedBehaviorSanitizer" OFF) +option(UR_USE_MSAN "enable MemorySanitizer" OFF) +option(UR_USE_TSAN "enable ThreadSanitizer" OFF) +option(UR_USE_CFI "enable Control Flow Integrity checks (requires clang and implies -flto)" OFF) +option(UR_ENABLE_TRACING "enable api tracing through xpti" OFF) +option(UR_ENABLE_SANITIZER "enable device sanitizer" ON) +option(UR_ENABLE_SYMBOLIZER "enable symoblizer for sanitizer" OFF) +option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" ON) +option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON) +option(UR_BUILD_ADAPTER_L0 "Build the Level-Zero adapter" OFF) +option(UR_BUILD_ADAPTER_OPENCL "Build the OpenCL adapter" OFF) +option(UR_BUILD_ADAPTER_CUDA "Build the CUDA adapter" OFF) +option(UR_BUILD_ADAPTER_HIP "Build the HIP adapter" OFF) +option(UR_BUILD_ADAPTER_NATIVE_CPU "Build the Native-CPU adapter" OFF) +option(UR_BUILD_ADAPTER_ALL "Build all currently supported adapters" OFF) +option(UR_BUILD_ADAPTER_L0_V2 "Build the (experimental) Level-Zero v2 adapter" OFF) +option(UR_STATIC_ADAPTER_L0 "Build the Level-Zero adapter as static and embed in the loader" OFF) +option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF) +option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF) +option(UR_ENABLE_ASSERTIONS "Enable assertions for all build types" OFF) +option(UR_BUILD_XPTI_LIBS "Build the XPTI libraries when tracing is enabled" ON) +option(UR_STATIC_LOADER "Build loader as a static library" OFF) +option(UR_FORCE_LIBSTDCXX "Force use of libstdc++ in a build using libc++ on Linux" OFF) +option(UR_ENABLE_LATENCY_HISTOGRAM "Enable latncy histogram" OFF) +set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable") +set(UR_DPCXX_BUILD_FLAGS "" CACHE STRING "Build flags to pass to DPC++ when compiling device programs") +set(UR_SYCL_LIBRARY_DIR "" CACHE PATH + "Path of the SYCL runtime library directory") +set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING + "List of sycl targets to build CTS device binaries for") +set(UR_CONFORMANCE_AMD_ARCH "" CACHE STRING "AMD device target ID to build CTS binaries for") +option(UR_CONFORMANCE_ENABLE_MATCH_FILES "Enable CTS match files" ON) +option(UR_CONFORMANCE_TEST_LOADER "Also test the loader in the conformance tests" OFF) +set(UR_ADAPTER_LEVEL_ZERO_SOURCE_DIR "" CACHE PATH + "Path to external 'level_zero' adapter source dir") +set(UR_ADAPTER_OPENCL_SOURCE_DIR "" CACHE PATH + "Path to external 'opencl' adapter source dir") +set(UR_ADAPTER_CUDA_SOURCE_DIR "" CACHE PATH + "Path to external 'cuda' adapter source dir") +set(UR_ADAPTER_HIP_SOURCE_DIR "" CACHE PATH + "Path to external 'hip' adapter source dir") +set(UR_ADAPTER_NATIVE_CPU_SOURCE_DIR "" CACHE PATH + "Path to external 'native_cpu' adapter source dir") + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(helpers) + +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(Python3_FIND_FRAMEWORK NEVER) + set(Python3_FIND_STRATEGY LOCATION) +endif() + +find_package(Python3 COMPONENTS Interpreter REQUIRED) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED YES) + +# There's little reason not to generate the compile_commands.json +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +include(Assertions) + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# Define rpath for libraries so that adapters can be found automatically +set(CMAKE_BUILD_RPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + +# Define a path for custom commands to work around MSVC +set(CUSTOM_COMMAND_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +if(CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT CMAKE_GENERATOR STREQUAL Ninja) + # MSVC implicitly adds $ to the output path + set(CUSTOM_COMMAND_BINARY_DIR ${CUSTOM_COMMAND_BINARY_DIR}/$) +endif() + +if(UR_FORCE_LIBSTDCXX AND CMAKE_SYSTEM_NAME STREQUAL Linux) + # Remove flags to specify using libc++ or static libstdc++ in order to + # support sitatuions where the libstdc++ ABI is required. + foreach(flags CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS) + string(REPLACE "-stdlib=libc++" "" ${flags} "${${flags}}") + string(REPLACE "-static-libstdc++" "" ${flags} "${${flags}}") + endforeach() + # Globally link against pthread, this is necessary when forcing use of + # libstdc++ in a libc++ build as the FindThreads module may have already + # been invoked and detected that pthread symbols are provided by libc++ + # which is not the case for libstdc++. + add_compile_options(-pthread) + link_libraries(pthread) +endif() + +if(NOT MSVC) + # Determine if libstdc++ is being used. + check_cxx_source_compiles(" + #include + #ifndef __GLIBCXX__ + #error not using libstdc++ + #endif + int main() {}" + USING_LIBSTDCXX) + if(UR_FORCE_LIBSTDCXX OR USING_LIBSTDCXX) + # Support older versions of GCC where the header is not + # available and must be used instead. This + # requires linking against libstdc++fs.a, on systems where + # is available we still need to link this library. + link_libraries(stdc++fs) + endif() +endif() + +if(UR_ENABLE_TRACING) + add_compile_definitions(UR_ENABLE_TRACING) + + if (UR_BUILD_XPTI_LIBS) + # fetch xpti proxy library for the tracing layer + FetchContentSparse_Declare(xpti https://github.com/intel/llvm.git "nightly-2024-10-22" "xpti") + FetchContent_MakeAvailable(xpti) + + # set -fPIC for xpti since we are linking it with a shared library + set_target_properties(xpti PROPERTIES POSITION_INDEPENDENT_CODE ON) + + # fetch the xptifw dispatcher, mostly used for testing + # these variables need to be set for xptifw to compile + set(XPTI_SOURCE_DIR ${xpti_SOURCE_DIR}) + set(XPTI_DIR ${xpti_SOURCE_DIR}) + set(XPTI_ENABLE_TESTS OFF CACHE INTERNAL "Turn off xptifw tests") + + FetchContentSparse_Declare(xptifw https://github.com/intel/llvm.git "nightly-2024-10-22" "xptifw") + + FetchContent_MakeAvailable(xptifw) + + check_cxx_compiler_flag("-Wno-error=maybe-uninitialized" HAS_MAYBE_UNINIT) + if (HAS_MAYBE_UNINIT) + target_compile_options(xptifw PRIVATE -Wno-error=maybe-uninitialized) + endif() + + set_target_properties(xptifw PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + ) + + if (NOT MSVC) + # Hardening flags cause issues on Windows + add_ur_target_compile_options(xptifw) + add_ur_target_link_options(xptifw) + endif() + + if (UR_STATIC_LOADER) + install(TARGETS xpti xptifw + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + endif() + endif() + + if (MSVC) + set(TARGET_XPTI $,xpti,xptid>) + else() + set(TARGET_XPTI xpti) + endif() +endif() + +if(UR_ENABLE_SANITIZER) + if(APPLE) + message(WARNING "Sanitizer layer isn't supported on macOS") + set(UR_ENABLE_SANITIZER OFF) + elseif(WIN32) + message(WARNING "Sanitizer layer isn't supported on Windows") + set(UR_ENABLE_SANITIZER OFF) + else() + add_compile_definitions(UR_ENABLE_SANITIZER) + endif() + + if(UR_ENABLE_SYMBOLIZER AND UR_STANDALONE_BUILD) + find_package(LLVM REQUIRED) + endif() +else() + if(UR_ENABLE_SYMBOLIZER) + message(FATAL_ERROR "Symbolizer must be enabled with Sanitizer layer") + endif() +endif() + +if(UR_USE_ASAN) + add_sanitizer_flag(address) +endif() + +if(UR_USE_UBSAN) + add_sanitizer_flag(undefined) +endif() + +if(UR_USE_TSAN) + add_sanitizer_flag(thread) +endif() + +if(UR_USE_MSAN) + message(WARNING "MemorySanitizer requires that all code is built with + its instrumentation, otherwise false positives are possible. + See https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo#instrumented-libc + for details") + add_sanitizer_flag(memory) +endif() + +if(NOT (UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_HIP + OR UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_OPENCL + OR UR_BUILD_ADAPTER_NATIVE_CPU OR UR_BUILD_ADAPTER_L0_V2 + OR UR_BUILD_ADAPTER_ALL)) + message(WARNING "No adapters have been enabled; conformance tests will not be ran") + message(STATUS "Consider setting UR_BUILD_ADAPTER_*") +endif() + +# Check if clang-format (in correct version) is available for Cpp code formatting. +if(UR_FORMAT_CPP_STYLE) + find_program(CLANG_FORMAT NAMES clang-format-18 clang-format-18.1 clang-format) + + if(CLANG_FORMAT) + get_program_version_major_minor(${CLANG_FORMAT} CLANG_FORMAT_VERSION) + message(STATUS "Found clang-format: ${CLANG_FORMAT} (version: ${CLANG_FORMAT_VERSION})") + + set(CLANG_FORMAT_REQUIRED "18.1") + if(NOT (CLANG_FORMAT_VERSION VERSION_EQUAL CLANG_FORMAT_REQUIRED)) + message(FATAL_ERROR "required clang-format version is ${CLANG_FORMAT_REQUIRED}") + endif() + else() + message(FATAL_ERROR "UR_FORMAT_CPP_STYLE=ON, but clang-format not found (required version: ${CLANG_FORMAT_REQUIRED})") + endif() +endif() + +# Obtain files for clang-format and license check +set(format_glob) +set(license_glob) +foreach(dir examples include source test tools) + list(APPEND format_glob + "${dir}/*.h" + "${dir}/*.hpp" + "${dir}/*.c" + "${dir}/*.cpp" + "${dir}/**/*.h" + "${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}) + +# Add license check target +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 hardening check +add_custom_target(verify-hardening + COMMAND "${PROJECT_SOURCE_DIR}/scripts/check-hardening.sh" + ${CMAKE_BINARY_DIR} + COMMENT "Check hardening settings on built binaries and libraries" +) + +# Add code formatter target +add_custom_target(cppformat) +# ... and all source files to the formatter +add_cppformat(all-sources ${format_src}) + +# Allow custom third_party folder +if(NOT DEFINED THIRD_PARTY_DIR) + set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party) +endif() + +add_subdirectory(${THIRD_PARTY_DIR}) + +# A header only library to specify include directories in transitive +# dependencies. +add_library(ur_headers INTERFACE) +# Alias target to support FetchContent. +add_library(${PROJECT_NAME}::headers ALIAS ur_headers) +target_include_directories(ur_headers INTERFACE + $ + $) + +# Add the include directory and the headers target to the install. +install( + DIRECTORY "${PROJECT_SOURCE_DIR}/include/" + DESTINATION include COMPONENT ur_headers) +install( + TARGETS ur_headers + EXPORT ${PROJECT_NAME}-targets) + +add_subdirectory(source) +if(UR_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() +if(UR_BUILD_TESTS) + add_subdirectory(test) +endif() +if(UR_BUILD_TOOLS) + add_subdirectory(tools) +endif() + +# Add the list of installed targets to the install. This includes the namespace +# which all installed targets will be prefixed with, e.g. for the headers +# target users will depend on ${PROJECT_NAME}::headers. +install( + EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION lib/cmake/${PROJECT_NAME}) + +# Configure the package versions file for use in find_package when installed. +write_basic_package_version_file( + ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake + COMPATIBILITY SameMajorVersion) +# Configure the package file that is searched for by find_package when +# installed. +configure_package_config_file( + ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in + ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake + INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}) + +# Add the package files to the install. +install( + FILES + ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake + DESTINATION lib/cmake/${PROJECT_NAME}) + +set(API_JSON_FILE ${PROJECT_BINARY_DIR}/unified_runtime.json) + +if(UR_FORMAT_CPP_STYLE) + # Generate source from the specification + add_custom_target(generate-code USES_TERMINAL + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/scripts + COMMAND ${Python3_EXECUTABLE} run.py + --api-json ${API_JSON_FILE} + --clang-format=${CLANG_FORMAT} + $<$:--fast-mode> + COMMAND ${Python3_EXECUTABLE} json2src.py --api-json ${API_JSON_FILE} ${PROJECT_SOURCE_DIR} + ) + + # Generate and format source from the specification + add_custom_target(generate USES_TERMINAL + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target generate-code + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target cppformat + ) + + # Generate source and check for uncommitted diffs + add_custom_target(check-generated + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMAND git diff --exit-code + DEPENDS generate + ) +else() + message(STATUS " UR_FORMAT_CPP_STYLE not set. Targets: 'generate' and 'check-generated' are not available") +endif() diff --git a/unified-runtime/LICENSE.TXT b/unified-runtime/LICENSE.TXT new file mode 100644 index 0000000000000..db138e5ba89f6 --- /dev/null +++ b/unified-runtime/LICENSE.TXT @@ -0,0 +1,234 @@ +============================================================================== +The Unified Runtime Project is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + +============================================================================== +Software from third parties included in the Unified Runtime Project: +============================================================================== +The Unified Runtime Project contains third party software which is under different license +terms. All such code will be identified clearly using at least one of two +mechanisms: +1) It will be in a separate directory tree with its own `LICENSE.txt` or + `LICENSE` file at the top containing the specific license and restrictions + which apply to that software, or +2) It will contain specific license and restriction terms at the top of every + file. diff --git a/unified-runtime/README.md b/unified-runtime/README.md new file mode 100644 index 0000000000000..84d96e6449c03 --- /dev/null +++ b/unified-runtime/README.md @@ -0,0 +1,201 @@ +# Unified Runtime + +[![Pre-commit](https://github.com/intel/llvm/actions/workflows/ur-precommit.yml/badge.svg)](https://github.com/intel/llvm/actions/workflows/ur-precommit.yml) +[![Nightly](https://github.com/oneapi-src/unified-runtime/actions/workflows/nightly.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/nightly.yml) +[![Deploy documentation to Pages](https://github.com/oneapi-src/unified-runtime/actions/workflows/docs.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/docs.yml) +[![Compute Benchmarks Nightly](https://github.com/oneapi-src/unified-runtime/actions/workflows/benchmarks-nightly.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/benchmarks-nightly.yml) + + + +## Table of contents + +- [Unified Runtime](#unified-runtime) + - [Table of contents](#table-of-contents) + - [Contents of the repo](#contents-of-the-repo) + - [Integration](#integration) + - [Weekly tags](#weekly-tags) + - [Third-Party tools](#third-party-tools) + - [Building](#building) + - [Requirements](#requirements) + - [Windows](#windows) + - [Linux](#linux) + - [CMake standard options](#cmake-standard-options) + - [Additional make targets](#additional-make-targets) + - [Contributions](#contributions) + - [Adapter naming convention](#adapter-naming-convention) + - [Source code generation](#source-code-generation) + - [Documentation](#documentation) + - [Release Process](#release-process) + +## Contents of the project + +This project contains the following: + +- API specification in YaML +- API programming guide in RST +- Loader and a null adapter implementation (partially generated) +- Example applications +- API C/C++ header files (generated) +- API Python module (generated) +- Sample C++ wrapper (generated) +- Sample C/C++ import library (generated) + +## Integration + +The recommended way to integrate this project into another is via CMake's +[FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html), +for example: + +```cmake +include(FetchContent) + +FetchContent_Declare( + unified-runtime + GIT_REPOSITORY https://github.com/oneapi-src/unified-runtime.git + GIT_TAG main # This will pull the latest changes from the main branch. +) +FetchContent_MakeAvailable(unified-runtime) + +add_executable(example example.cpp) +target_link_libraries(example PUBLIC unified-runtime::headers) +``` + +## Third-Party tools + +The recommended method to install the third-party tools is using a Python +virtual environment, for example: + +```bash +$ python -m venv .venv +$ source .venv/bin/activate +$ pip install -r third_party/requirements.txt +``` + +## Building + +The requirements and instructions below are for building the project from source +without any modifications. To make modifications to the specification, please +see the +[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html) +for more detailed instructions on the correct setup. + +### Requirements + +Required packages: +- C++ compiler with C++17 support +- [CMake](https://cmake.org/) >= 3.20.0 +- Python v3.6.6 or later + +### Windows + +Generating Visual Studio Project. EXE and binaries will be in **build/bin/{build_config}** + +```bash +$ mkdir build +$ cd build +$ cmake {path_to_source_dir} -G "Visual Studio 15 2017 Win64" +``` + +### Linux + +Executable and binaries will be in **build/bin** + +```bash +$ mkdir build +$ cd build +$ cmake {path_to_source_dir} +$ make +``` + +### CMake standard options + +List of options provided by CMake: + +| Name | Description | Values | Default | +| - | - | - | - | +| UR_BUILD_EXAMPLES | Build example applications | ON/OFF | ON | +| 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 | ON/OFF | OFF | +| UR_ENABLE_FAST_SPEC_MODE | Enable fast specification generation mode | 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_USE_CFI | Enable Control Flow Integrity checks (clang only, also enables lto) | ON/OFF | OFF | +| UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF | +| UR_ENABLE_SANITIZER | Enable device sanitizer layer | ON/OFF | ON | +| UR_CONFORMANCE_TARGET_TRIPLES | SYCL triples to build CTS device binaries for | Comma-separated list | spir64 | +| UR_CONFORMANCE_AMD_ARCH | AMD device target ID to build CTS binaries for | string | `""` | +| UR_CONFORMANCE_ENABLE_MATCH_FILES | Enable CTS match files | ON/OFF | ON | +| UR_CONFORMANCE_TEST_LOADER | Additionally build and run "loader" tests for the CTS | ON/OFF | OFF | +| UR_BUILD_ADAPTER_L0 | Build the Level-Zero adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_OPENCL | Build the OpenCL adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_CUDA | Build the CUDA adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_HIP | Build the HIP adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_NATIVE_CPU | Build the Native-CPU adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_ALL | Build all currently supported adapters | ON/OFF | OFF | +| UR_BUILD_ADAPTER_L0_V2 | Build the (experimental) Level-Zero v2 adapter | ON/OFF | OFF | +| UR_STATIC_ADAPTER_L0 | Build the Level-Zero adapter as static and embed in the loader | ON/OFF | OFF | +| UR_HIP_PLATFORM | Build HIP adapter for AMD or NVIDIA platform | AMD/NVIDIA | AMD | +| UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD | +| UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` | +| UR_DEVICE_CODE_EXTRACTOR | Path of the `clang-offload-extract` executable from the DPC++ package, required for CTS device binaries | File path | `"${dirname(UR_DPCXX)}/clang-offload-extract"` | +| UR_DPCXX_BUILD_FLAGS | Build flags to pass to DPC++ when compiling device programs | Space-separated options list | `""` | +| UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` | +| UR_HIP_ROCM_DIR | Path of the default ROCm HIP installation | Directory path | `$ENV{ROCM_PATH}` or `/opt/rocm` | +| UR_HIP_INCLUDE_DIR | Path of the ROCm HIP include directory | Directory path | `${UR_HIP_ROCM_DIR}/include` | +| UR_HIP_HSA_INCLUDE_DIRS | Path of the ROCm HSA include directory | Directory path | `${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include` | +| UR_HIP_LIB_DIR | Path of the ROCm HIP library directory | Directory path | `${UR_HIP_ROCM_DIR}/lib` | + +### Additional make targets + +To run tests, do the following: + +```bash +$ make +$ make test +``` + +To run automated code formatting, configure CMake with `UR_FORMAT_CPP_STYLE` option +and then run a custom `cppformat` target: + +```bash +$ make cppformat +``` + +If you've made modifications to the specification, you can also run +a custom `generate` target prior to building. +It will generate the source code **and** run automated code formatting: + +```bash +$ make generate +``` + +This target has additional dependencies which are described in the *Build +Environment* section of the +[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html). + +## Contributions + +For those who intend to make a contribution to the project please read our +[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html) +for more information. + +### Adapter naming convention + +To maintain consistency and clarity in naming adapter libraries, it is recommended +to use the following naming convention: + +* On Linux platforms, use `libur_adapter_[name].so`. +* On Windows platforms, use `ur_adapter_[name].dll`. + +### Source code generation + +Code is generated using included [Python scripts](/scripts/README.md). + +### Documentation + +Documentation is generated from source code using Sphinx - +see [scripts dir](/scripts/README.md) for details. diff --git a/unified-runtime/REQUIREMENTS.md b/unified-runtime/REQUIREMENTS.md new file mode 100644 index 0000000000000..00241b81883b8 --- /dev/null +++ b/unified-runtime/REQUIREMENTS.md @@ -0,0 +1,52 @@ +# Requirements + +## API and Library Requirements + +### API Namespace +* APIs will clearly define the functionality +* APIs will use a consistent style within the library +* APIs will not allow namespace collision when multiple libraries are linked in the same user application +* API will be consistent across libraries included in the product +* Will not allow namespace collision when multiple libraries are linked in the same user application +* Exceptions: + + If two libraries are unlikely to used together, willing to sacrifice optimal performance + + For existing libraries, favor API consistency vs. stylist name space + +### Common Functional Requirements +* Libraries will use common resource allocation (memory, threads, device context) – under & above API where applicable +* Libraries will support consistent data types to avoid unnecessary data manipulation / reformatting +* Libraries will support a composable threading model and synchronous/asynchronous operations +* Libraries will utilize unified error reporting, debug information, I/O mechanism (file, network,…), etc. + +### Directory Structure and Deployment Requirements +* The Libraries can be delivered as “stand-alone” deliverables +* The Libraries can be delivered in a common product suite configuration (with other product components) +* When delivered in a product suite, the directory structure will conform to the master product directory layout requirements +* The library subcomponents will be installed in a consistent directory structure across the included libraries +* When two or more libraries are installed independently, they will conform to a common directory structure and versioning layout +* Libraries will be packaged for installation using common packaging mechanism for the operations systems that they targeted (e.g. .rpm, .deb, .msi, etc.) + +### Library Language Binding Requirements +* DPC++ Language binding requirements + + Performance Libraries that execute on multiple Intel IP’s shall support the DPCP++ language binding as the primary mechanism for programming on multiple Intel Hardware IP’s + + If the library supports DPC++ for a only a subset of functions for offload to an accelerator (e.g. ATS), all CPU functions should all support DPC++ Language bindings so that application developers can write their entire application in DPC++ + + If a Library only supports only the CPU, but is likely to be used with another library the supports DPC++ on CPU and ATS, the library shall also support DPC++ +* Libraries may support other language bindings (C/C++/FORTRAN/JAVA/PYTHON, etc.) to support existing user base and use cases required by the developer domain + +### Library API Deprecation Management +* Library API deprecation will be managed via a change control process +* Definitions: + + Supported – In the currently released library and will not change at short notice. + + Deprecated – Documented to be no longer supported, and may be removed in the future at an announced date. Users are encouraged to use an alternative API or library + + Removed – Removed from library, no longer supported or available + +#### Objectives for Deprecation +* Refine and improve APIs to deliver better value for developer and Intel + + API does not expose best performance or support important usage models +* Remove outdated or infrequently used functionality based on usage data. + +#### Multi year/release process +* Goal: Provide customers ample time to review, respond and adapt + + Proactively communicate deprecation + + Use warning and \#pragma per each deprecated item + + Over the deprecation period: collect & analyze deprecation feedback & remove APIs diff --git a/unified-runtime/SECURITY.md b/unified-runtime/SECURITY.md new file mode 100644 index 0000000000000..6575529c3d1c8 --- /dev/null +++ b/unified-runtime/SECURITY.md @@ -0,0 +1,14 @@ +# Security Policy + +Intel is committed to rapidly addressing security vulnerabilities affecting our customers +and providing clear guidance on the solution, impact, severity and mitigation. + +## Report a Vulnerability + +Please report security issues or vulnerabilities to the [Intel Security Center]. + +For more information on how Intel works to resolve security issues, see [Vulnerability Handling Guidelines]. + +[Intel Security Center]:https://www.intel.com/security + +[Vulnerability Handling Guidelines]:https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html diff --git a/unified-runtime/ci/README.md b/unified-runtime/ci/README.md new file mode 100644 index 0000000000000..df47f74e5f2ee --- /dev/null +++ b/unified-runtime/ci/README.md @@ -0,0 +1,67 @@ +These scripts enable a Python virtual environment used for the CI scripts. This Python can also be used for local development as well. + +The only requirements of the system are: +* Windows platform +* Git is installed + +Once setup, a Python virtual environment with all necessary PIP modules will be enabled. Then you simply run your script as follows (from anywhere): + + ``` + (pyvirtualenv) local> python run.py ... + ``` + + Once you're done you simply deactivate as outlined below. + + **NOTES:** + * All dependencies will be installed in the *third_party* dir + * Add new PIP modules by modifying the *pyenv.cmd* file + * This leverages *Artifactory* and *irepo* + +## Setup + +### Activate the python virtual environment + +``` +local> ci\pyenv.cmd up +``` +which will give you prompt as follows: +``` +*** Python virtual environment enabled *** +Python 3.6.5 + +(pyvirtualenv) root> +``` + +### Updating PIP modules in python virtual environment + +Ideally, the PIP modules don't change too often. But if Python complains you can try to update the modules with the following command. + +``` +local> ci\pyenv.cmd update_pip +``` + +### Deactivate python virtual environment + +``` +local> ci\pyenv.cmd down +``` + +### Reset python virtual environment + +This will remove all files associated with the python virtual environment. Useful when reloading new pip modules, for instance. + +``` +local> ci\pyenv.cmd reset +``` + +## Troubleshooting + +### 'doxygen' is not recognized as an internal or external command + +Doxygen was added when pyenv.cmd setup the environment so you need to add it to your path by running the following in your shell: + +```console +set PATH=\one-api\level_zero\.deps\doxygen;%PATH% +``` + +*Note:* this dependent on the location specified in *third_party\windows_docs.yml* and may change in the future. Refer to the file for correct location. \ No newline at end of file diff --git a/unified-runtime/ci/pyenv.cmd b/unified-runtime/ci/pyenv.cmd new file mode 100644 index 0000000000000..a90a33509f63d --- /dev/null +++ b/unified-runtime/ci/pyenv.cmd @@ -0,0 +1,147 @@ +@echo off + +:: pyenv.cmd +:: +:: This script brings up a python virtual environment. It will install all necessary tools through the manifest +:: file specified in :setup_manifest. It will install all pip modules specified in :setup_python. The only dependency +:: is git. + +set _CI_ROOTDIR=%~dp0..\ +set _CI_SETUP_DIR=%~dp0 +set _CI_TOOLS_DIR=%_CI_ROOTDIR%.deps +set _CI_THIRD_PARTY_DIR=%_CI_ROOTDIR%third_party +set VDIR=%_CI_TOOLS_DIR%\pyvirtualenv +set MANIFEST_FILE=%_CI_THIRD_PARTY_DIR%\windows_docs.yml + +::echo _CI_ROOTDIR=%_CI_ROOTDIR% +::echo _CI_SETUP_DIR=%_CI_SETUP_DIR% +::echo _CI_TOOLS_DIR=%_CI_TOOLS_DIR% +::echo _CI_THIRD_PARTY_DIR=%_CI_THIRD_PARTY_DIR% +::echo VDIR=%VDIR% +::echo MANIFEST_FILE=%MANIFEST_FILE% + +if "%1" == "up" ( + call :up + goto :eof +) +if "%1" == "down" ( + call :down %* + goto :eof +) +if "%1" == "reset" ( + call :reset_python %* + goto :eof +) +if "%1" == "update_pip" ( + call :update_pip %* + goto :eof +) +if "%1" == "update_manifest" ( + call :setup_manifest %* + goto :eof +) + +echo usage: call %~nx0 ^ +goto :eof + + +::=============================================================== +:: Install manifest file (and supporting tools) +:setup_manifest +pushd %_ROOTDIR% +::echo cmd /C %_CI_SETUP_DIR%setup_manifest.cmd %MANIFEST_FILE% +cmd /C %_CI_SETUP_DIR%setup_manifest.cmd %MANIFEST_FILE% +if errorlevel 1 ( exit /B %ERRORLEVEL% ) +popd +goto :eof + +::=============================================================== +:setup_python +set PYTHON_VERSION=3.6.5-2-win64-full +set _PYDIR=%_CI_TOOLS_DIR%\python +if not exist "%_PYDIR%" ( + call :setup_manifest +) +if errorlevel 1 ( exit /B %ERRORLEVEL% ) +setlocal enabledelayedexpansion +if not exist "%VDIR%\Scripts\activate.bat" ( + set PYTHONPATH=%_PYDIR% + if exist "%VDIR%" ( + rd /s/q %VDIR% + ) + echo ********************************************** + echo * Generating python virtual environment + echo ********************************************** + %_PYDIR%\python -m venv "%VDIR%" + if errorlevel 1 ( exit /B %ERRORLEVEL% ) + call "%VDIR%\Scripts\activate.bat" + if errorlevel 1 ( exit /B %ERRORLEVEL% ) + call "%VDIR%\Scripts\deactivate.bat" + + call :update_pip +) +endlocal +goto :eof + + +::=============================================================== +:: Updates PIP modules (and PIP itself) +:update_pip +echo Updating python PIP modules... +set VDIR_ACTIVE= +if exist "%VDIR%" ( + call "%VDIR%\Scripts\activate.bat" + + rem Use PIP to install required modules + set http_proxy=http://proxy-us.intel.com:911 + set ftp_proxy=http://proxy-us.intel.com:911 + set https_proxy=http://proxy-us.intel.com:911 + python -m pip install --upgrade pip + + :: Install PIP modules here + python -m pip install -r %_CI_THIRD_PARTY_DIR%\requirements.txt + + call "%VDIR%\Scripts\deactivate.bat" + + echo Python PIP modules updated +) +echo Done. +goto :eof + + +::=============================================================== +:: Deletes existing python virtual env. +:reset_python +echo Resetting python... +set VDIR_ACTIVE= +if exist "%VDIR%" ( + call "%VDIR%\Scripts\deactivate.bat" + rmdir /s /q "%VDIR% +) +echo Done. +goto :eof + + +::=============================================================== +:: Activates python virtual env. +:up +call :setup_python +if exist "%VDIR%\Scripts\activate.bat" ( + call "%VDIR%\Scripts\activate.bat" + if errorlevel 1 ( exit /B %ERRORLEVEL% ) +) +setlocal +echo *** Python virtual environment enabled *** +python %* --version +endlocal +goto :eof + + +::=============================================================== +:: Deactivates python virtual env. +:down +if exist "%VDIR%\Scripts\deactivate.bat" ( + call "%VDIR%\Scripts\deactivate.bat" + if errorlevel 1 ( exit /B %ERRORLEVEL% ) +) +goto :eof diff --git a/unified-runtime/ci/setup_manifest.cmd b/unified-runtime/ci/setup_manifest.cmd new file mode 100644 index 0000000000000..aa8b5fa7e4d3b --- /dev/null +++ b/unified-runtime/ci/setup_manifest.cmd @@ -0,0 +1,86 @@ +@echo off +setlocal enabledelayedexpansion + +set MANIFEST_FILE="%1" +if not exist %MANIFEST_FILE% ( + echo Can not find manifest file: %MANIFEST_FILE% + goto failure +) + +set IREPO_CHECK=1 +if "%IREPO_BASE_DIR%" == "" ( + set IREPO_BASE_DIR=C:\intel\irepo +) +set IREPO_CMD=%IREPO_BASE_DIR%\irepo.bat + + +::=============================================================== +:check_irepo + echo Looking for %IREPO_CMD% + if exist %IREPO_CMD% goto irepo_found + + :: IREPO could be set to a different path with different path structure + :: If not found explicitly set location of both dir and batch file + set IREPO_BASE_DIR=C:\intel\irepo + set IREPO_CMD=%IREPO_BASE_DIR%\irepo.bat + + :: If second time through, exit failure + if [%IREPO_CHECK%]==[2] goto failure + + set IREPO_CHECK=2 + goto check_git + + +::=============================================================== +:check_git + echo Checking if git installed + cmd /c git --version + if [%ERRORLEVEL%]==[0] ( + goto install_irepo + ) else ( + echo git not installed + echo Install git and try again + goto failure + ) + + +::=============================================================== +:install_irepo + echo Installing irepo + if not exist %IREPO_BASE_DIR% mkdir %IREPO_BASE_DIR% + git clone https://github.intel.com/GSDI/irepo %IREPO_BASE_DIR% + goto check_irepo + + +::=============================================================== +:irepo_found + echo irepo found at %IREPO_CMD% + + +::=============================================================== +:init_manifest + echo %IREPO_CMD% select %MANIFEST_FILE% + cmd /c %IREPO_CMD% select %MANIFEST_FILE% + if [%ERRORLEVEL%]==[0] ( + goto sync_manifest + else ( + goto failure + ) + + +::=============================================================== +:sync_manifest + echo %IREPO_CMD% sync + cmd /c %IREPO_CMD% sync + goto exit + + +::=============================================================== +:exit + exit /B %ERRORLEVEL% + + +::=============================================================== +:failure + echo Manifest setup failed. Exiting + exit /B 1 \ No newline at end of file diff --git a/unified-runtime/cmake/Assertions.cmake b/unified-runtime/cmake/Assertions.cmake new file mode 100644 index 0000000000000..9d8f6c0f2650f --- /dev/null +++ b/unified-runtime/cmake/Assertions.cmake @@ -0,0 +1,30 @@ +# From 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 + +# This is lifted from llvm's LLVM_ENABLE_ASSERTIONS implementation +# https://github.com/llvm/llvm-project/blob/6be0e979896f7dd610abf263f845c532f1be3762/llvm/cmake/modules/HandleLLVMOptions.cmake#L89 +if(UR_ENABLE_ASSERTIONS) + # MSVC doesn't like _DEBUG on release builds + if( NOT MSVC ) + add_compile_definitions(_DEBUG) + endif() + # On non-Debug builds cmake automatically defines NDEBUG, so we + # explicitly undefine it: + if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) + add_compile_options($<$,$>:-UNDEBUG>) + if (MSVC) + # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines. + foreach (flags_var_to_scrub + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_MINSIZEREL) + string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " + "${flags_var_to_scrub}" "${${flags_var_to_scrub}}") + endforeach() + endif() + endif() +endif() diff --git a/unified-runtime/cmake/FetchLevelZero.cmake b/unified-runtime/cmake/FetchLevelZero.cmake new file mode 100644 index 0000000000000..6d0e10d10dae4 --- /dev/null +++ b/unified-runtime/cmake/FetchLevelZero.cmake @@ -0,0 +1,119 @@ +# Copyright (C) 2024 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 + +set(UR_LEVEL_ZERO_LOADER_LIBRARY "" CACHE FILEPATH "Path of the Level Zero Loader library") +set(UR_LEVEL_ZERO_INCLUDE_DIR "" CACHE FILEPATH "Directory containing the Level Zero Headers") +set(UR_LEVEL_ZERO_LOADER_REPO "" CACHE STRING "Github repo to get the Level Zero loader sources from") +set(UR_LEVEL_ZERO_LOADER_TAG "" CACHE STRING " GIT tag of the Level Loader taken from github repo") +set(UR_COMPUTE_RUNTIME_REPO "" CACHE STRING "Github repo to get the compute runtime sources from") +set(UR_COMPUTE_RUNTIME_TAG "" CACHE STRING " GIT tag of the compute runtime taken from github repo") + +# Copy Level Zero loader/headers locally to the build to avoid leaking their path. +set(LEVEL_ZERO_COPY_DIR ${CMAKE_CURRENT_BINARY_DIR}/level_zero_loader) +if (NOT UR_LEVEL_ZERO_LOADER_LIBRARY STREQUAL "") + get_filename_component(LEVEL_ZERO_LIB_NAME "${UR_LEVEL_ZERO_LOADER_LIBRARY}" NAME) + set(LEVEL_ZERO_LIBRARY ${LEVEL_ZERO_COPY_DIR}/${LEVEL_ZERO_LIB_NAME}) + message(STATUS "Level Zero Adapter: Copying Level Zero loader to local build tree") + file(COPY ${UR_LEVEL_ZERO_LOADER_LIBRARY} DESTINATION ${LEVEL_ZERO_COPY_DIR} FOLLOW_SYMLINK_CHAIN) +endif() +if (NOT UR_LEVEL_ZERO_INCLUDE_DIR STREQUAL "") + set(LEVEL_ZERO_INCLUDE_DIR ${LEVEL_ZERO_COPY_DIR}) + message(STATUS "Level Zero Adapter: Copying Level Zero headers to local build tree") + file(COPY ${UR_LEVEL_ZERO_INCLUDE_DIR}/ DESTINATION ${LEVEL_ZERO_COPY_DIR}) +endif() + +if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR) + message(STATUS "Level Zero Adapter: Download Level Zero loader and headers from github.com") + + # Workaround warnings/errors for Level Zero build + set(CMAKE_CXX_FLAGS_BAK "${CMAKE_CXX_FLAGS}") + if (UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat-extra-semi") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option") + endif() + + if (UR_LEVEL_ZERO_LOADER_REPO STREQUAL "") + set(UR_LEVEL_ZERO_LOADER_REPO "https://github.com/oneapi-src/level-zero.git") + endif() + if (UR_LEVEL_ZERO_LOADER_TAG STREQUAL "") + set(UR_LEVEL_ZERO_LOADER_TAG v1.19.2) + endif() + + # Disable due to a bug https://github.com/oneapi-src/level-zero/issues/104 + set(CMAKE_INCLUDE_CURRENT_DIR OFF) + # Prevent L0 loader from exporting extra symbols + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF) + + message(STATUS "Level Zero Adapter: Will fetch Level Zero Loader from ${UR_LEVEL_ZERO_LOADER_REPO}") + include(FetchContent) + FetchContent_Declare(level-zero-loader + GIT_REPOSITORY ${UR_LEVEL_ZERO_LOADER_REPO} + GIT_TAG ${UR_LEVEL_ZERO_LOADER_TAG} + ) + if(MSVC) + set(USE_Z7 ON) + endif() + FetchContent_MakeAvailable(level-zero-loader) + FetchContent_GetProperties(level-zero-loader) + + # Restore original flags + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK}") + + target_compile_options(ze_loader PRIVATE + $<$,GNU;Clang;Intel;IntelLLVM>:-Wno-error> + $<$:/WX- /UUNICODE> + ) + + set(LEVEL_ZERO_LIBRARY ze_loader) + set(LEVEL_ZERO_INCLUDE_DIR + ${level-zero-loader_SOURCE_DIR}/include CACHE PATH "Path to Level Zero Headers") +endif() + +add_library(LevelZeroLoader INTERFACE) +# The MSVC linker does not like / at the start of a path, so to work around this +# we split it into a link library and a library path, where the path is allowed +# to have leading /. +get_filename_component(LEVEL_ZERO_LIBRARY_SRC "${LEVEL_ZERO_LIBRARY}" DIRECTORY) +get_filename_component(LEVEL_ZERO_LIB_NAME "${LEVEL_ZERO_LIBRARY}" NAME) +target_link_directories(LevelZeroLoader + INTERFACE "$" + "$" +) +target_link_libraries(LevelZeroLoader + INTERFACE "${LEVEL_ZERO_LIB_NAME}" +) + +file(GLOB LEVEL_ZERO_LOADER_API_HEADERS "${LEVEL_ZERO_INCLUDE_DIR}/*.h") +file(COPY ${LEVEL_ZERO_LOADER_API_HEADERS} DESTINATION ${LEVEL_ZERO_INCLUDE_DIR}/level_zero) +add_library(LevelZeroLoader-Headers INTERFACE) +target_include_directories(LevelZeroLoader-Headers + INTERFACE "$" + "$" +) + +if (UR_COMPUTE_RUNTIME_REPO STREQUAL "") +set(UR_COMPUTE_RUNTIME_REPO "https://github.com/intel/compute-runtime.git") +endif() +if (UR_COMPUTE_RUNTIME_TAG STREQUAL "") +set(UR_COMPUTE_RUNTIME_TAG 24.39.31294.12) +endif() +include(FetchContent) +# Sparse fetch only the dir with level zero headers for experimental features to avoid pulling in the entire compute-runtime. +FetchContentSparse_Declare(exp-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG}" "level_zero/include") +FetchContent_GetProperties(exp-headers) +if(NOT exp-headers_POPULATED) + FetchContent_Populate(exp-headers) +endif() +add_library(ComputeRuntimeLevelZero-Headers INTERFACE) +set(COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${exp-headers_SOURCE_DIR}/../..") +message(STATUS "Level Zero Adapter: Using Level Zero headers from ${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE}") +target_include_directories(ComputeRuntimeLevelZero-Headers + INTERFACE "$" + "$" +) diff --git a/unified-runtime/cmake/FindCUDACupti.cmake b/unified-runtime/cmake/FindCUDACupti.cmake new file mode 100644 index 0000000000000..3e8447bcdd004 --- /dev/null +++ b/unified-runtime/cmake/FindCUDACupti.cmake @@ -0,0 +1,26 @@ +# Copyright (C) 2024 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 + +# This is lifted from intel-llvm's FindCUDACupti implementation +# https://github.com/intel/llvm/blob/0cd04144d9ca83371c212e8e4709a59c968291b9/sycl/cmake/modules/FindCUDACupti.cmake + +macro(find_cuda_cupti_library) + find_library(CUDA_cupti_LIBRARY + NAMES cupti + HINTS ${CUDA_TOOLKIT_ROOT_DIR} + ENV CUDA_PATH + PATH_SUFFIXES nvidia/current lib64 lib/x64 lib + ../extras/CUPTI/lib64/ + ../extras/CUPTI/lib/ + ) +endmacro() + +macro(find_cuda_cupti_include_dir) + find_path(CUDA_CUPTI_INCLUDE_DIR cupti.h PATHS + "${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/include" + "${CUDA_INCLUDE_DIRS}/../extras/CUPTI/include" + "${CUDA_INCLUDE_DIRS}" + NO_DEFAULT_PATH) +endmacro() diff --git a/unified-runtime/cmake/FindLibbacktrace.cmake b/unified-runtime/cmake/FindLibbacktrace.cmake new file mode 100644 index 0000000000000..07bc615a8245e --- /dev/null +++ b/unified-runtime/cmake/FindLibbacktrace.cmake @@ -0,0 +1,27 @@ +# 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 + +# +# FindLIBBACKTRACE.cmake -- module searching for libbacktrace library. +# LIBBACKTRACE_FOUND is set to true if libbacktrace is found. +# + +find_library(LIBBACKTRACE_LIBRARIES NAMES backtrace) +find_path(LIBBACKTRACE_INCLUDE_DIR NAMES backtrace.h) + +if (LIBBACKTRACE_LIBRARIES AND LIBBACKTRACE_INCLUDE_DIR) + set(LIBBACKTRACE_FOUND TRUE) +endif() + +if (LIBBACKTRACE_FOUND) + add_library(Libbacktrace INTERFACE IMPORTED) + set_target_properties(Libbacktrace PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBBACKTRACE_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${LIBBACKTRACE_LIBRARIES}" + ) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libbacktrace DEFAULT_MSG LIBBACKTRACE_LIBRARIES LIBBACKTRACE_INCLUDE_DIR) diff --git a/unified-runtime/cmake/FindRocmAgentEnumerator.cmake b/unified-runtime/cmake/FindRocmAgentEnumerator.cmake new file mode 100644 index 0000000000000..b966d8fd9d91e --- /dev/null +++ b/unified-runtime/cmake/FindRocmAgentEnumerator.cmake @@ -0,0 +1,19 @@ +# 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 + +# +# FindRocmAgentEnumerator.cmake -- module searching for rocm_agent_enumerator. +# ROCM_AGENT_ENUMERATOR_FOUND is set to true if +# rocm_agent_enumerator is found. +# + +find_program(ROCM_AGENT_ENUMERATOR NAMES rocm_agent_enumerator PATHS /opt/rocm/bin) + +if(ROCM_AGENT_ENUMERATOR) + set(ROCM_AGENT_ENUMERATOR_FOUND TRUE) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(RocmAgentEnumerator DEFAULT_MSG ROCM_AGENT_ENUMERATOR) diff --git a/unified-runtime/cmake/helpers.cmake b/unified-runtime/cmake/helpers.cmake new file mode 100644 index 0000000000000..bdd4a6d15cb90 --- /dev/null +++ b/unified-runtime/cmake/helpers.cmake @@ -0,0 +1,241 @@ +# Copyright (C) 2023-2024 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 + +# +# helpers.cmake -- helper functions for top-level CMakeLists.txt +# + +# Sets ${ret} to version of program specified by ${name} in major.minor format +function(get_program_version_major_minor name ret) + execute_process(COMMAND ${name} --version + OUTPUT_VARIABLE cmd_ret + ERROR_QUIET) + STRING(REGEX MATCH "([0-9]+)\.([0-9]+)" VERSION "${cmd_ret}") + SET(${ret} ${VERSION} PARENT_SCOPE) +endfunction() + +# Generates cppformat-$name targets and attaches them +# as dependencies of global "cppformat" target. +# Arguments are used as files to be checked. +# ${name} must be unique. +function(add_cppformat name) + if(NOT CLANG_FORMAT OR NOT (CLANG_FORMAT_VERSION VERSION_EQUAL CLANG_FORMAT_REQUIRED)) + return() + endif() + + if(${ARGC} EQUAL 0) + return() + else() + # Split args into 2 parts (in Windows the list is probably too long) + list(SUBLIST ARGN 0 250 selected_files_1) + list(SUBLIST ARGN 250 -1 selected_files_2) + add_custom_target(cppformat-${name} + COMMAND ${CLANG_FORMAT} --style=file --i ${selected_files_1} + COMMAND ${CLANG_FORMAT} --style=file --i ${selected_files_2} + COMMENT "Format CXX source files" + ) + endif() + + add_dependencies(cppformat cppformat-${name}) +endfunction() + +include(CheckCXXCompilerFlag) + +macro(add_sanitizer_flag flag) + set(SAVED_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} -fsanitize=${flag}") + + check_cxx_compiler_flag("-fsanitize=${flag}" CXX_HAS_SANITIZER) + if(CXX_HAS_SANITIZER) + add_compile_options(-fsanitize=${flag}) + add_link_options(-fsanitize=${flag}) + else() + message("${flag} sanitizer not supported") + endif() + + set(CMAKE_REQUIRED_LIBRARIES ${SAVED_CMAKE_REQUIRED_LIBRARIES}) +endmacro() + +if(CMAKE_SYSTEM_NAME STREQUAL Linux) + check_cxx_compiler_flag("-fcf-protection=full" CXX_HAS_FCF_PROTECTION_FULL) + check_cxx_compiler_flag("-fstack-clash-protection" CXX_HAS_FSTACK_CLASH_PROTECTION) +endif() + +if (UR_USE_CFI AND UR_USE_ASAN) + message(WARNING "Both UR_USE_CFI and UR_USE_ASAN are ON. " + "Due to build errors, this is unsupported; CFI checks will be disabled") + set(UR_USE_CFI OFF) +endif() + +if (UR_USE_CFI) + set(SAVED_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_FLAGS "-flto -fvisibility=hidden") + check_cxx_compiler_flag("-fsanitize=cfi" CXX_HAS_CFI_SANITIZE) + set(CMAKE_REQUIRED_FLAGS ${SAVED_CMAKE_REQUIRED_FLAGS}) +else() + # If CFI checking is disabled, pretend we don't support it + set(CXX_HAS_CFI_SANITIZE OFF) +endif() + +set(CFI_FLAGS "") +if (CFI_HAS_CFI_SANITIZE) + # cfi-icall requires called functions in shared libraries to also be built with cfi-icall, which we can't + # guarantee. -fsanitize=cfi depends on -flto + set(CFI_FLAGS "-flto -fsanitize=cfi -fno-sanitize=cfi-icall -fsanitize-ignorelist=${PROJECT_SOURCE_DIR}/sanitizer-ignorelist.txt") +endif() + +function(add_ur_target_compile_options name) + if(NOT MSVC) + target_compile_definitions(${name} PRIVATE -D_FORTIFY_SOURCE=2) + target_compile_options(${name} PRIVATE + # Warning options + -Wall + -Wpedantic + -Wempty-body + -Wformat + -Wformat-security + -Wunused-parameter + + # Hardening options + -fPIC + -fstack-protector-strong + -fvisibility=hidden + + ${CFI_FLAGS} + $<$:-fcf-protection=full> + $<$:-fstack-clash-protection> + + # Colored output + $<$:-fdiagnostics-color=always> + $<$:-fcolor-diagnostics> + ) + if (UR_DEVELOPER_MODE) + target_compile_options(${name} PRIVATE -Werror -Wextra) + endif() + if (CMAKE_BUILD_TYPE STREQUAL "Release") + target_compile_options(${name} PRIVATE -fvisibility=hidden) + endif() + elseif(MSVC) + target_compile_options(${name} PRIVATE + $<$:/MP> # clang-cl.exe does not support /MP + /MD$<$:d> + + /W3 + /GS # Enable: Buffer security check + /Gy # Enable: Function-level linking + + $<$:/sdl> # Enable: Additional SDL checks + $<$:/Qspectre> # Enable: Mitigate Spectre variant 1 vulnerabilities + + /wd4267 # Disable: 'var' : conversion from 'size_t' to 'type', possible loss of data + /wd6244 # Disable: local declaration of 'variable' hides previous declaration + /wd6246 # Disable: local declaration of 'variable' hides declaration of same name in outer scope + ) + + target_compile_definitions(${name} PRIVATE + WIN32_LEAN_AND_MEAN NOMINMAX # Cajole Windows.h to define fewer symbols + _CRT_SECURE_NO_WARNINGS # Slience warnings about getenv + ) + + if(UR_DEVELOPER_MODE) + target_compile_options(${name} PRIVATE + /WX # Enable: Treat all warnings as errors + ) + endif() + endif() +endfunction() + +function(add_ur_target_link_options name) + if(NOT MSVC) + if (NOT APPLE) + target_link_options(${name} PRIVATE + ${CFI_FLAGS} + "LINKER:-z,relro,-z,now,-z,noexecstack" + ) + if (UR_DEVELOPER_MODE) + target_link_options(${name} PRIVATE -Werror -Wextra) + endif() + if (CMAKE_BUILD_TYPE STREQUAL "Release") + target_link_options(${name} PRIVATE + $<$:-pie> + ) + endif() + endif() + elseif(MSVC) + target_link_options(${name} PRIVATE + LINKER:/DYNAMICBASE # Enable: Modify header to indicate ASLR should be use + LINKER:/HIGHENTROPYVA # Enable: High-entropy address space layout randomization (ASLR) + $<$: + LINKER:/NXCOMPAT # Enable: Data Execution Prevention + LINKER:/LTCG # Enable: Link-time code generation + > + ) + endif() +endfunction() + +function(add_ur_target_exec_options name) + if(MSVC) + target_link_options(${name} PRIVATE + LINKER:/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}) + if(MSVC) + target_link_options(${name} PRIVATE + $<$,link.exe>:LINKER:/DEPENDENTLOADFLAG:0x2000> + ) + endif() +endfunction() + +function(install_ur_library name) + install(TARGETS ${name} + EXPORT ${PROJECT_NAME}-targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT unified-runtime + ) +endfunction() + +include(FetchContent) + +function(FetchSource GIT_REPOSITORY GIT_TAG GIT_DIR DEST) + message(STATUS "Fetching sparse source ${GIT_DIR} from ${GIT_REPOSITORY} ${GIT_TAG}") + IF(NOT EXISTS ${DEST}) + file(MAKE_DIRECTORY ${DEST}) + execute_process(COMMAND git init + WORKING_DIRECTORY ${DEST}) + execute_process(COMMAND git checkout -b main + WORKING_DIRECTORY ${DEST}) + execute_process(COMMAND git remote add origin ${GIT_REPOSITORY} + WORKING_DIRECTORY ${DEST}) + execute_process(COMMAND git config core.sparsecheckout true + WORKING_DIRECTORY ${DEST}) + file(APPEND ${DEST}/.git/info/sparse-checkout ${GIT_DIR}/) + endif() + execute_process(COMMAND git fetch --depth=1 origin refs/tags/${GIT_TAG}:refs/tags/${GIT_TAG} + WORKING_DIRECTORY ${DEST}) + execute_process(COMMAND git checkout --quiet ${GIT_TAG} + WORKING_DIRECTORY ${DEST}) +endfunction() + +# A wrapper around FetchContent_Declare that supports git sparse checkout. +# This is useful for including subprojects from large repositories. +function(FetchContentSparse_Declare name GIT_REPOSITORY GIT_TAG GIT_DIR) + set(content-build-dir ${CMAKE_BINARY_DIR}/content-${name}) + FetchSource(${GIT_REPOSITORY} ${GIT_TAG} ${GIT_DIR} ${content-build-dir}) + FetchContent_Declare(${name} SOURCE_DIR ${content-build-dir}/${GIT_DIR}) +endfunction() diff --git a/unified-runtime/cmake/match.cmake b/unified-runtime/cmake/match.cmake new file mode 100644 index 0000000000000..0a0aa6a4dc85d --- /dev/null +++ b/unified-runtime/cmake/match.cmake @@ -0,0 +1,77 @@ +# 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 + +# +# match.cmake -- script for creating ctests that compare the output of a binary +# with a known good match file. +# + +find_package(Python3 COMPONENTS Interpreter) + +# Process variables passed to the script +if(NOT DEFINED MODE) + message(FATAL_ERROR "MODE needs to be defined. Possible values: 'stdout', 'stderr', 'file'") +elseif(${MODE} STREQUAL "stdout" OR ${MODE} STREQUAL "stderr") + if(NOT DEFINED TEST_FILE) + message(FATAL_ERROR "TEST_FILE needs to be defined with a path to a binary to run") + else() + set(OUT_FILE "_matchtmpfile") + endif() +elseif(${MODE} STREQUAL "file") + if(NOT DEFINED OUT_FILE) + message(FATAL_ERROR "OUT_FILE needs to be defined with an output file to be verified") + endif() +else() + message(FATAL_ERROR "${MODE} mode not recognised. Possible values: 'stdout', 'stderr', 'file'") +endif() +if(NOT DEFINED MATCH_FILE) + message(FATAL_ERROR "MATCH_FILE needs to be defined") +endif() +if(NOT DEFINED TEST_ARGS) # easier than ifdefing the rest of the code + set(TEST_ARGS "") +endif() + +string(REPLACE "\"" "" TEST_ARGS "${TEST_ARGS}") +separate_arguments(TEST_ARGS) + +if(EXISTS ${OUT_FILE}) + file(REMOVE ${OUT_FILE}) +endif() + +# Run the test binary. Capture the output to the temporary file. +if(${MODE} STREQUAL "stdout") + execute_process( + COMMAND ${TEST_FILE} ${TEST_ARGS} + OUTPUT_FILE ${OUT_FILE} + RESULT_VARIABLE TEST_RESULT + ) +elseif(${MODE} STREQUAL "stderr") + execute_process( + COMMAND ${TEST_FILE} ${TEST_ARGS} + ERROR_FILE ${OUT_FILE} + RESULT_VARIABLE TEST_RESULT + ) +elseif(${MODE} STREQUAL "file") + execute_process( + COMMAND ${TEST_FILE} + RESULT_VARIABLE TEST_RESULT + ) +endif() + +if(TEST_RESULT) + message(FATAL_ERROR "Failed: Test command '${TEST_FILE} ${TEST_ARGS}' returned non-zero (${TEST_RESULT}).") +endif() + +# Compare the output file contents with a match file contents +execute_process( + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/match.py ${OUT_FILE} ${MATCH_FILE} + RESULT_VARIABLE TEST_RESULT +) + +if(TEST_RESULT) + message(FATAL_ERROR "Failed (${TEST_RESULT}): The output of test command '${TEST_FILE} ${TEST_ARGS}' (stored in ${CMAKE_CURRENT_BINARY_DIR}/${OUT_FILE}) does not match '${MATCH_FILE}'") +else() + message("Passed: The output of test command '${TEST_FILE} ${TEST_ARGS}' (stored in ${CMAKE_CURRENT_BINARY_DIR}/${OUT_FILE}) matches '${MATCH_FILE}'") +endif() diff --git a/unified-runtime/cmake/match.py b/unified-runtime/cmake/match.py new file mode 100755 index 0000000000000..2448eaf78a729 --- /dev/null +++ b/unified-runtime/cmake/match.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 + +# 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 + +# Check if all input file content matches match file content. +# Lines in a match file can contain regex inside of double curly braces {{}}. +# Regex patterns are limited to single line. +# +# List of available special tags: +# {{OPT}} - makes content in the same line as the tag optional +# {{IGNORE}} - ignores all content until the next successfully matched line or the end of the input +# {{NONDETERMINISTIC}} - order of match rules isn't important - each (non OPT) input line is paired with a match line +# in any order +# Special tags are mutually exclusive and are expected to be located at the start of a line. +# + +import os +import sys +import re +from enum import Enum + + +## @brief print a sequence of lines +def print_lines(lines, hint=None): + counter = 1 + for l in lines: + hint_char = " " + if hint == counter - 1: + hint_char = ">" + print("{}{:4d}| {}".format(hint_char, counter, l.strip())) + counter += 1 + + +## @brief print the whole content of input and match files +def print_content( + input_lines, match_lines, ignored_lines, hint_input=None, hint_match=None +): + print("------ Input Lines " + "-" * 61) + print_lines(input_lines, hint_input) + print("------ Match Lines " + "-" * 61) + print_lines(match_lines, hint_match) + print("------ Ignored Lines " + "-" * 59) + print_lines(ignored_lines) + print("-" * 80) + + +## @brief print the incorrect match line +def print_incorrect_match(match_line, present, expected): + print("Line " + str(match_line) + " does not match") + print("is: " + present) + print("expected: " + expected) + + +## @brief print missing match line +def print_input_not_found(input_line, input): + print("Input line " + str(input_line) + " has no match line") + print("is: " + input) + + +## @brief print missing input line +def print_match_not_found(match_line, input): + print("Match line " + str(match_line) + " has no input line") + print("is: " + input) + + +## @brief print general syntax error +def print_error(text, match_line): + print("Line " + str(match_line) + " encountered an error") + print(text) + + +## @brief pattern matching script status values +class Status(Enum): + INPUT_END = 1 + MATCH_END = 2 + INPUT_AND_MATCH_END = 3 + PROCESSING = 4 + + +## @brief check matching script status +def check_status(input_lines, match_lines): + if not input_lines and not match_lines: + return Status.INPUT_AND_MATCH_END + elif not input_lines: + return Status.INPUT_END + elif not match_lines: + return Status.MATCH_END + return Status.PROCESSING + + +## @brief pattern matching tags. +## Tags are expected to be at the start of the line. +class Tag(Enum): + OPT = "{{OPT}}" # makes the line optional + IGNORE = "{{IGNORE}}" # ignores all input until next match or end of input file + NONDETERMINISTIC = "{{NONDETERMINISTIC}}" # switches on "deterministic mode" + COMMENT = "#" # comment - line ignored + + +## @brief main function for the match file processing script +def main(): + if len(sys.argv) != 3: + print("Usage: python match.py ") + sys.exit(1) + + input_file = sys.argv[1] + match_file = sys.argv[2] + + with open(input_file, "r") as input, open(match_file, "r") as match: + input_lines = input.readlines() + # Filter out empty lines and comments (lines beginning with the comment + # character, ignoring leading whitespace) + match_lines = list( + filter( + lambda line: line.strip() + and not line.lstrip().startswith(Tag.COMMENT.value), + match.readlines(), + ) + ) + + ignored_lines = [] + matched_lines = set() + + input_idx = 0 + match_idx = 0 + tags_in_effect = [] + deterministic_mode = False + while True: + # check file status + status = check_status(input_lines[input_idx:], match_lines[match_idx:]) + if deterministic_mode: + if status == Status.INPUT_END: + # Convert the list of seen matches to the list of unseen matches + remaining_matches = set(range(len(match_lines))) - matched_lines + for m in remaining_matches: + line = match_lines[m] + if line.startswith(Tag.OPT.value) or line.startswith( + Tag.NONDETERMINISTIC.value + ): + continue + print_match_not_found(m + 1, match_lines[m]) + print_content(input_lines, match_lines, ignored_lines, hint_match=m) + sys.exit(1) + + sys.exit(0) + elif status == Status.MATCH_END: + print_input_not_found(input_idx + 1, input_lines[input_idx]) + print_content( + input_lines, match_lines, ignored_lines, hint_input=input_idx + ) + sys.exit(1) + else: + if (status == Status.INPUT_AND_MATCH_END) or ( + status == Status.MATCH_END and Tag.IGNORE in tags_in_effect + ): + # all lines matched or the last line in match file is an ignore tag + sys.exit(0) + elif status == Status.MATCH_END: + print_incorrect_match(input_idx + 1, input_lines[input_idx].strip(), "") + print_content( + input_lines, match_lines, ignored_lines, hint_input=input_idx + ) + sys.exit(1) + elif status == Status.INPUT_END: + # If we get to the end of the input, but still have pending matches, + # then that's a failure unless all pending matches are optional - + # otherwise we're done + while match_idx < len(match_lines): + if not ( + match_lines[match_idx].startswith(Tag.OPT.value) + or match_lines[match_idx].startswith(Tag.IGNORE.value) + or match_lines[match_idx].startswith(Tag.NONDETERMINISTIC.value) + ): + print_incorrect_match(match_idx + 1, "", match_lines[match_idx]) + print_content( + input_lines, + match_lines, + ignored_lines, + hint_match=match_idx, + ) + sys.exit(1) + match_idx += 1 + sys.exit(0) + + input_line = ( + input_lines[input_idx].strip() if input_idx < len(input_lines) else "" + ) + match_line = match_lines[match_idx] + + # check for tags + if match_line.startswith(Tag.OPT.value): + tags_in_effect.append(Tag.OPT) + match_line = match_line[len(Tag.OPT.value) :] + elif ( + match_line.startswith(Tag.NONDETERMINISTIC.value) and not deterministic_mode + ): + deterministic_mode = True + match_idx = 0 + input_idx = 0 + continue + elif match_line.startswith(Tag.IGNORE.value): + if deterministic_mode: + print_error(r"Can't use \{{IGNORE\}} in deterministic mode") + sys.exit(2) + tags_in_effect.append(Tag.IGNORE) + match_idx += 1 + continue # line with ignore tag should be skipped + + # split into parts at {{ }} + match_parts = re.split(r"\{{(.*?)\}}", match_line.strip()) + pattern = "" + for j, part in enumerate(match_parts): + if j % 2 == 0: + pattern += re.escape(part) + else: + pattern += part + + # match or process tags + if deterministic_mode: + if re.fullmatch(pattern, input_line) and match_idx not in matched_lines: + input_idx += 1 + matched_lines.add(match_idx) + match_idx = 0 + tags_in_effect = [] + else: + match_idx += 1 + else: + if re.fullmatch(pattern, input_line): + input_idx += 1 + match_idx += 1 + tags_in_effect = [] + elif Tag.OPT in tags_in_effect: + match_idx += 1 + tags_in_effect.remove(Tag.OPT) + elif Tag.IGNORE in tags_in_effect: + ignored_lines.append(input_line + os.linesep) + input_idx += 1 + else: + print_incorrect_match(match_idx + 1, input_line, match_line.strip()) + print_content( + input_lines, + match_lines, + ignored_lines, + hint_match=match_idx, + hint_input=input_idx, + ) + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/unified-runtime/cmake/unified-runtime-config.cmake.in b/unified-runtime/cmake/unified-runtime-config.cmake.in new file mode 100644 index 0000000000000..035dc0fa0b54c --- /dev/null +++ b/unified-runtime/cmake/unified-runtime-config.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/unified-runtime/examples/CMakeLists.txt b/unified-runtime/examples/CMakeLists.txt new file mode 100644 index 0000000000000..aca7f396c24c9 --- /dev/null +++ b/unified-runtime/examples/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (C) 2022 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 + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + +add_subdirectory(hello_world) +if(UR_BUILD_EXAMPLE_CODEGEN) + add_subdirectory(codegen) +endif() +if(UR_ENABLE_TRACING) + add_subdirectory(collector) +endif() diff --git a/unified-runtime/examples/codegen/CMakeLists.txt b/unified-runtime/examples/codegen/CMakeLists.txt new file mode 100644 index 0000000000000..4896d3a721b83 --- /dev/null +++ b/unified-runtime/examples/codegen/CMakeLists.txt @@ -0,0 +1,47 @@ +# Copyright (C) 2022 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 + +set(TARGET_NAME codegen) + +find_package(LLVM CONFIG) +find_package(PkgConfig) + +set(TRANSLATOR_FOUND "FALSE") +if(${PkgConfig_FOUND}) + pkg_check_modules(LLVMSPIRVLib IMPORTED_TARGET LLVMSPIRVLib) +endif() + +if(LLVM_FOUND AND PkgConfig_FOUND AND LLVMSPIRVLib_FOUND) + message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") + message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") + llvm_map_components_to_libnames(llvm_libs support core irreader bitwriter) + + add_ur_executable(${TARGET_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/codegen.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/helpers.cpp + ) + + target_include_directories(${TARGET_NAME} PRIVATE ${LLVM_INCLUDE_DIRS}) + target_compile_definitions(${TARGET_NAME} PRIVATE ${LLVM_DEFINITIONS}) + target_link_libraries(${TARGET_NAME} + PRIVATE + ${CMAKE_DL_LIBS} + ${PROJECT_NAME}::headers + ${PROJECT_NAME}::loader + LLVM + PkgConfig::LLVMSPIRVLib + ) + # TODO: Depend on building adapters. + + if(MSVC) + set_target_properties(${TARGET_NAME} + PROPERTIES + VS_DEBUGGER_COMMAND_ARGUMENTS "" + VS_DEBUGGER_WORKING_DIRECTORY "$(OutDir)" + ) + endif() +else() + message(FATAL_ERROR "The environment did not satisfy dependency requirements (LLVM, PkgConfig, LLVMSPIRVLib) for codegen example (skipping target).") +endif() diff --git a/unified-runtime/examples/codegen/README.md b/unified-runtime/examples/codegen/README.md new file mode 100644 index 0000000000000..e28b9aa41f580 --- /dev/null +++ b/unified-runtime/examples/codegen/README.md @@ -0,0 +1,35 @@ +## End-to-end code generation example + +This example demonstrates an end-to-end pipeline of code generation and execution that typically occurs in a JIT engine. +It creates a simple function (adding +1 to an array and storing the result in a second one) via llvm API, +converts it to spirv, and submits it to the runtime. + +## Running the example + +The following commands are executed from the project root directory. + +### Using conda environment + +``` +$ conda env create -f third_party/deps.yml +$ conda activate examples +$ mkdir build && cd build +# configure with: +$ cmake .. -DUR_BUILD_ADAPTER_L0=ON -DUR_BUILD_EXAMPLE_CODEGEN=ON +$ make +$ ./bin/codegen +``` + +### Without using conda + +To run the example with llvm 13, you will need to make sure that `llvm-13` and `libllvmspirvlib-13-dev` are installed. + +**NOTE**: The example could be working with other llvm versions but it was tested with version 13. + +``` +$ mkdir build && cd build +# configure with: +$ cmake .. -DUR_BUILD_ADAPTER_L0=ON -DUR_BUILD_EXAMPLE_CODEGEN=ON -DLLVM_DIR=/usr/lib/llvm-13/cmake +$ make +$ ./bin/codegen +``` diff --git a/unified-runtime/examples/codegen/codegen.cpp b/unified-runtime/examples/codegen/codegen.cpp new file mode 100644 index 0000000000000..7d45789063682 --- /dev/null +++ b/unified-runtime/examples/codegen/codegen.cpp @@ -0,0 +1,178 @@ +/* + * + * 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 + * + * @file codegen.cpp + * + * @brief UR code generation and execution example for use with the Level Zero + * adapter. + * + * The codegen example demonstrates a complete flow for generating LLVM IR, + * translating it to SPIR-V, and submitting the kernel to Level Zero Runtime via + * UR API. + */ + +#include +#include + +#include "helpers.h" +#include "ur_api.h" + +constexpr unsigned PAGE_SIZE = 4096; + +void ur_check(const ur_result_t r) { + if (r != UR_RESULT_SUCCESS) { + urLoaderTearDown(); + throw std::runtime_error("Unified runtime error: " + std::to_string(r)); + } +} + +std::vector get_adapters() { + uint32_t adapterCount = 0; + ur_check(urAdapterGet(0, nullptr, &adapterCount)); + + if (!adapterCount) { + throw std::runtime_error("No adapters available."); + } + + std::vector adapters(adapterCount); + ur_check(urAdapterGet(adapterCount, adapters.data(), nullptr)); + return adapters; +} + +std::vector +get_supported_adapters(std::vector &adapters) { + std::vector supported_adapters; + for (auto adapter : adapters) { + ur_adapter_backend_t backend; + ur_check(urAdapterGetInfo(adapter, UR_ADAPTER_INFO_BACKEND, + sizeof(ur_adapter_backend_t), &backend, nullptr)); + + if (backend == UR_ADAPTER_BACKEND_LEVEL_ZERO) { + supported_adapters.push_back(adapter); + } + } + + return supported_adapters; +} + +std::vector +get_platforms(std::vector &adapters) { + uint32_t platformCount = 0; + ur_check(urPlatformGet(adapters.data(), adapters.size(), 1, nullptr, + &platformCount)); + + if (!platformCount) { + throw std::runtime_error("No platforms available."); + } + + std::vector platforms(platformCount); + ur_check(urPlatformGet(adapters.data(), adapters.size(), platformCount, + platforms.data(), nullptr)); + return platforms; +} + +std::vector get_gpus(ur_platform_handle_t p) { + uint32_t deviceCount = 0; + ur_check(urDeviceGet(p, UR_DEVICE_TYPE_GPU, 0, nullptr, &deviceCount)); + + if (!deviceCount) { + throw std::runtime_error("No GPUs available."); + } + + std::vector devices(deviceCount); + ur_check( + urDeviceGet(p, UR_DEVICE_TYPE_GPU, deviceCount, devices.data(), nullptr)); + return devices; +} + +template struct alignas(PAGE_SIZE) AlignedArray { + T data[N]; +}; + +int main() { + ur_loader_config_handle_t loader_config = nullptr; + ur_check(urLoaderInit(UR_DEVICE_INIT_FLAG_GPU, loader_config)); + + auto adapters = get_adapters(); + auto supported_adapters = get_supported_adapters(adapters); + auto platforms = get_platforms(supported_adapters); + auto gpus = get_gpus(platforms.front()); + auto spv = generate_plus_one_spv(); + + constexpr int a_size = 32; + AlignedArray a, b; + for (auto i = 0; i < a_size; ++i) { + a.data[i] = a_size - i; + b.data[i] = i; + } + + auto current_device = gpus.front(); + + ur_context_handle_t hContext; + ur_check(urContextCreate(1, ¤t_device, nullptr, &hContext)); + + ur_program_handle_t hProgram; + ur_check(urProgramCreateWithIL(hContext, spv.data(), spv.size(), nullptr, + &hProgram)); + ur_check(urProgramBuild(hContext, hProgram, nullptr)); + + ur_mem_handle_t dA, dB; + ur_check(urMemBufferCreate(hContext, UR_MEM_FLAG_READ_WRITE, + a_size * sizeof(int), nullptr, &dA)); + ur_check(urMemBufferCreate(hContext, UR_MEM_FLAG_READ_WRITE, + a_size * sizeof(int), nullptr, &dB)); + + ur_kernel_handle_t hKernel; + ur_check(urKernelCreate(hProgram, "plus1", &hKernel)); + ur_check(urKernelSetArgMemObj(hKernel, 0, nullptr, dA)); + ur_check(urKernelSetArgMemObj(hKernel, 1, nullptr, dB)); + + ur_queue_handle_t queue; + ur_check(urQueueCreate(hContext, current_device, nullptr, &queue)); + + ur_check(urEnqueueMemBufferWrite(queue, dA, true, 0, a_size * sizeof(int), + a.data, 0, nullptr, nullptr)); + ur_check(urEnqueueMemBufferWrite(queue, dB, true, 0, a_size * sizeof(int), + b.data, 0, nullptr, nullptr)); + + const size_t gWorkOffset[] = {0, 0, 0}; + const size_t gWorkSize[] = {128, 1, 1}; + const size_t lWorkSize[] = {1, 1, 1}; + ur_event_handle_t event; + ur_check(urEnqueueKernelLaunch(queue, hKernel, 3, gWorkOffset, gWorkSize, + lWorkSize, 0, nullptr, &event)); + + ur_check(urEnqueueMemBufferRead(queue, dB, true, 0, a_size * sizeof(int), + b.data, 1, &event, nullptr)); + + ur_check(urQueueFinish(queue)); + + std::cout << "Input Array: "; + for (int i = 0; i < a_size; ++i) { + std::cout << a.data[i] << " "; + } + std::cout << std::endl; + + bool expectedResult = false; + + std::cout << "Output Array: "; + for (int i = 0; i < a_size; ++i) { + std::cout << b.data[i] << " "; + expectedResult |= (b.data[i] == a.data[i] + 1); + } + std::cout << std::endl; + + if (expectedResult) { + std::cout << "Results are correct." << std::endl; + } else { + std::cout << "Results are incorrect." << std::endl; + } + + return urLoaderTearDown() == UR_RESULT_SUCCESS && expectedResult ? 0 : 1; +} diff --git a/unified-runtime/examples/codegen/helpers.cpp b/unified-runtime/examples/codegen/helpers.cpp new file mode 100644 index 0000000000000..024d648625fa2 --- /dev/null +++ b/unified-runtime/examples/codegen/helpers.cpp @@ -0,0 +1,103 @@ +/* + * + * 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 + */ + +#include "helpers.h" + +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/Module.h" +#include "llvm/Support/raw_ostream.h" +#include + +#include + +#include + +std::string generate_plus_one_spv() { + using namespace llvm; + LLVMContext ctx; + std::unique_ptr module = + std::make_unique("code_generated", ctx); + module->setTargetTriple("spir64-unknown-unknown"); + IRBuilder<> builder(ctx); + + std::vector args{Type::getInt32PtrTy(ctx, 1), + Type::getInt32PtrTy(ctx, 1)}; + FunctionType *f_type = FunctionType::get(Type::getVoidTy(ctx), args, false); + Function *f = + Function::Create(f_type, GlobalValue::LinkageTypes::ExternalLinkage, + "plus1", module.get()); + f->setCallingConv(CallingConv::SPIR_KERNEL); + + // get_global_id + FunctionType *ggi_type = + FunctionType::get(Type::getInt32Ty(ctx), {Type::getInt32Ty(ctx)}, false); + Function *get_global_idj = + Function::Create(ggi_type, GlobalValue::LinkageTypes::ExternalLinkage, + "_Z13get_global_idj", module.get()); + get_global_idj->setCallingConv(CallingConv::SPIR_FUNC); + + BasicBlock *entry = BasicBlock::Create(ctx, "entry", f); + + builder.SetInsertPoint(entry); + Constant *zero = ConstantInt::get(Type::getInt32Ty(ctx), 0); + Constant *onei = ConstantInt::get(Type::getInt32Ty(ctx), 1); + Value *idx = builder.CreateCall(get_global_idj, zero, "idx"); + auto argit = f->args().begin(); +#if LLVM_VERSION_MAJOR > 15 + Value *firstElemSrc = + builder.CreateGEP(argit->getType(), argit, idx, "src.idx"); + ++argit; + Value *firstElemDst = + builder.CreateGEP(argit->getType(), argit, idx, "dst.idx"); +#elif LLVM_VERSION_MAJOR > 12 + Value *firstElemSrc = builder.CreateGEP( + argit->getType()->getPointerElementType(), argit, idx, "src.idx"); + ++argit; + Value *firstElemDst = builder.CreateGEP( + argit->getType()->getPointerElementType(), argit, idx, "dst.idx"); +#else + Value *firstElemSrc = builder.CreateGEP(f->args().begin(), idx, "src.idx"); + Value *firstElemDst = builder.CreateGEP(++argit, idx, "dst.idx"); +#endif + Value *ldSrc = builder.CreateLoad(Type::getInt32Ty(ctx), firstElemSrc, "ld"); + Value *result = builder.CreateAdd(ldSrc, onei, "foo"); + builder.CreateStore(result, firstElemDst); + builder.CreateRetVoid(); + + // set metadata -- pretend we're opencl (see + // https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/master/docs/SPIRVRepresentationInLLVM.rst#spir-v-instructions-mapped-to-llvm-metadata) + Metadata *spirv_src_ops[] = { + ConstantAsMetadata::get( + ConstantInt::get(Type::getInt32Ty(ctx), 3 /*OpenCL_C*/)), + ConstantAsMetadata::get( + ConstantInt::get(Type::getInt32Ty(ctx), 102000 /*OpenCL ver 1.2*/))}; + NamedMDNode *spirv_src = module->getOrInsertNamedMetadata("spirv.Source"); + spirv_src->addOperand(MDNode::get(ctx, spirv_src_ops)); + + module->print(errs(), nullptr); + + SPIRV::TranslatorOpts opts; + opts.enableAllExtensions(); + opts.setDesiredBIsRepresentation(SPIRV::BIsRepresentation::OpenCL12); + opts.setDebugInfoEIS(SPIRV::DebugInfoEIS::OpenCL_DebugInfo_100); + + std::ostringstream ss; + std::string err; + auto success = writeSpirv(module.get(), opts, ss, err); + if (!success) { + errs() << "Spirv translation failed with error: " << err << "\n"; + } else { + errs() << "Spirv tranlsation success.\n"; + } + errs() << "Code size: " << ss.str().size() << "\n"; + + return ss.str(); +} diff --git a/unified-runtime/examples/codegen/helpers.h b/unified-runtime/examples/codegen/helpers.h new file mode 100644 index 0000000000000..79e13957e7917 --- /dev/null +++ b/unified-runtime/examples/codegen/helpers.h @@ -0,0 +1,15 @@ +/* + * + * 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 + */ + +#pragma once + +#include + +std::string generate_plus_one_spv(); diff --git a/unified-runtime/examples/collector/CMakeLists.txt b/unified-runtime/examples/collector/CMakeLists.txt new file mode 100644 index 0000000000000..061feed855225 --- /dev/null +++ b/unified-runtime/examples/collector/CMakeLists.txt @@ -0,0 +1,22 @@ +# 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 + +set(TARGET_NAME collector) + +add_ur_library(${TARGET_NAME} SHARED + ${CMAKE_CURRENT_SOURCE_DIR}/collector.cpp +) + +target_include_directories(${TARGET_NAME} PRIVATE + ${PROJECT_SOURCE_DIR}/include +) + +target_link_libraries(${TARGET_NAME} PRIVATE ${TARGET_XPTI}) +target_include_directories(${TARGET_NAME} PRIVATE ${xpti_SOURCE_DIR}/include) + +if(MSVC) + target_compile_definitions(${TARGET_NAME} PRIVATE XPTI_STATIC_LIBRARY) +endif() +target_compile_definitions(${TARGET_NAME} PRIVATE XPTI_CALLBACK_API_EXPORTS) diff --git a/unified-runtime/examples/collector/README.md b/unified-runtime/examples/collector/README.md new file mode 100644 index 0000000000000..de7755fa16577 --- /dev/null +++ b/unified-runtime/examples/collector/README.md @@ -0,0 +1,25 @@ +# Unified Runtime XPTI collector example + +This example demonstrates how to use the tracing layer integrated into +Unified Runtime. It leverages XPTI to intercept all UR calls in the traced +application and prints information about each function to standard output. + +## Running the example + +To run the example, you will need to build Unified Runtime with +tracing enabled (`-DUR_ENABLE_TRACING=ON`), link it with your application, +and then set appropriate environment variables for the collector (`XPTI_SUBSCRIBERS`) and the +XPTI dispatcher (`XPTI_FRAMEWORK_DISPATCHER`) to be loaded and enabled (`XPTI_TRACE_ENABLE`). +You will also need to setup your chosen adapter (`UR_ADAPTERS_FORCE_LOAD`). + +For example, to run the `hello_world` example with the collector, use: + +``` +$ mkdir build +$ cd build +$ cmake .. -DUR_ENABLE_TRACING=ON +$ make +$ UR_ADAPTERS_FORCE_LOAD=./lib/libur_adapter_mock.so UR_ENABLE_LAYERS=UR_LAYER_TRACING XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=./lib/libxptifw.so XPTI_SUBSCRIBERS=./lib/libcollector.so ./bin/hello_world +``` + +See [XPTI framework documentation](https://github.com/intel/llvm/blob/sycl/xptifw/doc/XPTI_Framework.md) for more information. diff --git a/unified-runtime/examples/collector/collector.cpp b/unified-runtime/examples/collector/collector.cpp new file mode 100644 index 0000000000000..6ff54ee2e2a14 --- /dev/null +++ b/unified-runtime/examples/collector/collector.cpp @@ -0,0 +1,158 @@ +/* + * + * 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 + * + * @file collector.cpp + * + * @brief UR collector library example for use with the XPTI framework. + * + * The collector example demonstrates the use of loader's tracing functionality + * that's integrated with the XPTI framework. + * This example can be loaded into any UR-based software and will trace all + * UR calls and print information about each to standard output. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "ur_api.h" +#include "xpti/xpti_trace_framework.h" + +constexpr uint16_t TRACE_FN_BEGIN = + static_cast(xpti::trace_point_type_t::function_with_args_begin); +constexpr uint16_t TRACE_FN_END = + static_cast(xpti::trace_point_type_t::function_with_args_end); +constexpr std::string_view UR_STREAM_NAME = "ur.call"; + +/** + * @brief Formats the function parameters and arguments for urAdapterGet + */ +std::ostream &operator<<(std::ostream &os, + const struct ur_adapter_get_params_t *params) { + os << ".NumEntries = "; + os << *params->pNumEntries; + os << ", "; + os << ".phAdapters = "; + os << *params->pphAdapters; + if (*params->pphAdapters) { + os << " (" << **params->pphAdapters << ")"; + } + os << ", "; + os << ".pNumAdapters = "; + os << *params->ppNumAdapters; + if (*params->ppNumAdapters) { + os << " (" << **params->ppNumAdapters << ")"; + } + os << ""; + return os; +} + +/** + * A map of functions that format the parameters and arguments for each UR + * function. This example only implements a handler for one function, + * `urAdapterGet`, but it's trivial to expand it to support more. + */ +static std::unordered_map< + std::string_view, + std::function> + handlers = {{"urAdapterGet", [](const xpti::function_with_args_t *fn_args, + std::ostream &os) { + auto params = + static_cast( + fn_args->args_data); + os << params; + }}}; + +/** + * @brief Tracing callback invoked by the dispatcher on every event. + * + * This function handles the incoming events and prints simple information about + * them. Specifically, its called twice for every UR function call: + * once before (`function_with_args_begin`) and once after + * (`function_with_args_end`) the actual UR adapter is invoked. + * On begin, it prints the function declaration with the call arguments + * specified, and on end it prints the function name with the result of the + * call. + */ +XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, + xpti::trace_event_data_t *, uint64_t instance, + const void *user_data) { + auto *args = static_cast(user_data); + std::ostringstream out; + if (trace_type == TRACE_FN_BEGIN) { + out << "function_with_args_begin(" << instance << ") - " + << args->function_name << "("; + auto it = handlers.find(args->function_name); + if (it == handlers.end()) { + out << "unimplemented"; + } else { + it->second(args, out); + } + out << ");"; + } else if (trace_type == TRACE_FN_END) { + auto result = static_cast(args->ret_data); + out << "function_with_args_end(" << instance << ") - " + << args->function_name << "(...) -> ur_result_t(" << *result << ");"; + } else { + out << "unsupported trace type"; + } + out << std::endl; + + std::cout << out.str(); +} + +/** + * @brief Subscriber initialization function called by the XPTI dispatcher. + * + * This function is called for every available event stream in the traced + * software, and enables the subscribers to register for receiving event + * notifications for selected trace types. + */ +XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, + unsigned int minor_version, const char *, + const char *stream_name) { + if (stream_name == nullptr) { + std::cout << "Stream name not provided. Aborting." << std::endl; + return; + } + if (std::string_view(stream_name) != UR_STREAM_NAME) { + // we expect ur.call, but this can also be xpti.framework. + return; + } + + if (UR_MAKE_VERSION(major_version, minor_version) != UR_API_VERSION_CURRENT) { + std::cout << "Invalid stream version: " << major_version << "." + << minor_version << ". Expected " + << UR_MAJOR_VERSION(UR_API_VERSION_CURRENT) << "." + << UR_MINOR_VERSION(UR_API_VERSION_CURRENT) << ". Aborting." + << std::endl; + return; + } + + uint8_t stream_id = xptiRegisterStream(stream_name); + + /** + * UR only issues two types of events, `function_with_args_begin` and + * `function_with_args_end`. In this example, we handle both with the same + * callback function. + */ + xptiRegisterCallback(stream_id, TRACE_FN_BEGIN, trace_cb); + xptiRegisterCallback(stream_id, TRACE_FN_END, trace_cb); +} + +/** + * @brief Subscriber finish function called by the XPTI dispatcher. + * + * Can be used to cleanup state or resources. + */ +XPTI_CALLBACK_API void xptiTraceFinish(const char *) { /* noop */ } diff --git a/unified-runtime/examples/hello_world/CMakeLists.txt b/unified-runtime/examples/hello_world/CMakeLists.txt new file mode 100644 index 0000000000000..8fd9bda19d36f --- /dev/null +++ b/unified-runtime/examples/hello_world/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2022 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 + +set(TARGET_NAME hello_world) + +add_ur_executable(${TARGET_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/hello_world.cpp +) + +if(MSVC) + set_target_properties(${TARGET_NAME} + PROPERTIES + VS_DEBUGGER_COMMAND_ARGUMENTS "" + VS_DEBUGGER_WORKING_DIRECTORY "$(OutDir)" + ) +endif() + +target_link_libraries(${TARGET_NAME} PRIVATE + ${PROJECT_NAME}::loader + ${CMAKE_DL_LIBS} + ${PROJECT_NAME}::headers +) diff --git a/unified-runtime/examples/hello_world/hello_world.cpp b/unified-runtime/examples/hello_world/hello_world.cpp new file mode 100644 index 0000000000000..1653c0482ae55 --- /dev/null +++ b/unified-runtime/examples/hello_world/hello_world.cpp @@ -0,0 +1,124 @@ +/* + * + * Copyright (C) 2020-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 + * + */ +#include +#include +#include +#include + +#include "ur_api.h" + +////////////////////////////////////////////////////////////////////////// +int main(int, char *[]) { + ur_result_t status; + + // Initialize the platform + status = urLoaderInit(0, nullptr); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urLoaderInit failed with return code: " << status + << std::endl; + return 1; + } + std::cout << "Platform initialized.\n"; + + uint32_t adapterCount = 0; + std::vector adapters; + uint32_t platformCount = 0; + std::vector platforms; + + status = urAdapterGet(0, nullptr, &adapterCount); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urAdapterGet failed with return code: " << status + << std::endl; + return 1; + } + adapters.resize(adapterCount); + status = urAdapterGet(adapterCount, adapters.data(), nullptr); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urAdapterGet failed with return code: " << status + << std::endl; + return 1; + } + + status = + urPlatformGet(adapters.data(), adapterCount, 1, nullptr, &platformCount); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urPlatformGet failed with return code: " << status + << std::endl; + goto out; + } + + platforms.resize(platformCount); + status = urPlatformGet(adapters.data(), adapterCount, platformCount, + platforms.data(), nullptr); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urPlatformGet failed with return code: " << status + << std::endl; + goto out; + } + + for (auto p : platforms) { + ur_api_version_t api_version = {}; + status = urPlatformGetApiVersion(p, &api_version); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urPlatformGetApiVersion failed with return code: " << status + << std::endl; + goto out; + } + std::cout << "API version: " << UR_MAJOR_VERSION(api_version) << "." + << UR_MINOR_VERSION(api_version) << std::endl; + + uint32_t deviceCount = 0; + status = urDeviceGet(p, UR_DEVICE_TYPE_GPU, 0, nullptr, &deviceCount); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urDeviceGet failed with return code: " << status + << std::endl; + goto out; + } + + std::vector devices(deviceCount); + status = urDeviceGet(p, UR_DEVICE_TYPE_GPU, deviceCount, devices.data(), + nullptr); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urDeviceGet failed with return code: " << status + << std::endl; + goto out; + } + for (auto d : devices) { + ur_device_type_t device_type = UR_DEVICE_TYPE_ALL; + status = urDeviceGetInfo(d, UR_DEVICE_INFO_TYPE, sizeof(ur_device_type_t), + static_cast(&device_type), nullptr); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urDeviceGetInfo failed with return code: " << status + << std::endl; + goto out; + } + static const size_t DEVICE_NAME_MAX_LEN = 1024; + char device_name[DEVICE_NAME_MAX_LEN] = {0}; + status = urDeviceGetInfo(d, UR_DEVICE_INFO_NAME, DEVICE_NAME_MAX_LEN - 1, + static_cast(&device_name), nullptr); + if (status != UR_RESULT_SUCCESS) { + std::cout << "urDeviceGetInfo failed with return code: " << status + << std::endl; + goto out; + } + if (device_type == UR_DEVICE_TYPE_GPU) { + std::cout << "Found a " << device_name << " gpu.\n"; + } + } + } + +out: + for (auto adapter : adapters) { + urAdapterRelease(adapter); + } + urLoaderTearDown(); + return status == UR_RESULT_SUCCESS ? 0 : 1; +} diff --git a/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h new file mode 100644 index 0000000000000..d7621bda3262a --- /dev/null +++ b/unified-runtime/include/ur_api.h @@ -0,0 +1,14474 @@ +/* + * + * Copyright (C) 2022 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 + * + * @file ur_api.h + * @version v0.12-r0 + * + */ +#ifndef UR_API_H_INCLUDED +#define UR_API_H_INCLUDED +#if defined(__cplusplus) +#pragma once +#endif + +// standard headers +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +// Intel 'oneAPI' Unified Runtime function registry +#if !defined(__GNUC__) +#pragma region registry +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Defines unique stable identifiers for all functions +typedef enum ur_function_t { + /// Enumerator for ::urContextCreate + UR_FUNCTION_CONTEXT_CREATE = 1, + /// Enumerator for ::urContextRetain + UR_FUNCTION_CONTEXT_RETAIN = 2, + /// Enumerator for ::urContextRelease + UR_FUNCTION_CONTEXT_RELEASE = 3, + /// Enumerator for ::urContextGetInfo + UR_FUNCTION_CONTEXT_GET_INFO = 4, + /// Enumerator for ::urContextGetNativeHandle + UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE = 5, + /// Enumerator for ::urContextCreateWithNativeHandle + UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE = 6, + /// Enumerator for ::urContextSetExtendedDeleter + UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER = 7, + /// Enumerator for ::urDeviceGet + UR_FUNCTION_DEVICE_GET = 8, + /// Enumerator for ::urDeviceGetInfo + UR_FUNCTION_DEVICE_GET_INFO = 9, + /// Enumerator for ::urDeviceRetain + UR_FUNCTION_DEVICE_RETAIN = 10, + /// Enumerator for ::urDeviceRelease + UR_FUNCTION_DEVICE_RELEASE = 11, + /// Enumerator for ::urDevicePartition + UR_FUNCTION_DEVICE_PARTITION = 12, + /// Enumerator for ::urDeviceSelectBinary + UR_FUNCTION_DEVICE_SELECT_BINARY = 13, + /// Enumerator for ::urDeviceGetNativeHandle + UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE = 14, + /// Enumerator for ::urDeviceCreateWithNativeHandle + UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE = 15, + /// Enumerator for ::urDeviceGetGlobalTimestamps + UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS = 16, + /// Enumerator for ::urEnqueueKernelLaunch + UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH = 17, + /// Enumerator for ::urEnqueueEventsWait + UR_FUNCTION_ENQUEUE_EVENTS_WAIT = 18, + /// Enumerator for ::urEnqueueEventsWaitWithBarrier + UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER = 19, + /// Enumerator for ::urEnqueueMemBufferRead + UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ = 20, + /// Enumerator for ::urEnqueueMemBufferWrite + UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE = 21, + /// Enumerator for ::urEnqueueMemBufferReadRect + UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT = 22, + /// Enumerator for ::urEnqueueMemBufferWriteRect + UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT = 23, + /// Enumerator for ::urEnqueueMemBufferCopy + UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY = 24, + /// Enumerator for ::urEnqueueMemBufferCopyRect + UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT = 25, + /// Enumerator for ::urEnqueueMemBufferFill + UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL = 26, + /// Enumerator for ::urEnqueueMemImageRead + UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ = 27, + /// Enumerator for ::urEnqueueMemImageWrite + UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE = 28, + /// Enumerator for ::urEnqueueMemImageCopy + UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY = 29, + /// Enumerator for ::urEnqueueMemBufferMap + UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP = 30, + /// Enumerator for ::urEnqueueMemUnmap + UR_FUNCTION_ENQUEUE_MEM_UNMAP = 31, + /// Enumerator for ::urEnqueueUSMFill + UR_FUNCTION_ENQUEUE_USM_FILL = 32, + /// Enumerator for ::urEnqueueUSMMemcpy + UR_FUNCTION_ENQUEUE_USM_MEMCPY = 33, + /// Enumerator for ::urEnqueueUSMPrefetch + UR_FUNCTION_ENQUEUE_USM_PREFETCH = 34, + /// Enumerator for ::urEnqueueUSMAdvise + UR_FUNCTION_ENQUEUE_USM_ADVISE = 35, + /// Enumerator for ::urEnqueueDeviceGlobalVariableWrite + UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE = 38, + /// Enumerator for ::urEnqueueDeviceGlobalVariableRead + UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ = 39, + /// Enumerator for ::urEventGetInfo + UR_FUNCTION_EVENT_GET_INFO = 40, + /// Enumerator for ::urEventGetProfilingInfo + UR_FUNCTION_EVENT_GET_PROFILING_INFO = 41, + /// Enumerator for ::urEventWait + UR_FUNCTION_EVENT_WAIT = 42, + /// Enumerator for ::urEventRetain + UR_FUNCTION_EVENT_RETAIN = 43, + /// Enumerator for ::urEventRelease + UR_FUNCTION_EVENT_RELEASE = 44, + /// Enumerator for ::urEventGetNativeHandle + UR_FUNCTION_EVENT_GET_NATIVE_HANDLE = 45, + /// Enumerator for ::urEventCreateWithNativeHandle + UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE = 46, + /// Enumerator for ::urEventSetCallback + UR_FUNCTION_EVENT_SET_CALLBACK = 47, + /// Enumerator for ::urKernelCreate + UR_FUNCTION_KERNEL_CREATE = 48, + /// Enumerator for ::urKernelSetArgValue + UR_FUNCTION_KERNEL_SET_ARG_VALUE = 49, + /// Enumerator for ::urKernelSetArgLocal + UR_FUNCTION_KERNEL_SET_ARG_LOCAL = 50, + /// Enumerator for ::urKernelGetInfo + UR_FUNCTION_KERNEL_GET_INFO = 51, + /// Enumerator for ::urKernelGetGroupInfo + UR_FUNCTION_KERNEL_GET_GROUP_INFO = 52, + /// Enumerator for ::urKernelGetSubGroupInfo + UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO = 53, + /// Enumerator for ::urKernelRetain + UR_FUNCTION_KERNEL_RETAIN = 54, + /// Enumerator for ::urKernelRelease + UR_FUNCTION_KERNEL_RELEASE = 55, + /// Enumerator for ::urKernelSetArgPointer + UR_FUNCTION_KERNEL_SET_ARG_POINTER = 56, + /// Enumerator for ::urKernelSetExecInfo + UR_FUNCTION_KERNEL_SET_EXEC_INFO = 57, + /// Enumerator for ::urKernelSetArgSampler + UR_FUNCTION_KERNEL_SET_ARG_SAMPLER = 58, + /// Enumerator for ::urKernelSetArgMemObj + UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ = 59, + /// Enumerator for ::urKernelSetSpecializationConstants + UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS = 60, + /// Enumerator for ::urKernelGetNativeHandle + UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE = 61, + /// Enumerator for ::urKernelCreateWithNativeHandle + UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE = 62, + /// Enumerator for ::urMemImageCreate + UR_FUNCTION_MEM_IMAGE_CREATE = 63, + /// Enumerator for ::urMemBufferCreate + UR_FUNCTION_MEM_BUFFER_CREATE = 64, + /// Enumerator for ::urMemRetain + UR_FUNCTION_MEM_RETAIN = 65, + /// Enumerator for ::urMemRelease + UR_FUNCTION_MEM_RELEASE = 66, + /// Enumerator for ::urMemBufferPartition + UR_FUNCTION_MEM_BUFFER_PARTITION = 67, + /// Enumerator for ::urMemGetNativeHandle + UR_FUNCTION_MEM_GET_NATIVE_HANDLE = 68, + /// Enumerator for ::urEnqueueReadHostPipe + UR_FUNCTION_ENQUEUE_READ_HOST_PIPE = 69, + /// Enumerator for ::urMemGetInfo + UR_FUNCTION_MEM_GET_INFO = 70, + /// Enumerator for ::urMemImageGetInfo + UR_FUNCTION_MEM_IMAGE_GET_INFO = 71, + /// Enumerator for ::urPlatformGet + UR_FUNCTION_PLATFORM_GET = 72, + /// Enumerator for ::urPlatformGetInfo + UR_FUNCTION_PLATFORM_GET_INFO = 73, + /// Enumerator for ::urPlatformGetApiVersion + UR_FUNCTION_PLATFORM_GET_API_VERSION = 74, + /// Enumerator for ::urPlatformGetNativeHandle + UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE = 75, + /// Enumerator for ::urPlatformCreateWithNativeHandle + UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE = 76, + /// Enumerator for ::urProgramCreateWithIL + UR_FUNCTION_PROGRAM_CREATE_WITH_IL = 78, + /// Enumerator for ::urProgramCreateWithBinary + UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY = 79, + /// Enumerator for ::urProgramBuild + UR_FUNCTION_PROGRAM_BUILD = 80, + /// Enumerator for ::urProgramCompile + UR_FUNCTION_PROGRAM_COMPILE = 81, + /// Enumerator for ::urProgramLink + UR_FUNCTION_PROGRAM_LINK = 82, + /// Enumerator for ::urProgramRetain + UR_FUNCTION_PROGRAM_RETAIN = 83, + /// Enumerator for ::urProgramRelease + UR_FUNCTION_PROGRAM_RELEASE = 84, + /// Enumerator for ::urProgramGetFunctionPointer + UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER = 85, + /// Enumerator for ::urProgramGetInfo + UR_FUNCTION_PROGRAM_GET_INFO = 86, + /// Enumerator for ::urProgramGetBuildInfo + UR_FUNCTION_PROGRAM_GET_BUILD_INFO = 87, + /// Enumerator for ::urProgramSetSpecializationConstants + UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS = 88, + /// Enumerator for ::urProgramGetNativeHandle + UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE = 89, + /// Enumerator for ::urProgramCreateWithNativeHandle + UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE = 90, + /// Enumerator for ::urQueueGetInfo + UR_FUNCTION_QUEUE_GET_INFO = 91, + /// Enumerator for ::urQueueCreate + UR_FUNCTION_QUEUE_CREATE = 92, + /// Enumerator for ::urQueueRetain + UR_FUNCTION_QUEUE_RETAIN = 93, + /// Enumerator for ::urQueueRelease + UR_FUNCTION_QUEUE_RELEASE = 94, + /// Enumerator for ::urQueueGetNativeHandle + UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE = 95, + /// Enumerator for ::urQueueCreateWithNativeHandle + UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE = 96, + /// Enumerator for ::urQueueFinish + UR_FUNCTION_QUEUE_FINISH = 97, + /// Enumerator for ::urQueueFlush + UR_FUNCTION_QUEUE_FLUSH = 98, + /// Enumerator for ::urSamplerCreate + UR_FUNCTION_SAMPLER_CREATE = 101, + /// Enumerator for ::urSamplerRetain + UR_FUNCTION_SAMPLER_RETAIN = 102, + /// Enumerator for ::urSamplerRelease + UR_FUNCTION_SAMPLER_RELEASE = 103, + /// Enumerator for ::urSamplerGetInfo + UR_FUNCTION_SAMPLER_GET_INFO = 104, + /// Enumerator for ::urSamplerGetNativeHandle + UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE = 105, + /// Enumerator for ::urSamplerCreateWithNativeHandle + UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE = 106, + /// Enumerator for ::urUSMHostAlloc + UR_FUNCTION_USM_HOST_ALLOC = 107, + /// Enumerator for ::urUSMDeviceAlloc + UR_FUNCTION_USM_DEVICE_ALLOC = 108, + /// Enumerator for ::urUSMSharedAlloc + UR_FUNCTION_USM_SHARED_ALLOC = 109, + /// Enumerator for ::urUSMFree + UR_FUNCTION_USM_FREE = 110, + /// Enumerator for ::urUSMGetMemAllocInfo + UR_FUNCTION_USM_GET_MEM_ALLOC_INFO = 111, + /// Enumerator for ::urUSMPoolCreate + UR_FUNCTION_USM_POOL_CREATE = 112, + /// Enumerator for ::urCommandBufferCreateExp + UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP = 113, + /// Enumerator for ::urPlatformGetBackendOption + UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION = 114, + /// Enumerator for ::urMemBufferCreateWithNativeHandle + UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE = 115, + /// Enumerator for ::urMemImageCreateWithNativeHandle + UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE = 116, + /// Enumerator for ::urEnqueueWriteHostPipe + UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE = 117, + /// Enumerator for ::urUSMPoolRetain + UR_FUNCTION_USM_POOL_RETAIN = 118, + /// Enumerator for ::urUSMPoolRelease + UR_FUNCTION_USM_POOL_RELEASE = 119, + /// Enumerator for ::urUSMPoolGetInfo + UR_FUNCTION_USM_POOL_GET_INFO = 120, + /// Enumerator for ::urCommandBufferRetainExp + UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP = 121, + /// Enumerator for ::urCommandBufferReleaseExp + UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP = 122, + /// Enumerator for ::urCommandBufferFinalizeExp + UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP = 123, + /// Enumerator for ::urCommandBufferAppendKernelLaunchExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP = 125, + /// Enumerator for ::urUSMPitchedAllocExp + UR_FUNCTION_USM_PITCHED_ALLOC_EXP = 132, + /// Enumerator for ::urBindlessImagesUnsampledImageHandleDestroyExp + UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP = 133, + /// Enumerator for ::urBindlessImagesSampledImageHandleDestroyExp + UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP = 134, + /// Enumerator for ::urBindlessImagesImageAllocateExp + UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP = 135, + /// Enumerator for ::urBindlessImagesImageFreeExp + UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP = 136, + /// Enumerator for ::urBindlessImagesUnsampledImageCreateExp + UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP = 137, + /// Enumerator for ::urBindlessImagesSampledImageCreateExp + UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP = 138, + /// Enumerator for ::urBindlessImagesImageCopyExp + UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP = 139, + /// Enumerator for ::urBindlessImagesImageGetInfoExp + UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP = 140, + /// Enumerator for ::urBindlessImagesMipmapGetLevelExp + UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP = 141, + /// Enumerator for ::urBindlessImagesMipmapFreeExp + UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP = 142, + /// Enumerator for ::urBindlessImagesMapExternalArrayExp + UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP = 144, + /// Enumerator for ::urBindlessImagesReleaseExternalSemaphoreExp + UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP = 147, + /// Enumerator for ::urBindlessImagesWaitExternalSemaphoreExp + UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP = 148, + /// Enumerator for ::urBindlessImagesSignalExternalSemaphoreExp + UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP = 149, + /// Enumerator for ::urEnqueueUSMFill2D + UR_FUNCTION_ENQUEUE_USM_FILL_2D = 151, + /// Enumerator for ::urEnqueueUSMMemcpy2D + UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D = 152, + /// Enumerator for ::urVirtualMemGranularityGetInfo + UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO = 153, + /// Enumerator for ::urVirtualMemReserve + UR_FUNCTION_VIRTUAL_MEM_RESERVE = 154, + /// Enumerator for ::urVirtualMemFree + UR_FUNCTION_VIRTUAL_MEM_FREE = 155, + /// Enumerator for ::urVirtualMemMap + UR_FUNCTION_VIRTUAL_MEM_MAP = 156, + /// Enumerator for ::urVirtualMemUnmap + UR_FUNCTION_VIRTUAL_MEM_UNMAP = 157, + /// Enumerator for ::urVirtualMemSetAccess + UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS = 158, + /// Enumerator for ::urVirtualMemGetInfo + UR_FUNCTION_VIRTUAL_MEM_GET_INFO = 159, + /// Enumerator for ::urPhysicalMemCreate + UR_FUNCTION_PHYSICAL_MEM_CREATE = 160, + /// Enumerator for ::urPhysicalMemRetain + UR_FUNCTION_PHYSICAL_MEM_RETAIN = 161, + /// Enumerator for ::urPhysicalMemRelease + UR_FUNCTION_PHYSICAL_MEM_RELEASE = 162, + /// Enumerator for ::urUSMImportExp + UR_FUNCTION_USM_IMPORT_EXP = 163, + /// Enumerator for ::urUSMReleaseExp + UR_FUNCTION_USM_RELEASE_EXP = 164, + /// Enumerator for ::urUsmP2PEnablePeerAccessExp + UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP = 165, + /// Enumerator for ::urUsmP2PDisablePeerAccessExp + UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP = 166, + /// Enumerator for ::urUsmP2PPeerAccessGetInfoExp + UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP = 167, + /// Enumerator for ::urLoaderConfigCreate + UR_FUNCTION_LOADER_CONFIG_CREATE = 172, + /// Enumerator for ::urLoaderConfigRelease + UR_FUNCTION_LOADER_CONFIG_RELEASE = 173, + /// Enumerator for ::urLoaderConfigRetain + UR_FUNCTION_LOADER_CONFIG_RETAIN = 174, + /// Enumerator for ::urLoaderConfigGetInfo + UR_FUNCTION_LOADER_CONFIG_GET_INFO = 175, + /// Enumerator for ::urLoaderConfigEnableLayer + UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER = 176, + /// Enumerator for ::urAdapterRelease + UR_FUNCTION_ADAPTER_RELEASE = 177, + /// Enumerator for ::urAdapterGet + UR_FUNCTION_ADAPTER_GET = 178, + /// Enumerator for ::urAdapterRetain + UR_FUNCTION_ADAPTER_RETAIN = 179, + /// Enumerator for ::urAdapterGetLastError + UR_FUNCTION_ADAPTER_GET_LAST_ERROR = 180, + /// Enumerator for ::urAdapterGetInfo + UR_FUNCTION_ADAPTER_GET_INFO = 181, + /// Enumerator for ::urProgramBuildExp + UR_FUNCTION_PROGRAM_BUILD_EXP = 197, + /// Enumerator for ::urProgramCompileExp + UR_FUNCTION_PROGRAM_COMPILE_EXP = 198, + /// Enumerator for ::urProgramLinkExp + UR_FUNCTION_PROGRAM_LINK_EXP = 199, + /// Enumerator for ::urLoaderConfigSetCodeLocationCallback + UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 200, + /// Enumerator for ::urLoaderInit + UR_FUNCTION_LOADER_INIT = 201, + /// Enumerator for ::urLoaderTearDown + UR_FUNCTION_LOADER_TEAR_DOWN = 202, + /// Enumerator for ::urEnqueueCooperativeKernelLaunchExp + UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 214, + /// Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp + UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 215, + /// Enumerator for ::urProgramGetGlobalVariablePointer + UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER = 216, + /// Enumerator for ::urDeviceGetSelected + UR_FUNCTION_DEVICE_GET_SELECTED = 217, + /// Enumerator for ::urCommandBufferUpdateKernelLaunchExp + UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP = 220, + /// Enumerator for ::urCommandBufferGetInfoExp + UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP = 221, + /// Enumerator for ::urEnqueueTimestampRecordingExp + UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP = 223, + /// Enumerator for ::urEnqueueKernelLaunchCustomExp + UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP = 224, + /// Enumerator for ::urKernelGetSuggestedLocalWorkSize + UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE = 225, + /// Enumerator for ::urBindlessImagesImportExternalMemoryExp + UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP = 226, + /// Enumerator for ::urBindlessImagesImportExternalSemaphoreExp + UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP = 227, + /// Enumerator for ::urEnqueueNativeCommandExp + UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP = 228, + /// Enumerator for ::urLoaderConfigSetMockingEnabled + UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED = 229, + /// Enumerator for ::urBindlessImagesReleaseExternalMemoryExp + UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP = 230, + /// Enumerator for ::urCommandBufferAppendUSMMemcpyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 231, + /// Enumerator for ::urCommandBufferAppendUSMFillExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP = 232, + /// Enumerator for ::urCommandBufferAppendMemBufferCopyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 233, + /// Enumerator for ::urCommandBufferAppendMemBufferWriteExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 234, + /// Enumerator for ::urCommandBufferAppendMemBufferReadExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 235, + /// Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 236, + /// Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 237, + /// Enumerator for ::urCommandBufferAppendMemBufferReadRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 238, + /// Enumerator for ::urCommandBufferAppendMemBufferFillExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 239, + /// Enumerator for ::urCommandBufferAppendUSMPrefetchExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 240, + /// Enumerator for ::urCommandBufferAppendUSMAdviseExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 241, + /// Enumerator for ::urCommandBufferEnqueueExp + UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP = 242, + /// Enumerator for ::urCommandBufferUpdateSignalEventExp + UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP = 243, + /// Enumerator for ::urCommandBufferUpdateWaitEventsExp + UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP = 244, + /// Enumerator for ::urBindlessImagesMapExternalLinearMemoryExp + UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP = 245, + /// Enumerator for ::urEnqueueEventsWaitWithBarrierExt + UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT = 246, + /// Enumerator for ::urPhysicalMemGetInfo + UR_FUNCTION_PHYSICAL_MEM_GET_INFO = 249, + /// @cond + UR_FUNCTION_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_function_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Defines structure types +typedef enum ur_structure_type_t { + /// ::ur_context_properties_t + UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES = 0, + /// ::ur_image_desc_t + UR_STRUCTURE_TYPE_IMAGE_DESC = 1, + /// ::ur_buffer_properties_t + UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, + /// ::ur_buffer_region_t + UR_STRUCTURE_TYPE_BUFFER_REGION = 3, + /// ::ur_buffer_channel_properties_t + UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, + /// ::ur_buffer_alloc_location_properties_t + UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, + /// ::ur_program_properties_t + UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, + /// ::ur_usm_desc_t + UR_STRUCTURE_TYPE_USM_DESC = 7, + /// ::ur_usm_host_desc_t + UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, + /// ::ur_usm_device_desc_t + UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, + /// ::ur_usm_pool_desc_t + UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, + /// ::ur_usm_pool_limits_desc_t + UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, + /// ::ur_device_binary_t + UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, + /// ::ur_sampler_desc_t + UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, + /// ::ur_queue_properties_t + UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, + /// ::ur_queue_index_properties_t + UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, + /// ::ur_context_native_properties_t + UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, + /// ::ur_kernel_native_properties_t + UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, + /// ::ur_queue_native_properties_t + UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, + /// ::ur_mem_native_properties_t + UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, + /// ::ur_event_native_properties_t + UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, + /// ::ur_platform_native_properties_t + UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, + /// ::ur_device_native_properties_t + UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, + /// ::ur_program_native_properties_t + UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, + /// ::ur_sampler_native_properties_t + UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, + /// ::ur_queue_native_desc_t + UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, + /// ::ur_device_partition_properties_t + UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, + /// ::ur_kernel_arg_mem_obj_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, + /// ::ur_physical_mem_properties_t + UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, + /// ::ur_kernel_arg_pointer_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, + /// ::ur_kernel_arg_sampler_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, + /// ::ur_kernel_exec_info_properties_t + UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, + /// ::ur_kernel_arg_value_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, + /// ::ur_kernel_arg_local_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, + /// ::ur_usm_alloc_location_desc_t + UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC = 35, + /// ::ur_exp_command_buffer_desc_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, + /// ::ur_exp_command_buffer_update_kernel_launch_desc_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC = 0x1001, + /// ::ur_exp_command_buffer_update_memobj_arg_desc_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC = 0x1002, + /// ::ur_exp_command_buffer_update_pointer_arg_desc_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC = 0x1003, + /// ::ur_exp_command_buffer_update_value_arg_desc_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC = 0x1004, + /// ::ur_exp_sampler_mip_properties_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, + /// ::ur_exp_external_mem_desc_t + UR_STRUCTURE_TYPE_EXP_EXTERNAL_MEM_DESC = 0x2001, + /// ::ur_exp_external_semaphore_desc_t + UR_STRUCTURE_TYPE_EXP_EXTERNAL_SEMAPHORE_DESC = 0x2002, + /// ::ur_exp_file_descriptor_t + UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, + /// ::ur_exp_win32_handle_t + UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, + /// ::ur_exp_sampler_addr_modes_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2005, + /// ::ur_exp_sampler_cubemap_properties_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES = 0x2006, + /// ::ur_exp_image_copy_region_t + UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION = 0x2007, + /// ::ur_exp_enqueue_native_command_properties_t + UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES = 0x3000, + /// ::ur_exp_enqueue_ext_properties_t + UR_STRUCTURE_TYPE_EXP_ENQUEUE_EXT_PROPERTIES = 0x4000, + /// @cond + UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_structure_type_t; + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime API common types +#if !defined(__GNUC__) +#pragma region common +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_MAKE_VERSION +/// @brief Generates generic 'oneAPI' API versions +#define UR_MAKE_VERSION(_major, _minor) ((_major << 16) | (_minor & 0x0000ffff)) +#endif // UR_MAKE_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_MAJOR_VERSION +/// @brief Extracts 'oneAPI' API major version +#define UR_MAJOR_VERSION(_ver) (_ver >> 16) +#endif // UR_MAJOR_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_MINOR_VERSION +/// @brief Extracts 'oneAPI' API minor version +#define UR_MINOR_VERSION(_ver) (_ver & 0x0000ffff) +#endif // UR_MINOR_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_APICALL +#if defined(_WIN32) +/// @brief Calling convention for all API functions +#define UR_APICALL __cdecl +#else +#define UR_APICALL +#endif // defined(_WIN32) +#endif // UR_APICALL + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_APIEXPORT +#if defined(_WIN32) +/// @brief Microsoft-specific dllexport storage-class attribute +#define UR_APIEXPORT __declspec(dllexport) +#endif // defined(_WIN32) +#endif // UR_APIEXPORT + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_APIEXPORT +#if __GNUC__ >= 4 +/// @brief GCC-specific dllexport storage-class attribute +#define UR_APIEXPORT __attribute__((visibility("default"))) +#else +#define UR_APIEXPORT +#endif // __GNUC__ >= 4 +#endif // UR_APIEXPORT + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DLLEXPORT +#if defined(_WIN32) +/// @brief Microsoft-specific dllexport storage-class attribute +#define UR_DLLEXPORT __declspec(dllexport) +#endif // defined(_WIN32) +#endif // UR_DLLEXPORT + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DLLEXPORT +#if __GNUC__ >= 4 +/// @brief GCC-specific dllexport storage-class attribute +#define UR_DLLEXPORT __attribute__((visibility("default"))) +#else +#define UR_DLLEXPORT +#endif // __GNUC__ >= 4 +#endif // UR_DLLEXPORT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief compiler-independent type +typedef uint8_t ur_bool_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a loader config object +typedef struct ur_loader_config_handle_t_ *ur_loader_config_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of an adapter instance +typedef struct ur_adapter_handle_t_ *ur_adapter_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a platform instance +typedef struct ur_platform_handle_t_ *ur_platform_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of platform's device object +typedef struct ur_device_handle_t_ *ur_device_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of context object +typedef struct ur_context_handle_t_ *ur_context_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of event object +typedef struct ur_event_handle_t_ *ur_event_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of Program object +typedef struct ur_program_handle_t_ *ur_program_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of program's Kernel object +typedef struct ur_kernel_handle_t_ *ur_kernel_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a queue object +typedef struct ur_queue_handle_t_ *ur_queue_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a native object +typedef uintptr_t ur_native_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a Sampler object +typedef struct ur_sampler_handle_t_ *ur_sampler_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of memory object which can either be buffer or image +typedef struct ur_mem_handle_t_ *ur_mem_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of physical memory object +typedef struct ur_physical_mem_handle_t_ *ur_physical_mem_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_BIT +/// @brief Generic macro for enumerator bit masks +#define UR_BIT(_i) (1 << _i) +#endif // UR_BIT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Defines Return/Error codes +typedef enum ur_result_t { + /// Success + UR_RESULT_SUCCESS = 0, + /// Invalid operation + UR_RESULT_ERROR_INVALID_OPERATION = 1, + /// Invalid queue properties + UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES = 2, + /// Invalid queue + UR_RESULT_ERROR_INVALID_QUEUE = 3, + /// Invalid Value + UR_RESULT_ERROR_INVALID_VALUE = 4, + /// Invalid context + UR_RESULT_ERROR_INVALID_CONTEXT = 5, + /// Invalid platform + UR_RESULT_ERROR_INVALID_PLATFORM = 6, + /// Invalid binary + UR_RESULT_ERROR_INVALID_BINARY = 7, + /// Invalid program + UR_RESULT_ERROR_INVALID_PROGRAM = 8, + /// Invalid sampler + UR_RESULT_ERROR_INVALID_SAMPLER = 9, + /// Invalid buffer size + UR_RESULT_ERROR_INVALID_BUFFER_SIZE = 10, + /// Invalid memory object + UR_RESULT_ERROR_INVALID_MEM_OBJECT = 11, + /// Invalid event + UR_RESULT_ERROR_INVALID_EVENT = 12, + /// Returned when the event wait list or the events in the wait list are + /// invalid. + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST = 13, + /// Misaligned sub buffer offset + UR_RESULT_ERROR_MISALIGNED_SUB_BUFFER_OFFSET = 14, + /// Invalid work group size + UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE = 15, + /// Compiler not available + UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE = 16, + /// Profiling info not available + UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE = 17, + /// Device not found + UR_RESULT_ERROR_DEVICE_NOT_FOUND = 18, + /// Invalid device + UR_RESULT_ERROR_INVALID_DEVICE = 19, + /// Device hung, reset, was removed, or adapter update occurred + UR_RESULT_ERROR_DEVICE_LOST = 20, + /// Device requires a reset + UR_RESULT_ERROR_DEVICE_REQUIRES_RESET = 21, + /// Device currently in low power state + UR_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE = 22, + /// Device partitioning failed + UR_RESULT_ERROR_DEVICE_PARTITION_FAILED = 23, + /// Invalid counts provided with ::UR_DEVICE_PARTITION_BY_COUNTS + UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT = 24, + /// Invalid work item size + UR_RESULT_ERROR_INVALID_WORK_ITEM_SIZE = 25, + /// Invalid work dimension + UR_RESULT_ERROR_INVALID_WORK_DIMENSION = 26, + /// Invalid kernel args + UR_RESULT_ERROR_INVALID_KERNEL_ARGS = 27, + /// Invalid kernel + UR_RESULT_ERROR_INVALID_KERNEL = 28, + /// [Validation] kernel name is not found in the program + UR_RESULT_ERROR_INVALID_KERNEL_NAME = 29, + /// [Validation] kernel argument index is not valid for kernel + UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX = 30, + /// [Validation] kernel argument size does not match kernel + UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE = 31, + /// [Validation] value of kernel attribute is not valid for the kernel or + /// device + UR_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE = 32, + /// Invalid image size + UR_RESULT_ERROR_INVALID_IMAGE_SIZE = 33, + /// Invalid image format descriptor + UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR = 34, + /// Memory object allocation failure + UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE = 35, + /// Program object parameter is invalid. + UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE = 36, + /// [Validation] adapter is not initialized or specific entry-point is not + /// implemented + UR_RESULT_ERROR_UNINITIALIZED = 37, + /// Insufficient host memory to satisfy call + UR_RESULT_ERROR_OUT_OF_HOST_MEMORY = 38, + /// Insufficient device memory to satisfy call + UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY = 39, + /// Out of resources + UR_RESULT_ERROR_OUT_OF_RESOURCES = 40, + /// Error occurred when building program, see build log for details + UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE = 41, + /// Error occurred when linking programs, see build log for details + UR_RESULT_ERROR_PROGRAM_LINK_FAILURE = 42, + /// [Validation] generic error code for unsupported versions + UR_RESULT_ERROR_UNSUPPORTED_VERSION = 43, + /// [Validation] generic error code for unsupported features + UR_RESULT_ERROR_UNSUPPORTED_FEATURE = 44, + /// [Validation] generic error code for invalid arguments + UR_RESULT_ERROR_INVALID_ARGUMENT = 45, + /// [Validation] handle argument is not valid + UR_RESULT_ERROR_INVALID_NULL_HANDLE = 46, + /// [Validation] object pointed to by handle still in-use by device + UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE = 47, + /// [Validation] pointer argument may not be nullptr + UR_RESULT_ERROR_INVALID_NULL_POINTER = 48, + /// [Validation] invalid size or dimensions (e.g., must not be zero, or is + /// out of bounds) + UR_RESULT_ERROR_INVALID_SIZE = 49, + /// [Validation] size argument is not supported by the device (e.g., too + /// large) + UR_RESULT_ERROR_UNSUPPORTED_SIZE = 50, + /// [Validation] alignment argument is not supported by the device (e.g., + /// too small) + UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT = 51, + /// [Validation] synchronization object in invalid state + UR_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT = 52, + /// [Validation] enumerator argument is not valid + UR_RESULT_ERROR_INVALID_ENUMERATION = 53, + /// [Validation] enumerator argument is not supported by the device + UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION = 54, + /// [Validation] image format is not supported by the device + UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 55, + /// [Validation] native binary is not supported by the device + UR_RESULT_ERROR_INVALID_NATIVE_BINARY = 56, + /// [Validation] global variable is not found in the program + UR_RESULT_ERROR_INVALID_GLOBAL_NAME = 57, + /// [Validation] function name is in the program but its address could not + /// be determined + UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE = 58, + /// [Validation] group size dimension is not valid for the kernel or + /// device + UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 59, + /// [Validation] global width dimension is not valid for the kernel or + /// device + UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 60, + /// [Validation] compiled program or program with imports needs to be + /// linked before kernels can be created from it. + UR_RESULT_ERROR_PROGRAM_UNLINKED = 61, + /// [Validation] copy operations do not support overlapping regions of + /// memory + UR_RESULT_ERROR_OVERLAPPING_REGIONS = 62, + /// Invalid host pointer + UR_RESULT_ERROR_INVALID_HOST_PTR = 63, + /// Invalid USM size + UR_RESULT_ERROR_INVALID_USM_SIZE = 64, + /// Objection allocation failure + UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE = 65, + /// An adapter specific warning/error has been reported and can be + /// retrieved via the urAdapterGetLastError entry point. + UR_RESULT_ERROR_ADAPTER_SPECIFIC = 66, + /// A requested layer was not found by the loader. + UR_RESULT_ERROR_LAYER_NOT_PRESENT = 67, + /// An event in the provided wait list has ::UR_EVENT_STATUS_ERROR. + UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS = 68, + /// Device in question has `::UR_DEVICE_INFO_AVAILABLE == false` + UR_RESULT_ERROR_DEVICE_NOT_AVAILABLE = 69, + /// A specialization constant identifier is not valid. + UR_RESULT_ERROR_INVALID_SPEC_ID = 70, + /// Invalid Command-Buffer + UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP = 0x1000, + /// Sync point is not valid for the command-buffer + UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP = 0x1001, + /// Sync point wait list is invalid + UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP = 0x1002, + /// Handle to command-buffer command is invalid + UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP = 0x1003, + /// Unknown or internal error + UR_RESULT_ERROR_UNKNOWN = 0x7ffffffe, + /// @cond + UR_RESULT_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_result_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Base for all properties types +typedef struct ur_base_properties_t { + /// [in] type of this structure + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + +} ur_base_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Base for all descriptor types +typedef struct ur_base_desc_t { + /// [in] type of this structure + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + +} ur_base_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3D offset argument passed to buffer rect operations +typedef struct ur_rect_offset_t { + /// [in] x offset (bytes) + uint64_t x; + /// [in] y offset (scalar) + uint64_t y; + /// [in] z offset (scalar) + uint64_t z; + +} ur_rect_offset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3D region argument passed to buffer rect operations +typedef struct ur_rect_region_t { + /// [in] width (bytes) + uint64_t width; + /// [in] height (scalar) + uint64_t height; + /// [in] scalar (scalar) + uint64_t depth; + +} ur_rect_region_t; + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Loader +#if !defined(__GNUC__) +#pragma region loader +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported device initialization flags +typedef uint32_t ur_device_init_flags_t; +typedef enum ur_device_init_flag_t { + /// initialize GPU device adapters. + UR_DEVICE_INIT_FLAG_GPU = UR_BIT(0), + /// initialize CPU device adapters. + UR_DEVICE_INIT_FLAG_CPU = UR_BIT(1), + /// initialize FPGA device adapters. + UR_DEVICE_INIT_FLAG_FPGA = UR_BIT(2), + /// initialize MCA device adapters. + UR_DEVICE_INIT_FLAG_MCA = UR_BIT(3), + /// initialize VPU device adapters. + UR_DEVICE_INIT_FLAG_VPU = UR_BIT(4), + /// @cond + UR_DEVICE_INIT_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_init_flag_t; +/// @brief Bit Mask for validating ur_device_init_flags_t +#define UR_DEVICE_INIT_FLAGS_MASK 0xffffffe0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a loader config object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phLoaderConfig` +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigCreate( + /// [out][alloc] Pointer to handle of loader config object created. + ur_loader_config_handle_t *phLoaderConfig); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the loader config object. +/// +/// @details +/// - Get a reference to the loader config handle. Increment its reference +/// count +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigRetain( + /// [in][retain] loader config handle to retain + ur_loader_config_handle_t hLoaderConfig); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release config handle. +/// +/// @details +/// - Decrement reference count and destroy the config handle if reference +/// count becomes zero. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigRelease( + /// [in][release] config handle to release + ur_loader_config_handle_t hLoaderConfig); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported loader info +typedef enum ur_loader_config_info_t { + /// [char[]] Null-terminated, semi-colon separated list of available + /// layers. + UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS = 0, + /// [uint32_t] Reference count of the loader config object. + UR_LOADER_CONFIG_INFO_REFERENCE_COUNT = 1, + /// @cond + UR_LOADER_CONFIG_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_loader_config_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves various information about the loader. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_LOADER_CONFIG_INFO_REFERENCE_COUNT < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the loader. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigGetInfo( + /// [in] handle of the loader config object + ur_loader_config_handle_t hLoaderConfig, + /// [in] type of the info to retrieve + ur_loader_config_info_t propName, + /// [in] the number of bytes pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If propSize is not equal to or greater than the real number of bytes + /// needed to return the info + /// then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enable a layer for the specified loader config. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pLayerName` +/// - ::UR_RESULT_ERROR_LAYER_NOT_PRESENT +/// + If layer specified with `pLayerName` can't be found by the loader. +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigEnableLayer( + /// [in] Handle to config object the layer will be enabled for. + ur_loader_config_handle_t hLoaderConfig, + /// [in] Null terminated string containing the name of the layer to + /// enable. Empty if none are enabled. + const char *pLayerName); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Code location data +typedef struct ur_code_location_t { + /// [in][out] Function name. + const char *functionName; + /// [in][out] Source code file. + const char *sourceFile; + /// [in][out] Source code line number. + uint32_t lineNumber; + /// [in][out] Source code column number. + uint32_t columnNumber; + +} ur_code_location_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Code location callback with user data. +typedef ur_code_location_t (*ur_code_location_callback_t)( + /// [in][out] pointer to data to be passed to callback + void *pUserData); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a function callback for use by the loader to retrieve code +/// location information. +/// +/// @details +/// - The code location callback is optional and provides additional +/// information to the tracing layer about the entry point of the current +/// execution flow. +/// - This functionality can be used to match traced unified runtime +/// function calls with higher-level user calls. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnCodeloc` +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigSetCodeLocationCallback( + /// [in] Handle to config object the layer will be enabled for. + ur_loader_config_handle_t hLoaderConfig, + /// [in] Function pointer to code location callback. + ur_code_location_callback_t pfnCodeloc, + /// [in][out][optional] pointer to data to be passed to callback. + void *pUserData); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief The only adapter reported with mock enabled will be the mock adapter. +/// +/// @details +/// - The mock adapter will default to returning ::UR_RESULT_SUCCESS for all +/// entry points. It will also create and correctly reference count dummy +/// handles where appropriate. Its behaviour can be modified by linking +/// the mock library and using the object accessed via +/// mock::getCallbacks(). +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +UR_APIEXPORT ur_result_t UR_APICALL urLoaderConfigSetMockingEnabled( + /// [in] Handle to config object mocking will be enabled for. + ur_loader_config_handle_t hLoaderConfig, + /// [in] Handle to config object the layer will be enabled for. + ur_bool_t enable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Initialize the 'oneAPI' loader +/// +/// @details +/// - The application must call this function before calling any other +/// function. +/// - If this function is not called then all other functions will return +/// ::UR_RESULT_ERROR_UNINITIALIZED. +/// - Only one instance of the loader will be initialized per process. +/// - The application may call this function multiple times with different +/// flags or environment variables enabled. +/// - The application must call this function after forking new processes. +/// Each forked process must call this function. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe for scenarios +/// where multiple libraries may initialize the loader simultaneously. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_DEVICE_INIT_FLAGS_MASK & device_flags` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urLoaderInit( + /// [in] device initialization flags. + /// must be 0 (default) or a combination of ::ur_device_init_flag_t. + ur_device_init_flags_t device_flags, + /// [in][optional] Handle of loader config handle. + ur_loader_config_handle_t hLoaderConfig); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Tear down the 'oneAPI' loader and release all its resources +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urLoaderTearDown(void); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Adapter +#if !defined(__GNUC__) +#pragma region adapter +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves all available adapters +/// +/// @details +/// - Adapter implementations must return exactly one adapter handle from +/// this entry point. +/// - The loader may return more than one adapter handle when there are +/// multiple available. +/// - Each returned adapter has its reference count incremented and should +/// be released with a subsequent call to ::urAdapterRelease. +/// - Adapters may perform adapter-specific state initialization when the +/// first reference to them is taken. +/// - An application may call this entry point multiple times to acquire +/// multiple references to the adapter handle(s). +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phAdapters != NULL` +UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet( + /// [in] the number of adapters to be added to phAdapters. + /// If phAdapters is not NULL, then NumEntries should be greater than + /// zero, otherwise ::UR_RESULT_ERROR_INVALID_SIZE, + /// will be returned. + uint32_t NumEntries, + /// [out][optional][range(0, NumEntries)][alloc] array of handle of + /// adapters. If NumEntries is less than the number of adapters available, + /// then + /// ::urAdapterGet shall only retrieve that number of adapters. + ur_adapter_handle_t *phAdapters, + /// [out][optional] returns the total number of adapters available. + uint32_t *pNumAdapters); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Releases the adapter handle reference indicating end of its usage +/// +/// @details +/// - When the reference count of the adapter reaches zero, the adapter may +/// perform adapter-specififc resource teardown. Resources must be left in +/// a state where it safe for the adapter to be subsequently reinitialized +/// with ::urAdapterGet +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +UR_APIEXPORT ur_result_t UR_APICALL urAdapterRelease( + /// [in][release] Adapter handle to release + ur_adapter_handle_t hAdapter); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the adapter handle. +/// +/// @details +/// - Get a reference to the adapter handle. Increment its reference count +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +UR_APIEXPORT ur_result_t UR_APICALL urAdapterRetain( + /// [in][retain] Adapter handle to retain + ur_adapter_handle_t hAdapter); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the last adapter specific error. +/// +/// @details +/// To be used after another entry-point has returned +/// ::UR_RESULT_ERROR_ADAPTER_SPECIFIC in order to retrieve a message describing +/// the circumstances of the underlying driver error and the error code +/// returned by the failed driver entry-point. +/// +/// * Implementations *must* store the message and error code in thread-local +/// storage prior to returning ::UR_RESULT_ERROR_ADAPTER_SPECIFIC. +/// +/// * The message and error code storage is will only be valid if a previously +/// called entry-point returned ::UR_RESULT_ERROR_ADAPTER_SPECIFIC. +/// +/// * The memory pointed to by the C string returned in `ppMessage` is owned by +/// the adapter and *must* be null terminated. +/// +/// * The application *may* call this function from simultaneous threads. +/// +/// * The implementation of this function *should* be lock-free. +/// +/// Example usage: +/// +/// ```cpp +/// if (::urQueueCreate(hContext, hDevice, nullptr, &hQueue) == +/// ::UR_RESULT_ERROR_ADAPTER_SPECIFIC) { +/// const char* pMessage; +/// int32_t error; +/// ::urAdapterGetLastError(hAdapter, &pMessage, &error); +/// } +/// ``` +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMessage` +/// + `NULL == pError` +UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetLastError( + /// [in] handle of the adapter instance + ur_adapter_handle_t hAdapter, + /// [out] pointer to a C string where the adapter specific error message + /// will be stored. + const char **ppMessage, + /// [out] pointer to an integer where the adapter specific error code will + /// be stored. + int32_t *pError); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported adapter info +typedef enum ur_adapter_info_t { + /// [::ur_adapter_backend_t] Identifies the native backend supported by + /// the adapter. + UR_ADAPTER_INFO_BACKEND = 0, + /// [uint32_t] Reference count of the adapter. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_ADAPTER_INFO_REFERENCE_COUNT = 1, + /// [uint32_t] Specifies the adapter version, initial value of 1 and + /// incremented unpon major changes, e.g. when multiple versions of an + /// adapter may exist in parallel. + UR_ADAPTER_INFO_VERSION = 2, + /// @cond + UR_ADAPTER_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_adapter_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves information about the adapter +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_ADAPTER_INFO_VERSION < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo( + /// [in] handle of the adapter + ur_adapter_handle_t hAdapter, + /// [in] type of the info to retrieve + ur_adapter_info_t propName, + /// [in] the number of bytes pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If Size is not equal to or greater to the real number of bytes needed + /// to return the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is + /// returned and pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual number of bytes being queried by + /// pPropValue. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Identifies backend of the adapter +typedef enum ur_adapter_backend_t { + /// The backend is not a recognized one + UR_ADAPTER_BACKEND_UNKNOWN = 0, + /// The backend is Level Zero + UR_ADAPTER_BACKEND_LEVEL_ZERO = 1, + /// The backend is OpenCL + UR_ADAPTER_BACKEND_OPENCL = 2, + /// The backend is CUDA + UR_ADAPTER_BACKEND_CUDA = 3, + /// The backend is HIP + UR_ADAPTER_BACKEND_HIP = 4, + /// The backend is Native CPU + UR_ADAPTER_BACKEND_NATIVE_CPU = 5, + /// @cond + UR_ADAPTER_BACKEND_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_adapter_backend_t; + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Platform +#if !defined(__GNUC__) +#pragma region platform +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves all available platforms for the given adapters +/// +/// @details +/// - Multiple calls to this function will return identical platforms +/// handles, in the same order. +/// - The application may call this function from simultaneous threads, the +/// implementation must be thread-safe +/// +/// @remarks +/// _Analogues_ +/// - **clGetPlatformIDs** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phAdapters` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phPlatforms != NULL` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `pNumPlatforms == NULL && phPlatforms == NULL` +UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet( + /// [in][range(0, NumAdapters)] array of adapters to query for platforms. + ur_adapter_handle_t *phAdapters, + /// [in] number of adapters pointed to by phAdapters + uint32_t NumAdapters, + /// [in] the number of platforms to be added to phPlatforms. + /// If phPlatforms is not NULL, then NumEntries should be greater than + /// zero, otherwise ::UR_RESULT_ERROR_INVALID_SIZE, + /// will be returned. + uint32_t NumEntries, + /// [out][optional][range(0, NumEntries)] array of handle of platforms. + /// If NumEntries is less than the number of platforms available, then + /// ::urPlatformGet shall only retrieve that number of platforms. + ur_platform_handle_t *phPlatforms, + /// [out][optional] returns the total number of platforms available. + uint32_t *pNumPlatforms); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported platform info +typedef enum ur_platform_info_t { + /// [char[]] The string denoting name of the platform. The size of the + /// info needs to be dynamically queried. + UR_PLATFORM_INFO_NAME = 1, + /// [char[]] The string denoting name of the vendor of the platform. The + /// size of the info needs to be dynamically queried. + UR_PLATFORM_INFO_VENDOR_NAME = 2, + /// [char[]] The string denoting the version of the platform. The size of + /// the info needs to be dynamically queried. + UR_PLATFORM_INFO_VERSION = 3, + /// [char[]] The string denoting extensions supported by the platform. The + /// size of the info needs to be dynamically queried. + UR_PLATFORM_INFO_EXTENSIONS = 4, + /// [char[]] The string denoting profile of the platform. The size of the + /// info needs to be dynamically queried. + UR_PLATFORM_INFO_PROFILE = 5, + /// [::ur_platform_backend_t] The backend of the platform. Identifies the + /// native backend adapter implementing this platform. + UR_PLATFORM_INFO_BACKEND = 6, + /// [::ur_adapter_handle_t] The adapter handle associated with the + /// platform. + UR_PLATFORM_INFO_ADAPTER = 7, + /// @cond + UR_PLATFORM_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_platform_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves various information about platform +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clGetPlatformInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPlatform` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_PLATFORM_INFO_ADAPTER < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_PLATFORM +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetInfo( + /// [in] handle of the platform + ur_platform_handle_t hPlatform, + /// [in] type of the info to retrieve + ur_platform_info_t propName, + /// [in] the number of bytes pointed to by pPlatformInfo. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If Size is not equal to or greater to the real number of bytes needed + /// to return the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is + /// returned and pPlatformInfo is not used. + void *pPropValue, + /// [out][optional] pointer to the actual number of bytes being queried by + /// pPlatformInfo. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported API versions +/// +/// @details +/// - API versions contain major and minor attributes, use +/// ::UR_MAJOR_VERSION and ::UR_MINOR_VERSION +typedef enum ur_api_version_t { + /// version 0.6 + UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), + /// version 0.7 + UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), + /// version 0.8 + UR_API_VERSION_0_8 = UR_MAKE_VERSION(0, 8), + /// version 0.9 + UR_API_VERSION_0_9 = UR_MAKE_VERSION(0, 9), + /// version 0.10 + UR_API_VERSION_0_10 = UR_MAKE_VERSION(0, 10), + /// version 0.11 + UR_API_VERSION_0_11 = UR_MAKE_VERSION(0, 11), + /// version 0.12 + UR_API_VERSION_0_12 = UR_MAKE_VERSION(0, 12), + /// latest known version + UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 12), + /// @cond + UR_API_VERSION_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_api_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Returns the API version supported by the specified platform +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPlatform` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pVersion` +UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetApiVersion( + /// [in] handle of the platform + ur_platform_handle_t hPlatform, + /// [out] api version + ur_api_version_t *pVersion); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return platform native platform handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability platform extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPlatform` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativePlatform` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetNativeHandle( + /// [in] handle of the platform. + ur_platform_handle_t hPlatform, + /// [out] a pointer to the native handle of the platform. + ur_native_handle_t *phNativePlatform); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native platform creation properties +typedef struct ur_platform_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_platform_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime platform object from native platform handle. +/// +/// @details +/// - Creates runtime platform handle from native driver platform handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phPlatform` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urPlatformCreateWithNativeHandle( + /// [in][nocheck] the native handle of the platform. + ur_native_handle_t hNativePlatform, + /// [in] handle of the adapter associated with the native backend. + ur_adapter_handle_t hAdapter, + /// [in][optional] pointer to native platform properties struct. + const ur_platform_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the platform object created. + ur_platform_handle_t *phPlatform); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the platform specific compiler backend option from a generic +/// frontend option. +/// +/// @details +/// - The string returned via the ppPlatformOption is a NULL terminated C +/// style string. +/// - The string returned via the ppPlatformOption is thread local. +/// - The memory in the string returned via the ppPlatformOption is owned by +/// the adapter. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPlatform` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pFrontendOption` +/// + `NULL == ppPlatformOption` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + If `pFrontendOption` is not a valid frontend option. +UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetBackendOption( + /// [in] handle of the platform instance. + ur_platform_handle_t hPlatform, + /// [in] string containing the frontend option. + const char *pFrontendOption, + /// [out] returns the correct platform specific compiler option based on + /// the frontend option. + const char **ppPlatformOption); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Identifies native backend adapters +typedef enum ur_platform_backend_t { + /// The backend is not a recognized one + UR_PLATFORM_BACKEND_UNKNOWN = 0, + /// The backend is Level Zero + UR_PLATFORM_BACKEND_LEVEL_ZERO = 1, + /// The backend is OpenCL + UR_PLATFORM_BACKEND_OPENCL = 2, + /// The backend is CUDA + UR_PLATFORM_BACKEND_CUDA = 3, + /// The backend is HIP + UR_PLATFORM_BACKEND_HIP = 4, + /// The backend is Native CPU + UR_PLATFORM_BACKEND_NATIVE_CPU = 5, + /// @cond + UR_PLATFORM_BACKEND_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_platform_backend_t; + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Device +#if !defined(__GNUC__) +#pragma region device +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_UNKNOWN +/// @brief Target identification strings for +/// ::ur_device_binary_t.pDeviceTargetSpec +/// A device type represented by a particular target triple requires +/// specific binary images. We need to map the image type onto the device +/// target triple +#define UR_DEVICE_BINARY_TARGET_UNKNOWN "" +#endif // UR_DEVICE_BINARY_TARGET_UNKNOWN + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_SPIRV32 +/// @brief SPIR-V 32-bit image <-> "spir", 32-bit OpenCL device +#define UR_DEVICE_BINARY_TARGET_SPIRV32 "spir" +#endif // UR_DEVICE_BINARY_TARGET_SPIRV32 + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_SPIRV64 +/// @brief SPIR-V 64-bit image <-> "spir64", 64-bit OpenCL device +#define UR_DEVICE_BINARY_TARGET_SPIRV64 "spir64" +#endif // UR_DEVICE_BINARY_TARGET_SPIRV64 + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_SPIRV64_X86_64 +/// @brief Device-specific binary images produced from SPIR-V 64-bit <-> various +/// "spir64_*" triples for specific 64-bit OpenCL CPU devices +#define UR_DEVICE_BINARY_TARGET_SPIRV64_X86_64 "spir64_x86_64" +#endif // UR_DEVICE_BINARY_TARGET_SPIRV64_X86_64 + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_SPIRV64_GEN +/// @brief Generic GPU device (64-bit OpenCL) +#define UR_DEVICE_BINARY_TARGET_SPIRV64_GEN "spir64_gen" +#endif // UR_DEVICE_BINARY_TARGET_SPIRV64_GEN + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_SPIRV64_FPGA +/// @brief 64-bit OpenCL FPGA device +#define UR_DEVICE_BINARY_TARGET_SPIRV64_FPGA "spir64_fpga" +#endif // UR_DEVICE_BINARY_TARGET_SPIRV64_FPGA + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_NVPTX64 +/// @brief PTX 64-bit image <-> "nvptx64", 64-bit NVIDIA PTX device +#define UR_DEVICE_BINARY_TARGET_NVPTX64 "nvptx64" +#endif // UR_DEVICE_BINARY_TARGET_NVPTX64 + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_AMDGCN +/// @brief AMD GCN +#define UR_DEVICE_BINARY_TARGET_AMDGCN "amdgcn" +#endif // UR_DEVICE_BINARY_TARGET_AMDGCN + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_DEVICE_BINARY_TARGET_NATIVE_CPU +/// @brief Native CPU +#define UR_DEVICE_BINARY_TARGET_NATIVE_CPU "native_cpu" +#endif // UR_DEVICE_BINARY_TARGET_NATIVE_CPU + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device Binary Type +typedef struct ur_device_binary_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_DEVICE_BINARY + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] null-terminated string representation of the device's target + /// architecture. For example: + /// + ::UR_DEVICE_BINARY_TARGET_UNKNOWN + /// + ::UR_DEVICE_BINARY_TARGET_SPIRV32 + /// + ::UR_DEVICE_BINARY_TARGET_SPIRV64 + /// + ::UR_DEVICE_BINARY_TARGET_SPIRV64_X86_64 + /// + ::UR_DEVICE_BINARY_TARGET_SPIRV64_GEN + /// + ::UR_DEVICE_BINARY_TARGET_SPIRV64_FPGA + /// + ::UR_DEVICE_BINARY_TARGET_NVPTX64 + /// + ::UR_DEVICE_BINARY_TARGET_AMDGCN + const char *pDeviceTargetSpec; + +} ur_device_binary_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported device types +typedef enum ur_device_type_t { + /// The default device type as preferred by the runtime + UR_DEVICE_TYPE_DEFAULT = 1, + /// Devices of all types + UR_DEVICE_TYPE_ALL = 2, + /// Graphics Processing Unit + UR_DEVICE_TYPE_GPU = 3, + /// Central Processing Unit + UR_DEVICE_TYPE_CPU = 4, + /// Field Programmable Gate Array + UR_DEVICE_TYPE_FPGA = 5, + /// Memory Copy Accelerator + UR_DEVICE_TYPE_MCA = 6, + /// Vision Processing Unit + UR_DEVICE_TYPE_VPU = 7, + /// @cond + UR_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves devices within a platform +/// +/// @details +/// - Multiple calls to this function will return identical device handles, +/// in the same order. +/// - The number and order of handles returned from this function can be +/// affected by environment variables that filter devices exposed through +/// API. +/// - The returned devices are taken a reference of and must be released +/// with a subsequent call to ::urDeviceRelease. +/// - The application may call this function from simultaneous threads, the +/// implementation must be thread-safe +/// +/// @remarks +/// _Analogues_ +/// - **clGetDeviceIDs** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPlatform` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phDevices != NULL` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NumEntries > 0 && phDevices == NULL` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet( + /// [in] handle of the platform instance + ur_platform_handle_t hPlatform, + /// [in] the type of the devices. + ur_device_type_t DeviceType, + /// [in] the number of devices to be added to phDevices. + /// If phDevices is not NULL, then NumEntries should be greater than zero. + /// Otherwise ::UR_RESULT_ERROR_INVALID_SIZE + /// will be returned. + uint32_t NumEntries, + /// [out][optional][range(0, NumEntries)][alloc] array of handle of devices. + /// If NumEntries is less than the number of devices available, then + /// platform shall only retrieve that number of devices. + ur_device_handle_t *phDevices, + /// [out][optional] pointer to the number of devices. + /// pNumDevices will be updated with the total number of devices available. + uint32_t *pNumDevices); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves devices within a platform selected by +/// ONEAPI_DEVICE_SELECTOR +/// +/// @details +/// - Multiple calls to this function will return identical device handles, +/// in the same order. +/// - The number and order of handles returned from this function will be +/// affected by environment variables that filter or select which devices +/// are exposed through this API. +/// - A reference is taken for each returned device and must be released +/// with a subsequent call to ::urDeviceRelease. +/// - The application may call this function from simultaneous threads, the +/// implementation must be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPlatform` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetSelected( + /// [in] handle of the platform instance + ur_platform_handle_t hPlatform, + /// [in] the type of the devices. + ur_device_type_t DeviceType, + /// [in] the number of devices to be added to phDevices. + /// If phDevices in not NULL then NumEntries should be greater than zero, + /// otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + /// will be returned. + uint32_t NumEntries, + /// [out][optional][range(0, NumEntries)] array of handle of devices. + /// If NumEntries is less than the number of devices available, then only + /// that number of devices will be retrieved. + ur_device_handle_t *phDevices, + /// [out][optional] pointer to the number of devices. + /// pNumDevices will be updated with the total number of selected devices + /// available for the given platform. + uint32_t *pNumDevices); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported device info +typedef enum ur_device_info_t { + /// [::ur_device_type_t] type of the device + UR_DEVICE_INFO_TYPE = 0, + /// [uint32_t] vendor Id of the device + UR_DEVICE_INFO_VENDOR_ID = 1, + /// [uint32_t][optional-query] Id of the device + UR_DEVICE_INFO_DEVICE_ID = 2, + /// [uint32_t] the number of compute units + UR_DEVICE_INFO_MAX_COMPUTE_UNITS = 3, + /// [uint32_t] max work item dimensions + UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS = 4, + /// [size_t[]] return an array of max work item sizes + UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES = 5, + /// [size_t] max work group size + UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE = 6, + /// [::ur_device_fp_capability_flags_t] single precision floating point + /// capability + UR_DEVICE_INFO_SINGLE_FP_CONFIG = 7, + /// [::ur_device_fp_capability_flags_t] half precision floating point + /// capability + UR_DEVICE_INFO_HALF_FP_CONFIG = 8, + /// [::ur_device_fp_capability_flags_t] double precision floating point + /// capability + UR_DEVICE_INFO_DOUBLE_FP_CONFIG = 9, + /// [::ur_queue_flags_t] command queue properties supported by the device + UR_DEVICE_INFO_QUEUE_PROPERTIES = 10, + /// [uint32_t] preferred vector width for char + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR = 11, + /// [uint32_t] preferred vector width for short + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT = 12, + /// [uint32_t] preferred vector width for int + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT = 13, + /// [uint32_t] preferred vector width for long + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG = 14, + /// [uint32_t] preferred vector width for float + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT = 15, + /// [uint32_t] preferred vector width for double + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE = 16, + /// [uint32_t] preferred vector width for half float + UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF = 17, + /// [uint32_t] native vector width for char + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR = 18, + /// [uint32_t] native vector width for short + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT = 19, + /// [uint32_t] native vector width for int + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT = 20, + /// [uint32_t] native vector width for long + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG = 21, + /// [uint32_t] native vector width for float + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT = 22, + /// [uint32_t] native vector width for double + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE = 23, + /// [uint32_t] native vector width for half float + UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF = 24, + /// [uint32_t] max clock frequency in MHz + UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY = 25, + /// [uint32_t][optional-query] memory clock frequency in MHz + UR_DEVICE_INFO_MEMORY_CLOCK_RATE = 26, + /// [uint32_t] address bits + UR_DEVICE_INFO_ADDRESS_BITS = 27, + /// [uint64_t] max memory allocation size + UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE = 28, + /// [::ur_bool_t] images are supported + UR_DEVICE_INFO_IMAGE_SUPPORTED = 29, + /// [uint32_t] max number of image objects arguments of a kernel declared + /// with the read_only qualifier + UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS = 30, + /// [uint32_t] max number of image objects arguments of a kernel declared + /// with the write_only qualifier + UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS = 31, + /// [uint32_t] max number of image objects arguments of a kernel declared + /// with the read_write qualifier + UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS = 32, + /// [size_t] max width of Image2D object + UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH = 33, + /// [size_t] max height of Image2D object + UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT = 34, + /// [size_t] max width of Image3D object + UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH = 35, + /// [size_t] max height of Image3D object + UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT = 36, + /// [size_t] max depth of Image3D object + UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH = 37, + /// [size_t] max image buffer size + UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE = 38, + /// [size_t] max image array size + UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE = 39, + /// [uint32_t] max number of samplers that can be used in a kernel + UR_DEVICE_INFO_MAX_SAMPLERS = 40, + /// [size_t] max size in bytes of all arguments passed to a kernel + UR_DEVICE_INFO_MAX_PARAMETER_SIZE = 41, + /// [uint32_t] memory base address alignment + UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN = 42, + /// [::ur_device_mem_cache_type_t] global memory cache type + UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE = 43, + /// [uint32_t] global memory cache line size in bytes + UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE = 44, + /// [uint64_t] size of global memory cache in bytes + UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE = 45, + /// [uint64_t] size of global memory in bytes + UR_DEVICE_INFO_GLOBAL_MEM_SIZE = 46, + /// [uint64_t][optional-query] size of global memory which is free in + /// bytes + UR_DEVICE_INFO_GLOBAL_MEM_FREE = 47, + /// [uint64_t] max constant buffer size in bytes + UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE = 48, + /// [uint32_t] max number of __const declared arguments in a kernel + UR_DEVICE_INFO_MAX_CONSTANT_ARGS = 49, + /// [::ur_device_local_mem_type_t] local memory type + UR_DEVICE_INFO_LOCAL_MEM_TYPE = 50, + /// [uint64_t] local memory size in bytes + UR_DEVICE_INFO_LOCAL_MEM_SIZE = 51, + /// [::ur_bool_t] support error correction to global and local memory + UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT = 52, + /// [::ur_bool_t] unified host device memory + UR_DEVICE_INFO_HOST_UNIFIED_MEMORY = 53, + /// [size_t] profiling timer resolution in nanoseconds + UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION = 54, + /// [::ur_bool_t] little endian byte order + UR_DEVICE_INFO_ENDIAN_LITTLE = 55, + /// [::ur_bool_t] device is available + UR_DEVICE_INFO_AVAILABLE = 56, + /// [::ur_bool_t] device compiler is available + UR_DEVICE_INFO_COMPILER_AVAILABLE = 57, + /// [::ur_bool_t] device linker is available + UR_DEVICE_INFO_LINKER_AVAILABLE = 58, + /// [::ur_device_exec_capability_flags_t] device kernel execution + /// capability bit-field + UR_DEVICE_INFO_EXECUTION_CAPABILITIES = 59, + /// [::ur_queue_flags_t] device command queue property bit-field + UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES = 60, + /// [::ur_queue_flags_t] host queue property bit-field + UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES = 61, + /// [char[]] a semi-colon separated list of built-in kernels + UR_DEVICE_INFO_BUILT_IN_KERNELS = 62, + /// [::ur_platform_handle_t] the platform associated with the device + UR_DEVICE_INFO_PLATFORM = 63, + /// [uint32_t] Reference count of the device object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_DEVICE_INFO_REFERENCE_COUNT = 64, + /// [char[]] IL version + UR_DEVICE_INFO_IL_VERSION = 65, + /// [char[]] Device name + UR_DEVICE_INFO_NAME = 66, + /// [char[]] Device vendor + UR_DEVICE_INFO_VENDOR = 67, + /// [char[]] Driver version + UR_DEVICE_INFO_DRIVER_VERSION = 68, + /// [char[]] Device profile + UR_DEVICE_INFO_PROFILE = 69, + /// [char[]] Device version + UR_DEVICE_INFO_VERSION = 70, + /// [char[]] Version of backend runtime + UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION = 71, + /// [char[]] Return a space separated list of extension names + UR_DEVICE_INFO_EXTENSIONS = 72, + /// [size_t] Maximum size in bytes of internal printf buffer + UR_DEVICE_INFO_PRINTF_BUFFER_SIZE = 73, + /// [::ur_bool_t] prefer user synchronization when sharing object with + /// other API + UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC = 74, + /// [::ur_device_handle_t] return parent device handle + UR_DEVICE_INFO_PARENT_DEVICE = 75, + /// [::ur_device_partition_t[]] Returns an array of partition types + /// supported by the device + UR_DEVICE_INFO_SUPPORTED_PARTITIONS = 76, + /// [uint32_t] maximum number of sub-devices when the device is + /// partitioned + UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES = 77, + /// [::ur_device_affinity_domain_flags_t] Returns a bit-field of the + /// supported affinity domains for partitioning. + /// If the device does not support any affinity domains, then 0 will be + /// returned. + UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN = 78, + /// [::ur_device_partition_property_t[]] return an array of + /// ::ur_device_partition_property_t for properties specified in + /// ::urDevicePartition + UR_DEVICE_INFO_PARTITION_TYPE = 79, + /// [uint32_t] max number of sub groups + UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS = 80, + /// [::ur_bool_t] support sub group independent forward progress + UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS = 81, + /// [uint32_t[]] return an array of supported sub group sizes + UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL = 82, + /// [::ur_device_usm_access_capability_flags_t] support USM host memory + /// access + UR_DEVICE_INFO_USM_HOST_SUPPORT = 83, + /// [::ur_device_usm_access_capability_flags_t] support USM device memory + /// access + UR_DEVICE_INFO_USM_DEVICE_SUPPORT = 84, + /// [::ur_device_usm_access_capability_flags_t] support USM single device + /// shared memory access + UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT = 85, + /// [::ur_device_usm_access_capability_flags_t] support USM cross device + /// shared memory access + UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT = 86, + /// [::ur_device_usm_access_capability_flags_t] support USM system wide + /// shared memory access + UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT = 87, + /// [uint8_t[]][optional-query] return device UUID + UR_DEVICE_INFO_UUID = 88, + /// [char[]][optional-query] return device PCI address + UR_DEVICE_INFO_PCI_ADDRESS = 89, + /// [uint32_t][optional-query] return Intel GPU EU count + UR_DEVICE_INFO_GPU_EU_COUNT = 90, + /// [uint32_t][optional-query] return Intel GPU EU SIMD width + UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH = 91, + /// [uint32_t][optional-query] return Intel GPU number of slices + UR_DEVICE_INFO_GPU_EU_SLICES = 92, + /// [uint32_t][optional-query] return Intel GPU EU count per subslice + UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE = 93, + /// [uint32_t][optional-query] return Intel GPU number of subslices per + /// slice + UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE = 94, + /// [uint32_t][optional-query] return Intel GPU number of threads per EU + UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU = 95, + /// [uint32_t][optional-query] return max memory bandwidth in Mb/s + UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH = 96, + /// [::ur_bool_t] device supports sRGB images + UR_DEVICE_INFO_IMAGE_SRGB = 97, + /// [::ur_bool_t] Return true if sub-device should do its own program + /// build + UR_DEVICE_INFO_BUILD_ON_SUBDEVICE = 98, + /// [::ur_bool_t] support 64 bit atomics + UR_DEVICE_INFO_ATOMIC_64 = 99, + /// [::ur_memory_order_capability_flags_t] return a bit-field of atomic + /// memory order capabilities + UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES = 100, + /// [::ur_memory_scope_capability_flags_t] return a bit-field of atomic + /// memory scope capabilities + UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES = 101, + /// [::ur_memory_order_capability_flags_t] return a bit-field of atomic + /// memory fence order capabilities + UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES = 102, + /// [::ur_memory_scope_capability_flags_t] return a bit-field of atomic + /// memory fence scope capabilities + UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES = 103, + /// [::ur_bool_t] support for bfloat16 + UR_DEVICE_INFO_BFLOAT16 = 104, + /// [uint32_t] Returns 1 if the device doesn't have a notion of a + /// queue index. Otherwise, returns the number of queue indices that are + /// available for this device. + UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES = 105, + /// [::ur_bool_t] support the ::urKernelSetSpecializationConstants entry + /// point + UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS = 106, + /// [uint32_t][optional-query] return the width in bits of the memory bus + /// interface of the device. + UR_DEVICE_INFO_MEMORY_BUS_WIDTH = 107, + /// [size_t[3]] return max 3D work groups + UR_DEVICE_INFO_MAX_WORK_GROUPS_3D = 108, + /// [::ur_bool_t] return true if Async Barrier is supported + UR_DEVICE_INFO_ASYNC_BARRIER = 109, + /// [::ur_bool_t] return true if specifying memory channels is supported + UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT = 110, + /// [::ur_bool_t] Return true if the device supports enqueueing commands + /// to read and write pipes from the host. + UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED = 111, + /// [uint32_t][optional-query] The maximum number of registers available + /// per block. + UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP = 112, + /// [uint32_t][optional-query] The device IP version. The meaning of the + /// device IP version is implementation-defined, but newer devices should + /// have a higher version than older devices. + UR_DEVICE_INFO_IP_VERSION = 113, + /// [::ur_bool_t] return true if the device supports virtual memory. + UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT = 114, + /// [::ur_bool_t] return true if the device supports ESIMD. + UR_DEVICE_INFO_ESIMD_SUPPORT = 115, + /// [::ur_device_handle_t[]][optional-query] The set of component devices + /// contained by this composite device. + UR_DEVICE_INFO_COMPONENT_DEVICES = 116, + /// [::ur_device_handle_t][optional-query] The composite device containing + /// this component device. + UR_DEVICE_INFO_COMPOSITE_DEVICE = 117, + /// [::ur_bool_t] return true if the device supports the + /// `EnqueueDeviceGlobalVariableWrite` and + /// `EnqueueDeviceGlobalVariableRead` entry points. + UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT = 118, + /// [::ur_bool_t] return true if the device supports USM pooling. Pertains + /// to the `USMPool` entry points and usage of the `pool` parameter of the + /// USM alloc entry points. + UR_DEVICE_INFO_USM_POOL_SUPPORT = 119, + /// [uint32_t] the number of compute units for specific backend. + UR_DEVICE_INFO_NUM_COMPUTE_UNITS = 120, + /// [::ur_bool_t] support the ::urProgramSetSpecializationConstants entry + /// point + UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS = 121, + /// [::ur_bool_t] Returns true if the device supports the use of + /// command-buffers. + UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP = 0x1000, + /// [::ur_device_command_buffer_update_capability_flags_t] Command-buffer + /// update capabilities of the device + UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP = 0x1001, + /// [::ur_bool_t] Returns true if the device supports using event objects + /// for command synchronization outside of a command-buffer. + UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP = 0x1002, + /// [::ur_bool_t] return true if enqueue Cluster Launch is supported + UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP = 0x1111, + /// [::ur_bool_t] returns true if the device supports the creation of + /// bindless images + UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP = 0x2000, + /// [::ur_bool_t] returns true if the device supports the creation of + /// bindless images backed by shared USM + UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP = 0x2001, + /// [::ur_bool_t] returns true if the device supports the creation of 1D + /// bindless images backed by USM + UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP = 0x2002, + /// [::ur_bool_t] returns true if the device supports the creation of 2D + /// bindless images backed by USM + UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP = 0x2003, + /// [uint32_t] returns the required alignment of the pitch between two + /// rows of an image in bytes + UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP = 0x2004, + /// [size_t] returns the maximum linear width allowed for images allocated + /// using USM + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP = 0x2005, + /// [size_t] returns the maximum linear height allowed for images + /// allocated using USM + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP = 0x2006, + /// [size_t] returns the maximum linear pitch allowed for images allocated + /// using USM + UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP = 0x2007, + /// [::ur_bool_t] returns true if the device supports allocating mipmap + /// resources + UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP = 0x2008, + /// [::ur_bool_t] returns true if the device supports sampling mipmap + /// images with anisotropic filtering + UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP = 0x2009, + /// [uint32_t] returns the maximum anisotropic ratio supported by the + /// device + UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP = 0x200A, + /// [::ur_bool_t] returns true if the device supports using images created + /// from individual mipmap levels + UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP = 0x200B, + /// [::ur_bool_t] returns true if the device supports importing external + /// memory resources + UR_DEVICE_INFO_EXTERNAL_MEMORY_IMPORT_SUPPORT_EXP = 0x200C, + /// [::ur_bool_t] returns true if the device supports importing external + /// semaphore resources + UR_DEVICE_INFO_EXTERNAL_SEMAPHORE_IMPORT_SUPPORT_EXP = 0x200E, + /// [::ur_bool_t] returns true if the device supports allocating and + /// accessing cubemap resources + UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP = 0x2010, + /// [::ur_bool_t] returns true if the device supports sampling cubemapped + /// images across face boundaries + UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP = 0x2011, + /// [::ur_bool_t] returns true if the device is capable of fetching USM + /// backed 1D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP = 0x2012, + /// [::ur_bool_t] returns true if the device is capable of fetching + /// non-USM backed 1D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP = 0x2013, + /// [::ur_bool_t] returns true if the device is capable of fetching USM + /// backed 2D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP = 0x2014, + /// [::ur_bool_t] returns true if the device is capable of fetching + /// non-USM backed 2D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP = 0x2015, + /// [::ur_bool_t] returns true if the device is capable of fetching + /// non-USM backed 3D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP = 0x2017, + /// [::ur_bool_t] returns true if the device supports timestamp recording + UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP = 0x2018, + /// [::ur_bool_t] returns true if the device supports allocating and + /// accessing image array resources. + UR_DEVICE_INFO_IMAGE_ARRAY_SUPPORT_EXP = 0x2019, + /// [::ur_bool_t] returns true if the device supports unique addressing + /// per dimension. + UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP = 0x201A, + /// [::ur_bool_t] returns true if the device is capable of sampling USM + /// backed 1D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLE_1D_USM_EXP = 0x201B, + /// [::ur_bool_t] returns true if the device is capable of sampling USM + /// backed 2D sampled image data. + UR_DEVICE_INFO_BINDLESS_SAMPLE_2D_USM_EXP = 0x201C, + /// [::ur_bool_t] returns true if the device supports enqueueing of native + /// work + UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP = 0x2020, + /// [::ur_bool_t] returns true if the device supports low-power events. + UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP = 0x2021, + /// [::ur_exp_device_2d_block_array_capability_flags_t] return a bit-field + /// of Intel GPU 2D block array capabilities + UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP = 0x2022, + /// @cond + UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves various information about device +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clGetDeviceInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( + /// [in] handle of the device instance + ur_device_handle_t hDevice, + /// [in] type of the info to retrieve + ur_device_info_t propName, + /// [in] the number of bytes pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If propSize is not equal to or greater than the real number of bytes + /// needed to return the info + /// then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Makes a reference of the device handle indicating it's in use until +/// paired ::urDeviceRelease is called +/// +/// @details +/// - Increments the device reference count if `hDevice` is a valid +/// sub-device created by a call to `urDevicePartition`. If `hDevice` is a +/// root level device (e.g. obtained with `urDeviceGet`), the reference +/// count remains unchanged. +/// - It is not valid to use the device handle, which has all of its +/// references released. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clRetainDevice** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +UR_APIEXPORT ur_result_t UR_APICALL urDeviceRetain( + /// [in][retain] handle of the device to get a reference of. + ur_device_handle_t hDevice); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Releases the device handle reference indicating end of its usage +/// +/// @details +/// - Decrements the device reference count if `hDevice` is a valid +/// sub-device created by a call to `urDevicePartition`. If `hDevice` is a +/// root level device (e.g. obtained with `urDeviceGet`), the reference +/// count remains unchanged. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseDevice** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +UR_APIEXPORT ur_result_t UR_APICALL urDeviceRelease( + /// [in][release] handle of the device to release. + ur_device_handle_t hDevice); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device affinity domain +typedef uint32_t ur_device_affinity_domain_flags_t; +typedef enum ur_device_affinity_domain_flag_t { + /// Split the device into sub devices comprised of compute units that + /// share a NUMA node. + UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA = UR_BIT(0), + /// Split the device into sub devices comprised of compute units that + /// share a level 4 data cache. + UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE = UR_BIT(1), + /// Split the device into sub devices comprised of compute units that + /// share a level 3 data cache. + UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE = UR_BIT(2), + /// Split the device into sub devices comprised of compute units that + /// share a level 2 data cache. + UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE = UR_BIT(3), + /// Split the device into sub devices comprised of compute units that + /// share a level 1 data cache. + UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE = UR_BIT(4), + /// Split the device along the next partitionable affinity domain. + /// The implementation shall find the first level along which the device + /// or sub device may be further subdivided in the order: + /// ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA, + /// ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE, + /// ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE, + /// ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE, + /// ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE, and partition the device into + /// sub devices comprised of compute units that share memory subsystems at + /// this level. + UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE = UR_BIT(5), + /// @cond + UR_DEVICE_AFFINITY_DOMAIN_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_affinity_domain_flag_t; +/// @brief Bit Mask for validating ur_device_affinity_domain_flags_t +#define UR_DEVICE_AFFINITY_DOMAIN_FLAGS_MASK 0xffffffc0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Partition Properties +typedef enum ur_device_partition_t { + /// Partition Equally + UR_DEVICE_PARTITION_EQUALLY = 0x1086, + /// Partition by counts + UR_DEVICE_PARTITION_BY_COUNTS = 0x1087, + /// Partition by affinity domain + UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN = 0x1088, + /// Partition by c-slice + UR_DEVICE_PARTITION_BY_CSLICE = 0x1089, + /// @cond + UR_DEVICE_PARTITION_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_partition_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device partition value. +typedef union ur_device_partition_value_t { + /// [in] Number of compute units per sub-device when partitioning with + /// ::UR_DEVICE_PARTITION_EQUALLY. + uint32_t equally; + /// [in] Number of compute units in a sub-device when partitioning with + /// ::UR_DEVICE_PARTITION_BY_COUNTS. + uint32_t count; + /// [in] The affinity domain to partition for when partitioning with + /// ::UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN. + ur_device_affinity_domain_flags_t affinity_domain; + +} ur_device_partition_value_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device partition property +typedef struct ur_device_partition_property_t { + /// [in] The partitioning type to be used. + ur_device_partition_t type; + /// [in][tagged_by(type)] The partitioning value. + ur_device_partition_value_t value; + +} ur_device_partition_property_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device Partition Properties +typedef struct ur_device_partition_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Pointer to the beginning of the properties array. + const ur_device_partition_property_t *pProperties; + /// [in] The length of properties pointed to by `pProperties`. + size_t PropCount; + +} ur_device_partition_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Partition the device into sub-devices +/// +/// @details +/// - Repeated calls to this function with the same inputs will produce the +/// same output in the same order. +/// - The function may be called to request a further partitioning of a +/// sub-device into sub-sub-devices, and so on. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateSubDevices** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pProperties` +/// + `NULL == pProperties->pProperties` +/// - ::UR_RESULT_ERROR_DEVICE_PARTITION_FAILED +/// - ::UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT +UR_APIEXPORT ur_result_t UR_APICALL urDevicePartition( + /// [in] handle of the device to partition. + ur_device_handle_t hDevice, + /// [in] Device partition properties. + const ur_device_partition_properties_t *pProperties, + /// [in] the number of sub-devices. + uint32_t NumDevices, + /// [out][optional][range(0, NumDevices)] array of handle of devices. + /// If NumDevices is less than the number of sub-devices available, then + /// the function shall only retrieve that number of sub-devices. + ur_device_handle_t *phSubDevices, + /// [out][optional] pointer to the number of sub-devices the device can be + /// partitioned into according to the partitioning property. + uint32_t *pNumDevicesRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Selects the most appropriate device binary based on runtime +/// information and the IR characteristics. +/// +/// @details +/// - The input binaries are various AOT images, and possibly an IL binary +/// for JIT compilation. +/// - The selected binary will be able to be run on the target device. +/// - If no suitable binary can be found then function returns +/// ${X}_INVALID_BINARY. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pBinaries` +/// + `NULL == pSelectedBinary` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumBinaries == 0` +UR_APIEXPORT ur_result_t UR_APICALL urDeviceSelectBinary( + /// [in] handle of the device to select binary for. + ur_device_handle_t hDevice, + /// [in] the array of binaries to select from. + const ur_device_binary_t *pBinaries, + /// [in] the number of binaries passed in ppBinaries. + /// Must greater than or equal to zero otherwise + /// ::UR_RESULT_ERROR_INVALID_VALUE is returned. + uint32_t NumBinaries, + /// [out] the index of the selected binary in the input array of binaries. + /// If a suitable binary was not found the function returns + /// ::UR_RESULT_ERROR_INVALID_BINARY. + uint32_t *pSelectedBinary); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief FP capabilities +typedef uint32_t ur_device_fp_capability_flags_t; +typedef enum ur_device_fp_capability_flag_t { + /// Support correctly rounded divide and sqrt + UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT = UR_BIT(0), + /// Support round to nearest + UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST = UR_BIT(1), + /// Support round to zero + UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO = UR_BIT(2), + /// Support round to infinity + UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF = UR_BIT(3), + /// Support INF to NAN + UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN = UR_BIT(4), + /// Support denorm + UR_DEVICE_FP_CAPABILITY_FLAG_DENORM = UR_BIT(5), + /// Support FMA + UR_DEVICE_FP_CAPABILITY_FLAG_FMA = UR_BIT(6), + /// Basic floating point operations implemented in software. + UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT = UR_BIT(7), + /// @cond + UR_DEVICE_FP_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_fp_capability_flag_t; +/// @brief Bit Mask for validating ur_device_fp_capability_flags_t +#define UR_DEVICE_FP_CAPABILITY_FLAGS_MASK 0xffffff00 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device memory cache type +typedef enum ur_device_mem_cache_type_t { + /// Has none cache + UR_DEVICE_MEM_CACHE_TYPE_NONE = 0, + /// Has read only cache + UR_DEVICE_MEM_CACHE_TYPE_READ_ONLY_CACHE = 1, + /// Has read write cache + UR_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE = 2, + /// @cond + UR_DEVICE_MEM_CACHE_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_mem_cache_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device local memory type +typedef enum ur_device_local_mem_type_t { + /// No local memory support + UR_DEVICE_LOCAL_MEM_TYPE_NONE = 0, + /// Dedicated local memory + UR_DEVICE_LOCAL_MEM_TYPE_LOCAL = 1, + /// Global memory + UR_DEVICE_LOCAL_MEM_TYPE_GLOBAL = 2, + /// @cond + UR_DEVICE_LOCAL_MEM_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_local_mem_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device kernel execution capability +typedef uint32_t ur_device_exec_capability_flags_t; +typedef enum ur_device_exec_capability_flag_t { + /// Support kernel execution + UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL = UR_BIT(0), + /// Support native kernel execution + UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL = UR_BIT(1), + /// @cond + UR_DEVICE_EXEC_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_exec_capability_flag_t; +/// @brief Bit Mask for validating ur_device_exec_capability_flags_t +#define UR_DEVICE_EXEC_CAPABILITY_FLAGS_MASK 0xfffffffc + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return platform native device handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability platform extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeDevice` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetNativeHandle( + /// [in] handle of the device. + ur_device_handle_t hDevice, + /// [out] a pointer to the native handle of the device. + ur_native_handle_t *phNativeDevice); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native device creation properties +typedef struct ur_device_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_device_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime device object from native device handle. +/// +/// @details +/// - Creates runtime device handle from native driver device handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevice` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle( + /// [in][nocheck] the native handle of the device. + ur_native_handle_t hNativeDevice, + /// [in] handle of the adapter to which `hNativeDevice` belongs + ur_adapter_handle_t hAdapter, + /// [in][optional] pointer to native device properties struct. + const ur_device_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the device object created. + ur_device_handle_t *phDevice); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Returns synchronized Host and Device global timestamps. +/// +/// @details +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clGetDeviceAndHostTimer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( + /// [in] handle of the device instance + ur_device_handle_t hDevice, + /// [out][optional] pointer to the Device's global timestamp that + /// correlates with the Host's global timestamp value + uint64_t *pDeviceTimestamp, + /// [out][optional] pointer to the Host's global timestamp that + /// correlates with the Device's global timestamp value + uint64_t *pHostTimestamp); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory order capabilities +typedef uint32_t ur_memory_order_capability_flags_t; +typedef enum ur_memory_order_capability_flag_t { + /// Relaxed memory ordering + UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED = UR_BIT(0), + /// Acquire memory ordering + UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE = UR_BIT(1), + /// Release memory ordering + UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE = UR_BIT(2), + /// Acquire/release memory ordering + UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL = UR_BIT(3), + /// Sequentially consistent memory ordering + UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST = UR_BIT(4), + /// @cond + UR_MEMORY_ORDER_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_memory_order_capability_flag_t; +/// @brief Bit Mask for validating ur_memory_order_capability_flags_t +#define UR_MEMORY_ORDER_CAPABILITY_FLAGS_MASK 0xffffffe0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory scope capabilities +typedef uint32_t ur_memory_scope_capability_flags_t; +typedef enum ur_memory_scope_capability_flag_t { + /// Work item scope + UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM = UR_BIT(0), + /// Sub group scope + UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP = UR_BIT(1), + /// Work group scope + UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP = UR_BIT(2), + /// Device scope + UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE = UR_BIT(3), + /// System scope + UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM = UR_BIT(4), + /// @cond + UR_MEMORY_SCOPE_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_memory_scope_capability_flag_t; +/// @brief Bit Mask for validating ur_memory_scope_capability_flags_t +#define UR_MEMORY_SCOPE_CAPABILITY_FLAGS_MASK 0xffffffe0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM access capabilities +typedef uint32_t ur_device_usm_access_capability_flags_t; +typedef enum ur_device_usm_access_capability_flag_t { + /// Memory can be accessed + UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS = UR_BIT(0), + /// Memory can be accessed atomically + UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS = UR_BIT(1), + /// Memory can be accessed concurrently + UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS = UR_BIT(2), + /// Memory can be accessed atomically and concurrently + UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS = UR_BIT(3), + /// @cond + UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_usm_access_capability_flag_t; +/// @brief Bit Mask for validating ur_device_usm_access_capability_flags_t +#define UR_DEVICE_USM_ACCESS_CAPABILITY_FLAGS_MASK 0xfffffff0 + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Context +#if !defined(__GNUC__) +#pragma region context +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Context property type +typedef uint32_t ur_context_flags_t; +typedef enum ur_context_flag_t { + /// reserved for future use + UR_CONTEXT_FLAG_TBD = UR_BIT(0), + /// @cond + UR_CONTEXT_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_context_flag_t; +/// @brief Bit Mask for validating ur_context_flags_t +#define UR_CONTEXT_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Context creation properties +typedef struct ur_context_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] context creation flags. + ur_context_flags_t flags; + +} ur_context_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Creates a context with the given devices. +/// +/// @details +/// - All devices should be from the same platform. +/// - Context is used for resource sharing between all the devices +/// associated with it. +/// - Context also serves for resource isolation such that resources do not +/// cross context boundaries. +/// - The returned context is a reference and must be released with a +/// subsequent call to ::urContextRelease. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateContext** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// + `NULL == phContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_CONTEXT_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urContextCreate( + /// [in] the number of devices given in phDevices + uint32_t DeviceCount, + /// [in][range(0, DeviceCount)] array of handle of devices. + const ur_device_handle_t *phDevices, + /// [in][optional] pointer to context creation properties. + const ur_context_properties_t *pProperties, + /// [out][alloc] pointer to handle of context object created + ur_context_handle_t *phContext); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Makes a reference of the context handle indicating it's in use until +/// paired ::urContextRelease is called +/// +/// @details +/// - It is not valid to use a context handle, which has all of its +/// references released. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clRetainContext** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +UR_APIEXPORT ur_result_t UR_APICALL urContextRetain( + /// [in][retain] handle of the context to get a reference of. + ur_context_handle_t hContext); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported context info +typedef enum ur_context_info_t { + /// [uint32_t] The number of the devices in the context + UR_CONTEXT_INFO_NUM_DEVICES = 0, + /// [::ur_device_handle_t[]] The array of the device handles in the + /// context + UR_CONTEXT_INFO_DEVICES = 1, + /// [uint32_t] Reference count of the context object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_CONTEXT_INFO_REFERENCE_COUNT = 2, + /// [::ur_bool_t] to indicate if the ::urEnqueueUSMMemcpy2D entrypoint is + /// supported. + UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT = 3, + /// [::ur_bool_t] to indicate if the ::urEnqueueUSMFill2D entrypoint is + /// supported. + UR_CONTEXT_INFO_USM_FILL2D_SUPPORT = 4, + /// [::ur_memory_order_capability_flags_t][optional-query] return a + /// bit-field of atomic memory order capabilities. + UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES = 5, + /// [::ur_memory_scope_capability_flags_t][optional-query] return a + /// bit-field of atomic memory scope capabilities. + UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES = 6, + /// [::ur_memory_order_capability_flags_t][optional-query] return a + /// bit-field of atomic memory fence order capabilities. + /// Zero is returned if the backend does not support context-level fences. + UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES = 7, + /// [::ur_memory_scope_capability_flags_t][optional-query] return a + /// bit-field of atomic memory fence scope capabilities. + /// Zero is returned if the backend does not support context-level fences. + UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES = 8, + /// @cond + UR_CONTEXT_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_context_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Releases the context handle reference indicating end of its usage +/// +/// @details +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseContext** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +UR_APIEXPORT ur_result_t UR_APICALL urContextRelease( + /// [in][release] handle of the context to release. + ur_context_handle_t hContext); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves various information about context +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clGetContextInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo( + /// [in] handle of the context + ur_context_handle_t hContext, + /// [in] type of the info to retrieve + ur_context_info_t propName, + /// [in] the number of bytes of memory pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// if propSize is not equal to or greater than the real number of bytes + /// needed to return + /// the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return platform native context handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability platform extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeContext` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urContextGetNativeHandle( + /// [in] handle of the context. + ur_context_handle_t hContext, + /// [out] a pointer to the native handle of the context. + ur_native_handle_t *phNativeContext); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urContextCreateWithNativeHandle. +typedef struct ur_context_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_context_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime context object from native context handle. +/// +/// @details +/// - Creates runtime context handle from native driver context handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hAdapter` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phContext` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urContextCreateWithNativeHandle( + /// [in][nocheck] the native handle of the context. + ur_native_handle_t hNativeContext, + /// [in] handle of the adapter that owns the native handle + ur_adapter_handle_t hAdapter, + /// [in] number of devices associated with the context + uint32_t numDevices, + /// [in][optional][range(0, numDevices)] list of devices associated with + /// the context + const ur_device_handle_t *phDevices, + /// [in][optional] pointer to native context properties struct + const ur_context_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the context object created. + ur_context_handle_t *phContext); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Context's extended deleter callback function with user data. +typedef void (*ur_context_extended_deleter_t)( + /// [in][out] pointer to data to be passed to callback + void *pUserData); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Call extended deleter function as callback. +/// +/// @details +/// - Calls extended deleter, a user-defined callback to delete context on +/// some platforms. +/// - This is done for performance reasons. +/// - This API might be called directly by an application instead of a +/// runtime backend. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnDeleter` +UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter( + /// [in] handle of the context. + ur_context_handle_t hContext, + /// [in] Function pointer to extended deleter. + ur_context_extended_deleter_t pfnDeleter, + /// [in][out][optional] pointer to data to be passed to callback. + void *pUserData); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region memory +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory flags +typedef uint32_t ur_mem_flags_t; +typedef enum ur_mem_flag_t { + /// The memory object will be read and written by a kernel. This is the + /// default + UR_MEM_FLAG_READ_WRITE = UR_BIT(0), + /// The memory object will be written but not read by a kernel + UR_MEM_FLAG_WRITE_ONLY = UR_BIT(1), + /// The memory object is a read-only inside a kernel + UR_MEM_FLAG_READ_ONLY = UR_BIT(2), + /// Use memory pointed by a host pointer parameter as the storage bits for + /// the memory object + UR_MEM_FLAG_USE_HOST_POINTER = UR_BIT(3), + /// Allocate memory object from host accessible memory + UR_MEM_FLAG_ALLOC_HOST_POINTER = UR_BIT(4), + /// Allocate memory and copy the data from host pointer pointed memory + UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER = UR_BIT(5), + /// @cond + UR_MEM_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_mem_flag_t; +/// @brief Bit Mask for validating ur_mem_flags_t +#define UR_MEM_FLAGS_MASK 0xffffffc0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory types +typedef enum ur_mem_type_t { + /// 2D image object + UR_MEM_TYPE_IMAGE2D = 0, + /// 3D image object + UR_MEM_TYPE_IMAGE3D = 1, + /// 2D image array object + UR_MEM_TYPE_IMAGE2D_ARRAY = 2, + /// 1D image object + UR_MEM_TYPE_IMAGE1D = 3, + /// 1D image array object + UR_MEM_TYPE_IMAGE1D_ARRAY = 4, + /// Experimental cubemap image object + UR_MEM_TYPE_IMAGE_CUBEMAP_EXP = 0x2000, + /// @cond + UR_MEM_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_mem_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory Information type +typedef enum ur_mem_info_t { + /// [size_t] actual size of the memory object in bytes + UR_MEM_INFO_SIZE = 0, + /// [::ur_context_handle_t] context in which the memory object was created + UR_MEM_INFO_CONTEXT = 1, + /// [uint32_t] Reference count of the memory object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_MEM_INFO_REFERENCE_COUNT = 2, + /// @cond + UR_MEM_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_mem_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image channel order info: number of channels and the channel layout +typedef enum ur_image_channel_order_t { + /// channel order A + UR_IMAGE_CHANNEL_ORDER_A = 0, + /// channel order R + UR_IMAGE_CHANNEL_ORDER_R = 1, + /// channel order RG + UR_IMAGE_CHANNEL_ORDER_RG = 2, + /// channel order RA + UR_IMAGE_CHANNEL_ORDER_RA = 3, + /// channel order RGB + UR_IMAGE_CHANNEL_ORDER_RGB = 4, + /// channel order RGBA + UR_IMAGE_CHANNEL_ORDER_RGBA = 5, + /// channel order BGRA + UR_IMAGE_CHANNEL_ORDER_BGRA = 6, + /// channel order ARGB + UR_IMAGE_CHANNEL_ORDER_ARGB = 7, + /// channel order ABGR + UR_IMAGE_CHANNEL_ORDER_ABGR = 8, + /// channel order intensity + UR_IMAGE_CHANNEL_ORDER_INTENSITY = 9, + /// channel order luminance + UR_IMAGE_CHANNEL_ORDER_LUMINANCE = 10, + /// channel order Rx + UR_IMAGE_CHANNEL_ORDER_RX = 11, + /// channel order RGx + UR_IMAGE_CHANNEL_ORDER_RGX = 12, + /// channel order RGBx + UR_IMAGE_CHANNEL_ORDER_RGBX = 13, + /// channel order sRGBA + UR_IMAGE_CHANNEL_ORDER_SRGBA = 14, + /// @cond + UR_IMAGE_CHANNEL_ORDER_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_image_channel_order_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image channel type info: describe the size of the channel data type +typedef enum ur_image_channel_type_t { + /// channel type snorm int8 + UR_IMAGE_CHANNEL_TYPE_SNORM_INT8 = 0, + /// channel type snorm int16 + UR_IMAGE_CHANNEL_TYPE_SNORM_INT16 = 1, + /// channel type unorm int8 + UR_IMAGE_CHANNEL_TYPE_UNORM_INT8 = 2, + /// channel type unorm int16 + UR_IMAGE_CHANNEL_TYPE_UNORM_INT16 = 3, + /// channel type unorm short 565 + UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565 = 4, + /// channel type unorm short 555 + UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555 = 5, + /// channel type int 101010 + UR_IMAGE_CHANNEL_TYPE_INT_101010 = 6, + /// channel type signed int8 + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8 = 7, + /// channel type signed int16 + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16 = 8, + /// channel type signed int32 + UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32 = 9, + /// channel type unsigned int8 + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8 = 10, + /// channel type unsigned int16 + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16 = 11, + /// channel type unsigned int32 + UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32 = 12, + /// channel type half float + UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT = 13, + /// channel type float + UR_IMAGE_CHANNEL_TYPE_FLOAT = 14, + /// @cond + UR_IMAGE_CHANNEL_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_image_channel_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image information types +typedef enum ur_image_info_t { + /// [::ur_image_format_t] image format + UR_IMAGE_INFO_FORMAT = 0, + /// [size_t] element size + UR_IMAGE_INFO_ELEMENT_SIZE = 1, + /// [size_t] row pitch + UR_IMAGE_INFO_ROW_PITCH = 2, + /// [size_t] slice pitch + UR_IMAGE_INFO_SLICE_PITCH = 3, + /// [size_t] image width + UR_IMAGE_INFO_WIDTH = 4, + /// [size_t] image height + UR_IMAGE_INFO_HEIGHT = 5, + /// [size_t] image depth + UR_IMAGE_INFO_DEPTH = 6, + /// [size_t] array size + UR_IMAGE_INFO_ARRAY_SIZE = 7, + /// [uint32_t] number of MIP levels + UR_IMAGE_INFO_NUM_MIP_LEVELS = 8, + /// [uint32_t] number of samples + UR_IMAGE_INFO_NUM_SAMPLES = 9, + /// @cond + UR_IMAGE_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_image_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image format including channel layout and data type +typedef struct ur_image_format_t { + /// [in] image channel order + ur_image_channel_order_t channelOrder; + /// [in] image channel type + ur_image_channel_type_t channelType; + +} ur_image_format_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image descriptor type. +typedef struct ur_image_desc_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_IMAGE_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in][nocheck] memory object type + ur_mem_type_t type; + /// [in] image width + size_t width; + /// [in] image height + size_t height; + /// [in] image depth + size_t depth; + /// [in] image array size + size_t arraySize; + /// [in] image row pitch + size_t rowPitch; + /// [in] image slice pitch + size_t slicePitch; + /// [in] number of MIP levels, must be `0` + uint32_t numMipLevel; + /// [in] number of samples, must be `0` + uint32_t numSamples; + +} ur_image_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create an image object +/// +/// @details +/// - The primary ::ur_image_format_t that must be supported by all the +/// adapters are {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_UNORM_INT8}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_UNORM_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_SNORM_INT8}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_SNORM_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT}, {UR_IMAGE_CHANNEL_ORDER_RGBA, +/// UR_IMAGE_CHANNEL_TYPE_FLOAT}. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateImage** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_MEM_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pImageFormat` +/// + `NULL == pImageDesc` +/// + `NULL == phMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR +/// + `pImageDesc && UR_STRUCTURE_TYPE_IMAGE_DESC != pImageDesc->stype` +/// + `pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type` +/// + `pImageDesc && pImageDesc->numMipLevel != 0` +/// + `pImageDesc && pImageDesc->numSamples != 0` +/// + `pImageDesc && pImageDesc->rowPitch != 0 && pHost == nullptr` +/// + `pImageDesc && pImageDesc->slicePitch != 0 && pHost == nullptr` +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR +/// + `pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | +/// UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0` +/// + `pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | +/// UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] allocation and usage information flags + ur_mem_flags_t flags, + /// [in] pointer to image format specification + const ur_image_format_t *pImageFormat, + /// [in] pointer to image description + const ur_image_desc_t *pImageDesc, + /// [in][optional] pointer to the buffer data + void *pHost, + /// [out][alloc] pointer to handle of image object created + ur_mem_handle_t *phMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Buffer creation properties +typedef struct ur_buffer_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_BUFFER_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in][optional] pointer to the buffer data + void *pHost; + +} ur_buffer_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Buffer memory channel creation properties +/// +/// @details +/// - Specify these properties in ::urMemBufferCreate via +/// ::ur_buffer_properties_t as part of a `pNext` chain. +/// +/// @remarks +/// _Analogues_ +/// - cl_intel_mem_channel_property +typedef struct ur_buffer_channel_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Identifies the channel/region to which the buffer should be mapped. + uint32_t channel; + +} ur_buffer_channel_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Buffer allocation location creation properties +/// +/// @details +/// - Specify these properties in ::urMemBufferCreate via +/// ::ur_buffer_properties_t as part of a `pNext` chain. +/// +/// @remarks +/// _Analogues_ +/// - cl_intel_mem_alloc_buffer_location +typedef struct ur_buffer_alloc_location_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Identifies the ID of global memory partition to which the memory + /// should be allocated. + uint32_t location; + +} ur_buffer_alloc_location_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a memory buffer +/// +/// @details +/// - See also ::ur_buffer_channel_properties_t. +/// - See also ::ur_buffer_alloc_location_properties_t. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_MEM_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phBuffer` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_BUFFER_SIZE +/// + `size == 0` +/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR +/// + `pProperties == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | +/// UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0` +/// + `pProperties != NULL && pProperties->pHost == NULL && (flags & +/// (UR_MEM_FLAG_USE_HOST_POINTER | +/// UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0` +/// + `pProperties != NULL && pProperties->pHost != NULL && (flags & +/// (UR_MEM_FLAG_USE_HOST_POINTER | +/// UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] allocation and usage information flags + ur_mem_flags_t flags, + /// [in] size in bytes of the memory object to be allocated + size_t size, + /// [in][optional] pointer to buffer creation properties + const ur_buffer_properties_t *pProperties, + /// [out][alloc] pointer to handle of the memory buffer created + ur_mem_handle_t *phBuffer); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference the memory object. Increment the memory object's +/// reference count +/// +/// @details +/// - Useful in library function to retain access to the memory object after +/// the caller released the object +/// +/// @remarks +/// _Analogues_ +/// - **clRetainMemoryObject** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hMem` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urMemRetain( + /// [in][retain] handle of the memory object to get access + ur_mem_handle_t hMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Decrement the memory object's reference count and delete the object +/// if +/// the reference count becomes zero. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseMemoryObject** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hMem` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urMemRelease( + /// [in][release] handle of the memory object to release + ur_mem_handle_t hMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Buffer region type, used to describe a sub buffer +typedef struct ur_buffer_region_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_BUFFER_REGION + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] buffer origin offset + size_t origin; + /// [in] size of the buffer region + size_t size; + +} ur_buffer_region_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Buffer creation type +typedef enum ur_buffer_create_type_t { + /// buffer create type is region + UR_BUFFER_CREATE_TYPE_REGION = 0, + /// @cond + UR_BUFFER_CREATE_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_buffer_create_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a sub buffer representing a region in an existing buffer +/// +/// @remarks +/// _Analogues_ +/// - **clCreateSubBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_MEM_FLAGS_MASK & flags` +/// + `::UR_BUFFER_CREATE_TYPE_REGION < bufferCreateType` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pRegion` +/// + `NULL == phMem` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_BUFFER_SIZE +/// + `pRegion && pRegion->size == 0` +/// + hBuffer allocation size < (pRegion->origin + pRegion->size) +/// - ::UR_RESULT_ERROR_INVALID_HOST_PTR +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urMemBufferPartition( + /// [in] handle of the buffer object to allocate from + ur_mem_handle_t hBuffer, + /// [in] allocation and usage information flags + ur_mem_flags_t flags, + /// [in] buffer creation type + ur_buffer_create_type_t bufferCreateType, + /// [in] pointer to buffer create region information + const ur_buffer_region_t *pRegion, + /// [out] pointer to the handle of sub buffer created + ur_mem_handle_t *phMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return platform native mem handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability platform extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// - The implementation may require a valid device handle to return the +/// native mem handle +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hMem` +/// + If `hDevice == NULL` and the implementation requires a valid +/// device. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeMem` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urMemGetNativeHandle( + /// [in] handle of the mem. + ur_mem_handle_t hMem, + /// [in][optional] handle of the device that the native handle will be + /// resident on. + ur_device_handle_t hDevice, + /// [out] a pointer to the native handle of the mem. + ur_native_handle_t *phNativeMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native memory object creation properties +typedef struct ur_mem_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_mem_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime buffer memory object from native memory handle. +/// +/// @details +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phMem` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( + /// [in][nocheck] the native handle to the memory. + ur_native_handle_t hNativeMem, + /// [in] handle of the context object. + ur_context_handle_t hContext, + /// [in][optional] pointer to native memory creation properties. + const ur_mem_native_properties_t *pProperties, + /// [out][alloc] pointer to handle of buffer memory object created. + ur_mem_handle_t *phMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime image memory object from native memory handle. +/// +/// @details +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pImageFormat` +/// + `NULL == pImageDesc` +/// + `NULL == phMem` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( + /// [in][nocheck] the native handle to the memory. + ur_native_handle_t hNativeMem, + /// [in] handle of the context object. + ur_context_handle_t hContext, + /// [in] pointer to image format specification. + const ur_image_format_t *pImageFormat, + /// [in] pointer to image description. + const ur_image_desc_t *pImageDesc, + /// [in][optional] pointer to native memory creation properties. + const ur_mem_native_properties_t *pProperties, + /// [out][alloc pointer to handle of image memory object created. + ur_mem_handle_t *phMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieve information about a memory object. +/// +/// @details +/// - Query information that is common to all memory objects. +/// +/// @remarks +/// _Analogues_ +/// - **clGetMemObjectInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_MEM_INFO_REFERENCE_COUNT < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo( + /// [in] handle to the memory object being queried. + ur_mem_handle_t hMemory, + /// [in] type of the info to retrieve. + ur_mem_info_t propName, + /// [in] the number of bytes of memory pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If propSize is less than the real number of bytes needed to return + /// the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieve information about an image object. +/// +/// @details +/// - Query information specific to an image object. +/// +/// @remarks +/// _Analogues_ +/// - **clGetImageInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_IMAGE_INFO_NUM_SAMPLES < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo( + /// [in] handle to the image object being queried. + ur_mem_handle_t hMemory, + /// [in] type of image info to retrieve. + ur_image_info_t propName, + /// [in] the number of bytes of memory pointer to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If propSize is less than the real number of bytes needed to return + /// the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region sampler +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sampler Filter Mode +typedef enum ur_sampler_filter_mode_t { + /// Filter mode nearest. + UR_SAMPLER_FILTER_MODE_NEAREST = 0, + /// Filter mode linear. + UR_SAMPLER_FILTER_MODE_LINEAR = 1, + /// @cond + UR_SAMPLER_FILTER_MODE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_sampler_filter_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sampler addressing mode +typedef enum ur_sampler_addressing_mode_t { + /// None + UR_SAMPLER_ADDRESSING_MODE_NONE = 0, + /// Clamp to edge + UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE = 1, + /// Clamp + UR_SAMPLER_ADDRESSING_MODE_CLAMP = 2, + /// Repeat + UR_SAMPLER_ADDRESSING_MODE_REPEAT = 3, + /// Mirrored Repeat + UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT = 4, + /// @cond + UR_SAMPLER_ADDRESSING_MODE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_sampler_addressing_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get sample object information +typedef enum ur_sampler_info_t { + /// [uint32_t] Reference count of the sampler object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_SAMPLER_INFO_REFERENCE_COUNT = 0, + /// [::ur_context_handle_t] Sampler context info + UR_SAMPLER_INFO_CONTEXT = 1, + /// [::ur_bool_t] Sampler normalized coordinate setting + UR_SAMPLER_INFO_NORMALIZED_COORDS = 2, + /// [::ur_sampler_addressing_mode_t] Sampler addressing mode setting + UR_SAMPLER_INFO_ADDRESSING_MODE = 3, + /// [::ur_sampler_filter_mode_t] Sampler filter mode setting + UR_SAMPLER_INFO_FILTER_MODE = 4, + /// @cond + UR_SAMPLER_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_sampler_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sampler description. +typedef struct ur_sampler_desc_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_SAMPLER_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Specify if image coordinates are normalized (true) or not (false) + bool normalizedCoords; + /// [in] Specify the address mode of the sampler + ur_sampler_addressing_mode_t addressingMode; + /// [in] Specify the filter mode of the sampler + ur_sampler_filter_mode_t filterMode; + +} ur_sampler_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a sampler object in a context +/// +/// @details +/// - The props parameter specifies a list of sampler property names and +/// their corresponding values. +/// - The list is terminated with 0. If the list is NULL, default values +/// will be used. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateSamplerWithProperties** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDesc` +/// + `NULL == phSampler` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT < +/// pDesc->addressingMode` +/// + `::UR_SAMPLER_FILTER_MODE_LINEAR < pDesc->filterMode` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urSamplerCreate( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] pointer to the sampler description + const ur_sampler_desc_t *pDesc, + /// [out][alloc] pointer to handle of sampler object created + ur_sampler_handle_t *phSampler); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the sampler object handle. Increment its reference +/// count +/// +/// @remarks +/// _Analogues_ +/// - **clRetainSampler** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hSampler` +/// - ::UR_RESULT_ERROR_INVALID_SAMPLER +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urSamplerRetain( + /// [in][retain] handle of the sampler object to get access + ur_sampler_handle_t hSampler); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Decrement the sampler's reference count and delete the sampler if the +/// reference count becomes zero. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseSampler** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hSampler` +/// - ::UR_RESULT_ERROR_INVALID_SAMPLER +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urSamplerRelease( + /// [in][release] handle of the sampler object to release + ur_sampler_handle_t hSampler); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query information about a sampler object +/// +/// @remarks +/// _Analogues_ +/// - **clGetSamplerInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hSampler` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_SAMPLER_INFO_FILTER_MODE < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_SAMPLER +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urSamplerGetInfo( + /// [in] handle of the sampler object + ur_sampler_handle_t hSampler, + /// [in] name of the sampler property to query + ur_sampler_info_t propName, + /// [in] size in bytes of the sampler property value provided + size_t propSize, + /// [out][typename(propName, propSize)][optional] value of the sampler + /// property + void *pPropValue, + /// [out][optional] size in bytes returned in sampler property value + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return sampler native sampler handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability sampler extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hSampler` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeSampler` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urSamplerGetNativeHandle( + /// [in] handle of the sampler. + ur_sampler_handle_t hSampler, + /// [out] a pointer to the native handle of the sampler. + ur_native_handle_t *phNativeSampler); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native sampler creation properties +typedef struct ur_sampler_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_sampler_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime sampler object from native sampler handle. +/// +/// @details +/// - Creates runtime sampler handle from native driver sampler handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phSampler` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( + /// [in][nocheck] the native handle of the sampler. + ur_native_handle_t hNativeSampler, + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in][optional] pointer to native sampler properties struct. + const ur_sampler_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the sampler object created. + ur_sampler_handle_t *phSampler); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region usm +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM host memory property flags +typedef uint32_t ur_usm_host_mem_flags_t; +typedef enum ur_usm_host_mem_flag_t { + /// Optimize shared allocation for first access on the host + UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT = UR_BIT(0), + /// @cond + UR_USM_HOST_MEM_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_host_mem_flag_t; +/// @brief Bit Mask for validating ur_usm_host_mem_flags_t +#define UR_USM_HOST_MEM_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM device memory property flags +typedef uint32_t ur_usm_device_mem_flags_t; +typedef enum ur_usm_device_mem_flag_t { + /// Memory should be allocated write-combined (WC) + UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED = UR_BIT(0), + /// Optimize shared allocation for first access on the device + UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT = UR_BIT(1), + /// Memory is only possibly modified from the host, but read-only in all + /// device code + UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY = UR_BIT(2), + /// @cond + UR_USM_DEVICE_MEM_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_device_mem_flag_t; +/// @brief Bit Mask for validating ur_usm_device_mem_flags_t +#define UR_USM_DEVICE_MEM_FLAGS_MASK 0xfffffff8 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM memory property flags +typedef uint32_t ur_usm_pool_flags_t; +typedef enum ur_usm_pool_flag_t { + /// All coarse-grain allocations (allocations from the driver) will be + /// zero-initialized. + UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK = UR_BIT(0), + /// @cond + UR_USM_POOL_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_pool_flag_t; +/// @brief Bit Mask for validating ur_usm_pool_flags_t +#define UR_USM_POOL_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocation type +typedef enum ur_usm_type_t { + /// Unknown USM type + UR_USM_TYPE_UNKNOWN = 0, + /// Host USM type + UR_USM_TYPE_HOST = 1, + /// Device USM type + UR_USM_TYPE_DEVICE = 2, + /// Shared USM type + UR_USM_TYPE_SHARED = 3, + /// @cond + UR_USM_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM memory allocation information type +typedef enum ur_usm_alloc_info_t { + /// [::ur_usm_type_t] Memory allocation type info + UR_USM_ALLOC_INFO_TYPE = 0, + /// [void *] Memory allocation base pointer info + UR_USM_ALLOC_INFO_BASE_PTR = 1, + /// [size_t] Memory allocation size info + UR_USM_ALLOC_INFO_SIZE = 2, + /// [::ur_device_handle_t] Memory allocation device info + UR_USM_ALLOC_INFO_DEVICE = 3, + /// [::ur_usm_pool_handle_t][optional-query] Memory allocation pool info + UR_USM_ALLOC_INFO_POOL = 4, + /// @cond + UR_USM_ALLOC_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_alloc_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM memory advice +typedef uint32_t ur_usm_advice_flags_t; +typedef enum ur_usm_advice_flag_t { + /// The USM memory advice is default + UR_USM_ADVICE_FLAG_DEFAULT = UR_BIT(0), + /// Hint that memory will be read from frequently and written to rarely + UR_USM_ADVICE_FLAG_SET_READ_MOSTLY = UR_BIT(1), + /// Removes the affect of ::UR_USM_ADVICE_FLAG_SET_READ_MOSTLY + UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY = UR_BIT(2), + /// Hint that the preferred memory location is the specified device + UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION = UR_BIT(3), + /// Removes the affect of ::UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION + UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION = UR_BIT(4), + /// Hint that memory will mostly be accessed non-atomically + UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY = UR_BIT(5), + /// Removes the affect of ::UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY + UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY = UR_BIT(6), + /// Hint that memory should be cached + UR_USM_ADVICE_FLAG_BIAS_CACHED = UR_BIT(7), + /// Hint that memory should be not be cached + UR_USM_ADVICE_FLAG_BIAS_UNCACHED = UR_BIT(8), + /// Hint that memory will be mostly accessed by the specified device + UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE = UR_BIT(9), + /// Removes the affect of ::UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE + UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE = UR_BIT(10), + /// Hint that memory will be mostly accessed by the host + UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST = UR_BIT(11), + /// Removes the affect of ::UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST + UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST = UR_BIT(12), + /// Hint that the preferred memory location is the host + UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST = UR_BIT(13), + /// Removes the affect of ::UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST + UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST = UR_BIT(14), + /// Hint that memory coherence will be coarse-grained (up-to-date only at + /// kernel boundaries) + UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY = UR_BIT(15), + /// Removes the effect of ::UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY + UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY = UR_BIT(16), + /// @cond + UR_USM_ADVICE_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_advice_flag_t; +/// @brief Bit Mask for validating ur_usm_advice_flags_t +#define UR_USM_ADVICE_FLAGS_MASK 0xfffe0000 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of USM pool +typedef struct ur_usm_pool_handle_t_ *ur_usm_pool_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocation descriptor type. +typedef struct ur_usm_desc_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_USM_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Memory advice hints + ur_usm_advice_flags_t hints; + /// [in] alignment of the USM memory object + /// Must be zero or a power of 2. + /// Must be equal to or smaller than the size of the largest data type + /// supported by `hDevice`. + uint32_t align; + +} ur_usm_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM host allocation descriptor type. +/// +/// @details +/// - Specify these properties in ::urUSMHostAlloc and ::urUSMSharedAlloc +/// via ::ur_usm_desc_t as part of a `pNext` chain. +typedef struct ur_usm_host_desc_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_USM_HOST_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] host memory allocation flags + ur_usm_host_mem_flags_t flags; + +} ur_usm_host_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM device allocation descriptor type. +/// +/// @details +/// - Specify these properties in ::urUSMDeviceAlloc and ::urUSMSharedAlloc +/// via ::ur_usm_desc_t as part of a `pNext` chain. +typedef struct ur_usm_device_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_USM_DEVICE_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] device memory allocation flags. + ur_usm_device_mem_flags_t flags; + +} ur_usm_device_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocation location desc +/// +/// @details +/// - Specify these properties in ::urUSMHostAlloc, ::urUSMDeviceAlloc and +/// ::urUSMSharedAlloc via ::ur_usm_desc_t as part of a `pNext` chain. +/// +/// @remarks +/// _Analogues_ +/// - cl_intel_mem_alloc_buffer_location +typedef struct ur_usm_alloc_location_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Identifies the ID of global memory partition to which the memory + /// should be allocated. + uint32_t location; + +} ur_usm_alloc_location_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM pool descriptor type +typedef struct ur_usm_pool_desc_t { + /// [in] type of this structure, must be ::UR_STRUCTURE_TYPE_USM_POOL_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] memory allocation flags + ur_usm_pool_flags_t flags; + +} ur_usm_pool_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM pool limits descriptor type +/// +/// @details +/// - Specify these properties in ::urUSMPoolCreate via ::ur_usm_pool_desc_t +/// as part of a `pNext` chain. +typedef struct ur_usm_pool_limits_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Allocations up to this limit will be subject to pooling + size_t maxPoolableSize; + /// [in] Minimum allocation size that will be requested from the driver + size_t minDriverAllocSize; + +} ur_usm_pool_limits_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocate host memory +/// +/// @details +/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation +/// will be served from a specified memory pool. +/// - Otherwise, the behavior is implementation-defined. +/// - Allocations served from different memory pools must be isolated and +/// must not reside on the same page. +/// - Any flags/hints passed through pUSMDesc only affect the single +/// allocation. +/// - See also ::ur_usm_host_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If ::UR_DEVICE_INFO_USM_HOST_SUPPORT is false. +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & +/// (pUSMDesc->align-1)) != 0)` +/// + If `align` is greater that the size of the largest data type +/// supported by any device in `hContext`. +/// - ::UR_RESULT_ERROR_INVALID_USM_SIZE +/// + `size == 0` +/// + `size` is greater than ::UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE for any +/// device in `hContext` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMHostAlloc( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in][optional] USM memory allocation descriptor + const ur_usm_desc_t *pUSMDesc, + /// [in][optional] Pointer to a pool created using urUSMPoolCreate + ur_usm_pool_handle_t pool, + /// [in] minimum size in bytes of the USM memory object to be allocated + size_t size, + /// [out] pointer to USM host memory object + void **ppMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocate device memory +/// +/// @details +/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation +/// will be served from a specified memory pool. +/// - Otherwise, the behavior is implementation-defined. +/// - Allocations served from different memory pools must be isolated and +/// must not reside on the same page. +/// - Any flags/hints passed through pUSMDesc only affect the single +/// allocation. +/// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If ::UR_DEVICE_INFO_USM_HOST_SUPPORT is false. +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & +/// (pUSMDesc->align-1)) != 0)` +/// + If `align` is greater that the size of the largest data type +/// supported by `hDevice`. +/// - ::UR_RESULT_ERROR_INVALID_USM_SIZE +/// + `size == 0` +/// + `size` is greater than ::UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMDeviceAlloc( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][optional] USM memory allocation descriptor + const ur_usm_desc_t *pUSMDesc, + /// [in][optional] Pointer to a pool created using urUSMPoolCreate + ur_usm_pool_handle_t pool, + /// [in] minimum size in bytes of the USM memory object to be allocated + size_t size, + /// [out] pointer to USM device memory object + void **ppMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocate shared memory +/// +/// @details +/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation +/// will be served from a specified memory pool. +/// - Otherwise, the behavior is implementation-defined. +/// - Allocations served from different memory pools must be isolated and +/// must not reside on the same page. +/// - Any flags/hints passed through pUSMDesc only affect the single +/// allocation. +/// - See also ::ur_usm_host_desc_t. +/// - See also ::ur_usm_device_desc_t. +/// - See also ::ur_usm_alloc_location_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & +/// (pUSMDesc->align-1)) != 0)` +/// + If `align` is greater that the size of the largest data type +/// supported by `hDevice`. +/// - ::UR_RESULT_ERROR_INVALID_USM_SIZE +/// + `size == 0` +/// + `size` is greater than ::UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE. +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If `UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT` and +/// `UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT` are both false. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMSharedAlloc( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][optional] Pointer to USM memory allocation descriptor. + const ur_usm_desc_t *pUSMDesc, + /// [in][optional] Pointer to a pool created using urUSMPoolCreate + ur_usm_pool_handle_t pool, + /// [in] minimum size in bytes of the USM memory object to be allocated + size_t size, + /// [out] pointer to USM shared memory object + void **ppMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Free the USM memory object +/// +/// @details +/// - Note that implementations are required to wait for previously enqueued +/// commands that may be accessing `pMem` to finish before freeing the +/// memory. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urUSMFree( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] pointer to USM memory object + void *pMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get USM memory object allocation information +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ALLOC_INFO_POOL < propName` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urUSMGetMemAllocInfo( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] pointer to USM memory object + const void *pMem, + /// [in] the name of the USM allocation property to query + ur_usm_alloc_info_t propName, + /// [in] size in bytes of the USM allocation property value + size_t propSize, + /// [out][optional][typename(propName, propSize)] value of the USM + /// allocation property + void *pPropValue, + /// [out][optional] bytes returned in USM allocation property + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create USM memory pool with desired properties. +/// +/// @details +/// - UR can create multiple instances of the pool depending on allocation +/// requests. +/// - See also ::ur_usm_pool_limits_desc_t. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPoolDesc` +/// + `NULL == ppPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_FLAGS_MASK & pPoolDesc->flags` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If any device associated with `hContext` reports `false` for +/// ::UR_DEVICE_INFO_USM_POOL_SUPPORT +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolCreate( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] pointer to USM pool descriptor. Can be chained with + /// ::ur_usm_pool_limits_desc_t + ur_usm_pool_desc_t *pPoolDesc, + /// [out][alloc] pointer to USM memory pool + ur_usm_pool_handle_t *ppPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the pool handle. Increment its reference count +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolRetain( + /// [in][retain] pointer to USM memory pool + ur_usm_pool_handle_t pPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Decrement the pool's reference count and delete the pool if the +/// reference count becomes zero. +/// +/// @details +/// - All allocation belonging to the pool must be freed prior to the the +/// reference count becoming zero. +/// - If the pool is deleted, this function returns all its reserved memory +/// to the driver. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == pPool` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolRelease( + /// [in][release] pointer to USM memory pool + ur_usm_pool_handle_t pPool); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get USM memory pool information +typedef enum ur_usm_pool_info_t { + /// [uint32_t] Reference count of the pool object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_USM_POOL_INFO_REFERENCE_COUNT = 0, + /// [::ur_context_handle_t] USM memory pool context info + UR_USM_POOL_INFO_CONTEXT = 1, + /// @cond + UR_USM_POOL_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_pool_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query information about a USM memory pool +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPool` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_POOL_INFO_CONTEXT < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +UR_APIEXPORT ur_result_t UR_APICALL urUSMPoolGetInfo( + /// [in] handle of the USM memory pool + ur_usm_pool_handle_t hPool, + /// [in] name of the pool property to query + ur_usm_pool_info_t propName, + /// [in] size in bytes of the pool property value provided + size_t propSize, + /// [out][optional][typename(propName, propSize)] value of the pool + /// property + void *pPropValue, + /// [out][optional] size in bytes returned in pool property value + size_t *pPropSizeRet); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region virtual_memory +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Virtual memory granularity info +typedef enum ur_virtual_mem_granularity_info_t { + /// [size_t] size in bytes of the minimum virtual memory granularity. + UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM = 0x30100, + /// [size_t] size in bytes of the recommended virtual memory granularity. + UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED = 0x30101, + /// @cond + UR_VIRTUAL_MEM_GRANULARITY_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_virtual_mem_granularity_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get information about the minimum and recommended granularity of +/// physical and virtual memory. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemGranularityGetInfo( + /// [in] handle of the context object. + ur_context_handle_t hContext, + /// [in][optional] is the device to get the granularity from, if the + /// device is null then the granularity is suitable for all devices in + /// context. + ur_device_handle_t hDevice, + /// [in] type of the info to query. + ur_virtual_mem_granularity_info_t propName, + /// [in] size in bytes of the memory pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. If propSize is less than the real number of bytes needed to + /// return the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is + /// returned and pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName." + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserve a virtual memory range. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppStart` +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemReserve( + /// [in] handle of the context object. + ur_context_handle_t hContext, + /// [in][optional] pointer to the start of the virtual memory region to + /// reserve, specifying a null value causes the implementation to select a + /// start address. + const void *pStart, + /// [in] size in bytes of the virtual address range to reserve. + size_t size, + /// [out] pointer to the returned address at the start of reserved virtual + /// memory range. + void **ppStart); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Free a virtual memory range. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pStart` +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemFree( + /// [in] handle of the context object. + ur_context_handle_t hContext, + /// [in] pointer to the start of the virtual memory range to free. + const void *pStart, + /// [in] size in bytes of the virtual memory range to free. + size_t size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Virtual memory access mode flags. +typedef uint32_t ur_virtual_mem_access_flags_t; +typedef enum ur_virtual_mem_access_flag_t { + /// Virtual memory has no access. + UR_VIRTUAL_MEM_ACCESS_FLAG_NONE = UR_BIT(0), + /// Virtual memory has both read and write access. + UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE = UR_BIT(1), + /// Virtual memory has read only access. + UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY = UR_BIT(2), + /// @cond + UR_VIRTUAL_MEM_ACCESS_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_virtual_mem_access_flag_t; +/// @brief Bit Mask for validating ur_virtual_mem_access_flags_t +#define UR_VIRTUAL_MEM_ACCESS_FLAGS_MASK 0xfffffff8 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Map a virtual memory range to a physical memory handle. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hPhysicalMem` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pStart` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_VIRTUAL_MEM_ACCESS_FLAGS_MASK & flags` +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemMap( + /// [in] handle to the context object. + ur_context_handle_t hContext, + /// [in] pointer to the start of the virtual memory range. + const void *pStart, + /// [in] size in bytes of the virtual memory range to map. + size_t size, + /// [in] handle of the physical memory to map pStart to. + ur_physical_mem_handle_t hPhysicalMem, + /// [in] offset in bytes into the physical memory to map pStart to. + size_t offset, + /// [in] access flags for the physical memory mapping. + ur_virtual_mem_access_flags_t flags); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Unmap a virtual memory range previously mapped in a context. +/// +/// @details +/// - After a call to this function, the virtual memory range is left in a +/// state ready to be remapped. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pStart` +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemUnmap( + /// [in] handle to the context object. + ur_context_handle_t hContext, + /// [in] pointer to the start of the mapped virtual memory range + const void *pStart, + /// [in] size in bytes of the virtual memory range. + size_t size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the access mode of a mapped virtual memory range. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pStart` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_VIRTUAL_MEM_ACCESS_FLAGS_MASK & flags` +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemSetAccess( + /// [in] handle to the context object. + ur_context_handle_t hContext, + /// [in] pointer to the start of the virtual memory range. + const void *pStart, + /// [in] size in bytes of the virtual memory range. + size_t size, + /// [in] access flags to set for the mapped virtual memory range. + ur_virtual_mem_access_flags_t flags); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Virtual memory range info queries. +typedef enum ur_virtual_mem_info_t { + /// [::ur_virtual_mem_access_flags_t] access flags of a mapped virtual + /// memory range. + UR_VIRTUAL_MEM_INFO_ACCESS_MODE = 0, + /// @cond + UR_VIRTUAL_MEM_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_virtual_mem_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get information about a mapped virtual memory range. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pStart` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_VIRTUAL_MEM_INFO_ACCESS_MODE < propName` +UR_APIEXPORT ur_result_t UR_APICALL urVirtualMemGetInfo( + /// [in] handle to the context object. + ur_context_handle_t hContext, + /// [in] pointer to the start of the virtual memory range. + const void *pStart, + /// [in] size in bytes of the virtual memory range. + size_t size, + /// [in] type of the info to query. + ur_virtual_mem_info_t propName, + /// [in] size in bytes of the memory pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. If propSize is less than the real number of bytes needed to + /// return the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is + /// returned and pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName." + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Physical memory creation properties. +typedef uint32_t ur_physical_mem_flags_t; +typedef enum ur_physical_mem_flag_t { + /// reserved for future use. + UR_PHYSICAL_MEM_FLAG_TBD = UR_BIT(0), + /// @cond + UR_PHYSICAL_MEM_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_physical_mem_flag_t; +/// @brief Bit Mask for validating ur_physical_mem_flags_t +#define UR_PHYSICAL_MEM_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Physical memory creation properties. +typedef struct ur_physical_mem_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] physical memory creation flags + ur_physical_mem_flags_t flags; + +} ur_physical_mem_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a physical memory handle that virtual memory can be mapped to. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_PHYSICAL_MEM_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phPhysicalMem` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If size is not a multiple of +/// ::UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM. +UR_APIEXPORT ur_result_t UR_APICALL urPhysicalMemCreate( + /// [in] handle of the context object. + ur_context_handle_t hContext, + /// [in] handle of the device object. + ur_device_handle_t hDevice, + /// [in] size in bytes of physical memory to allocate, must be a multiple + /// of ::UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM. + size_t size, + /// [in][optional] pointer to physical memory creation properties. + const ur_physical_mem_properties_t *pProperties, + /// [out][alloc] pointer to handle of physical memory object created. + ur_physical_mem_handle_t *phPhysicalMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retain a physical memory handle, increment its reference count. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPhysicalMem` +UR_APIEXPORT ur_result_t UR_APICALL urPhysicalMemRetain( + /// [in][retain] handle of the physical memory object to retain. + ur_physical_mem_handle_t hPhysicalMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release a physical memory handle, decrement its reference count. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPhysicalMem` +UR_APIEXPORT ur_result_t UR_APICALL urPhysicalMemRelease( + /// [in][release] handle of the physical memory object to release. + ur_physical_mem_handle_t hPhysicalMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Physical memory range info queries. +typedef enum ur_physical_mem_info_t { + /// [::ur_context_handle_t] context in which the physical memory object + /// was created. + UR_PHYSICAL_MEM_INFO_CONTEXT = 0, + /// [::ur_device_handle_t] device associated with this physical memory + /// object. + UR_PHYSICAL_MEM_INFO_DEVICE = 1, + /// [size_t] actual size of the physical memory object in bytes. + UR_PHYSICAL_MEM_INFO_SIZE = 2, + /// [::ur_physical_mem_properties_t] properties set when creating this + /// physical memory object. + UR_PHYSICAL_MEM_INFO_PROPERTIES = 3, + /// [uint32_t] Reference count of the physical memory object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT = 4, + /// @cond + UR_PHYSICAL_MEM_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_physical_mem_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get information about a physical memory object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hPhysicalMem` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT < propName` +UR_APIEXPORT ur_result_t UR_APICALL urPhysicalMemGetInfo( + /// [in] handle of the physical memory object to query. + ur_physical_mem_handle_t hPhysicalMem, + /// [in] type of the info to query. + ur_physical_mem_info_t propName, + /// [in] size in bytes of the memory pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. If propSize is less than the real number of bytes needed to + /// return the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is + /// returned and pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName." + size_t *pPropSizeRet); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Runtime APIs for Program +#if !defined(__GNUC__) +#pragma region program +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Program metadata property type. +typedef enum ur_program_metadata_type_t { + /// type is a 32-bit integer. + UR_PROGRAM_METADATA_TYPE_UINT32 = 0, + /// type is a 64-bit integer. + UR_PROGRAM_METADATA_TYPE_UINT64 = 1, + /// type is a byte array. + UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY = 2, + /// type is a null-terminated string. + UR_PROGRAM_METADATA_TYPE_STRING = 3, + /// @cond + UR_PROGRAM_METADATA_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_program_metadata_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Program metadata value union. +typedef union ur_program_metadata_value_t { + /// [in] inline storage for the 32-bit data, type + /// ::UR_PROGRAM_METADATA_TYPE_UINT32. + uint32_t data32; + /// [in] inline storage for the 64-bit data, type + /// ::UR_PROGRAM_METADATA_TYPE_UINT64. + uint64_t data64; + /// [in] pointer to null-terminated string data, type + /// ::UR_PROGRAM_METADATA_TYPE_STRING. + char *pString; + /// [in] pointer to binary data, type + /// ::UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY. + void *pData; + +} ur_program_metadata_value_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Program metadata property. +typedef struct ur_program_metadata_t { + /// [in] null-terminated metadata name. + const char *pName; + /// [in] the type of metadata value. + ur_program_metadata_type_t type; + /// [in] size in bytes of the data pointed to by value.pData, or 0 when + /// value size is less than 64-bits and is stored directly in value.data. + size_t size; + /// [in][tagged_by(type)] the metadata value storage. + ur_program_metadata_value_t value; + +} ur_program_metadata_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Program creation properties. +typedef struct ur_program_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] the number of entries in pMetadatas, if count is greater than + /// zero then pMetadatas must not be null. + uint32_t count; + /// [in][optional][range(0,count)] pointer to array of metadata entries. + const ur_program_metadata_t *pMetadatas; + +} ur_program_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a program object from input intermediate language. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The adapter may (but is not required to) perform validation of the +/// provided module during this call. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateProgramWithIL** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pIL` +/// + `NULL == phProgram` +/// + `NULL != pProperties && pProperties->count > 0 && NULL == +/// pProperties->pMetadatas` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NULL != pProperties && NULL != pProperties->pMetadatas && +/// pProperties->count == 0` +/// + `length == 0` +/// - ::UR_RESULT_ERROR_INVALID_BINARY +/// + If `pIL` is not a valid IL binary for devices in `hContext`. +/// - ::UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE +/// + If devices in `hContext` don't have the capability to compile an +/// IL binary at runtime. +UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithIL( + /// [in] handle of the context instance + ur_context_handle_t hContext, + /// [in] pointer to IL binary. + const void *pIL, + /// [in] length of `pIL` in bytes. + size_t length, + /// [in][optional] pointer to program creation properties. + const ur_program_properties_t *pProperties, + /// [out][alloc] pointer to handle of program object created. + ur_program_handle_t *phProgram); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a program object from native binaries for the specified +/// devices. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, `phProgram` will +/// contain binaries of type ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT or +/// ::UR_PROGRAM_BINARY_TYPE_LIBRARY for the specified devices in +/// `phDevices`. +/// - The devices specified by `phDevices` must be associated with the +/// context. +/// - The adapter may (but is not required to) perform validation of the +/// provided modules during this call. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateProgramWithBinary** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// + `NULL == pLengths` +/// + `NULL == ppBinaries` +/// + `NULL == phProgram` +/// + `NULL != pProperties && pProperties->count > 0 && NULL == +/// pProperties->pMetadatas` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NULL != pProperties && NULL != pProperties->pMetadatas && +/// pProperties->count == 0` +/// + `numDevices == 0` +/// - ::UR_RESULT_ERROR_INVALID_NATIVE_BINARY +/// + If any binary in `ppBinaries` isn't a valid binary for the +/// corresponding device in `phDevices.` +UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary( + /// [in] handle of the context instance + ur_context_handle_t hContext, + /// [in] number of devices + uint32_t numDevices, + /// [in][range(0, numDevices)] a pointer to a list of device handles. The + /// binaries are loaded for devices specified in this list. + ur_device_handle_t *phDevices, + /// [in][range(0, numDevices)] array of sizes of program binaries + /// specified by `pBinaries` (in bytes). + size_t *pLengths, + /// [in][range(0, numDevices)] pointer to program binaries to be loaded + /// for devices specified by `phDevices`. + const uint8_t **ppBinaries, + /// [in][optional] pointer to program creation properties. + const ur_program_properties_t *pProperties, + /// [out][alloc] pointer to handle of Program object created. + ur_program_handle_t *phProgram); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `hContext`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild( + /// [in] handle of the context instance. + ur_context_handle_t hContext, + /// [in] Handle of the program to build. + ur_program_handle_t hProgram, + /// [in][optional] pointer to build options null-terminated string. + const char *pOptions); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point `hProgram` will +/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type +/// for each device in `hContext`. +/// +/// @remarks +/// _Analogues_ +/// - **clCompileProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred while compiling `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL urProgramCompile( + /// [in] handle of the context instance. + ur_context_handle_t hContext, + /// [in][out] handle of the program to compile. + ur_program_handle_t hProgram, + /// [in][optional] pointer to build options null-terminated string. + const char *pOptions); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point the program returned +/// in `phProgram` will contain a binary of the +/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in +/// `hContext`. +/// - If a non-success code is returned and `phProgram` is not `nullptr`, it +/// will contain an unspecified program or `nullptr`. Implementations may +/// use the build log of this program (accessible via +/// ::urProgramGetBuildInfo) to provide an error log for the linking +/// failure. +/// +/// @remarks +/// _Analogues_ +/// - **clLinkProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phPrograms` +/// + `NULL == phProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If one of the programs in `phPrograms` isn't a valid program +/// object. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE +/// + If an error occurred while linking `phPrograms`. +UR_APIEXPORT ur_result_t UR_APICALL urProgramLink( + /// [in] handle of the context instance. + ur_context_handle_t hContext, + /// [in] number of program handles in `phPrograms`. + uint32_t count, + /// [in][range(0, count)] pointer to array of program handles. + const ur_program_handle_t *phPrograms, + /// [in][optional] pointer to linker options null-terminated string. + const char *pOptions, + /// [out][alloc] pointer to handle of program object created. + ur_program_handle_t *phProgram); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the Program object. +/// +/// @details +/// - Get a reference to the Program object handle. Increment its reference +/// count +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clRetainProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +UR_APIEXPORT ur_result_t UR_APICALL urProgramRetain( + /// [in][retain] handle for the Program to retain + ur_program_handle_t hProgram); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release Program. +/// +/// @details +/// - Decrement reference count and destroy the Program if reference count +/// becomes zero. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +UR_APIEXPORT ur_result_t UR_APICALL urProgramRelease( + /// [in][release] handle for the Program to release + ur_program_handle_t hProgram); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves a device function pointer to a user-defined function. +/// +/// @details +/// - Retrieves a pointer to the functions with the given name and defined +/// in the given program. +/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE is returned if the +/// function can not be obtained. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clGetDeviceFunctionPointerINTEL** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pFunctionName` +/// + `NULL == ppFunctionPointer` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME +/// + If `pFunctionName` couldn't be found in `hProgram`. +/// - ::UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE +/// + If `pFunctionName` could be located, but its address couldn't be +/// retrieved. +UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer( + /// [in] handle of the device to retrieve pointer for. + ur_device_handle_t hDevice, + /// [in] handle of the program to search for function in. + /// The program must already be built to the specified device, or + /// otherwise ::UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE is returned. + ur_program_handle_t hProgram, + /// [in] A null-terminates string denoting the mangled function name. + const char *pFunctionName, + /// [out] Returns the pointer to the function if it is found in the program. + void **ppFunctionPointer); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves a pointer to a device global variable. +/// +/// @details +/// - Retrieves a pointer to a device global variable. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @remarks +/// _Analogues_ +/// - **clGetDeviceGlobalVariablePointerINTEL** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hDevice` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalVariableName` +/// + `NULL == ppGlobalVariablePointerRet` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `name` is not a valid variable in the program. +UR_APIEXPORT ur_result_t UR_APICALL urProgramGetGlobalVariablePointer( + /// [in] handle of the device to retrieve the pointer for. + ur_device_handle_t hDevice, + /// [in] handle of the program where the global variable is. + ur_program_handle_t hProgram, + /// [in] mangled name of the global variable to retrieve the pointer for. + const char *pGlobalVariableName, + /// [out][optional] Returns the size of the global variable if it is found + /// in the program. + size_t *pGlobalVariableSizeRet, + /// [out] Returns the pointer to the global variable if it is found in the + /// program. + void **ppGlobalVariablePointerRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Program object information +typedef enum ur_program_info_t { + /// [uint32_t] Reference count of the program object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_PROGRAM_INFO_REFERENCE_COUNT = 0, + /// [::ur_context_handle_t] Program context info. + UR_PROGRAM_INFO_CONTEXT = 1, + /// [uint32_t] Return number of devices associated with Program. + UR_PROGRAM_INFO_NUM_DEVICES = 2, + /// [::ur_device_handle_t[]] Return list of devices associated with a program. + /// This is either the list of devices associated with the context or a + /// subset of those devices when the program is created using + /// ::urProgramCreateWithBinary. + UR_PROGRAM_INFO_DEVICES = 3, + /// [char[]] Return program IL if the program was created with + /// ::urProgramCreateWithIL, otherwise return size will be set to 0 and + /// nothing will be returned. + UR_PROGRAM_INFO_IL = 4, + /// [size_t[]] Return program binary sizes for each device. + UR_PROGRAM_INFO_BINARY_SIZES = 5, + /// [unsigned char[]] Return program binaries for all devices for this + /// Program. + UR_PROGRAM_INFO_BINARIES = 6, + /// [size_t][optional-query] Number of kernels in Program, return type + /// size_t. + UR_PROGRAM_INFO_NUM_KERNELS = 7, + /// [char[]][optional-query] Return a null-terminated, semi-colon + /// separated list of kernel names in Program. + UR_PROGRAM_INFO_KERNEL_NAMES = 8, + /// @cond + UR_PROGRAM_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_program_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query information about a Program object +/// +/// @remarks +/// _Analogues_ +/// - **clGetProgramInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_PROGRAM_INFO_KERNEL_NAMES < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urProgramGetInfo( + /// [in] handle of the Program object + ur_program_handle_t hProgram, + /// [in] name of the Program property to query + ur_program_info_t propName, + /// [in] the size of the Program property. + size_t propSize, + /// [in,out][optional][typename(propName, propSize)] array of bytes of + /// holding the program info property. + /// If propSize is not equal to or greater than the real number of bytes + /// needed to return + /// the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Program object build status +typedef enum ur_program_build_status_t { + /// Program build status none + UR_PROGRAM_BUILD_STATUS_NONE = 0, + /// Program build error + UR_PROGRAM_BUILD_STATUS_ERROR = 1, + /// Program build success + UR_PROGRAM_BUILD_STATUS_SUCCESS = 2, + /// Program build in progress + UR_PROGRAM_BUILD_STATUS_IN_PROGRESS = 3, + /// @cond + UR_PROGRAM_BUILD_STATUS_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_program_build_status_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Program object binary type +typedef enum ur_program_binary_type_t { + /// No program binary is associated with device + UR_PROGRAM_BINARY_TYPE_NONE = 0, + /// Program binary is compiled object + UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT = 1, + /// Program binary is library object + UR_PROGRAM_BINARY_TYPE_LIBRARY = 2, + /// Program binary is executable + UR_PROGRAM_BINARY_TYPE_EXECUTABLE = 3, + /// @cond + UR_PROGRAM_BINARY_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_program_binary_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Program object build information +typedef enum ur_program_build_info_t { + /// [::ur_program_build_status_t] Program build status. + UR_PROGRAM_BUILD_INFO_STATUS = 0, + /// [char[]] Null-terminated options string specified by last build, + /// compile or link operation performed on the program. + UR_PROGRAM_BUILD_INFO_OPTIONS = 1, + /// [char[]] Null-terminated program build log. + UR_PROGRAM_BUILD_INFO_LOG = 2, + /// [::ur_program_binary_type_t] Program binary type. + UR_PROGRAM_BUILD_INFO_BINARY_TYPE = 3, + /// @cond + UR_PROGRAM_BUILD_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_program_build_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query build information about a Program object for a Device +/// +/// @remarks +/// _Analogues_ +/// - **clGetProgramBuildInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_PROGRAM_BUILD_INFO_BINARY_TYPE < propName` +UR_APIEXPORT ur_result_t UR_APICALL urProgramGetBuildInfo( + /// [in] handle of the Program object + ur_program_handle_t hProgram, + /// [in] handle of the Device object + ur_device_handle_t hDevice, + /// [in] name of the Program build info to query + ur_program_build_info_t propName, + /// [in] size of the Program build info property. + size_t propSize, + /// [in,out][optional][typename(propName, propSize)] value of the Program + /// build property. + /// If propSize is not equal to or greater than the real number of bytes + /// needed to return the info then the ::UR_RESULT_ERROR_INVALID_SIZE + /// error is returned and pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of data being + /// queried by propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Specialization constant information +typedef struct ur_specialization_constant_info_t { + /// [in] specialization constant Id + uint32_t id; + /// [in] size of the specialization constant value + size_t size; + /// [in] pointer to the specialization constant value bytes + const void *pValue; + +} ur_specialization_constant_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set an array of specialization constants on a Program. +/// +/// @details +/// - This entry point is optional, the application should query for support +/// with device query +/// ::UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS passed to +/// ::urDeviceGetInfo. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// - `hProgram` must have been created with the ::urProgramCreateWithIL +/// entry point. +/// - Any spec constants set with this entry point will apply only to +/// subsequent calls to ::urProgramBuild or ::urProgramCompile. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSpecConstants` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If ::UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS query is +/// false +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + A pSpecConstant entry contains a size that does not match that of +/// the specialization constant in the module. +/// + A pSpecConstant entry contains a nullptr pValue. +/// - ::UR_RESULT_ERROR_INVALID_SPEC_ID +/// + Any id specified in a pSpecConstant entry is not a valid +/// specialization constant identifier. +UR_APIEXPORT ur_result_t UR_APICALL urProgramSetSpecializationConstants( + /// [in] handle of the Program object + ur_program_handle_t hProgram, + /// [in] the number of elements in the pSpecConstants array + uint32_t count, + /// [in][range(0, count)] array of specialization constant value + /// descriptions + const ur_specialization_constant_info_t *pSpecConstants); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return program native program handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability program extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeProgram` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urProgramGetNativeHandle( + /// [in] handle of the program. + ur_program_handle_t hProgram, + /// [out] a pointer to the native handle of the program. + ur_native_handle_t *phNativeProgram); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native program creation properties +typedef struct ur_program_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_program_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime program object from native program handle. +/// +/// @details +/// - Creates runtime program handle from native driver program handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phProgram` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithNativeHandle( + /// [in][nocheck] the native handle of the program. + ur_native_handle_t hNativeProgram, + /// [in] handle of the context instance + ur_context_handle_t hContext, + /// [in][optional] pointer to native program properties struct. + const ur_program_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the program object created. + ur_program_handle_t *phProgram); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Program +#if !defined(__GNUC__) +#pragma region kernel +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create kernel object from a program. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pKernelName` +/// + `NULL == phKernel` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_NAME +/// + If `pKernelName` wasn't found in `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL urKernelCreate( + /// [in] handle of the program instance + ur_program_handle_t hProgram, + /// [in] pointer to null-terminated string. + const char *pKernelName, + /// [out][alloc] pointer to handle of kernel object created. + ur_kernel_handle_t *phKernel); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelSetArgValue. +typedef struct ur_kernel_arg_value_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + +} ur_kernel_arg_value_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set kernel argument to a value. +/// +/// @details +/// - The application may call this function from simultaneous threads with +/// the same kernel handle. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pArgValue` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgValue( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] argument index in range [0, num args - 1] + uint32_t argIndex, + /// [in] size of argument type + size_t argSize, + /// [in][optional] pointer to value properties. + const ur_kernel_arg_value_properties_t *pProperties, + /// [in] argument value represented as matching arg type. + /// The data pointed to will be copied and therefore can be reused on + /// return. + const void *pArgValue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelSetArgLocal. +typedef struct ur_kernel_arg_local_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + +} ur_kernel_arg_local_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set kernel argument to a local buffer. +/// +/// @details +/// - The application may call this function from simultaneous threads with +/// the same kernel handle. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgLocal( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] argument index in range [0, num args - 1] + uint32_t argIndex, + /// [in] size of the local buffer to be allocated by the runtime + size_t argSize, + /// [in][optional] pointer to local buffer properties. + const ur_kernel_arg_local_properties_t *pProperties); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Kernel object information +typedef enum ur_kernel_info_t { + /// [char[]] Return null-terminated kernel function name. + UR_KERNEL_INFO_FUNCTION_NAME = 0, + /// [uint32_t] Return Kernel number of arguments. + UR_KERNEL_INFO_NUM_ARGS = 1, + /// [uint32_t] Reference count of the kernel object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_KERNEL_INFO_REFERENCE_COUNT = 2, + /// [::ur_context_handle_t] Return Context object associated with Kernel. + UR_KERNEL_INFO_CONTEXT = 3, + /// [::ur_program_handle_t] Return Program object associated with Kernel. + UR_KERNEL_INFO_PROGRAM = 4, + /// [char[]] Return null-terminated kernel attributes string. + UR_KERNEL_INFO_ATTRIBUTES = 5, + /// [uint32_t][optional-query] Return the number of registers used by the + /// compiled kernel. + UR_KERNEL_INFO_NUM_REGS = 6, + /// [uint32_t[]][optional-query] Return the spill memory size allocated by + /// the compiler. + /// The returned values correspond to the associated devices. + /// The order of the devices is guaranteed (i.e., the same as queried by + /// `urDeviceGet`) by the UR within a single application even if the runtime + /// is reinitialized. + UR_KERNEL_INFO_SPILL_MEM_SIZE = 7, + /// @cond + UR_KERNEL_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_kernel_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Kernel Work Group information +typedef enum ur_kernel_group_info_t { + /// [size_t[3]][optional-query] Return Work Group maximum global size + UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE = 0, + /// [size_t] Return maximum Work Group size + UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE = 1, + /// [size_t[3]] Return Work Group size required by the source code, such + /// as __attribute__((required_work_group_size(X,Y,Z)), or (0, 0, 0) if + /// unspecified + UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE = 2, + /// [size_t] Return local memory required by the Kernel + UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE = 3, + /// [size_t] Return preferred multiple of Work Group size for launch + UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 4, + /// [size_t] Return minimum amount of private memory in bytes used by each + /// work item in the Kernel + UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE = 5, + /// [size_t[3]][optional-query] Return the maximum Work Group size guaranteed + /// by the source code, or (0, 0, 0) if unspecified + UR_KERNEL_GROUP_INFO_COMPILE_MAX_WORK_GROUP_SIZE = 6, + /// [size_t][optional-query] Return the maximum linearized Work Group size + /// (X * Y * Z) guaranteed by the source code, or 0 if unspecified + UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE = 7, + /// @cond + UR_KERNEL_GROUP_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_kernel_group_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Kernel SubGroup information +typedef enum ur_kernel_sub_group_info_t { + /// [uint32_t] Return maximum SubGroup size + UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE = 0, + /// [uint32_t] Return maximum number of SubGroup + UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS = 1, + /// [uint32_t] Return number of SubGroup required by the source code or 0 + /// if unspecified + UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS = 2, + /// [uint32_t] Return SubGroup size required by Intel + UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL = 3, + /// @cond + UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_kernel_sub_group_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Kernel Cache Configuration. +typedef enum ur_kernel_cache_config_t { + /// No preference for SLM or data cache. + UR_KERNEL_CACHE_CONFIG_DEFAULT = 0, + /// Large Shared Local Memory (SLM) size. + UR_KERNEL_CACHE_CONFIG_LARGE_SLM = 1, + /// Large General Data size. + UR_KERNEL_CACHE_CONFIG_LARGE_DATA = 2, + /// @cond + UR_KERNEL_CACHE_CONFIG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_kernel_cache_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set additional Kernel execution information +typedef enum ur_kernel_exec_info_t { + /// [::ur_bool_t] Kernel might access data through USM pointer. + UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS = 0, + /// [void *[]] Provide an explicit array of USM pointers that the kernel + /// will access. + UR_KERNEL_EXEC_INFO_USM_PTRS = 1, + /// [::ur_kernel_cache_config_t] Provide the preferred cache configuration + UR_KERNEL_EXEC_INFO_CACHE_CONFIG = 2, + /// @cond + UR_KERNEL_EXEC_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_kernel_exec_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query information about a Kernel object +/// +/// @remarks +/// _Analogues_ +/// - **clGetKernelInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_KERNEL_INFO_SPILL_MEM_SIZE < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urKernelGetInfo( + /// [in] handle of the Kernel object + ur_kernel_handle_t hKernel, + /// [in] name of the Kernel property to query + ur_kernel_info_t propName, + /// [in] the size of the Kernel property value. + size_t propSize, + /// [in,out][optional][typename(propName, propSize)] array of bytes + /// holding the kernel info property. + /// If propSize is not equal to or greater than the real number of bytes + /// needed to return + /// the info then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of data being + /// queried by propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query work Group information about a Kernel object +/// +/// @remarks +/// _Analogues_ +/// - **clGetKernelWorkGroupInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE < +/// propName` +UR_APIEXPORT ur_result_t UR_APICALL urKernelGetGroupInfo( + /// [in] handle of the Kernel object + ur_kernel_handle_t hKernel, + /// [in] handle of the Device object + ur_device_handle_t hDevice, + /// [in] name of the work Group property to query + ur_kernel_group_info_t propName, + /// [in] size of the Kernel Work Group property value + size_t propSize, + /// [in,out][optional][typename(propName, propSize)] value of the Kernel + /// Work Group property. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of data being + /// queried by propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query SubGroup information about a Kernel object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL < propName` +UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSubGroupInfo( + /// [in] handle of the Kernel object + ur_kernel_handle_t hKernel, + /// [in] handle of the Device object + ur_device_handle_t hDevice, + /// [in] name of the SubGroup property to query + ur_kernel_sub_group_info_t propName, + /// [in] size of the Kernel SubGroup property value + size_t propSize, + /// [in,out][optional][typename(propName, propSize)] value of the Kernel + /// SubGroup property. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of data being + /// queried by propName. + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the Kernel object. +/// +/// @details +/// - Get a reference to the Kernel object handle. Increment its reference +/// count +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clRetainKernel** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +UR_APIEXPORT ur_result_t UR_APICALL urKernelRetain( + /// [in][retain] handle for the Kernel to retain + ur_kernel_handle_t hKernel); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release Kernel. +/// +/// @details +/// - Decrement reference count and destroy the Kernel if reference count +/// becomes zero. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseKernel** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +UR_APIEXPORT ur_result_t UR_APICALL urKernelRelease( + /// [in][release] handle for the Kernel to release + ur_kernel_handle_t hKernel); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelSetArgPointer. +typedef struct ur_kernel_arg_pointer_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + +} ur_kernel_arg_pointer_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a USM pointer as the argument value of a Kernel. +/// +/// @details +/// - The application may call this function from simultaneous threads with +/// the same kernel handle. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clSetKernelArgSVMPointer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgPointer( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] argument index in range [0, num args - 1] + uint32_t argIndex, + /// [in][optional] pointer to USM pointer properties. + const ur_kernel_arg_pointer_properties_t *pProperties, + /// [in][optional] Pointer obtained by USM allocation or virtual memory + /// mapping operation. If null then argument value is considered null. + const void *pArgValue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelSetExecInfo. +typedef struct ur_kernel_exec_info_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + +} ur_kernel_exec_info_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set additional Kernel execution attributes. +/// +/// @details +/// - The application must **not** call this function from simultaneous +/// threads with the same kernel handle. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clSetKernelExecInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_KERNEL_EXEC_INFO_CACHE_CONFIG < propName` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPropValue` +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetExecInfo( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] name of the execution attribute + ur_kernel_exec_info_t propName, + /// [in] size in byte the attribute value + size_t propSize, + /// [in][optional] pointer to execution info properties. + const ur_kernel_exec_info_properties_t *pProperties, + /// [in][typename(propName, propSize)] pointer to memory location holding + /// the property value. + const void *pPropValue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelSetArgSampler. +typedef struct ur_kernel_arg_sampler_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + +} ur_kernel_arg_sampler_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a Sampler object as the argument value of a Kernel. +/// +/// @details +/// - The application may call this function from simultaneous threads with +/// the same kernel handle. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// + `NULL == hArgValue` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgSampler( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] argument index in range [0, num args - 1] + uint32_t argIndex, + /// [in][optional] pointer to sampler properties. + const ur_kernel_arg_sampler_properties_t *pProperties, + /// [in] handle of Sampler object. + ur_sampler_handle_t hArgValue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelSetArgMemObj. +typedef struct ur_kernel_arg_mem_obj_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Memory access flag. Allowed values are: ::UR_MEM_FLAG_READ_WRITE, + /// ::UR_MEM_FLAG_WRITE_ONLY, ::UR_MEM_FLAG_READ_ONLY. + ur_mem_flags_t memoryAccess; + +} ur_kernel_arg_mem_obj_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a Memory object as the argument value of a Kernel. +/// +/// @details +/// - The application may call this function from simultaneous threads with +/// the same kernel handle. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_MEM_FLAGS_MASK & +/// pProperties->memoryAccess` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgMemObj( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] argument index in range [0, num args - 1] + uint32_t argIndex, + /// [in][optional] pointer to Memory object properties. + const ur_kernel_arg_mem_obj_properties_t *pProperties, + /// [in][optional] handle of Memory object. + ur_mem_handle_t hArgValue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set an array of specialization constants on a Kernel. +/// +/// @details +/// - This entry point is optional, the application should query for support +/// with device query ::UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS +/// passed to ::urDeviceGetInfo. +/// - Adapters which are capable of setting specialization constants +/// immediately prior to ::urEnqueueKernelLaunch with low overhead should +/// implement this entry point. +/// - Otherwise, if setting specialization constants late requires +/// recompiling or linking a program, adapters should not implement this +/// entry point. +/// - The application may call this function from simultaneous threads for +/// the same device. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSpecConstants` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If ::UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS query is +/// false +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + A pSpecConstant entry contains a size that does not match that of +/// the specialization constant in the module. +/// + A pSpecConstant entry contains a nullptr pValue. +/// - ::UR_RESULT_ERROR_INVALID_SPEC_ID +/// + Any id specified in a pSpecConstant entry is not a valid +/// specialization constant identifier. +UR_APIEXPORT ur_result_t UR_APICALL urKernelSetSpecializationConstants( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] the number of elements in the pSpecConstants array + uint32_t count, + /// [in] array of specialization constant value descriptions + const ur_specialization_constant_info_t *pSpecConstants); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return platform native kernel handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability platform extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeKernel` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urKernelGetNativeHandle( + /// [in] handle of the kernel. + ur_kernel_handle_t hKernel, + /// [out] a pointer to the native handle of the kernel. + ur_native_handle_t *phNativeKernel); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urKernelCreateWithNativeHandle. +typedef struct ur_kernel_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_kernel_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime kernel object from native kernel handle. +/// +/// @details +/// - Creates runtime kernel handle from native driver kernel handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// - The implementation may require a valid program handle to return the +/// native kernel handle +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + If `hProgram == NULL` and the implementation requires a valid +/// program. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phKernel` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urKernelCreateWithNativeHandle( + /// [in][nocheck] the native handle of the kernel. + ur_native_handle_t hNativeKernel, + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in][optional] handle of the program associated with the kernel + ur_program_handle_t hProgram, + /// [in][optional] pointer to native kernel properties struct + const ur_kernel_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the kernel object created. + ur_kernel_handle_t *phKernel); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the suggested local work size for a kernel. +/// +/// @details +/// - Query a suggested local work size for a kernel given a global size for +/// each dimension. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// + `NULL == pSuggestedLocalWorkSize` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize( + /// [in] handle of the kernel + ur_kernel_handle_t hKernel, + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] number of dimensions, from 1 to 3, to specify the global + /// and work-group work-items + uint32_t numWorkDim, + /// [in] pointer to an array of numWorkDim unsigned values that specify + /// the offset used to calculate the global ID of a work-item + const size_t *pGlobalWorkOffset, + /// [in] pointer to an array of numWorkDim unsigned values that specify + /// the number of global work-items in workDim that will execute the + /// kernel function + const size_t *pGlobalWorkSize, + /// [out] pointer to an array of numWorkDim unsigned values that specify + /// suggested local work size that will contain the result of the query + size_t *pSuggestedLocalWorkSize); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region queue +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query queue info +typedef enum ur_queue_info_t { + /// [::ur_context_handle_t] context associated with this queue. + UR_QUEUE_INFO_CONTEXT = 0, + /// [::ur_device_handle_t] device associated with this queue. + UR_QUEUE_INFO_DEVICE = 1, + /// [::ur_queue_handle_t] the current default queue of the underlying + /// device. + UR_QUEUE_INFO_DEVICE_DEFAULT = 2, + /// [::ur_queue_flags_t] the properties associated with + /// ::ur_queue_properties_t::flags. + UR_QUEUE_INFO_FLAGS = 3, + /// [uint32_t] Reference count of the queue object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_QUEUE_INFO_REFERENCE_COUNT = 4, + /// [uint32_t] The size of the queue on the device. Only a valid query + /// if the queue was created with the `ON_DEVICE` queue flag, otherwise + /// `::urQueueGetInfo` will return `::UR_RESULT_ERROR_INVALID_QUEUE`. + UR_QUEUE_INFO_SIZE = 5, + /// [::ur_bool_t][optional-query] return true if the queue was empty at + /// the time of the query. + UR_QUEUE_INFO_EMPTY = 6, + /// @cond + UR_QUEUE_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_queue_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Queue property flags +typedef uint32_t ur_queue_flags_t; +typedef enum ur_queue_flag_t { + /// Enable/disable out of order execution + UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE = UR_BIT(0), + /// Enable/disable profiling + UR_QUEUE_FLAG_PROFILING_ENABLE = UR_BIT(1), + /// Is a device queue. If this is enabled `OUT_OF_ORDER_EXEC_MODE_ENABLE` + /// must also be enabled. + UR_QUEUE_FLAG_ON_DEVICE = UR_BIT(2), + /// Is the default queue for a device + UR_QUEUE_FLAG_ON_DEVICE_DEFAULT = UR_BIT(3), + /// Events will be discarded + UR_QUEUE_FLAG_DISCARD_EVENTS = UR_BIT(4), + /// Low priority queue + UR_QUEUE_FLAG_PRIORITY_LOW = UR_BIT(5), + /// High priority queue + UR_QUEUE_FLAG_PRIORITY_HIGH = UR_BIT(6), + /// Hint: enqueue and submit in a batch later. No change in queue + /// semantics. Implementation chooses submission mode. + UR_QUEUE_FLAG_SUBMISSION_BATCHED = UR_BIT(7), + /// Hint: enqueue and submit immediately. No change in queue semantics. + /// Implementation chooses submission mode. + UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE = UR_BIT(8), + /// Use the default stream. Only meaningful for CUDA. Other platforms may + /// ignore this flag. + UR_QUEUE_FLAG_USE_DEFAULT_STREAM = UR_BIT(9), + /// Synchronize with the default stream. Only meaningful for CUDA. Other + /// platforms may ignore this flag. + UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM = UR_BIT(10), + /// Hint: use low-power events. Only meaningful for Level Zero, where the + /// implementation may use interrupt-driven events. May reduce CPU + /// utilization at the cost of increased event completion latency. Other + /// platforms may ignore this flag. + UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP = UR_BIT(11), + /// @cond + UR_QUEUE_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_queue_flag_t; +/// @brief Bit Mask for validating ur_queue_flags_t +#define UR_QUEUE_FLAGS_MASK 0xfffff000 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query information about a command queue +/// +/// @remarks +/// _Analogues_ +/// - **clGetCommandQueueInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_QUEUE_INFO_EMPTY < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE - "If `hQueue` isn't a valid queue +/// handle or if `propName` isn't supported by `hQueue`." +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urQueueGetInfo( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] name of the queue property to query + ur_queue_info_t propName, + /// [in] size in bytes of the queue property value provided + size_t propSize, + /// [out][optional][typename(propName, propSize)] value of the queue + /// property + void *pPropValue, + /// [out][optional] size in bytes returned in queue property value + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Queue creation properties +typedef struct ur_queue_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_QUEUE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Bitfield of queue creation flags + ur_queue_flags_t flags; + +} ur_queue_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Queue index creation properties +/// +/// @details +/// - Specify these properties in ::urQueueCreate via +/// ::ur_queue_properties_t as part of a `pNext` chain. +typedef struct ur_queue_index_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Specifies the compute index as described in the + /// sycl_ext_intel_queue_index extension. + uint32_t computeIndex; + +} ur_queue_index_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a command queue for a device in a context +/// +/// @details +/// - See also ::ur_queue_index_properties_t. +/// +/// @remarks +/// _Analogues_ +/// - **clCreateCommandQueueWithProperties** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_QUEUE_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phQueue` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES +/// + `pProperties != NULL && pProperties->flags & +/// UR_QUEUE_FLAG_PRIORITY_HIGH && pProperties->flags & +/// UR_QUEUE_FLAG_PRIORITY_LOW` +/// + `pProperties != NULL && pProperties->flags & +/// UR_QUEUE_FLAG_SUBMISSION_BATCHED && pProperties->flags & +/// UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][optional] pointer to queue creation properties. + const ur_queue_properties_t *pProperties, + /// [out][alloc] pointer to handle of queue object created + ur_queue_handle_t *phQueue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to the command queue handle. Increment the command +/// queue's reference count +/// +/// @details +/// - Useful in library function to retain access to the command queue after +/// the caller released the queue. +/// +/// @remarks +/// _Analogues_ +/// - **clRetainCommandQueue** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urQueueRetain( + /// [in][retain] handle of the queue object to get access + ur_queue_handle_t hQueue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Decrement the command queue's reference count and delete the command +/// queue if the reference count becomes zero. +/// +/// @details +/// - After the command queue reference count becomes zero and all queued +/// commands in the queue have finished, the queue is deleted. +/// - It also performs an implicit flush to issue all previously queued +/// commands in the queue. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseCommandQueue** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease( + /// [in][release] handle of the queue object to release + ur_queue_handle_t hQueue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Descriptor for ::urQueueGetNativeHandle and +/// ::urQueueCreateWithNativeHandle. +/// +/// @details +/// - Specify this descriptor in ::urQueueGetNativeHandle directly or +/// ::urQueueCreateWithNativeHandle via ::ur_queue_native_properties_t as +/// part of a `pNext` chain. +typedef struct ur_queue_native_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in][optional] Adapter-specific metadata needed to create the handle. + void *pNativeData; + +} ur_queue_native_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return queue native queue handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability queue extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeQueue` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urQueueGetNativeHandle( + /// [in] handle of the queue. + ur_queue_handle_t hQueue, + /// [in][optional] pointer to native descriptor + ur_queue_native_desc_t *pDesc, + /// [out] a pointer to the native handle of the queue. + ur_native_handle_t *phNativeQueue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urQueueCreateWithNativeHandle. +typedef struct ur_queue_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_queue_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime queue object from native queue handle. +/// +/// @details +/// - Creates runtime queue handle from native driver queue handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phQueue` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urQueueCreateWithNativeHandle( + /// [in][nocheck] the native handle of the queue. + ur_native_handle_t hNativeQueue, + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in][optional] handle of the device object + ur_device_handle_t hDevice, + /// [in][optional] pointer to native queue properties struct + const ur_queue_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the queue object created. + ur_queue_handle_t *phQueue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Blocks until all previously issued commands to the command queue are +/// finished. +/// +/// @details +/// - Blocks until all previously issued commands to the command queue are +/// issued and completed. +/// - ::urQueueFinish does not return until all enqueued commands have been +/// processed and finished. +/// - ::urQueueFinish acts as a synchronization point. +/// +/// @remarks +/// _Analogues_ +/// - **clFinish** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urQueueFinish( + /// [in] handle of the queue to be finished. + ur_queue_handle_t hQueue); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Issues all previously enqueued commands in a command queue to the +/// device. +/// +/// @details +/// - Guarantees that all enqueued commands will be issued to the +/// appropriate device. +/// - There is no guarantee that they will be completed after ::urQueueFlush +/// returns. +/// +/// @remarks +/// _Analogues_ +/// - **clFlush** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urQueueFlush( + /// [in] handle of the queue to be flushed. + ur_queue_handle_t hQueue); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region event +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Command type +typedef enum ur_command_t { + /// Event created by ::urEnqueueKernelLaunch + UR_COMMAND_KERNEL_LAUNCH = 0, + /// Event created by ::urEnqueueEventsWait + UR_COMMAND_EVENTS_WAIT = 1, + /// Event created by ::urEnqueueEventsWaitWithBarrier + UR_COMMAND_EVENTS_WAIT_WITH_BARRIER = 2, + /// Event created by ::urEnqueueMemBufferRead + UR_COMMAND_MEM_BUFFER_READ = 3, + /// Event created by ::urEnqueueMemBufferWrite + UR_COMMAND_MEM_BUFFER_WRITE = 4, + /// Event created by ::urEnqueueMemBufferReadRect + UR_COMMAND_MEM_BUFFER_READ_RECT = 5, + /// Event created by ::urEnqueueMemBufferWriteRect + UR_COMMAND_MEM_BUFFER_WRITE_RECT = 6, + /// Event created by ::urEnqueueMemBufferCopy + UR_COMMAND_MEM_BUFFER_COPY = 7, + /// Event created by ::urEnqueueMemBufferCopyRect + UR_COMMAND_MEM_BUFFER_COPY_RECT = 8, + /// Event created by ::urEnqueueMemBufferFill + UR_COMMAND_MEM_BUFFER_FILL = 9, + /// Event created by ::urEnqueueMemImageRead + UR_COMMAND_MEM_IMAGE_READ = 10, + /// Event created by ::urEnqueueMemImageWrite + UR_COMMAND_MEM_IMAGE_WRITE = 11, + /// Event created by ::urEnqueueMemImageCopy + UR_COMMAND_MEM_IMAGE_COPY = 12, + /// Event created by ::urEnqueueMemBufferMap + UR_COMMAND_MEM_BUFFER_MAP = 14, + /// Event created by ::urEnqueueMemUnmap + UR_COMMAND_MEM_UNMAP = 16, + /// Event created by ::urEnqueueUSMFill + UR_COMMAND_USM_FILL = 17, + /// Event created by ::urEnqueueUSMMemcpy + UR_COMMAND_USM_MEMCPY = 18, + /// Event created by ::urEnqueueUSMPrefetch + UR_COMMAND_USM_PREFETCH = 19, + /// Event created by ::urEnqueueUSMAdvise + UR_COMMAND_USM_ADVISE = 20, + /// Event created by ::urEnqueueUSMFill2D + UR_COMMAND_USM_FILL_2D = 21, + /// Event created by ::urEnqueueUSMMemcpy2D + UR_COMMAND_USM_MEMCPY_2D = 22, + /// Event created by ::urEnqueueDeviceGlobalVariableWrite + UR_COMMAND_DEVICE_GLOBAL_VARIABLE_WRITE = 23, + /// Event created by ::urEnqueueDeviceGlobalVariableRead + UR_COMMAND_DEVICE_GLOBAL_VARIABLE_READ = 24, + /// Event created by ::urEnqueueReadHostPipe + UR_COMMAND_READ_HOST_PIPE = 25, + /// Event created by ::urEnqueueWriteHostPipe + UR_COMMAND_WRITE_HOST_PIPE = 26, + /// Event created by ::urCommandBufferEnqueueExp + UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP = 0x1000, + /// Event created by ::urBindlessImagesWaitExternalSemaphoreExp + UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP = 0x2000, + /// Event created by ::urBindlessImagesSignalExternalSemaphoreExp + UR_COMMAND_EXTERNAL_SEMAPHORE_SIGNAL_EXP = 0x2001, + /// Event created by ::urEnqueueTimestampRecordingExp + UR_COMMAND_TIMESTAMP_RECORDING_EXP = 0x2002, + /// Event created by ::urEnqueueNativeCommandExp + UR_COMMAND_ENQUEUE_NATIVE_EXP = 0x2004, + /// @cond + UR_COMMAND_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_command_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Event Status +typedef enum ur_event_status_t { + /// Command is complete + UR_EVENT_STATUS_COMPLETE = 0, + /// Command is running + UR_EVENT_STATUS_RUNNING = 1, + /// Command is submitted + UR_EVENT_STATUS_SUBMITTED = 2, + /// Command is queued + UR_EVENT_STATUS_QUEUED = 3, + /// Command was abnormally terminated + UR_EVENT_STATUS_ERROR = 4, + /// @cond + UR_EVENT_STATUS_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_event_status_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Event query information type +typedef enum ur_event_info_t { + /// [::ur_queue_handle_t] Command queue information of an event object + UR_EVENT_INFO_COMMAND_QUEUE = 0, + /// [::ur_context_handle_t] Context information of an event object + UR_EVENT_INFO_CONTEXT = 1, + /// [::ur_command_t] Command type information of an event object + UR_EVENT_INFO_COMMAND_TYPE = 2, + /// [::ur_event_status_t] Command execution status of an event object + UR_EVENT_INFO_COMMAND_EXECUTION_STATUS = 3, + /// [uint32_t] Reference count of the event object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_EVENT_INFO_REFERENCE_COUNT = 4, + /// @cond + UR_EVENT_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_event_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Profiling query information type +typedef enum ur_profiling_info_t { + /// [uint64_t] A 64-bit value of current device counter in nanoseconds + /// when the event is enqueued + UR_PROFILING_INFO_COMMAND_QUEUED = 0, + /// [uint64_t] A 64-bit value of current device counter in nanoseconds + /// when the event is submitted + UR_PROFILING_INFO_COMMAND_SUBMIT = 1, + /// [uint64_t] A 64-bit value of current device counter in nanoseconds + /// when the event starts execution + UR_PROFILING_INFO_COMMAND_START = 2, + /// [uint64_t] A 64-bit value of current device counter in nanoseconds + /// when the event has finished execution + UR_PROFILING_INFO_COMMAND_END = 3, + /// [uint64_t] A 64-bit value of current device counter in nanoseconds + /// when the event and any child events enqueued by this event on the + /// device have finished execution + UR_PROFILING_INFO_COMMAND_COMPLETE = 4, + /// @cond + UR_PROFILING_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_profiling_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get event object information +/// +/// @remarks +/// _Analogues_ +/// - **clGetEventInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hEvent` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EVENT_INFO_REFERENCE_COUNT < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urEventGetInfo( + /// [in] handle of the event object + ur_event_handle_t hEvent, + /// [in] the name of the event property to query + ur_event_info_t propName, + /// [in] size in bytes of the event property value + size_t propSize, + /// [out][optional][typename(propName, propSize)] value of the event + /// property + void *pPropValue, + /// [out][optional] bytes returned in event property + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get profiling information for the command associated with an event +/// object +/// +/// @remarks +/// _Analogues_ +/// - **clGetEventProfilingInfo** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hEvent` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_PROFILING_INFO_COMMAND_COMPLETE < propName` +/// - ::UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE +/// + If `hEvent`s associated queue was not created with +/// `UR_QUEUE_FLAG_PROFILING_ENABLE`. +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `pPropValue && propSize == 0` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo( + /// [in] handle of the event object + ur_event_handle_t hEvent, + /// [in] the name of the profiling property to query + ur_profiling_info_t propName, + /// [in] size in bytes of the profiling property value + size_t propSize, + /// [out][optional][typename(propName, propSize)] value of the profiling + /// property + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes returned in + /// propValue + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Wait for a list of events to finish. +/// +/// @remarks +/// _Analogues_ +/// - **clWaitForEvent** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phEventWaitList` +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `numEvents == 0` +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEventWait( + /// [in] number of events in the event list + uint32_t numEvents, + /// [in][range(0, numEvents)] pointer to a list of events to wait for + /// completion + const ur_event_handle_t *phEventWaitList); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a reference to an event handle. Increment the event object's +/// reference count. +/// +/// @remarks +/// _Analogues_ +/// - **clRetainEvent** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hEvent` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urEventRetain( + /// [in][retain] handle of the event object + ur_event_handle_t hEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Decrement the event object's reference count and delete the event +/// object if the reference count becomes zero. +/// +/// @remarks +/// _Analogues_ +/// - **clReleaseEvent** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hEvent` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urEventRelease( + /// [in][release] handle of the event object + ur_event_handle_t hEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Return platform native event handle. +/// +/// @details +/// - Retrieved native handle can be used for direct interaction with the +/// native platform driver. +/// - Use interoperability platform extensions to convert native handle to +/// native type. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hEvent` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phNativeEvent` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urEventGetNativeHandle( + /// [in] handle of the event. + ur_event_handle_t hEvent, + /// [out] a pointer to the native handle of the event. + ur_native_handle_t *phNativeEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties for for ::urEventCreateWithNativeHandle. +typedef struct ur_event_native_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] If true then ownership of the native handle is transferred to + /// the resultant object. This means the object will be responsible for + /// releasing the native resources at the end of its lifetime. + bool isNativeHandleOwned; + +} ur_event_native_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create runtime event object from native event handle. +/// +/// @details +/// - Creates runtime event handle from native driver event handle. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phEvent` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the adapter has no underlying equivalent handle. +UR_APIEXPORT ur_result_t UR_APICALL urEventCreateWithNativeHandle( + /// [in][nocheck] the native handle of the event. + ur_native_handle_t hNativeEvent, + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in][optional] pointer to native event properties struct + const ur_event_native_properties_t *pProperties, + /// [out][alloc] pointer to the handle of the event object created. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Event states for all events. +typedef enum ur_execution_info_t { + /// Indicates that the event has completed. + UR_EXECUTION_INFO_COMPLETE = 0, + /// Indicates that the device has started processing this event. + UR_EXECUTION_INFO_RUNNING = 1, + /// Indicates that the event has been submitted by the host to the device. + UR_EXECUTION_INFO_SUBMITTED = 2, + /// Indicates that the event has been queued, this is the initial state of + /// events. + UR_EXECUTION_INFO_QUEUED = 3, + /// @cond + UR_EXECUTION_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_execution_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Event callback function that can be registered by the application. +typedef void (*ur_event_callback_t)( + /// [in] handle to event + ur_event_handle_t hEvent, + /// [in] execution status of the event + ur_execution_info_t execStatus, + /// [in][out] pointer to data to be passed to callback + void *pUserData); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Register a user callback function for a specific command execution +/// status. +/// +/// @details +/// - The registered callback function will be called when the execution +/// status of command associated with event changes to an execution status +/// equal to or past the status specified by command_exec_status. +/// - `execStatus` must not be `UR_EXECUTION_INFO_QUEUED` as this is the +/// initial state of all events. +/// - The application may call this function from simultaneous threads for +/// the same context. +/// - The implementation of this function should be thread-safe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hEvent` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EXECUTION_INFO_QUEUED < execStatus` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnNotify` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + `execStatus == UR_EXECUTION_INFO_QUEUED` +UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback( + /// [in] handle of the event object + ur_event_handle_t hEvent, + /// [in] execution status of the event + ur_execution_info_t execStatus, + /// [in] execution status of the event + ur_event_callback_t pfnNotify, + /// [in][out][optional] pointer to data to be passed to callback. + void *pUserData); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs +#if !defined(__GNUC__) +#pragma region enqueue +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to execute a kernel +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueNDRangeKernel** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGS - "The kernel argument values +/// have not been specified." +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] number of dimensions, from 1 to 3, to specify the global and + /// work-group work-items + uint32_t workDim, + /// [in] pointer to an array of workDim unsigned values that specify the + /// offset used to calculate the global ID of a work-item + const size_t *pGlobalWorkOffset, + /// [in] pointer to an array of workDim unsigned values that specify the + /// number of global work-items in workDim that will execute the kernel + /// function + const size_t *pGlobalWorkSize, + /// [in][optional] pointer to an array of workDim unsigned values that + /// specify the number of local work-items forming a work-group that will + /// execute the kernel function. + /// If nullptr, the runtime implementation will choose the work-group size. + const size_t *pLocalWorkSize, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command which waits a list of events to complete before it +/// completes +/// +/// @details +/// - If the event list is empty, it waits for all previously enqueued +/// commands to complete. +/// - It returns an event which can be waited on. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueMarkerWithWaitList** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWait( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that all + /// previously enqueued commands + /// must be complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a barrier command which waits a list of events to complete +/// before it completes +/// +/// @details +/// - If the event list is empty, it waits for all previously enqueued +/// commands to complete. +/// - It blocks command execution - any following commands enqueued after it +/// do not execute until it completes. +/// - It returns an event which can be waited on. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueBarrierWithWaitList** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that all + /// previously enqueued commands + /// must be complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to read from a buffer object to host memory +/// +/// @details +/// - Input parameter blockingRead indicates if the read is blocking or +/// non-blocking. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueReadBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(offset, size)] handle of the buffer object + ur_mem_handle_t hBuffer, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingRead, + /// [in] offset in bytes in the buffer object + size_t offset, + /// [in] size in bytes of data being read + size_t size, + /// [in] pointer to host memory where data is to be read into + void *pDst, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to write into a buffer object from host memory +/// +/// @details +/// - Input parameter blockingWrite indicates if the write is blocking or +/// non-blocking. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueWriteBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(offset, size)] handle of the buffer object + ur_mem_handle_t hBuffer, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingWrite, + /// [in] offset in bytes in the buffer object + size_t offset, + /// [in] size in bytes of data being written + size_t size, + /// [in] pointer to host memory where data is to be written from + const void *pSrc, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to read a 2D or 3D rectangular region from a buffer +/// object to host memory +/// +/// @details +/// - Input parameter blockingRead indicates if the read is blocking or +/// non-blocking. +/// - The buffer and host 2D or 3D rectangular regions can have different +/// shapes. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueReadBufferRect** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.width == 0` +/// + `bufferRowPitch != 0 && bufferRowPitch < region.width` +/// + `hostRowPitch != 0 && hostRowPitch < region.width` +/// + `bufferSlicePitch != 0 && bufferSlicePitch < region.height * +/// (bufferRowPitch != 0 ? bufferRowPitch : region.width)` +/// + `bufferSlicePitch != 0 && bufferSlicePitch % (bufferRowPitch != 0 +/// ? bufferRowPitch : region.width) != 0` +/// + `hostSlicePitch != 0 && hostSlicePitch < region.height * +/// (hostRowPitch != 0 ? hostRowPitch : region.width)` +/// + `hostSlicePitch != 0 && hostSlicePitch % (hostRowPitch != 0 ? +/// hostRowPitch : region.width) != 0` +/// + If the combination of `bufferOrigin`, `region`, `bufferRowPitch`, +/// and `bufferSlicePitch` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(bufferOrigin, region)] handle of the buffer object + ur_mem_handle_t hBuffer, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingRead, + /// [in] 3D offset in the buffer + ur_rect_offset_t bufferOrigin, + /// [in] 3D offset in the host region + ur_rect_offset_t hostOrigin, + /// [in] 3D rectangular region descriptor: width, height, depth + ur_rect_region_t region, + /// [in] length of each row in bytes in the buffer object + size_t bufferRowPitch, + /// [in] length of each 2D slice in bytes in the buffer object being read + size_t bufferSlicePitch, + /// [in] length of each row in bytes in the host memory region pointed by + /// dst + size_t hostRowPitch, + /// [in] length of each 2D slice in bytes in the host memory region + /// pointed by dst + size_t hostSlicePitch, + /// [in] pointer to host memory where data is to be read into + void *pDst, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to write a 2D or 3D rectangular region in a buffer +/// object from host memory +/// +/// @details +/// - Input parameter blockingWrite indicates if the write is blocking or +/// non-blocking. +/// - The buffer and host 2D or 3D rectangular regions can have different +/// shapes. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueWriteBufferRect** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.width == 0` +/// + `bufferRowPitch != 0 && bufferRowPitch < region.width` +/// + `hostRowPitch != 0 && hostRowPitch < region.width` +/// + `bufferSlicePitch != 0 && bufferSlicePitch < region.height * +/// (bufferRowPitch != 0 ? bufferRowPitch : region.width)` +/// + `bufferSlicePitch != 0 && bufferSlicePitch % (bufferRowPitch != 0 +/// ? bufferRowPitch : region.width) != 0` +/// + `hostSlicePitch != 0 && hostSlicePitch < region.height * +/// (hostRowPitch != 0 ? hostRowPitch : region.width)` +/// + `hostSlicePitch != 0 && hostSlicePitch % (hostRowPitch != 0 ? +/// hostRowPitch : region.width) != 0` +/// + If the combination of `bufferOrigin`, `region`, `bufferRowPitch`, +/// and `bufferSlicePitch` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(bufferOrigin, region)] handle of the buffer object + ur_mem_handle_t hBuffer, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingWrite, + /// [in] 3D offset in the buffer + ur_rect_offset_t bufferOrigin, + /// [in] 3D offset in the host region + ur_rect_offset_t hostOrigin, + /// [in] 3D rectangular region descriptor: width, height, depth + ur_rect_region_t region, + /// [in] length of each row in bytes in the buffer object + size_t bufferRowPitch, + /// [in] length of each 2D slice in bytes in the buffer object being + /// written + size_t bufferSlicePitch, + /// [in] length of each row in bytes in the host memory region pointed by + /// src + size_t hostRowPitch, + /// [in] length of each 2D slice in bytes in the host memory region + /// pointed by src + size_t hostSlicePitch, + /// [in] pointer to host memory where data is to be written from + void *pSrc, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] points to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to copy from a buffer object to another +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueCopyBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBufferSrc` +/// + `NULL == hBufferDst` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `srcOffset + size` results in an out-of-bounds access. +/// + If `dstOffset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t hBufferSrc, + /// [in][bounds(dstOffset, size)] handle of the dest buffer object + ur_mem_handle_t hBufferDst, + /// [in] offset into hBufferSrc to begin copying from + size_t srcOffset, + /// [in] offset info hBufferDst to begin copying into + size_t dstOffset, + /// [in] size in bytes of data being copied + size_t size, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to copy a 2D or 3D rectangular region from one +/// buffer object to another +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueCopyBufferRect** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBufferSrc` +/// + `NULL == hBufferDst` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` +/// + `srcRowPitch != 0 && srcRowPitch < region.width` +/// + `dstRowPitch != 0 && dstRowPitch < region.width` +/// + `srcSlicePitch != 0 && srcSlicePitch < region.height * +/// (srcRowPitch != 0 ? srcRowPitch : region.width)` +/// + `srcSlicePitch != 0 && srcSlicePitch % (srcRowPitch != 0 ? +/// srcRowPitch : region.width) != 0` +/// + `dstSlicePitch != 0 && dstSlicePitch < region.height * +/// (dstRowPitch != 0 ? dstRowPitch : region.width)` +/// + `dstSlicePitch != 0 && dstSlicePitch % (dstRowPitch != 0 ? +/// dstRowPitch : region.width) != 0` +/// + If the combination of `srcOrigin`, `region`, `srcRowPitch`, and +/// `srcSlicePitch` results in an out-of-bounds access. +/// + If the combination of `dstOrigin`, `region`, `dstRowPitch`, and +/// `dstSlicePitch` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t hBufferSrc, + /// [in][bounds(dstOrigin, region)] handle of the dest buffer object + ur_mem_handle_t hBufferDst, + /// [in] 3D offset in the source buffer + ur_rect_offset_t srcOrigin, + /// [in] 3D offset in the destination buffer + ur_rect_offset_t dstOrigin, + /// [in] source 3D rectangular region descriptor: width, height, depth + ur_rect_region_t region, + /// [in] length of each row in bytes in the source buffer object + size_t srcRowPitch, + /// [in] length of each 2D slice in bytes in the source buffer object + size_t srcSlicePitch, + /// [in] length of each row in bytes in the destination buffer object + size_t dstRowPitch, + /// [in] length of each 2D slice in bytes in the destination buffer object + size_t dstSlicePitch, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to fill a buffer object with a pattern of a given +/// size +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueFillBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + `offset % patternSize != 0` +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(offset, size)] handle of the buffer object + ur_mem_handle_t hBuffer, + /// [in] pointer to the fill pattern + const void *pPattern, + /// [in] size in bytes of the pattern + size_t patternSize, + /// [in] offset into the buffer + size_t offset, + /// [in] fill size in bytes, must be a multiple of patternSize + size_t size, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to read from an image or image array object to host +/// memory +/// +/// @details +/// - Input parameter blockingRead indicates if the read is blocking or +/// non-blocking. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueReadImage** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hImage` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(origin, region)] handle of the image object + ur_mem_handle_t hImage, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingRead, + /// [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image + ur_rect_offset_t origin, + /// [in] defines the (width, height, depth) in pixels of the 1D, 2D, or 3D + /// image + ur_rect_region_t region, + /// [in] length of each row in bytes + size_t rowPitch, + /// [in] length of each 2D slice of the 3D image + size_t slicePitch, + /// [in] pointer to host memory where image is to be read into + void *pDst, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to write an image or image array object from host +/// memory +/// +/// @details +/// - Input parameter blockingWrite indicates if the write is blocking or +/// non-blocking. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueWriteImage** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hImage` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(origin, region)] handle of the image object + ur_mem_handle_t hImage, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingWrite, + /// [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image + ur_rect_offset_t origin, + /// [in] defines the (width, height, depth) in pixels of the 1D, 2D, or 3D + /// image + ur_rect_region_t region, + /// [in] length of each row in bytes + size_t rowPitch, + /// [in] length of each 2D slice of the 3D image + size_t slicePitch, + /// [in] pointer to host memory where image is to be read into + void *pSrc, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to copy from an image object to another +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueCopyImage** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hImageSrc` +/// + `NULL == hImageDst` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t hImageSrc, + /// [in][bounds(dstOrigin, region)] handle of the dest image object + ur_mem_handle_t hImageDst, + /// [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D + /// image + ur_rect_offset_t srcOrigin, + /// [in] defines the (x,y,z) offset in pixels in the destination 1D, 2D, + /// or 3D image + ur_rect_offset_t dstOrigin, + /// [in] defines the (width, height, depth) in pixels of the 1D, 2D, or 3D + /// image + ur_rect_region_t region, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Map flags +typedef uint32_t ur_map_flags_t; +typedef enum ur_map_flag_t { + /// Map for read access + UR_MAP_FLAG_READ = UR_BIT(0), + /// Map for write access + UR_MAP_FLAG_WRITE = UR_BIT(1), + /// Map for discard_write access + UR_MAP_FLAG_WRITE_INVALIDATE_REGION = UR_BIT(2), + /// @cond + UR_MAP_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_map_flag_t; +/// @brief Bit Mask for validating ur_map_flags_t +#define UR_MAP_FLAGS_MASK 0xfffffff8 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Map flags +typedef uint32_t ur_usm_migration_flags_t; +typedef enum ur_usm_migration_flag_t { + /// Default migration TODO: Add more enums! + UR_USM_MIGRATION_FLAG_DEFAULT = UR_BIT(0), + /// @cond + UR_USM_MIGRATION_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_usm_migration_flag_t; +/// @brief Bit Mask for validating ur_usm_migration_flags_t +#define UR_USM_MIGRATION_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to map a region of the buffer object into the host +/// address space and return a pointer to the mapped region +/// +/// @details +/// - Currently, no direct support in Level Zero. Implemented as a shared +/// allocation followed by copying on discrete GPU +/// - TODO: add a driver function in Level Zero? +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueMapBuffer** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_MAP_FLAGS_MASK & mapFlags` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppRetMap` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(offset, size)] handle of the buffer object + ur_mem_handle_t hBuffer, + /// [in] indicates blocking (true), non-blocking (false) + bool blockingMap, + /// [in] flags for read, write, readwrite mapping + ur_map_flags_t mapFlags, + /// [in] offset in bytes of the buffer region being mapped + size_t offset, + /// [in] size in bytes of the buffer region being mapped + size_t size, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent, + /// [out] return mapped pointer. TODO: move it before + /// numEventsInWaitList? + void **ppRetMap); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to unmap a previously mapped region of a memory +/// object +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueUnmapMemObject** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hMem` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMappedPtr` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemUnmap( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] handle of the memory (buffer or image) object + ur_mem_handle_t hMem, + /// [in] mapped host address + void *pMappedPtr, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to fill USM memory. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(0, size)] pointer to USM memory object + void *pMem, + /// [in] the size in bytes of the pattern. Must be a power of 2 and less + /// than or equal to width. + size_t patternSize, + /// [in] pointer with the bytes of the pattern to set. + const void *pPattern, + /// [in] size in bytes to be set. Must be a multiple of patternSize. + size_t size, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to copy USM memory +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pSrc` or `pDst` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] blocking or non-blocking copy + bool blocking, + /// [in][bounds(0, size)] pointer to the destination USM memory object + void *pDst, + /// [in][bounds(0, size)] pointer to the source USM memory object + const void *pSrc, + /// [in] size in bytes to be copied + size_t size, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to prefetch USM memory +/// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMem` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(0, size)] pointer to the USM memory object + const void *pMem, + /// [in] size in bytes to be fetched + size_t size, + /// [in] USM prefetch flags + ur_usm_migration_flags_t flags, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that this + /// command does not wait on any event to complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to set USM memory advice +/// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. Some adapters may return ::UR_RESULT_ERROR_ADAPTER_SPECIFIC, +/// more information can be retrieved by using urAdapterGetLastError. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMem` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMAdvise( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][bounds(0, size)] pointer to the USM memory object + const void *pMem, + /// [in] size in bytes to be advised + size_t size, + /// [in] USM memory advice + ur_usm_advice_flags_t advice, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to fill 2D USM memory. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `pitch == 0` +/// + `pitch < width` +/// + `patternSize == 0` +/// + `patternSize > width * height` +/// + `patternSize != 0 && ((patternSize & (patternSize - 1)) != 0)` +/// + `width == 0` +/// + `height == 0` +/// + `width * height % patternSize != 0` +/// + If `pitch * height` is higher than the allocation size of `pMem` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill2D( + /// [in] handle of the queue to submit to. + ur_queue_handle_t hQueue, + /// [in][bounds(0, pitch * height)] pointer to memory to be filled. + void *pMem, + /// [in] the total width of the destination memory including padding. + size_t pitch, + /// [in] the size in bytes of the pattern. Must be a power of 2 and less + /// than or equal to width. + size_t patternSize, + /// [in] pointer with the bytes of the pattern to set. + const void *pPattern, + /// [in] the width in bytes of each row to fill. Must be a multiple of + /// patternSize. + size_t width, + /// [in] the height of the columns to fill. + size_t height, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to copy 2D USM memory. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `srcPitch == 0` +/// + `dstPitch == 0` +/// + `srcPitch < width` +/// + `dstPitch < width` +/// + `height == 0` +/// + If `srcPitch * height` is higher than the allocation size of +/// `pSrc` +/// + If `dstPitch * height` is higher than the allocation size of +/// `pDst` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( + /// [in] handle of the queue to submit to. + ur_queue_handle_t hQueue, + /// [in] indicates if this operation should block the host. + bool blocking, + /// [in][bounds(0, dstPitch * height)] pointer to memory where data will + /// be copied. + void *pDst, + /// [in] the total width of the source memory including padding. + size_t dstPitch, + /// [in][bounds(0, srcPitch * height)] pointer to memory to be copied. + const void *pSrc, + /// [in] the total width of the source memory including padding. + size_t srcPitch, + /// [in] the width in bytes of each row to be copied. + size_t width, + /// [in] the height of columns to be copied. + size_t height, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to write data from the host to device global +/// variable. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == name` +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( + /// [in] handle of the queue to submit to. + ur_queue_handle_t hQueue, + /// [in] handle of the program containing the device global variable. + ur_program_handle_t hProgram, + /// [in] the unique identifier for the device global variable. + const char *name, + /// [in] indicates if this operation should block. + bool blockingWrite, + /// [in] the number of bytes to copy. + size_t count, + /// [in] the byte offset into the device global variable to start copying. + size_t offset, + /// [in] pointer to where the data must be copied from. + const void *pSrc, + /// [in] size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to read data from a device global variable to the +/// host. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == name` +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( + /// [in] handle of the queue to submit to. + ur_queue_handle_t hQueue, + /// [in] handle of the program containing the device global variable. + ur_program_handle_t hProgram, + /// [in] the unique identifier for the device global variable. + const char *name, + /// [in] indicates if this operation should block. + bool blockingRead, + /// [in] the number of bytes to copy. + size_t count, + /// [in] the byte offset into the device global variable to start copying. + size_t offset, + /// [in] pointer to where the data must be copied to. + void *pDst, + /// [in] size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to read from a pipe to the host. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pipe_symbol` +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueReadHostPipe( + /// [in] a valid host command-queue in which the read command + /// will be queued. hQueue and hProgram must be created with the same + /// UR context. + ur_queue_handle_t hQueue, + /// [in] a program object with a successfully built executable. + ur_program_handle_t hProgram, + /// [in] the name of the program scope pipe global variable. + const char *pipe_symbol, + /// [in] indicate if the read operation is blocking or non-blocking. + bool blocking, + /// [in] a pointer to buffer in host memory that will hold resulting data + /// from pipe. + void *pDst, + /// [in] size of the memory region to read, in bytes. + size_t size, + /// [in] number of events in the wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the host pipe read. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] returns an event object that identifies this + /// read command + /// and can be used to query or queue a wait for this command to complete. + /// If phEventWaitList and phEvent are not NULL, phEvent must not refer to + /// an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to write data from the host to a pipe. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pipe_symbol` +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueWriteHostPipe( + /// [in] a valid host command-queue in which the write command + /// will be queued. hQueue and hProgram must be created with the same + /// UR context. + ur_queue_handle_t hQueue, + /// [in] a program object with a successfully built executable. + ur_program_handle_t hProgram, + /// [in] the name of the program scope pipe global variable. + const char *pipe_symbol, + /// [in] indicate if the read and write operations are blocking or + /// non-blocking. + bool blocking, + /// [in] a pointer to buffer in host memory that holds data to be written + /// to the host pipe. + void *pSrc, + /// [in] size of the memory region to read or write, in bytes. + size_t size, + /// [in] number of events in the wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the host pipe write. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] returns an event object that identifies this + /// write command + /// and can be used to query or queue a wait for this command to complete. + /// If phEventWaitList and phEvent are not NULL, phEvent must not refer to + /// an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental device descriptor for querying +// Intel device 2D block array capabilities +#if !defined(__GNUC__) +#pragma region 2d_block_array_capabilities_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intel GPU 2D block array capabilities +typedef uint32_t ur_exp_device_2d_block_array_capability_flags_t; +typedef enum ur_exp_device_2d_block_array_capability_flag_t { + /// Load instructions are supported + UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD = UR_BIT(0), + /// Store instructions are supported + UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE = UR_BIT(1), + /// @cond + UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_device_2d_block_array_capability_flag_t; +/// @brief Bit Mask for validating +/// ur_exp_device_2d_block_array_capability_flags_t +#define UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAGS_MASK 0xfffffffc + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Bindless Images Extension APIs +#if !defined(__GNUC__) +#pragma region bindless_images_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of bindless image +typedef uintptr_t ur_exp_image_native_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of bindless image memory +typedef uintptr_t ur_exp_image_mem_native_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of external memory +typedef struct ur_exp_external_mem_handle_t_ *ur_exp_external_mem_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of external semaphore +typedef struct ur_exp_external_semaphore_handle_t_ + *ur_exp_external_semaphore_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Dictates the type of memory copy. +typedef uint32_t ur_exp_image_copy_flags_t; +typedef enum ur_exp_image_copy_flag_t { + /// Host to device + UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE = UR_BIT(0), + /// Device to host + UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST = UR_BIT(1), + /// Device to device + UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE = UR_BIT(2), + /// Host to host + UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST = UR_BIT(3), + /// @cond + UR_EXP_IMAGE_COPY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_image_copy_flag_t; +/// @brief Bit Mask for validating ur_exp_image_copy_flags_t +#define UR_EXP_IMAGE_COPY_FLAGS_MASK 0xfffffff0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sampler cubemap seamless filtering mode. +typedef enum ur_exp_sampler_cubemap_filter_mode_t { + /// Disable seamless filtering + UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED = 0, + /// Enable Seamless filtering + UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS = 1, + /// @cond + UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_sampler_cubemap_filter_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Dictates the type of external memory handle. +typedef enum ur_exp_external_mem_type_t { + /// Opaque file descriptor + UR_EXP_EXTERNAL_MEM_TYPE_OPAQUE_FD = 0, + /// Win32 NT handle + UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT = 1, + /// Win32 NT DirectX 12 resource handle + UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT_DX12_RESOURCE = 2, + /// @cond + UR_EXP_EXTERNAL_MEM_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_external_mem_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Dictates the type of external semaphore handle. +typedef enum ur_exp_external_semaphore_type_t { + /// Opaque file descriptor + UR_EXP_EXTERNAL_SEMAPHORE_TYPE_OPAQUE_FD = 0, + /// Win32 NT handle + UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT = 1, + /// Win32 NT DirectX 12 fence handle + UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE = 2, + /// @cond + UR_EXP_EXTERNAL_SEMAPHORE_TYPE_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_external_semaphore_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief File descriptor +typedef struct ur_exp_file_descriptor_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] A file descriptor used for Linux and & MacOS operating systems. + int fd; + +} ur_exp_file_descriptor_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Windows specific file handle +typedef struct ur_exp_win32_handle_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] A win32 file handle. + void *handle; + +} ur_exp_win32_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes mipmap sampler properties +/// +/// @details +/// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t +/// as part of a `pNext` chain. +typedef struct ur_exp_sampler_mip_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] minimum mipmap level from which we can sample, minimum value + /// being 0 + float minMipmapLevelClamp; + /// [in] maximum mipmap level from which we can sample, maximum value + /// being the number of levels + float maxMipmapLevelClamp; + /// [in] anisotropic ratio used when samplling the mipmap with anisotropic + /// filtering + float maxAnisotropy; + /// [in] mipmap filter mode used for filtering between mipmap levels + ur_sampler_filter_mode_t mipFilterMode; + +} ur_exp_sampler_mip_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes unique sampler addressing mode per dimension +/// +/// @details +/// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t +/// as part of a `pNext` chain. +typedef struct ur_exp_sampler_addr_modes_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] Specify the address mode of the sampler per dimension + ur_sampler_addressing_mode_t addrModes[3]; + +} ur_exp_sampler_addr_modes_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes cubemap sampler properties +/// +/// @details +/// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t +/// as part of a `pNext` chain. +typedef struct ur_exp_sampler_cubemap_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] enables or disables seamless cubemap filtering between cubemap + /// faces + ur_exp_sampler_cubemap_filter_mode_t cubemapFilterMode; + +} ur_exp_sampler_cubemap_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes an external memory resource descriptor +typedef struct ur_exp_external_mem_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_EXTERNAL_MEM_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + +} ur_exp_external_mem_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes an external semaphore resource descriptor +typedef struct ur_exp_external_semaphore_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_EXTERNAL_SEMAPHORE_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + +} ur_exp_external_semaphore_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes the (sub-)regions and the extent to be copied +typedef struct ur_exp_image_copy_region_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] the offset into the source image + ur_rect_offset_t srcOffset; + /// [in] the offset into the destination image + ur_rect_offset_t dstOffset; + /// [in] the extent (region) of the image to copy + ur_rect_region_t copyExtent; + +} ur_exp_image_copy_region_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief USM allocate pitched memory +/// +/// @details +/// - This function must support memory pooling. +/// - If pUSMDesc is not NULL and pUSMDesc->pool is not NULL the allocation +/// will be served from a specified memory pool. +/// - Otherwise, the behavior is implementation-defined. +/// - Allocations served from different memory pools must be isolated and +/// must not reside on the same page. +/// - Any flags/hints passed through pUSMDesc only affect the single +/// allocation. +/// - See also ::ur_usm_host_desc_t. +/// - See also ::ur_usm_device_desc_t. +/// +/// @remarks +/// _Analogues_ +/// - **cuMemAllocPitch** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppMem` +/// + `NULL == pResultPitch` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & +/// (pUSMDesc->align-1)) != 0)` +/// + If `align` is greater that the size of the largest data type +/// supported by `hDevice`. +/// - ::UR_RESULT_ERROR_INVALID_USM_SIZE +/// + `widthInBytes == 0` +/// + `size` is greater than ::UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE. +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If `UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT` and +/// `UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT` are both false. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urUSMPitchedAllocExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][optional] Pointer to USM memory allocation descriptor. + const ur_usm_desc_t *pUSMDesc, + /// [in][optional] Pointer to a pool created using urUSMPoolCreate + ur_usm_pool_handle_t pool, + /// [in] width in bytes of the USM memory object to be allocated + size_t widthInBytes, + /// [in] height of the USM memory object to be allocated + size_t height, + /// [in] size in bytes of an element in the allocation + size_t elementSizeBytes, + /// [out] pointer to USM shared memory object + void **ppMem, + /// [out] pitch of the allocation + size_t *pResultPitch); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroy bindless unsampled image handles +/// +/// @remarks +/// _Analogues_ +/// - **cuSurfObjectDestroy** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesUnsampledImageHandleDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][release] pointer to handle of image object to destroy + ur_exp_image_native_handle_t hImage); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroy bindless sampled image handles +/// +/// @remarks +/// _Analogues_ +/// - **cuTexObjectDestroy** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL +urBindlessImagesSampledImageHandleDestroyExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][release] pointer to handle of image object to destroy + ur_exp_image_native_handle_t hImage); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Allocate memory for bindless images +/// +/// @remarks +/// _Analogues_ +/// - **cuArray3DCreate** +/// - **cuMipmappedArrayCreate** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pImageFormat` +/// + `NULL == pImageDesc` +/// + `NULL == phImageMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR +/// + `pImageDesc && UR_MEM_TYPE_IMAGE_CUBEMAP_EXP < pImageDesc->type` +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageAllocateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to image format specification + const ur_image_format_t *pImageFormat, + /// [in] pointer to image description + const ur_image_desc_t *pImageDesc, + /// [out][alloc] pointer to handle of image memory allocated + ur_exp_image_mem_native_handle_t *phImageMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Free memory for bindless images +/// +/// @remarks +/// _Analogues_ +/// - **cuArrayDestroy** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageFreeExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][release] handle of image memory to be freed + ur_exp_image_mem_native_handle_t hImageMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a bindless unsampled image handle +/// +/// @remarks +/// _Analogues_ +/// - **cuSurfObjectCreate** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pImageFormat` +/// + `NULL == pImageDesc` +/// + `NULL == phImage` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR +/// + `pImageDesc && UR_MEM_TYPE_IMAGE_CUBEMAP_EXP < pImageDesc->type` +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesUnsampledImageCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to memory from which to create the image + ur_exp_image_mem_native_handle_t hImageMem, + /// [in] pointer to image format specification + const ur_image_format_t *pImageFormat, + /// [in] pointer to image description + const ur_image_desc_t *pImageDesc, + /// [out][alloc] pointer to handle of image object created + ur_exp_image_native_handle_t *phImage); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a bindless sampled image handle +/// +/// @remarks +/// _Analogues_ +/// - **cuTexObjectCreate** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hSampler` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pImageFormat` +/// + `NULL == pImageDesc` +/// + `NULL == phImage` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR +/// + `pImageDesc && UR_MEM_TYPE_IMAGE_CUBEMAP_EXP < pImageDesc->type` +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_SAMPLER +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] handle to memory from which to create the image + ur_exp_image_mem_native_handle_t hImageMem, + /// [in] pointer to image format specification + const ur_image_format_t *pImageFormat, + /// [in] pointer to image description + const ur_image_desc_t *pImageDesc, + /// [in] sampler to be used + ur_sampler_handle_t hSampler, + /// [out][alloc] pointer to handle of image object created + ur_exp_image_native_handle_t *phImage); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Copy image data Host to Device, Device to Host, or Device to Device +/// +/// @remarks +/// _Analogues_ +/// - **cuMemcpyHtoAAsync** +/// - **cuMemcpyAtoHAsync** +/// - **cuMemcpy2DAsync** +/// - **cuMemcpy3DAsync** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// + `NULL == pDst` +/// + `NULL == pSrcImageDesc` +/// + `NULL == pDstImageDesc` +/// + `NULL == pSrcImageFormat` +/// + `NULL == pDstImageFormat` +/// + `NULL == pCopyRegion` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EXP_IMAGE_COPY_FLAGS_MASK & imageCopyFlags` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR +/// + `pSrcImageDesc && UR_MEM_TYPE_IMAGE_CUBEMAP_EXP < +/// pSrcImageDesc->type` +/// + `pDstImageDesc && UR_MEM_TYPE_IMAGE_CUBEMAP_EXP < +/// pDstImageDesc->type` +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageCopyExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] location the data will be copied from + const void *pSrc, + /// [in] location the data will be copied to + void *pDst, + /// [in] pointer to image description + const ur_image_desc_t *pSrcImageDesc, + /// [in] pointer to image description + const ur_image_desc_t *pDstImageDesc, + /// [in] pointer to image format specification + const ur_image_format_t *pSrcImageFormat, + /// [in] pointer to image format specification + const ur_image_format_t *pDstImageFormat, + /// [in] Pointer to structure describing the (sub-)regions of source and + /// destination images + ur_exp_image_copy_region_t *pCopyRegion, + /// [in] flags describing copy direction e.g. H2D or D2H + ur_exp_image_copy_flags_t imageCopyFlags, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that all + /// previously enqueued commands + /// must be complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query an image memory handle for specific properties +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_IMAGE_INFO_NUM_SAMPLES < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle to the image memory + ur_exp_image_mem_native_handle_t hImageMem, + /// [in] queried info name + ur_image_info_t propName, + /// [out][optional] returned query value + void *pPropValue, + /// [out][optional] returned query value size + size_t *pPropSizeRet); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieve individual image from mipmap +/// +/// @remarks +/// _Analogues_ +/// - **cuMipmappedArrayGetLevel** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phImageMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapGetLevelExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] memory handle to the mipmap image + ur_exp_image_mem_native_handle_t hImageMem, + /// [in] requested level of the mipmap + uint32_t mipmapLevel, + /// [out] returning memory handle to the individual image + ur_exp_image_mem_native_handle_t *phImageMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Free mipmap memory for bindless images +/// +/// @remarks +/// _Analogues_ +/// - **cuMipmappedArrayDestroy** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMipmapFreeExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][release] handle of image memory to be freed + ur_exp_image_mem_native_handle_t hMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Import external memory +/// +/// @remarks +/// _Analogues_ +/// - **cuImportExternalMemory** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT_DX12_RESOURCE < +/// memHandleType` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pExternalMemDesc` +/// + `NULL == phExternalMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportExternalMemoryExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] size of the external memory + size_t size, + /// [in] type of external memory handle + ur_exp_external_mem_type_t memHandleType, + /// [in] the external memory descriptor + ur_exp_external_mem_desc_t *pExternalMemDesc, + /// [out][alloc] external memory handle to the external memory + ur_exp_external_mem_handle_t *phExternalMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Map an external memory handle to an image memory handle +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hExternalMem` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pImageFormat` +/// + `NULL == pImageDesc` +/// + `NULL == phImageMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR +/// + `pImageDesc && UR_MEM_TYPE_IMAGE_CUBEMAP_EXP < pImageDesc->type` +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalArrayExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] pointer to image format specification + const ur_image_format_t *pImageFormat, + /// [in] pointer to image description + const ur_image_desc_t *pImageDesc, + /// [in] external memory handle to the external memory + ur_exp_external_mem_handle_t hExternalMem, + /// [out] image memory handle to the externally allocated memory + ur_exp_image_mem_native_handle_t *phImageMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Map an external memory handle to a device memory region described by +/// void* +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hExternalMem` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == ppRetMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_INVALID_IMAGE_SIZE +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesMapExternalLinearMemoryExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] offset into memory region to map + uint64_t offset, + /// [in] size of memory region to map + uint64_t size, + /// [in] external memory handle to the external memory + ur_exp_external_mem_handle_t hExternalMem, + /// [out] pointer of the externally allocated memory + void **ppRetMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release external memory +/// +/// @remarks +/// _Analogues_ +/// - **cuDestroyExternalMemory** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hExternalMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseExternalMemoryExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][release] handle of external memory to be destroyed + ur_exp_external_mem_handle_t hExternalMem); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Import an external semaphore +/// +/// @remarks +/// _Analogues_ +/// - **cuImportExternalSemaphore** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE < +/// semHandleType` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pExternalSemaphoreDesc` +/// + `NULL == phExternalSemaphore` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesImportExternalSemaphoreExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] type of external memory handle + ur_exp_external_semaphore_type_t semHandleType, + /// [in] the external semaphore descriptor + ur_exp_external_semaphore_desc_t *pExternalSemaphoreDesc, + /// [out][alloc] external semaphore handle to the external semaphore + ur_exp_external_semaphore_handle_t *phExternalSemaphore); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release the external semaphore +/// +/// @remarks +/// _Analogues_ +/// - **cuDestroyExternalSemaphore** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// + `NULL == hExternalSemaphore` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesReleaseExternalSemaphoreExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in][release] handle of external semaphore to be destroyed + ur_exp_external_semaphore_handle_t hExternalSemaphore); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Instruct the queue with a non-blocking wait on an external semaphore +/// +/// @remarks +/// _Analogues_ +/// - **cuWaitExternalSemaphoresAsync** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hSemaphore` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] external semaphore handle + ur_exp_external_semaphore_handle_t hSemaphore, + /// [in] indicates whether the samephore is capable and should wait on a + /// certain value. + /// Otherwise the semaphore is treated like a binary state, and + /// `waitValue` is ignored. + bool hasWaitValue, + /// [in] the value to be waited on + uint64_t waitValue, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that all + /// previously enqueued commands + /// must be complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Instruct the queue to signal the external semaphore handle once all +/// previous commands have completed execution +/// +/// @remarks +/// _Analogues_ +/// - **cuSignalExternalSemaphoresAsync** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hSemaphore` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] external semaphore handle + ur_exp_external_semaphore_handle_t hSemaphore, + /// [in] indicates whether the samephore is capable and should signal on a + /// certain value. + /// Otherwise the semaphore is treated like a binary state, and + /// `signalValue` is ignored. + bool hasSignalValue, + /// [in] the value to be signalled + uint64_t signalValue, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that all + /// previously enqueued commands + /// must be complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for Command-Buffers +#if !defined(__GNUC__) +#pragma region command_buffer_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device kernel execution capability +typedef uint32_t ur_device_command_buffer_update_capability_flags_t; +typedef enum ur_device_command_buffer_update_capability_flag_t { + /// Device supports updating the kernel arguments in command-buffer + /// commands. + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS = UR_BIT(0), + /// Device supports updating the local work-group size in command-buffer + /// commands. + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE = UR_BIT(1), + /// Device supports updating the global work-group size in command-buffer + /// commands. + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE = UR_BIT(2), + /// Device supports updating the global work offset in command-buffer + /// commands. + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET = + UR_BIT(3), + /// Device supports updating the kernel handle in command-buffer commands. + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE = UR_BIT(4), + /// Device supports updating the event parameters in command-buffer + /// commands. + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS = UR_BIT(5), + /// @cond + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_device_command_buffer_update_capability_flag_t; +/// @brief Bit Mask for validating +/// ur_device_command_buffer_update_capability_flags_t +#define UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAGS_MASK 0xffffffc0 + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Command-buffer query information type +typedef enum ur_exp_command_buffer_info_t { + /// [uint32_t] Reference count of the command-buffer object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT = 0, + /// [::ur_exp_command_buffer_desc_t] Returns a ::ur_exp_command_buffer_desc_t + /// with the properties of the command-buffer. Returned values may differ + /// from those passed on construction if the property was ignored by the + /// adapter. + UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR = 1, + /// @cond + UR_EXP_COMMAND_BUFFER_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_command_buffer_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Command-buffer command query information type +typedef enum ur_exp_command_buffer_command_info_t { + /// [uint32_t] Reference count of the command-buffer object. + /// The reference count returned should be considered immediately stale. + /// It is unsuitable for general use in applications. This feature is + /// provided for identifying memory leaks. + UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT = 0, + /// @cond + UR_EXP_COMMAND_BUFFER_COMMAND_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_command_buffer_command_info_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_COMMAND_BUFFER_EXTENSION_STRING_EXP +/// @brief The extension string which defines support for command-buffers which +/// is returned when querying device extensions. +#define UR_COMMAND_BUFFER_EXTENSION_STRING_EXP "ur_exp_command_buffer" +#endif // UR_COMMAND_BUFFER_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Command-Buffer Descriptor Type +typedef struct ur_exp_command_buffer_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Commands in a finalized command-buffer can be updated. + ur_bool_t isUpdatable; + /// [in] Commands in a command-buffer may be executed in-order without + /// explicit dependencies. + ur_bool_t isInOrder; + /// [in] Command-buffer profiling is enabled. + ur_bool_t enableProfiling; + +} ur_exp_command_buffer_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Descriptor type for updating a kernel command memobj argument. +typedef struct ur_exp_command_buffer_update_memobj_arg_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Argument index. + uint32_t argIndex; + /// [in][optional] Pointer to memory object properties. + const ur_kernel_arg_mem_obj_properties_t *pProperties; + /// [in][optional] Handle of memory object to set at argument index. + ur_mem_handle_t hNewMemObjArg; + +} ur_exp_command_buffer_update_memobj_arg_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Descriptor type for updating a kernel command pointer argument. +typedef struct ur_exp_command_buffer_update_pointer_arg_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Argument index. + uint32_t argIndex; + /// [in][optional] Pointer to USM pointer properties. + const ur_kernel_arg_pointer_properties_t *pProperties; + /// [in][optional] USM pointer to memory location holding the argument + /// value to set at argument index. + const void *pNewPointerArg; + +} ur_exp_command_buffer_update_pointer_arg_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Descriptor type for updating a kernel command value argument. +typedef struct ur_exp_command_buffer_update_value_arg_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in] Argument index. + uint32_t argIndex; + /// [in] Argument size. + size_t argSize; + /// [in][optional] Pointer to value properties. + const ur_kernel_arg_value_properties_t *pProperties; + /// [in][optional] Argument value representing matching kernel arg type to + /// set at argument index. + const void *pNewValueArg; + +} ur_exp_command_buffer_update_value_arg_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Descriptor type for updating a kernel launch command. +typedef struct ur_exp_command_buffer_update_kernel_launch_desc_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC + ur_structure_type_t stype; + /// [in][optional] pointer to extension-specific structure + const void *pNext; + /// [in][optional] The new kernel handle. If this parameter is nullptr, + /// the current kernel handle in `hCommand` + /// will be used. If a kernel handle is passed, it must be a valid kernel + /// alternative as defined in + /// ::urCommandBufferAppendKernelLaunchExp. + ur_kernel_handle_t hNewKernel; + /// [in] Length of pNewMemObjArgList. + uint32_t numNewMemObjArgs; + /// [in] Length of pNewPointerArgList. + uint32_t numNewPointerArgs; + /// [in] Length of pNewValueArgList. + uint32_t numNewValueArgs; + /// [in] Number of work dimensions in the kernel ND-range, from 1-3. + uint32_t newWorkDim; + /// [in][optional][range(0, numNewMemObjArgs)] An array describing the new + /// kernel mem obj arguments for the command. + const ur_exp_command_buffer_update_memobj_arg_desc_t *pNewMemObjArgList; + /// [in][optional][range(0, numNewPointerArgs)] An array describing the + /// new kernel pointer arguments for the command. + const ur_exp_command_buffer_update_pointer_arg_desc_t *pNewPointerArgList; + /// [in][optional][range(0, numNewValueArgs)] An array describing the new + /// kernel value arguments for the command. + const ur_exp_command_buffer_update_value_arg_desc_t *pNewValueArgList; + /// [in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned + /// values that describe the offset used + /// to calculate the global ID. If this parameter is nullptr, the current + /// global work offset will be used. This parameter is required if + /// `newWorkDim` is different from the current work dimensions + /// in the command. + size_t *pNewGlobalWorkOffset; + /// [in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned + /// values that describe the number of + /// global work-items. If this parameter is nullptr, the current global + /// work size in `hCommand` will be used. + /// This parameter is required if `newWorkDim` is different from the + /// current work dimensions in the command. + size_t *pNewGlobalWorkSize; + /// [in][optional][range(0, newWorkDim)] Array of newWorkDim unsigned + /// values that describe the number of + /// work-items that make up a work-group. If `pNewGlobalWorkSize` is set + /// and `pNewLocalWorkSize` is nullptr, + /// then the runtime implementation will choose the local work size. If + /// `pNewGlobalWorkSize` is nullptr and + /// `pNewLocalWorkSize` is nullptr, the current local work size in the + /// command will be used. + size_t *pNewLocalWorkSize; + +} ur_exp_command_buffer_update_kernel_launch_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief A value that identifies a command inside of a command-buffer, used +/// for +/// defining dependencies between commands in the same command-buffer. +typedef uint32_t ur_exp_command_buffer_sync_point_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of Command-Buffer object +typedef struct ur_exp_command_buffer_handle_t_ *ur_exp_command_buffer_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a Command-Buffer command +typedef struct ur_exp_command_buffer_command_handle_t_ + *ur_exp_command_buffer_command_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create a Command-Buffer object +/// +/// @details +/// - Create a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_DEVICE +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If `pCommandBufferDesc->isUpdatable` is true and `hDevice` returns +/// 0 for the ::UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP +/// query. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp( + /// [in] Handle of the context object. + ur_context_handle_t hContext, + /// [in] Handle of the device object. + ur_device_handle_t hDevice, + /// [in][optional] command-buffer descriptor. + const ur_exp_command_buffer_desc_t *pCommandBufferDesc, + /// [out][alloc] Pointer to command-Buffer handle. + ur_exp_command_buffer_handle_t *phCommandBuffer); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Increment the command-buffer object's reference count. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainExp( + /// [in][retain] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Decrement the command-buffer object's reference count and delete the +/// command-buffer object if the reference count becomes zero. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseExp( + /// [in][release] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Stop recording on a command-buffer object such that no more commands +/// can be appended and make it ready to enqueue. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_OPERATION - "If `hCommandBuffer` has already +/// been finalized" +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferFinalizeExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a kernel execution command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + `phKernelAlternatives == NULL && numKernelAlternatives > 0` +/// + `phKernelAlternatives != NULL && numKernelAlternatives == 0` +/// + If `phKernelAlternatives` contains `hKernel` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_INVALID_OPERATION - "phCommand is not NULL and +/// hCommandBuffer is not updatable." +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] Kernel to append. + ur_kernel_handle_t hKernel, + /// [in] Dimension of the kernel execution. + uint32_t workDim, + /// [in] Offset to use when executing kernel. + const size_t *pGlobalWorkOffset, + /// [in] Global work size to use when executing kernel. + const size_t *pGlobalWorkSize, + /// [in][optional] Local work size to use when executing kernel. If this + /// parameter is nullptr, then a local work size will be generated by the + /// implementation. + const size_t *pLocalWorkSize, + /// [in] The number of kernel alternatives provided in + /// phKernelAlternatives. + uint32_t numKernelAlternatives, + /// [in][optional][range(0, numKernelAlternatives)] List of kernel handles + /// that might be used to update the kernel in this + /// command after the command-buffer is finalized. The default kernel + /// `hKernel` is implicitly marked as an alternative. It's + /// invalid to specify it as part of this list. + ur_kernel_handle_t *phKernelAlternatives, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. Only available if the + /// command-buffer is updatable. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM memcpy command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pSrc` or `pDst` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] Location the data will be copied to. + void *pDst, + /// [in] The data to be copied. + const void *pSrc, + /// [in] The number of bytes to copy. + size_t size, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + /// [in] handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] pointer to USM allocated memory to fill. + void *pMemory, + /// [in] pointer to the fill pattern. + const void *pPattern, + /// [in] size in bytes of the pattern. + size_t patternSize, + /// [in] fill size in bytes, must be a multiple of patternSize. + size_t size, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory copy command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hSrcMem` +/// + `NULL == hDstMem` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] The data to be copied. + ur_mem_handle_t hSrcMem, + /// [in] The location the data will be copied to. + ur_mem_handle_t hDstMem, + /// [in] Offset into the source memory. + size_t srcOffset, + /// [in] Offset into the destination memory + size_t dstOffset, + /// [in] The number of bytes to be copied. + size_t size, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory write command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] Handle of the buffer object. + ur_mem_handle_t hBuffer, + /// [in] Offset in bytes in the buffer object. + size_t offset, + /// [in] Size in bytes of data being written. + size_t size, + /// [in] Pointer to host memory where data is to be written from. + const void *pSrc, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory read command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] Handle of the buffer object. + ur_mem_handle_t hBuffer, + /// [in] Offset in bytes in the buffer object. + size_t offset, + /// [in] Size in bytes of data being written. + size_t size, + /// [in] Pointer to host memory where data is to be written to. + void *pDst, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory copy command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hSrcMem` +/// + `NULL == hDstMem` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] The data to be copied. + ur_mem_handle_t hSrcMem, + /// [in] The location the data will be copied to. + ur_mem_handle_t hDstMem, + /// [in] Origin for the region of data to be copied from the source. + ur_rect_offset_t srcOrigin, + /// [in] Origin for the region of data to be copied to in the destination. + ur_rect_offset_t dstOrigin, + /// [in] The extents describing the region to be copied. + ur_rect_region_t region, + /// [in] Row pitch of the source memory. + size_t srcRowPitch, + /// [in] Slice pitch of the source memory. + size_t srcSlicePitch, + /// [in] Row pitch of the destination memory. + size_t dstRowPitch, + /// [in] Slice pitch of the destination memory. + size_t dstSlicePitch, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory write command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pSrc` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] Handle of the buffer object. + ur_mem_handle_t hBuffer, + /// [in] 3D offset in the buffer. + ur_rect_offset_t bufferOffset, + /// [in] 3D offset in the host region. + ur_rect_offset_t hostOffset, + /// [in] 3D rectangular region descriptor: width, height, depth. + ur_rect_region_t region, + /// [in] Length of each row in bytes in the buffer object. + size_t bufferRowPitch, + /// [in] Length of each 2D slice in bytes in the buffer object being + /// written. + size_t bufferSlicePitch, + /// [in] Length of each row in bytes in the host memory region pointed to + /// by pSrc. + size_t hostRowPitch, + /// [in] Length of each 2D slice in bytes in the host memory region + /// pointed to by pSrc. + size_t hostSlicePitch, + /// [in] Pointer to host memory where data is to be written from. + void *pSrc, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a rectangular memory read command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pDst` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] Handle of the buffer object. + ur_mem_handle_t hBuffer, + /// [in] 3D offset in the buffer. + ur_rect_offset_t bufferOffset, + /// [in] 3D offset in the host region. + ur_rect_offset_t hostOffset, + /// [in] 3D rectangular region descriptor: width, height, depth. + ur_rect_region_t region, + /// [in] Length of each row in bytes in the buffer object. + size_t bufferRowPitch, + /// [in] Length of each 2D slice in bytes in the buffer object being read. + size_t bufferSlicePitch, + /// [in] Length of each row in bytes in the host memory region pointed to + /// by pDst. + size_t hostRowPitch, + /// [in] Length of each 2D slice in bytes in the host memory region + /// pointed to by pDst. + size_t hostSlicePitch, + /// [in] Pointer to host memory where data is to be read into. + void *pDst, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] Sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional] return an event object that will be signaled by the + /// completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill command to a command-buffer object. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + /// [in] handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] handle of the buffer object. + ur_mem_handle_t hBuffer, + /// [in] pointer to the fill pattern. + const void *pPattern, + /// [in] size in bytes of the pattern. + size_t patternSize, + /// [in] offset into the buffer. + size_t offset, + /// [in] fill size in bytes, must be a multiple of patternSize. + size_t size, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object. +/// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + /// [in] handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] pointer to USM allocated memory to prefetch. + const void *pMemory, + /// [in] size in bytes to be fetched. + size_t size, + /// [in] USM prefetch flags + ur_usm_migration_flags_t flags, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object. +/// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If the device associated with `hCommandBuffer` does not support +/// UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP and either `phEvent` +/// or `phEventWaitList` are not NULL. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + /// [in] handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] pointer to the USM memory object. + const void *pMemory, + /// [in] size in bytes to be advised. + size_t size, + /// [in] USM memory advice + ur_usm_advice_flags_t advice, + /// [in] The number of sync points in the provided dependency list. + uint32_t numSyncPointsInWaitList, + /// [in][optional] A list of sync points that this command depends on. May + /// be ignored if command-buffer is in-order. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional] sync point associated with this command. + ur_exp_command_buffer_sync_point_t *pSyncPoint, + /// [out][optional][alloc] return an event object that will be signaled by + /// the completion of this command in the next execution of the + /// command-buffer. + ur_event_handle_t *phEvent, + /// [out][optional][alloc] Handle to this command. + ur_exp_command_buffer_command_handle_t *phCommand); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Submit a command-buffer for execution on a queue. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( + /// [in] Handle of the command-buffer object. + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] The queue to submit this command-buffer for execution. + ur_queue_handle_t hQueue, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command-buffer execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command-buffer execution instance. If phEventWaitList and + /// phEvent are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Update a kernel launch command in a finalized command-buffer. +/// +/// @details +/// This entry-point is synchronous and may block if the command-buffer is +/// executing when the entry-point is called. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommand` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pUpdateKernelLaunch` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If +/// ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS +/// is not supported by the device, but any of +/// `pUpdateKernelLaunch->numNewMemObjArgs`, +/// `pUpdateKernelLaunch->numNewPointerArgs`, or +/// `pUpdateKernelLaunch->numNewValueArgs` are not zero. +/// + If +/// ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE is +/// not supported by the device but +/// `pUpdateKernelLaunch->pNewLocalWorkSize` is not nullptr. +/// + If +/// ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE is +/// not supported by the device but +/// `pUpdateKernelLaunch->pNewLocalWorkSize` is nullptr and +/// `pUpdateKernelLaunch->pNewGlobalWorkSize` is not nullptr. +/// + If +/// ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE +/// is not supported by the device but +/// `pUpdateKernelLaunch->pNewGlobalWorkSize` is not nullptr +/// + If +/// ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET +/// is not supported by the device but +/// `pUpdateKernelLaunch->pNewGlobalWorkOffset` is not nullptr. +/// + If ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE +/// is not supported by the device but `pUpdateKernelLaunch->hNewKernel` +/// is not nullptr. +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If ::ur_exp_command_buffer_desc_t::isUpdatable was not set to true +/// on creation of the command-buffer `hCommand` belongs to. +/// + If the command-buffer `hCommand` belongs to has not been +/// finalized. +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP +/// + If `hCommand` is not a kernel execution command. +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX +/// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// + `pUpdateKernelLaunch->newWorkDim < 1 || +/// pUpdateKernelLaunch->newWorkDim > 3` +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// + If `pUpdateKernelLaunch->hNewKernel` was not passed to the +/// `hKernel` or `phKernelAlternatives` parameters of +/// ::urCommandBufferAppendKernelLaunchExp when this command was +/// created. +/// + If `pUpdateKernelLaunch->newWorkDim` is different from the current +/// workDim in `hCommand` and, +/// `pUpdateKernelLaunch->pNewGlobalWorkSize`, or +/// `pUpdateKernelLaunch->pNewGlobalWorkOffset` are nullptr. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp( + /// [in] Handle of the command-buffer kernel command to update. + ur_exp_command_buffer_command_handle_t hCommand, + /// [in] Struct defining how the kernel command is to be updated. + const ur_exp_command_buffer_update_kernel_launch_desc_t + *pUpdateKernelLaunch); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get a new event that will be signaled the next time the command in +/// the +/// command-buffer executes. +/// +/// @details +/// It is the users responsibility to release the returned `phSignalEvent`. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommand` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phSignalEvent` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS is not +/// supported by the device associated with `hCommand`. +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If ::ur_exp_command_buffer_desc_t::isUpdatable was not set to true +/// on creation of the command-buffer `hCommand` belongs to. +/// + If the command-buffer `hCommand` belongs to has not been +/// finalized. +/// + If no `phEvent` parameter was set on creation of the command +/// associated with `hCommand`. +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateSignalEventExp( + /// [in] Handle of the command-buffer command to update. + ur_exp_command_buffer_command_handle_t hCommand, + /// [out][alloc] Event to be signaled. + ur_event_handle_t *phSignalEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the list of wait events for a command to depend on to a list of +/// new events. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommand` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + If ::UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS is not +/// supported by the device associated with `hCommand`. +/// - ::UR_RESULT_ERROR_INVALID_OPERATION +/// + If ::ur_exp_command_buffer_desc_t::isUpdatable was not set to true +/// on creation of the command-buffer `hCommand` belongs to. +/// + If the command-buffer `hCommand` belongs to has not been +/// finalized. +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// + If `numEventsInWaitList` does not match the number of wait events +/// set when the command associated with `hCommand` was created. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateWaitEventsExp( + /// [in] Handle of the command-buffer command to update. + ur_exp_command_buffer_command_handle_t hCommand, + /// [in] Size of the event wait list. + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the command execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating no wait events. + const ur_event_handle_t *phEventWaitList); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get command-buffer object information. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferGetInfoExp( + /// [in] handle of the command-buffer object + ur_exp_command_buffer_handle_t hCommandBuffer, + /// [in] the name of the command-buffer property to query + ur_exp_command_buffer_info_t propName, + /// [in] size in bytes of the command-buffer property value + size_t propSize, + /// [out][optional][typename(propName, propSize)] value of the + /// command-buffer property + void *pPropValue, + /// [out][optional] bytes returned in command-buffer property + size_t *pPropSizeRet); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for Cooperative Kernels +#if !defined(__GNUC__) +#pragma region cooperative_kernels_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP +/// @brief The extension string which defines support for cooperative-kernels +/// which is returned when querying device extensions. +#define UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP "ur_exp_cooperative_kernels" +#endif // UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to execute a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] number of dimensions, from 1 to 3, to specify the global and + /// work-group work-items + uint32_t workDim, + /// [in] pointer to an array of workDim unsigned values that specify the + /// offset used to calculate the global ID of a work-item + const size_t *pGlobalWorkOffset, + /// [in] pointer to an array of workDim unsigned values that specify the + /// number of global work-items in workDim that will execute the kernel + /// function + const size_t *pGlobalWorkSize, + /// [in][optional] pointer to an array of workDim unsigned values that + /// specify the number of local work-items forming a work-group that will + /// execute the kernel function. + /// If nullptr, the runtime implementation will choose the work-group size. + const size_t *pLocalWorkSize, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating that no wait + /// event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query the maximum number of work groups for a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pLocalWorkSize` +/// + `NULL == pGroupCountRet` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +UR_APIEXPORT ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] handle of the device object + ur_device_handle_t hDevice, + /// [in] number of dimensions, from 1 to 3, to specify the work-group + /// work-items + uint32_t workDim, + /// [in] pointer to an array of workDim unsigned values that specify the + /// number of local work-items forming a work-group that will execute the + /// kernel function. + const size_t *pLocalWorkSize, + /// [in] size of dynamic shared memory, for each work-group, in bytes, + /// that will be used when the kernel is launched + size_t dynamicSharedMemorySize, + /// [out] pointer to maximum number of groups + uint32_t *pGroupCountRet); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for enqueuing timestamp +// recordings +#if !defined(__GNUC__) +#pragma region enqueue_timestamp_recording_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command for recording the device timestamp +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phEvent` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueTimestampRecordingExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] indicates whether the call to this function should block until + /// until the device timestamp recording command has executed on the + /// device. + bool blocking, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [in,out] return an event object that identifies this particular kernel + /// execution instance. Profiling information can be queried + /// from this event as if `hQueue` had profiling enabled. Querying + /// `UR_PROFILING_INFO_COMMAND_QUEUED` or `UR_PROFILING_INFO_COMMAND_SUBMIT` + /// reports the timestamp at the time of the call to this function. + /// Querying `UR_PROFILING_INFO_COMMAND_START` or + /// `UR_PROFILING_INFO_COMMAND_END` reports the timestamp recorded when the + /// command is executed on the device. If phEventWaitList and phEvent are + /// not NULL, phEvent must not refer to an element of the phEventWaitList + /// array. + ur_event_handle_t *phEvent); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for (kernel) Launch +// Properties +#if !defined(__GNUC__) +#pragma region launch_properties_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP +/// @brief The extension string that defines support for the Launch Properties +/// extension, which is returned when querying device extensions. +#define UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP "ur_exp_launch_properties" +#endif // UR_LAUNCH_PROPERTIES_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Specifies a launch property id +/// +/// @remarks +/// _Analogues_ +/// - **CUlaunchAttributeID** +typedef enum ur_exp_launch_property_id_t { + /// The property has no effect + UR_EXP_LAUNCH_PROPERTY_ID_IGNORE = 0, + /// Whether to launch a cooperative kernel + UR_EXP_LAUNCH_PROPERTY_ID_COOPERATIVE = 1, + /// work-group cluster dimensions + UR_EXP_LAUNCH_PROPERTY_ID_CLUSTER_DIMENSION = 2, + /// Implicit work group memory allocation + UR_EXP_LAUNCH_PROPERTY_ID_WORK_GROUP_MEMORY = 3, + /// @cond + UR_EXP_LAUNCH_PROPERTY_ID_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_launch_property_id_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Specifies a launch property value +/// +/// @remarks +/// _Analogues_ +/// - **CUlaunchAttributeValue** +typedef union ur_exp_launch_property_value_t { + /// [in] dimensions of the cluster (units of work-group) (x, y, z). Each + /// value must be a divisor of the corresponding global work-size + /// dimension (in units of work-group). + uint32_t clusterDim[3]; + /// [in] non-zero value indicates a cooperative kernel + int cooperative; + /// [in] non-zero value indicates the amount of work group memory to + /// allocate in bytes + size_t workgroup_mem_size; + +} ur_exp_launch_property_value_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Kernel launch property +/// +/// @remarks +/// _Analogues_ +/// - **cuLaunchAttribute** +typedef struct ur_exp_launch_property_t { + /// [in] launch property id + ur_exp_launch_property_id_t id; + /// [in][tagged_by(id)] launch property value + ur_exp_launch_property_value_t value; + +} ur_exp_launch_property_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Launch kernel with custom launch properties +/// +/// @details +/// - Launches the kernel using the specified launch properties +/// - If numPropsInLaunchPropList == 0 then a regular kernel launch is used: +/// `urEnqueueKernelLaunch` +/// - Consult the appropriate adapter driver documentation for details of +/// adapter specific behavior and native error codes that may be returned. +/// +/// @remarks +/// _Analogues_ +/// - **cuLaunchKernelEx** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hKernel` +/// + NULL == hQueue +/// + NULL == hKernel +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// + `NULL == launchPropList` +/// + NULL == pGlobalWorkSize +/// + numPropsInLaunchpropList != 0 && launchPropList == NULL +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + phEventWaitList == NULL && numEventsInWaitList > 0 +/// + phEventWaitList != NULL && numEventsInWaitList == 0 +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in phEventWaitList has ::UR_EVENT_STATUS_ERROR +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunchCustomExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] handle of the kernel object + ur_kernel_handle_t hKernel, + /// [in] number of dimensions, from 1 to 3, to specify the global and + /// work-group work-items + uint32_t workDim, + /// [in] pointer to an array of workDim unsigned values that specify the + /// offset used to calculate the global ID of a work-item + const size_t *pGlobalWorkOffset, + /// [in] pointer to an array of workDim unsigned values that specify the + /// number of global work-items in workDim that will execute the kernel + /// function + const size_t *pGlobalWorkSize, + /// [in][optional] pointer to an array of workDim unsigned values that + /// specify the number of local work-items forming a work-group that will + /// execute the kernel function. If nullptr, the runtime implementation + /// will choose the work-group size. + const size_t *pLocalWorkSize, + /// [in] size of the launch prop list + uint32_t numPropsInLaunchPropList, + /// [in][range(0, numPropsInLaunchPropList)] pointer to a list of launch + /// properties + const ur_exp_launch_property_t *launchPropList, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. If nullptr, + /// the numEventsInWaitList must be 0, indicating that no wait event. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular kernel execution instance. If phEventWaitList and phEvent + /// are not NULL, phEvent must not refer to an element of the + /// phEventWaitList array. + ur_event_handle_t *phEvent); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for multi-device compile +#if !defined(__GNUC__) +#pragma region multi_device_compile_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP +/// @brief The extension string which defines support for test +/// which is returned when querying device extensions. +#define UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP \ + "ur_exp_multi_device_compile" +#endif // UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL urProgramBuildExp( + /// [in] Handle of the program to build. + ur_program_handle_t hProgram, + /// [in] number of devices + uint32_t numDevices, + /// [in][range(0, numDevices)] pointer to array of device handles + ur_device_handle_t *phDevices, + /// [in][optional] pointer to build options null-terminated string. + const char *pOptions); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point `hProgram` will +/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clCompileProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred while compiling `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL urProgramCompileExp( + /// [in][out] handle of the program to compile. + ur_program_handle_t hProgram, + /// [in] number of devices + uint32_t numDevices, + /// [in][range(0, numDevices)] pointer to array of device handles + ur_device_handle_t *phDevices, + /// [in][optional] pointer to build options null-terminated string. + const char *pOptions); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point the program returned +/// in `phProgram` will contain a binary of the +/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in +/// `phDevices`. +/// - If a non-success code is returned and `phProgram` is not `nullptr`, it +/// will contain an unspecified program or `nullptr`. Implementations may +/// use the build log of this program (accessible via +/// ::urProgramGetBuildInfo) to provide an error log for the linking +/// failure. +/// +/// @remarks +/// _Analogues_ +/// - **clLinkProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// + `NULL == phPrograms` +/// + `NULL == phProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If one of the programs in `phPrograms` isn't a valid program +/// object. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE +/// + If an error occurred while linking `phPrograms`. +UR_APIEXPORT ur_result_t UR_APICALL urProgramLinkExp( + /// [in] handle of the context instance. + ur_context_handle_t hContext, + /// [in] number of devices + uint32_t numDevices, + /// [in][range(0, numDevices)] pointer to array of device handles + ur_device_handle_t *phDevices, + /// [in] number of program handles in `phPrograms`. + uint32_t count, + /// [in][range(0, count)] pointer to array of program handles. + const ur_program_handle_t *phPrograms, + /// [in][optional] pointer to linker options null-terminated string. + const char *pOptions, + /// [out][alloc] pointer to handle of program object created. + ur_program_handle_t *phProgram); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' USM Import/Release Extension APIs +#if !defined(__GNUC__) +#pragma region usm_import_release_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Import memory into USM +/// +/// @details +/// - Import memory into USM +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +UR_APIEXPORT ur_result_t UR_APICALL urUSMImportExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] pointer to host memory object + void *pMem, + /// [in] size in bytes of the host memory object to be imported + size_t size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Release memory from USM +/// +/// @details +/// - Release memory from USM +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMem` +/// - ::UR_RESULT_ERROR_INVALID_CONTEXT +UR_APIEXPORT ur_result_t UR_APICALL urUSMReleaseExp( + /// [in] handle of the context object + ur_context_handle_t hContext, + /// [in] pointer to host memory object + void *pMem); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for USM P2P +#if !defined(__GNUC__) +#pragma region usm_p2p_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_USM_P2P_EXTENSION_STRING_EXP +/// @brief The extension string that defines support for USM P2P which is +/// returned when querying device extensions. +#define UR_USM_P2P_EXTENSION_STRING_EXP "ur_exp_usm_p2p" +#endif // UR_USM_P2P_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported peer info +typedef enum ur_exp_peer_info_t { + /// [int] 1 if P2P access is supported otherwise P2P access is not + /// supported. + UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED = 0, + /// [int] 1 if atomic operations are supported over the P2P link, + /// otherwise such operations are not supported. + UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED = 1, + /// @cond + UR_EXP_PEER_INFO_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_peer_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enable access to peer device memory +/// +/// @details +/// - Enables the command device to access and write device memory +/// allocations located on the peer device, provided that a P2P link +/// between the two devices is available. +/// - When Peer Access is successfully enabled, P2P memory accesses are +/// guaranteed to be allowed on the peer device until +/// ::urUsmP2PDisablePeerAccessExp is called. +/// - Note that the function operands may, but aren't guaranteed to, commute +/// for a given adapter: the peer device is not guaranteed to have access +/// to device memory allocations located on the command device. +/// - It is not guaranteed that the commutation relations of the function +/// arguments are identical for peer access and peer copies: For example, +/// for a given adapter the peer device may be able to copy data from the +/// command device, but not access and write the same data on the command +/// device. +/// - Consult the appropriate adapter driver documentation for details of +/// adapter specific behavior and native error codes that may be returned. +/// +/// @remarks +/// _Analogues_ +/// - **cuCtxEnablePeerAccess** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == commandDevice` +/// + `NULL == peerDevice` +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PEnablePeerAccessExp( + /// [in] handle of the command device object + ur_device_handle_t commandDevice, + /// [in] handle of the peer device object + ur_device_handle_t peerDevice); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Disable access to peer device memory +/// +/// @details +/// - Disables the ability of the command device to access and write device +/// memory allocations located on the peer device, provided that a P2P +/// link between the two devices was enabled prior to the call. +/// - Note that the function operands may, but aren't guaranteed to, commute +/// for a given adapter. If, prior to the function call, the peer device +/// had access to device memory allocations on the command device, it is +/// not guaranteed to still have such access following the function +/// return. +/// - It is not guaranteed that the commutation relations of the function +/// arguments are identical for peer access and peer copies: For example +/// for a given adapter, if, prior to the call, the peer device had access +/// to device memory allocations on the command device, the peer device +/// may still, following the function call, be able to copy data from the +/// command device, but not access and write the same data on the command +/// device. +/// - Consult the appropriate adapter driver documentation for details of +/// adapter specific behavior and native error codes that may be returned. +/// +/// @remarks +/// _Analogues_ +/// - **cuCtxDisablePeerAccess** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == commandDevice` +/// + `NULL == peerDevice` +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PDisablePeerAccessExp( + /// [in] handle of the command device object + ur_device_handle_t commandDevice, + /// [in] handle of the peer device object + ur_device_handle_t peerDevice); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Disable access to peer device memory +/// +/// @details +/// - Queries the peer access capabilities from the command device to the +/// peer device according to the query `propName`. +/// +/// @remarks +/// _Analogues_ +/// - **cuDeviceGetP2PAttribute** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == commandDevice` +/// + `NULL == peerDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED < propName` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + If `propName` is not supported by the adapter. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `propSize == 0 && pPropValue != NULL` +/// + If `propSize` is less than the real number of bytes needed to +/// return the info. +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `propSize != 0 && pPropValue == NULL` +/// + `pPropValue == NULL && pPropSizeRet == NULL` +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp( + /// [in] handle of the command device object + ur_device_handle_t commandDevice, + /// [in] handle of the peer device object + ur_device_handle_t peerDevice, + /// [in] type of the info to retrieve + ur_exp_peer_info_t propName, + /// [in] the number of bytes pointed to by pPropValue. + size_t propSize, + /// [out][optional][typename(propName, propSize)] array of bytes holding + /// the info. + /// If propSize is not equal to or greater than the real number of bytes + /// needed to return the info + /// then the ::UR_RESULT_ERROR_INVALID_SIZE error is returned and + /// pPropValue is not used. + void *pPropValue, + /// [out][optional] pointer to the actual size in bytes of the queried + /// propName. + size_t *pPropSizeRet); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental API for low-power events API +#if !defined(__GNUC__) +#pragma region low_power_events_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Extended enqueue properties +typedef uint32_t ur_exp_enqueue_ext_flags_t; +typedef enum ur_exp_enqueue_ext_flag_t { + /// Hint: use low-power events. Only meaningful for Level Zero, where the + /// implementation may use interrupt-driven events. May reduce CPU + /// utilization at the cost of increased event completion latency. Other + /// platforms may ignore this flag. + UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS = UR_BIT(11), + /// @cond + UR_EXP_ENQUEUE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_enqueue_ext_flag_t; +/// @brief Bit Mask for validating ur_exp_enqueue_ext_flags_t +#define UR_EXP_ENQUEUE_EXT_FLAGS_MASK 0xfffff7ff + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Extended enqueue properties +typedef struct ur_exp_enqueue_ext_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_ENQUEUE_EXT_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] extended enqueue flags + ur_exp_enqueue_ext_flags_t flags; + +} ur_exp_enqueue_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a barrier command which waits a list of events to complete +/// before it completes, with optional extended properties +/// +/// @details +/// - If the event list is empty, it waits for all previously enqueued +/// commands to complete. +/// - It blocks command execution - any following commands enqueued after it +/// do not execute until it completes. +/// - It returns an event which can be waited on. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueBarrierWithWaitList** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_EXT_FLAGS_MASK & +/// pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS +/// + An event in `phEventWaitList` has ::UR_EVENT_STATUS_ERROR. +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrierExt( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][optional] pointer to the extended enqueue properties + const ur_exp_enqueue_ext_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before this command can be executed. + /// If nullptr, the numEventsInWaitList must be 0, indicating that all + /// previously enqueued commands + /// must be complete. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies this + /// particular command instance. If phEventWaitList and phEvent are not + /// NULL, phEvent must not refer to an element of the phEventWaitList array. + ur_event_handle_t *phEvent); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental API for enqueuing work through +// native APIs +#if !defined(__GNUC__) +#pragma region native_enqueue_(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native enqueue properties +typedef uint32_t ur_exp_enqueue_native_command_flags_t; +typedef enum ur_exp_enqueue_native_command_flag_t { + /// reserved for future use. + UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD = UR_BIT(0), + /// @cond + UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_FORCE_UINT32 = 0x7fffffff + /// @endcond + +} ur_exp_enqueue_native_command_flag_t; +/// @brief Bit Mask for validating ur_exp_enqueue_native_command_flags_t +#define UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK 0xfffffffe + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Native enqueue properties +typedef struct ur_exp_enqueue_native_command_properties_t { + /// [in] type of this structure, must be + /// ::UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES + ur_structure_type_t stype; + /// [in,out][optional] pointer to extension-specific structure + void *pNext; + /// [in] native enqueue flags + ur_exp_enqueue_native_command_flags_t flags; + +} ur_exp_enqueue_native_command_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function enqueueing work through the native API to be executed +/// immediately. +typedef void (*ur_exp_enqueue_native_command_function_t)( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in][out] pointer to data to be passed to callback + void *pUserData); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Immediately enqueue work through a native backend API +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnNativeEnqueue` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAGS_MASK +/// & pProperties->flags` +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +UR_APIEXPORT ur_result_t UR_APICALL urEnqueueNativeCommandExp( + /// [in] handle of the queue object + ur_queue_handle_t hQueue, + /// [in] function calling the native underlying API, to be executed + /// immediately. + ur_exp_enqueue_native_command_function_t pfnNativeEnqueue, + /// [in][optional] data used by pfnNativeEnqueue + void *data, + /// [in] size of the mem list + uint32_t numMemsInMemList, + /// [in][optional][range(0, numMemsInMemList)] mems that are used within + /// pfnNativeEnqueue using ::urMemGetNativeHandle. + /// If nullptr, the numMemsInMemList must be 0, indicating that no mems + /// are accessed with ::urMemGetNativeHandle within pfnNativeEnqueue. + const ur_mem_handle_t *phMemList, + /// [in][optional] pointer to the native enqueue properties + const ur_exp_enqueue_native_command_properties_t *pProperties, + /// [in] size of the event wait list + uint32_t numEventsInWaitList, + /// [in][optional][range(0, numEventsInWaitList)] pointer to a list of + /// events that must be complete before the kernel execution. + /// If nullptr, the numEventsInWaitList must be 0, indicating no wait + /// events. + const ur_event_handle_t *phEventWaitList, + /// [out][optional][alloc] return an event object that identifies the work + /// that has + /// been enqueued in nativeEnqueueFunc. If phEventWaitList and phEvent are + /// not NULL, phEvent must not refer to an element of the phEventWaitList + /// array. + ur_event_handle_t *phEvent); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime API function parameters +#if !defined(__GNUC__) +#pragma region callbacks +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_create_params_t { + ur_loader_config_handle_t **pphLoaderConfig; +} ur_loader_config_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_retain_params_t { + ur_loader_config_handle_t *phLoaderConfig; +} ur_loader_config_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_release_params_t { + ur_loader_config_handle_t *phLoaderConfig; +} ur_loader_config_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_get_info_params_t { + ur_loader_config_handle_t *phLoaderConfig; + ur_loader_config_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_loader_config_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigEnableLayer +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_enable_layer_params_t { + ur_loader_config_handle_t *phLoaderConfig; + const char **ppLayerName; +} ur_loader_config_enable_layer_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigSetCodeLocationCallback +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_set_code_location_callback_params_t { + ur_loader_config_handle_t *phLoaderConfig; + ur_code_location_callback_t *ppfnCodeloc; + void **ppUserData; +} ur_loader_config_set_code_location_callback_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigSetMockingEnabled +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_set_mocking_enabled_params_t { + ur_loader_config_handle_t *phLoaderConfig; + ur_bool_t *penable; +} ur_loader_config_set_mocking_enabled_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPlatformGet +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_platform_get_params_t { + ur_adapter_handle_t **pphAdapters; + uint32_t *pNumAdapters; + uint32_t *pNumEntries; + ur_platform_handle_t **pphPlatforms; + uint32_t **ppNumPlatforms; +} ur_platform_get_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPlatformGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_platform_get_info_params_t { + ur_platform_handle_t *phPlatform; + ur_platform_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_platform_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPlatformGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_platform_get_native_handle_params_t { + ur_platform_handle_t *phPlatform; + ur_native_handle_t **pphNativePlatform; +} ur_platform_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPlatformCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_platform_create_with_native_handle_params_t { + ur_native_handle_t *phNativePlatform; + ur_adapter_handle_t *phAdapter; + const ur_platform_native_properties_t **ppProperties; + ur_platform_handle_t **pphPlatform; +} ur_platform_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPlatformGetApiVersion +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_platform_get_api_version_params_t { + ur_platform_handle_t *phPlatform; + ur_api_version_t **ppVersion; +} ur_platform_get_api_version_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPlatformGetBackendOption +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_platform_get_backend_option_params_t { + ur_platform_handle_t *phPlatform; + const char **ppFrontendOption; + const char ***pppPlatformOption; +} ur_platform_get_backend_option_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_create_params_t { + uint32_t *pDeviceCount; + const ur_device_handle_t **pphDevices; + const ur_context_properties_t **ppProperties; + ur_context_handle_t **pphContext; +} ur_context_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_retain_params_t { + ur_context_handle_t *phContext; +} ur_context_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_release_params_t { + ur_context_handle_t *phContext; +} ur_context_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_get_info_params_t { + ur_context_handle_t *phContext; + ur_context_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_context_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_get_native_handle_params_t { + ur_context_handle_t *phContext; + ur_native_handle_t **pphNativeContext; +} ur_context_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_create_with_native_handle_params_t { + ur_native_handle_t *phNativeContext; + ur_adapter_handle_t *phAdapter; + uint32_t *pnumDevices; + const ur_device_handle_t **pphDevices; + const ur_context_native_properties_t **ppProperties; + ur_context_handle_t **pphContext; +} ur_context_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urContextSetExtendedDeleter +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_context_set_extended_deleter_params_t { + ur_context_handle_t *phContext; + ur_context_extended_deleter_t *ppfnDeleter; + void **ppUserData; +} ur_context_set_extended_deleter_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_get_info_params_t { + ur_event_handle_t *phEvent; + ur_event_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_event_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventGetProfilingInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_get_profiling_info_params_t { + ur_event_handle_t *phEvent; + ur_profiling_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_event_get_profiling_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventWait +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_wait_params_t { + uint32_t *pnumEvents; + const ur_event_handle_t **pphEventWaitList; +} ur_event_wait_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_retain_params_t { + ur_event_handle_t *phEvent; +} ur_event_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_release_params_t { + ur_event_handle_t *phEvent; +} ur_event_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_get_native_handle_params_t { + ur_event_handle_t *phEvent; + ur_native_handle_t **pphNativeEvent; +} ur_event_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_create_with_native_handle_params_t { + ur_native_handle_t *phNativeEvent; + ur_context_handle_t *phContext; + const ur_event_native_properties_t **ppProperties; + ur_event_handle_t **pphEvent; +} ur_event_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEventSetCallback +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_event_set_callback_params_t { + ur_event_handle_t *phEvent; + ur_execution_info_t *pexecStatus; + ur_event_callback_t *ppfnNotify; + void **ppUserData; +} ur_event_set_callback_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramCreateWithIL +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_create_with_il_params_t { + ur_context_handle_t *phContext; + const void **ppIL; + size_t *plength; + const ur_program_properties_t **ppProperties; + ur_program_handle_t **pphProgram; +} ur_program_create_with_il_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramCreateWithBinary +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_create_with_binary_params_t { + ur_context_handle_t *phContext; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + size_t **ppLengths; + const uint8_t ***pppBinaries; + const ur_program_properties_t **ppProperties; + ur_program_handle_t **pphProgram; +} ur_program_create_with_binary_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramBuild +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_build_params_t { + ur_context_handle_t *phContext; + ur_program_handle_t *phProgram; + const char **ppOptions; +} ur_program_build_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramBuildExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_build_exp_params_t { + ur_program_handle_t *phProgram; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + const char **ppOptions; +} ur_program_build_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramCompile +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_compile_params_t { + ur_context_handle_t *phContext; + ur_program_handle_t *phProgram; + const char **ppOptions; +} ur_program_compile_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramCompileExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_compile_exp_params_t { + ur_program_handle_t *phProgram; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + const char **ppOptions; +} ur_program_compile_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramLink +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_link_params_t { + ur_context_handle_t *phContext; + uint32_t *pcount; + const ur_program_handle_t **pphPrograms; + const char **ppOptions; + ur_program_handle_t **pphProgram; +} ur_program_link_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramLinkExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_link_exp_params_t { + ur_context_handle_t *phContext; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + uint32_t *pcount; + const ur_program_handle_t **pphPrograms; + const char **ppOptions; + ur_program_handle_t **pphProgram; +} ur_program_link_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_retain_params_t { + ur_program_handle_t *phProgram; +} ur_program_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_release_params_t { + ur_program_handle_t *phProgram; +} ur_program_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramGetFunctionPointer +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_get_function_pointer_params_t { + ur_device_handle_t *phDevice; + ur_program_handle_t *phProgram; + const char **ppFunctionName; + void ***pppFunctionPointer; +} ur_program_get_function_pointer_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramGetGlobalVariablePointer +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_get_global_variable_pointer_params_t { + ur_device_handle_t *phDevice; + ur_program_handle_t *phProgram; + const char **ppGlobalVariableName; + size_t **ppGlobalVariableSizeRet; + void ***pppGlobalVariablePointerRet; +} ur_program_get_global_variable_pointer_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_get_info_params_t { + ur_program_handle_t *phProgram; + ur_program_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_program_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramGetBuildInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_get_build_info_params_t { + ur_program_handle_t *phProgram; + ur_device_handle_t *phDevice; + ur_program_build_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_program_get_build_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramSetSpecializationConstants +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_set_specialization_constants_params_t { + ur_program_handle_t *phProgram; + uint32_t *pcount; + const ur_specialization_constant_info_t **ppSpecConstants; +} ur_program_set_specialization_constants_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_get_native_handle_params_t { + ur_program_handle_t *phProgram; + ur_native_handle_t **pphNativeProgram; +} ur_program_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_create_with_native_handle_params_t { + ur_native_handle_t *phNativeProgram; + ur_context_handle_t *phContext; + const ur_program_native_properties_t **ppProperties; + ur_program_handle_t **pphProgram; +} ur_program_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_create_params_t { + ur_program_handle_t *phProgram; + const char **ppKernelName; + ur_kernel_handle_t **pphKernel; +} ur_kernel_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_get_info_params_t { + ur_kernel_handle_t *phKernel; + ur_kernel_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_kernel_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelGetGroupInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_get_group_info_params_t { + ur_kernel_handle_t *phKernel; + ur_device_handle_t *phDevice; + ur_kernel_group_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_kernel_get_group_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelGetSubGroupInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_get_sub_group_info_params_t { + ur_kernel_handle_t *phKernel; + ur_device_handle_t *phDevice; + ur_kernel_sub_group_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_kernel_get_sub_group_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_retain_params_t { + ur_kernel_handle_t *phKernel; +} ur_kernel_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_release_params_t { + ur_kernel_handle_t *phKernel; +} ur_kernel_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_get_native_handle_params_t { + ur_kernel_handle_t *phKernel; + ur_native_handle_t **pphNativeKernel; +} ur_kernel_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_create_with_native_handle_params_t { + ur_native_handle_t *phNativeKernel; + ur_context_handle_t *phContext; + ur_program_handle_t *phProgram; + const ur_kernel_native_properties_t **ppProperties; + ur_kernel_handle_t **pphKernel; +} ur_kernel_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelGetSuggestedLocalWorkSize +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_get_suggested_local_work_size_params_t { + ur_kernel_handle_t *phKernel; + ur_queue_handle_t *phQueue; + uint32_t *pnumWorkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + size_t **ppSuggestedLocalWorkSize; +} ur_kernel_get_suggested_local_work_size_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetArgValue +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_arg_value_params_t { + ur_kernel_handle_t *phKernel; + uint32_t *pargIndex; + size_t *pargSize; + const ur_kernel_arg_value_properties_t **ppProperties; + const void **ppArgValue; +} ur_kernel_set_arg_value_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetArgLocal +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_arg_local_params_t { + ur_kernel_handle_t *phKernel; + uint32_t *pargIndex; + size_t *pargSize; + const ur_kernel_arg_local_properties_t **ppProperties; +} ur_kernel_set_arg_local_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetArgPointer +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_arg_pointer_params_t { + ur_kernel_handle_t *phKernel; + uint32_t *pargIndex; + const ur_kernel_arg_pointer_properties_t **ppProperties; + const void **ppArgValue; +} ur_kernel_set_arg_pointer_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetExecInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_exec_info_params_t { + ur_kernel_handle_t *phKernel; + ur_kernel_exec_info_t *ppropName; + size_t *ppropSize; + const ur_kernel_exec_info_properties_t **ppProperties; + const void **ppPropValue; +} ur_kernel_set_exec_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetArgSampler +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_arg_sampler_params_t { + ur_kernel_handle_t *phKernel; + uint32_t *pargIndex; + const ur_kernel_arg_sampler_properties_t **ppProperties; + ur_sampler_handle_t *phArgValue; +} ur_kernel_set_arg_sampler_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetArgMemObj +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_arg_mem_obj_params_t { + ur_kernel_handle_t *phKernel; + uint32_t *pargIndex; + const ur_kernel_arg_mem_obj_properties_t **ppProperties; + ur_mem_handle_t *phArgValue; +} ur_kernel_set_arg_mem_obj_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSetSpecializationConstants +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_set_specialization_constants_params_t { + ur_kernel_handle_t *phKernel; + uint32_t *pcount; + const ur_specialization_constant_info_t **ppSpecConstants; +} ur_kernel_set_specialization_constants_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSuggestMaxCooperativeGroupCountExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t { + ur_kernel_handle_t *phKernel; + ur_device_handle_t *phDevice; + uint32_t *pworkDim; + const size_t **ppLocalWorkSize; + size_t *pdynamicSharedMemorySize; + uint32_t **ppGroupCountRet; +} ur_kernel_suggest_max_cooperative_group_count_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_get_info_params_t { + ur_queue_handle_t *phQueue; + ur_queue_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_queue_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_create_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_queue_properties_t **ppProperties; + ur_queue_handle_t **pphQueue; +} ur_queue_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_retain_params_t { + ur_queue_handle_t *phQueue; +} ur_queue_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_release_params_t { + ur_queue_handle_t *phQueue; +} ur_queue_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_get_native_handle_params_t { + ur_queue_handle_t *phQueue; + ur_queue_native_desc_t **ppDesc; + ur_native_handle_t **pphNativeQueue; +} ur_queue_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_create_with_native_handle_params_t { + ur_native_handle_t *phNativeQueue; + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_queue_native_properties_t **ppProperties; + ur_queue_handle_t **pphQueue; +} ur_queue_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueFinish +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_finish_params_t { + ur_queue_handle_t *phQueue; +} ur_queue_finish_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urQueueFlush +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_queue_flush_params_t { + ur_queue_handle_t *phQueue; +} ur_queue_flush_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urSamplerCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_sampler_create_params_t { + ur_context_handle_t *phContext; + const ur_sampler_desc_t **ppDesc; + ur_sampler_handle_t **pphSampler; +} ur_sampler_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urSamplerRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_sampler_retain_params_t { + ur_sampler_handle_t *phSampler; +} ur_sampler_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urSamplerRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_sampler_release_params_t { + ur_sampler_handle_t *phSampler; +} ur_sampler_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urSamplerGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_sampler_get_info_params_t { + ur_sampler_handle_t *phSampler; + ur_sampler_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_sampler_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urSamplerGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_sampler_get_native_handle_params_t { + ur_sampler_handle_t *phSampler; + ur_native_handle_t **pphNativeSampler; +} ur_sampler_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urSamplerCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_sampler_create_with_native_handle_params_t { + ur_native_handle_t *phNativeSampler; + ur_context_handle_t *phContext; + const ur_sampler_native_properties_t **ppProperties; + ur_sampler_handle_t **pphSampler; +} ur_sampler_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemImageCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_image_create_params_t { + ur_context_handle_t *phContext; + ur_mem_flags_t *pflags; + const ur_image_format_t **ppImageFormat; + const ur_image_desc_t **ppImageDesc; + void **ppHost; + ur_mem_handle_t **pphMem; +} ur_mem_image_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemBufferCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_buffer_create_params_t { + ur_context_handle_t *phContext; + ur_mem_flags_t *pflags; + size_t *psize; + const ur_buffer_properties_t **ppProperties; + ur_mem_handle_t **pphBuffer; +} ur_mem_buffer_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_retain_params_t { + ur_mem_handle_t *phMem; +} ur_mem_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_release_params_t { + ur_mem_handle_t *phMem; +} ur_mem_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemBufferPartition +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_buffer_partition_params_t { + ur_mem_handle_t *phBuffer; + ur_mem_flags_t *pflags; + ur_buffer_create_type_t *pbufferCreateType; + const ur_buffer_region_t **ppRegion; + ur_mem_handle_t **pphMem; +} ur_mem_buffer_partition_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_get_native_handle_params_t { + ur_mem_handle_t *phMem; + ur_device_handle_t *phDevice; + ur_native_handle_t **pphNativeMem; +} ur_mem_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemBufferCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_buffer_create_with_native_handle_params_t { + ur_native_handle_t *phNativeMem; + ur_context_handle_t *phContext; + const ur_mem_native_properties_t **ppProperties; + ur_mem_handle_t **pphMem; +} ur_mem_buffer_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemImageCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_image_create_with_native_handle_params_t { + ur_native_handle_t *phNativeMem; + ur_context_handle_t *phContext; + const ur_image_format_t **ppImageFormat; + const ur_image_desc_t **ppImageDesc; + const ur_mem_native_properties_t **ppProperties; + ur_mem_handle_t **pphMem; +} ur_mem_image_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_get_info_params_t { + ur_mem_handle_t *phMemory; + ur_mem_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_mem_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urMemImageGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_mem_image_get_info_params_t { + ur_mem_handle_t *phMemory; + ur_image_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_mem_image_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPhysicalMemCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_physical_mem_create_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + size_t *psize; + const ur_physical_mem_properties_t **ppProperties; + ur_physical_mem_handle_t **pphPhysicalMem; +} ur_physical_mem_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPhysicalMemRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_physical_mem_retain_params_t { + ur_physical_mem_handle_t *phPhysicalMem; +} ur_physical_mem_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPhysicalMemRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_physical_mem_release_params_t { + ur_physical_mem_handle_t *phPhysicalMem; +} ur_physical_mem_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urPhysicalMemGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_physical_mem_get_info_params_t { + ur_physical_mem_handle_t *phPhysicalMem; + ur_physical_mem_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_physical_mem_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGet +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_params_t { + uint32_t *pNumEntries; + ur_adapter_handle_t **pphAdapters; + uint32_t **ppNumAdapters; +} ur_adapter_get_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_release_params_t { + ur_adapter_handle_t *phAdapter; +} ur_adapter_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_retain_params_t { + ur_adapter_handle_t *phAdapter; +} ur_adapter_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGetLastError +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_last_error_params_t { + ur_adapter_handle_t *phAdapter; + const char ***pppMessage; + int32_t **ppError; +} ur_adapter_get_last_error_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_info_params_t { + ur_adapter_handle_t *phAdapter; + ur_adapter_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_adapter_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueKernelLaunch +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_kernel_launch_params_t { + ur_queue_handle_t *phQueue; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_kernel_launch_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueEventsWait +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_events_wait_params_t { + ur_queue_handle_t *phQueue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_events_wait_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueEventsWaitWithBarrier +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_events_wait_with_barrier_params_t { + ur_queue_handle_t *phQueue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_events_wait_with_barrier_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferRead +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_read_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingRead; + size_t *poffset; + size_t *psize; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_read_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferWrite +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_write_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingWrite; + size_t *poffset; + size_t *psize; + const void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_write_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferReadRect +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_read_rect_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingRead; + ur_rect_offset_t *pbufferOrigin; + ur_rect_offset_t *phostOrigin; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_read_rect_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferWriteRect +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_write_rect_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingWrite; + ur_rect_offset_t *pbufferOrigin; + ur_rect_offset_t *phostOrigin; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_write_rect_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferCopy +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_copy_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBufferSrc; + ur_mem_handle_t *phBufferDst; + size_t *psrcOffset; + size_t *pdstOffset; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_copy_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferCopyRect +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_copy_rect_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBufferSrc; + ur_mem_handle_t *phBufferDst; + ur_rect_offset_t *psrcOrigin; + ur_rect_offset_t *pdstOrigin; + ur_rect_region_t *pregion; + size_t *psrcRowPitch; + size_t *psrcSlicePitch; + size_t *pdstRowPitch; + size_t *pdstSlicePitch; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_copy_rect_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferFill +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_fill_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + const void **ppPattern; + size_t *ppatternSize; + size_t *poffset; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_buffer_fill_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemImageRead +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_image_read_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phImage; + bool *pblockingRead; + ur_rect_offset_t *porigin; + ur_rect_region_t *pregion; + size_t *prowPitch; + size_t *pslicePitch; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_image_read_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemImageWrite +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_image_write_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phImage; + bool *pblockingWrite; + ur_rect_offset_t *porigin; + ur_rect_region_t *pregion; + size_t *prowPitch; + size_t *pslicePitch; + void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_image_write_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemImageCopy +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_image_copy_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phImageSrc; + ur_mem_handle_t *phImageDst; + ur_rect_offset_t *psrcOrigin; + ur_rect_offset_t *pdstOrigin; + ur_rect_region_t *pregion; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_image_copy_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemBufferMap +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_buffer_map_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phBuffer; + bool *pblockingMap; + ur_map_flags_t *pmapFlags; + size_t *poffset; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; + void ***pppRetMap; +} ur_enqueue_mem_buffer_map_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueMemUnmap +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_mem_unmap_params_t { + ur_queue_handle_t *phQueue; + ur_mem_handle_t *phMem; + void **ppMappedPtr; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_mem_unmap_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMFill +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_fill_params_t { + ur_queue_handle_t *phQueue; + void **ppMem; + size_t *ppatternSize; + const void **ppPattern; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_fill_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMMemcpy +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_memcpy_params_t { + ur_queue_handle_t *phQueue; + bool *pblocking; + void **ppDst; + const void **ppSrc; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_memcpy_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMPrefetch +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_prefetch_params_t { + ur_queue_handle_t *phQueue; + const void **ppMem; + size_t *psize; + ur_usm_migration_flags_t *pflags; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_prefetch_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMAdvise +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_advise_params_t { + ur_queue_handle_t *phQueue; + const void **ppMem; + size_t *psize; + ur_usm_advice_flags_t *padvice; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_advise_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMFill2D +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_fill_2d_params_t { + ur_queue_handle_t *phQueue; + void **ppMem; + size_t *ppitch; + size_t *ppatternSize; + const void **ppPattern; + size_t *pwidth; + size_t *pheight; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_fill_2d_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueUSMMemcpy2D +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_usm_memcpy_2d_params_t { + ur_queue_handle_t *phQueue; + bool *pblocking; + void **ppDst; + size_t *pdstPitch; + const void **ppSrc; + size_t *psrcPitch; + size_t *pwidth; + size_t *pheight; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_usm_memcpy_2d_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueDeviceGlobalVariableWrite +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_device_global_variable_write_params_t { + ur_queue_handle_t *phQueue; + ur_program_handle_t *phProgram; + const char **pname; + bool *pblockingWrite; + size_t *pcount; + size_t *poffset; + const void **ppSrc; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_device_global_variable_write_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueDeviceGlobalVariableRead +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_device_global_variable_read_params_t { + ur_queue_handle_t *phQueue; + ur_program_handle_t *phProgram; + const char **pname; + bool *pblockingRead; + size_t *pcount; + size_t *poffset; + void **ppDst; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_device_global_variable_read_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueReadHostPipe +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_read_host_pipe_params_t { + ur_queue_handle_t *phQueue; + ur_program_handle_t *phProgram; + const char **ppipe_symbol; + bool *pblocking; + void **ppDst; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_read_host_pipe_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueWriteHostPipe +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_write_host_pipe_params_t { + ur_queue_handle_t *phQueue; + ur_program_handle_t *phProgram; + const char **ppipe_symbol; + bool *pblocking; + void **ppSrc; + size_t *psize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_write_host_pipe_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueKernelLaunchCustomExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_kernel_launch_custom_exp_params_t { + ur_queue_handle_t *phQueue; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumPropsInLaunchPropList; + const ur_exp_launch_property_t **plaunchPropList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_kernel_launch_custom_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueEventsWaitWithBarrierExt +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_events_wait_with_barrier_ext_params_t { + ur_queue_handle_t *phQueue; + const ur_exp_enqueue_ext_properties_t **ppProperties; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_events_wait_with_barrier_ext_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueCooperativeKernelLaunchExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_cooperative_kernel_launch_exp_params_t { + ur_queue_handle_t *phQueue; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_cooperative_kernel_launch_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueTimestampRecordingExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_timestamp_recording_exp_params_t { + ur_queue_handle_t *phQueue; + bool *pblocking; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_timestamp_recording_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueNativeCommandExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_native_command_exp_params_t { + ur_queue_handle_t *phQueue; + ur_exp_enqueue_native_command_function_t *ppfnNativeEnqueue; + void **pdata; + uint32_t *pnumMemsInMemList; + const ur_mem_handle_t **pphMemList; + const ur_exp_enqueue_native_command_properties_t **ppProperties; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_native_command_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for +/// urBindlessImagesUnsampledImageHandleDestroyExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_native_handle_t *phImage; +} ur_bindless_images_unsampled_image_handle_destroy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesSampledImageHandleDestroyExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_sampled_image_handle_destroy_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_native_handle_t *phImage; +} ur_bindless_images_sampled_image_handle_destroy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesImageAllocateExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_image_allocate_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_image_format_t **ppImageFormat; + const ur_image_desc_t **ppImageDesc; + ur_exp_image_mem_native_handle_t **pphImageMem; +} ur_bindless_images_image_allocate_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesImageFreeExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_image_free_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_mem_native_handle_t *phImageMem; +} ur_bindless_images_image_free_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesUnsampledImageCreateExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_unsampled_image_create_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_mem_native_handle_t *phImageMem; + const ur_image_format_t **ppImageFormat; + const ur_image_desc_t **ppImageDesc; + ur_exp_image_native_handle_t **pphImage; +} ur_bindless_images_unsampled_image_create_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesSampledImageCreateExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_sampled_image_create_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_mem_native_handle_t *phImageMem; + const ur_image_format_t **ppImageFormat; + const ur_image_desc_t **ppImageDesc; + ur_sampler_handle_t *phSampler; + ur_exp_image_native_handle_t **pphImage; +} ur_bindless_images_sampled_image_create_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesImageCopyExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_image_copy_exp_params_t { + ur_queue_handle_t *phQueue; + const void **ppSrc; + void **ppDst; + const ur_image_desc_t **ppSrcImageDesc; + const ur_image_desc_t **ppDstImageDesc; + const ur_image_format_t **ppSrcImageFormat; + const ur_image_format_t **ppDstImageFormat; + ur_exp_image_copy_region_t **ppCopyRegion; + ur_exp_image_copy_flags_t *pimageCopyFlags; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_bindless_images_image_copy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesImageGetInfoExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_image_get_info_exp_params_t { + ur_context_handle_t *phContext; + ur_exp_image_mem_native_handle_t *phImageMem; + ur_image_info_t *ppropName; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_bindless_images_image_get_info_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesMipmapGetLevelExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_mipmap_get_level_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_mem_native_handle_t *phImageMem; + uint32_t *pmipmapLevel; + ur_exp_image_mem_native_handle_t **pphImageMem; +} ur_bindless_images_mipmap_get_level_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesMipmapFreeExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_mipmap_free_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_image_mem_native_handle_t *phMem; +} ur_bindless_images_mipmap_free_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesImportExternalMemoryExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_import_external_memory_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + size_t *psize; + ur_exp_external_mem_type_t *pmemHandleType; + ur_exp_external_mem_desc_t **ppExternalMemDesc; + ur_exp_external_mem_handle_t **pphExternalMem; +} ur_bindless_images_import_external_memory_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesMapExternalArrayExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_map_external_array_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_image_format_t **ppImageFormat; + const ur_image_desc_t **ppImageDesc; + ur_exp_external_mem_handle_t *phExternalMem; + ur_exp_image_mem_native_handle_t **pphImageMem; +} ur_bindless_images_map_external_array_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesMapExternalLinearMemoryExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_map_external_linear_memory_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + uint64_t *poffset; + uint64_t *psize; + ur_exp_external_mem_handle_t *phExternalMem; + void ***pppRetMem; +} ur_bindless_images_map_external_linear_memory_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesReleaseExternalMemoryExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_release_external_memory_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_external_mem_handle_t *phExternalMem; +} ur_bindless_images_release_external_memory_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesImportExternalSemaphoreExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_import_external_semaphore_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_external_semaphore_type_t *psemHandleType; + ur_exp_external_semaphore_desc_t **ppExternalSemaphoreDesc; + ur_exp_external_semaphore_handle_t **pphExternalSemaphore; +} ur_bindless_images_import_external_semaphore_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesReleaseExternalSemaphoreExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_release_external_semaphore_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_exp_external_semaphore_handle_t *phExternalSemaphore; +} ur_bindless_images_release_external_semaphore_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesWaitExternalSemaphoreExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_wait_external_semaphore_exp_params_t { + ur_queue_handle_t *phQueue; + ur_exp_external_semaphore_handle_t *phSemaphore; + bool *phasWaitValue; + uint64_t *pwaitValue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_bindless_images_wait_external_semaphore_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urBindlessImagesSignalExternalSemaphoreExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_bindless_images_signal_external_semaphore_exp_params_t { + ur_queue_handle_t *phQueue; + ur_exp_external_semaphore_handle_t *phSemaphore; + bool *phasSignalValue; + uint64_t *psignalValue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_bindless_images_signal_external_semaphore_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMHostAlloc +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_host_alloc_params_t { + ur_context_handle_t *phContext; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; + size_t *psize; + void ***pppMem; +} ur_usm_host_alloc_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMDeviceAlloc +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_device_alloc_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; + size_t *psize; + void ***pppMem; +} ur_usm_device_alloc_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMSharedAlloc +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_shared_alloc_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; + size_t *psize; + void ***pppMem; +} ur_usm_shared_alloc_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMFree +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_free_params_t { + ur_context_handle_t *phContext; + void **ppMem; +} ur_usm_free_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMGetMemAllocInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_get_mem_alloc_info_params_t { + ur_context_handle_t *phContext; + const void **ppMem; + ur_usm_alloc_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_usm_get_mem_alloc_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolCreate +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_create_params_t { + ur_context_handle_t *phContext; + ur_usm_pool_desc_t **ppPoolDesc; + ur_usm_pool_handle_t **pppPool; +} ur_usm_pool_create_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_retain_params_t { + ur_usm_pool_handle_t *ppPool; +} ur_usm_pool_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_release_params_t { + ur_usm_pool_handle_t *ppPool; +} ur_usm_pool_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPoolGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pool_get_info_params_t { + ur_usm_pool_handle_t *phPool; + ur_usm_pool_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_usm_pool_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMPitchedAllocExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_pitched_alloc_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_usm_desc_t **ppUSMDesc; + ur_usm_pool_handle_t *ppool; + size_t *pwidthInBytes; + size_t *pheight; + size_t *pelementSizeBytes; + void ***pppMem; + size_t **ppResultPitch; +} ur_usm_pitched_alloc_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMImportExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_import_exp_params_t { + ur_context_handle_t *phContext; + void **ppMem; + size_t *psize; +} ur_usm_import_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUSMReleaseExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_release_exp_params_t { + ur_context_handle_t *phContext; + void **ppMem; +} ur_usm_release_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferCreateExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_create_exp_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + const ur_exp_command_buffer_desc_t **ppCommandBufferDesc; + ur_exp_command_buffer_handle_t **pphCommandBuffer; +} ur_command_buffer_create_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferRetainExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_retain_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; +} ur_command_buffer_retain_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferReleaseExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_release_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; +} ur_command_buffer_release_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferFinalizeExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_finalize_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; +} ur_command_buffer_finalize_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendKernelLaunchExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_kernel_launch_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumKernelAlternatives; + ur_kernel_handle_t **pphKernelAlternatives; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_kernel_launch_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMMemcpyExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_memcpy_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppDst; + const void **ppSrc; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_usm_memcpy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMFillExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_fill_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + const void **ppPattern; + size_t *ppatternSize; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_usm_fill_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferCopyExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_copy_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phSrcMem; + ur_mem_handle_t *phDstMem; + size_t *psrcOffset; + size_t *pdstOffset; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_copy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferWriteExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_write_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + size_t *poffset; + size_t *psize; + const void **ppSrc; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_write_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferReadExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_read_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + size_t *poffset; + size_t *psize; + void **ppDst; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_read_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferCopyRectExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phSrcMem; + ur_mem_handle_t *phDstMem; + ur_rect_offset_t *psrcOrigin; + ur_rect_offset_t *pdstOrigin; + ur_rect_region_t *pregion; + size_t *psrcRowPitch; + size_t *psrcSlicePitch; + size_t *pdstRowPitch; + size_t *pdstSlicePitch; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferWriteRectExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + ur_rect_offset_t *pbufferOffset; + ur_rect_offset_t *phostOffset; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppSrc; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_write_rect_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferReadRectExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + ur_rect_offset_t *pbufferOffset; + ur_rect_offset_t *phostOffset; + ur_rect_region_t *pregion; + size_t *pbufferRowPitch; + size_t *pbufferSlicePitch; + size_t *phostRowPitch; + size_t *phostSlicePitch; + void **ppDst; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_read_rect_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferFillExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_fill_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + const void **ppPattern; + size_t *ppatternSize; + size_t *poffset; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_mem_buffer_fill_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMPrefetchExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_prefetch_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + const void **ppMemory; + size_t *psize; + ur_usm_migration_flags_t *pflags; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_usm_prefetch_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMAdviseExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_advise_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + const void **ppMemory; + size_t *psize; + ur_usm_advice_flags_t *padvice; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; + ur_event_handle_t **pphEvent; + ur_exp_command_buffer_command_handle_t **pphCommand; +} ur_command_buffer_append_usm_advise_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferEnqueueExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_enqueue_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_queue_handle_t *phQueue; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_command_buffer_enqueue_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferUpdateKernelLaunchExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_update_kernel_launch_exp_params_t { + ur_exp_command_buffer_command_handle_t *phCommand; + const ur_exp_command_buffer_update_kernel_launch_desc_t * + *ppUpdateKernelLaunch; +} ur_command_buffer_update_kernel_launch_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferUpdateSignalEventExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_update_signal_event_exp_params_t { + ur_exp_command_buffer_command_handle_t *phCommand; + ur_event_handle_t **pphSignalEvent; +} ur_command_buffer_update_signal_event_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferUpdateWaitEventsExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_update_wait_events_exp_params_t { + ur_exp_command_buffer_command_handle_t *phCommand; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; +} ur_command_buffer_update_wait_events_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferGetInfoExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_get_info_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_exp_command_buffer_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_command_buffer_get_info_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUsmP2PEnablePeerAccessExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_p2p_enable_peer_access_exp_params_t { + ur_device_handle_t *pcommandDevice; + ur_device_handle_t *ppeerDevice; +} ur_usm_p2p_enable_peer_access_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUsmP2PDisablePeerAccessExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_p2p_disable_peer_access_exp_params_t { + ur_device_handle_t *pcommandDevice; + ur_device_handle_t *ppeerDevice; +} ur_usm_p2p_disable_peer_access_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urUsmP2PPeerAccessGetInfoExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_usm_p2p_peer_access_get_info_exp_params_t { + ur_device_handle_t *pcommandDevice; + ur_device_handle_t *ppeerDevice; + ur_exp_peer_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_usm_p2p_peer_access_get_info_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderInit +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_init_params_t { + ur_device_init_flags_t *pdevice_flags; + ur_loader_config_handle_t *phLoaderConfig; +} ur_loader_init_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemGranularityGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_granularity_get_info_params_t { + ur_context_handle_t *phContext; + ur_device_handle_t *phDevice; + ur_virtual_mem_granularity_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_virtual_mem_granularity_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemReserve +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_reserve_params_t { + ur_context_handle_t *phContext; + const void **ppStart; + size_t *psize; + void ***pppStart; +} ur_virtual_mem_reserve_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemFree +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_free_params_t { + ur_context_handle_t *phContext; + const void **ppStart; + size_t *psize; +} ur_virtual_mem_free_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemMap +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_map_params_t { + ur_context_handle_t *phContext; + const void **ppStart; + size_t *psize; + ur_physical_mem_handle_t *phPhysicalMem; + size_t *poffset; + ur_virtual_mem_access_flags_t *pflags; +} ur_virtual_mem_map_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemUnmap +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_unmap_params_t { + ur_context_handle_t *phContext; + const void **ppStart; + size_t *psize; +} ur_virtual_mem_unmap_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemSetAccess +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_set_access_params_t { + ur_context_handle_t *phContext; + const void **ppStart; + size_t *psize; + ur_virtual_mem_access_flags_t *pflags; +} ur_virtual_mem_set_access_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urVirtualMemGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_virtual_mem_get_info_params_t { + ur_context_handle_t *phContext; + const void **ppStart; + size_t *psize; + ur_virtual_mem_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_virtual_mem_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceGet +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_get_params_t { + ur_platform_handle_t *phPlatform; + ur_device_type_t *pDeviceType; + uint32_t *pNumEntries; + ur_device_handle_t **pphDevices; + uint32_t **ppNumDevices; +} ur_device_get_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceGetSelected +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_get_selected_params_t { + ur_platform_handle_t *phPlatform; + ur_device_type_t *pDeviceType; + uint32_t *pNumEntries; + ur_device_handle_t **pphDevices; + uint32_t **ppNumDevices; +} ur_device_get_selected_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_get_info_params_t { + ur_device_handle_t *phDevice; + ur_device_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_device_get_info_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_retain_params_t { + ur_device_handle_t *phDevice; +} ur_device_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_release_params_t { + ur_device_handle_t *phDevice; +} ur_device_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDevicePartition +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_partition_params_t { + ur_device_handle_t *phDevice; + const ur_device_partition_properties_t **ppProperties; + uint32_t *pNumDevices; + ur_device_handle_t **pphSubDevices; + uint32_t **ppNumDevicesRet; +} ur_device_partition_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceSelectBinary +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_select_binary_params_t { + ur_device_handle_t *phDevice; + const ur_device_binary_t **ppBinaries; + uint32_t *pNumBinaries; + uint32_t **ppSelectedBinary; +} ur_device_select_binary_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceGetNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_get_native_handle_params_t { + ur_device_handle_t *phDevice; + ur_native_handle_t **pphNativeDevice; +} ur_device_get_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceCreateWithNativeHandle +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_create_with_native_handle_params_t { + ur_native_handle_t *phNativeDevice; + ur_adapter_handle_t *phAdapter; + const ur_device_native_properties_t **ppProperties; + ur_device_handle_t **pphDevice; +} ur_device_create_with_native_handle_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urDeviceGetGlobalTimestamps +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_device_get_global_timestamps_params_t { + ur_device_handle_t *phDevice; + uint64_t **ppDeviceTimestamp; + uint64_t **ppHostTimestamp; +} ur_device_get_global_timestamps_params_t; + +#if !defined(__GNUC__) +#pragma endregion +#endif + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // UR_API_H_INCLUDED diff --git a/unified-runtime/include/ur_api_funcs.def b/unified-runtime/include/ur_api_funcs.def new file mode 100644 index 0000000000000..8c25dde67f466 --- /dev/null +++ b/unified-runtime/include/ur_api_funcs.def @@ -0,0 +1,216 @@ + +/* + * + * Copyright (C) 2024 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 + * + * @file ur_api_funcs.def + * @version v0.12-r0 + * + */ + + // Auto-generated file, do not edit. + +_UR_API(urPlatformGet) +_UR_API(urPlatformGetInfo) +_UR_API(urPlatformGetNativeHandle) +_UR_API(urPlatformCreateWithNativeHandle) +_UR_API(urPlatformGetApiVersion) +_UR_API(urPlatformGetBackendOption) +_UR_API(urContextCreate) +_UR_API(urContextRetain) +_UR_API(urContextRelease) +_UR_API(urContextGetInfo) +_UR_API(urContextGetNativeHandle) +_UR_API(urContextCreateWithNativeHandle) +_UR_API(urContextSetExtendedDeleter) +_UR_API(urEventGetInfo) +_UR_API(urEventGetProfilingInfo) +_UR_API(urEventWait) +_UR_API(urEventRetain) +_UR_API(urEventRelease) +_UR_API(urEventGetNativeHandle) +_UR_API(urEventCreateWithNativeHandle) +_UR_API(urEventSetCallback) +_UR_API(urProgramCreateWithIL) +_UR_API(urProgramCreateWithBinary) +_UR_API(urProgramBuild) +_UR_API(urProgramCompile) +_UR_API(urProgramLink) +_UR_API(urProgramRetain) +_UR_API(urProgramRelease) +_UR_API(urProgramGetFunctionPointer) +_UR_API(urProgramGetGlobalVariablePointer) +_UR_API(urProgramGetInfo) +_UR_API(urProgramGetBuildInfo) +_UR_API(urProgramSetSpecializationConstants) +_UR_API(urProgramGetNativeHandle) +_UR_API(urProgramCreateWithNativeHandle) +_UR_API(urProgramBuildExp) +_UR_API(urProgramCompileExp) +_UR_API(urProgramLinkExp) +_UR_API(urKernelCreate) +_UR_API(urKernelGetInfo) +_UR_API(urKernelGetGroupInfo) +_UR_API(urKernelGetSubGroupInfo) +_UR_API(urKernelRetain) +_UR_API(urKernelRelease) +_UR_API(urKernelGetNativeHandle) +_UR_API(urKernelCreateWithNativeHandle) +_UR_API(urKernelGetSuggestedLocalWorkSize) +_UR_API(urKernelSetArgValue) +_UR_API(urKernelSetArgLocal) +_UR_API(urKernelSetArgPointer) +_UR_API(urKernelSetExecInfo) +_UR_API(urKernelSetArgSampler) +_UR_API(urKernelSetArgMemObj) +_UR_API(urKernelSetSpecializationConstants) +_UR_API(urKernelSuggestMaxCooperativeGroupCountExp) +_UR_API(urQueueGetInfo) +_UR_API(urQueueCreate) +_UR_API(urQueueRetain) +_UR_API(urQueueRelease) +_UR_API(urQueueGetNativeHandle) +_UR_API(urQueueCreateWithNativeHandle) +_UR_API(urQueueFinish) +_UR_API(urQueueFlush) +_UR_API(urSamplerCreate) +_UR_API(urSamplerRetain) +_UR_API(urSamplerRelease) +_UR_API(urSamplerGetInfo) +_UR_API(urSamplerGetNativeHandle) +_UR_API(urSamplerCreateWithNativeHandle) +_UR_API(urMemImageCreate) +_UR_API(urMemBufferCreate) +_UR_API(urMemRetain) +_UR_API(urMemRelease) +_UR_API(urMemBufferPartition) +_UR_API(urMemGetNativeHandle) +_UR_API(urMemBufferCreateWithNativeHandle) +_UR_API(urMemImageCreateWithNativeHandle) +_UR_API(urMemGetInfo) +_UR_API(urMemImageGetInfo) +_UR_API(urPhysicalMemCreate) +_UR_API(urPhysicalMemRetain) +_UR_API(urPhysicalMemRelease) +_UR_API(urPhysicalMemGetInfo) +_UR_API(urAdapterGet) +_UR_API(urAdapterRelease) +_UR_API(urAdapterRetain) +_UR_API(urAdapterGetLastError) +_UR_API(urAdapterGetInfo) +_UR_API(urEnqueueKernelLaunch) +_UR_API(urEnqueueEventsWait) +_UR_API(urEnqueueEventsWaitWithBarrier) +_UR_API(urEnqueueMemBufferRead) +_UR_API(urEnqueueMemBufferWrite) +_UR_API(urEnqueueMemBufferReadRect) +_UR_API(urEnqueueMemBufferWriteRect) +_UR_API(urEnqueueMemBufferCopy) +_UR_API(urEnqueueMemBufferCopyRect) +_UR_API(urEnqueueMemBufferFill) +_UR_API(urEnqueueMemImageRead) +_UR_API(urEnqueueMemImageWrite) +_UR_API(urEnqueueMemImageCopy) +_UR_API(urEnqueueMemBufferMap) +_UR_API(urEnqueueMemUnmap) +_UR_API(urEnqueueUSMFill) +_UR_API(urEnqueueUSMMemcpy) +_UR_API(urEnqueueUSMPrefetch) +_UR_API(urEnqueueUSMAdvise) +_UR_API(urEnqueueUSMFill2D) +_UR_API(urEnqueueUSMMemcpy2D) +_UR_API(urEnqueueDeviceGlobalVariableWrite) +_UR_API(urEnqueueDeviceGlobalVariableRead) +_UR_API(urEnqueueReadHostPipe) +_UR_API(urEnqueueWriteHostPipe) +_UR_API(urEnqueueEventsWaitWithBarrierExt) +_UR_API(urEnqueueKernelLaunchCustomExp) +_UR_API(urEnqueueCooperativeKernelLaunchExp) +_UR_API(urEnqueueTimestampRecordingExp) +_UR_API(urEnqueueNativeCommandExp) +_UR_API(urBindlessImagesUnsampledImageHandleDestroyExp) +_UR_API(urBindlessImagesSampledImageHandleDestroyExp) +_UR_API(urBindlessImagesImageAllocateExp) +_UR_API(urBindlessImagesImageFreeExp) +_UR_API(urBindlessImagesUnsampledImageCreateExp) +_UR_API(urBindlessImagesSampledImageCreateExp) +_UR_API(urBindlessImagesImageCopyExp) +_UR_API(urBindlessImagesImageGetInfoExp) +_UR_API(urBindlessImagesMipmapGetLevelExp) +_UR_API(urBindlessImagesMipmapFreeExp) +_UR_API(urBindlessImagesImportExternalMemoryExp) +_UR_API(urBindlessImagesMapExternalArrayExp) +_UR_API(urBindlessImagesMapExternalLinearMemoryExp) +_UR_API(urBindlessImagesReleaseExternalMemoryExp) +_UR_API(urBindlessImagesImportExternalSemaphoreExp) +_UR_API(urBindlessImagesReleaseExternalSemaphoreExp) +_UR_API(urBindlessImagesWaitExternalSemaphoreExp) +_UR_API(urBindlessImagesSignalExternalSemaphoreExp) +_UR_API(urUSMHostAlloc) +_UR_API(urUSMDeviceAlloc) +_UR_API(urUSMSharedAlloc) +_UR_API(urUSMFree) +_UR_API(urUSMGetMemAllocInfo) +_UR_API(urUSMPoolCreate) +_UR_API(urUSMPoolRetain) +_UR_API(urUSMPoolRelease) +_UR_API(urUSMPoolGetInfo) +_UR_API(urUSMPitchedAllocExp) +_UR_API(urUSMImportExp) +_UR_API(urUSMReleaseExp) +_UR_API(urCommandBufferCreateExp) +_UR_API(urCommandBufferRetainExp) +_UR_API(urCommandBufferReleaseExp) +_UR_API(urCommandBufferFinalizeExp) +_UR_API(urCommandBufferAppendKernelLaunchExp) +_UR_API(urCommandBufferAppendUSMMemcpyExp) +_UR_API(urCommandBufferAppendUSMFillExp) +_UR_API(urCommandBufferAppendMemBufferCopyExp) +_UR_API(urCommandBufferAppendMemBufferWriteExp) +_UR_API(urCommandBufferAppendMemBufferReadExp) +_UR_API(urCommandBufferAppendMemBufferCopyRectExp) +_UR_API(urCommandBufferAppendMemBufferWriteRectExp) +_UR_API(urCommandBufferAppendMemBufferReadRectExp) +_UR_API(urCommandBufferAppendMemBufferFillExp) +_UR_API(urCommandBufferAppendUSMPrefetchExp) +_UR_API(urCommandBufferAppendUSMAdviseExp) +_UR_API(urCommandBufferEnqueueExp) +_UR_API(urCommandBufferUpdateKernelLaunchExp) +_UR_API(urCommandBufferUpdateSignalEventExp) +_UR_API(urCommandBufferUpdateWaitEventsExp) +_UR_API(urCommandBufferGetInfoExp) +_UR_API(urUsmP2PEnablePeerAccessExp) +_UR_API(urUsmP2PDisablePeerAccessExp) +_UR_API(urUsmP2PPeerAccessGetInfoExp) +_UR_API(urVirtualMemGranularityGetInfo) +_UR_API(urVirtualMemReserve) +_UR_API(urVirtualMemFree) +_UR_API(urVirtualMemMap) +_UR_API(urVirtualMemUnmap) +_UR_API(urVirtualMemSetAccess) +_UR_API(urVirtualMemGetInfo) +_UR_API(urDeviceGet) +_UR_API(urDeviceGetInfo) +_UR_API(urDeviceRetain) +_UR_API(urDeviceRelease) +_UR_API(urDevicePartition) +_UR_API(urDeviceSelectBinary) +_UR_API(urDeviceGetNativeHandle) +_UR_API(urDeviceCreateWithNativeHandle) +_UR_API(urDeviceGetGlobalTimestamps) +_UR_API(urLoaderConfigCreate) +_UR_API(urLoaderConfigEnableLayer) +_UR_API(urLoaderConfigGetInfo) +_UR_API(urLoaderConfigRelease) +_UR_API(urLoaderConfigRetain) +_UR_API(urLoaderConfigSetCodeLocationCallback) +_UR_API(urLoaderConfigSetMockingEnabled) +_UR_API(urLoaderInit) +_UR_API(urLoaderTearDown) diff --git a/unified-runtime/include/ur_ddi.h b/unified-runtime/include/ur_ddi.h new file mode 100644 index 0000000000000..c64aaa8d464b7 --- /dev/null +++ b/unified-runtime/include/ur_ddi.h @@ -0,0 +1,1896 @@ +/* + * + * Copyright (C) 2022 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 + * + * @file ur_ddi.h + * @version v0.12-r0 + * + */ +#ifndef UR_DDI_H_INCLUDED +#define UR_DDI_H_INCLUDED +#if defined(__cplusplus) +#pragma once +#endif +#include "ur_api.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPlatformGet +typedef ur_result_t(UR_APICALL *ur_pfnPlatformGet_t)(ur_adapter_handle_t *, + uint32_t, uint32_t, + ur_platform_handle_t *, + uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPlatformGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnPlatformGetInfo_t)(ur_platform_handle_t, + ur_platform_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPlatformGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnPlatformGetNativeHandle_t)( + ur_platform_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPlatformCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnPlatformCreateWithNativeHandle_t)( + ur_native_handle_t, ur_adapter_handle_t, + const ur_platform_native_properties_t *, ur_platform_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPlatformGetApiVersion +typedef ur_result_t(UR_APICALL *ur_pfnPlatformGetApiVersion_t)( + ur_platform_handle_t, ur_api_version_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPlatformGetBackendOption +typedef ur_result_t(UR_APICALL *ur_pfnPlatformGetBackendOption_t)( + ur_platform_handle_t, const char *, const char **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Platform functions pointers +typedef struct ur_platform_dditable_t { + ur_pfnPlatformGet_t pfnGet; + ur_pfnPlatformGetInfo_t pfnGetInfo; + ur_pfnPlatformGetNativeHandle_t pfnGetNativeHandle; + ur_pfnPlatformCreateWithNativeHandle_t pfnCreateWithNativeHandle; + ur_pfnPlatformGetApiVersion_t pfnGetApiVersion; + ur_pfnPlatformGetBackendOption_t pfnGetBackendOption; +} ur_platform_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Platform table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetPlatformProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_platform_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetPlatformProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetPlatformProcAddrTable_t)( + ur_api_version_t, ur_platform_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextCreate +typedef ur_result_t(UR_APICALL *ur_pfnContextCreate_t)( + uint32_t, const ur_device_handle_t *, const ur_context_properties_t *, + ur_context_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextRetain +typedef ur_result_t(UR_APICALL *ur_pfnContextRetain_t)(ur_context_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextRelease +typedef ur_result_t(UR_APICALL *ur_pfnContextRelease_t)(ur_context_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnContextGetInfo_t)(ur_context_handle_t, + ur_context_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnContextGetNativeHandle_t)( + ur_context_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnContextCreateWithNativeHandle_t)( + ur_native_handle_t, ur_adapter_handle_t, uint32_t, + const ur_device_handle_t *, const ur_context_native_properties_t *, + ur_context_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urContextSetExtendedDeleter +typedef ur_result_t(UR_APICALL *ur_pfnContextSetExtendedDeleter_t)( + ur_context_handle_t, ur_context_extended_deleter_t, void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Context functions pointers +typedef struct ur_context_dditable_t { + ur_pfnContextCreate_t pfnCreate; + ur_pfnContextRetain_t pfnRetain; + ur_pfnContextRelease_t pfnRelease; + ur_pfnContextGetInfo_t pfnGetInfo; + ur_pfnContextGetNativeHandle_t pfnGetNativeHandle; + ur_pfnContextCreateWithNativeHandle_t pfnCreateWithNativeHandle; + ur_pfnContextSetExtendedDeleter_t pfnSetExtendedDeleter; +} ur_context_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Context table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetContextProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_context_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetContextProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetContextProcAddrTable_t)( + ur_api_version_t, ur_context_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnEventGetInfo_t)(ur_event_handle_t, + ur_event_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventGetProfilingInfo +typedef ur_result_t(UR_APICALL *ur_pfnEventGetProfilingInfo_t)( + ur_event_handle_t, ur_profiling_info_t, size_t, void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventWait +typedef ur_result_t(UR_APICALL *ur_pfnEventWait_t)(uint32_t, + const ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventRetain +typedef ur_result_t(UR_APICALL *ur_pfnEventRetain_t)(ur_event_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventRelease +typedef ur_result_t(UR_APICALL *ur_pfnEventRelease_t)(ur_event_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnEventGetNativeHandle_t)( + ur_event_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnEventCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, + const ur_event_native_properties_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEventSetCallback +typedef ur_result_t(UR_APICALL *ur_pfnEventSetCallback_t)(ur_event_handle_t, + ur_execution_info_t, + ur_event_callback_t, + void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Event functions pointers +typedef struct ur_event_dditable_t { + ur_pfnEventGetInfo_t pfnGetInfo; + ur_pfnEventGetProfilingInfo_t pfnGetProfilingInfo; + ur_pfnEventWait_t pfnWait; + ur_pfnEventRetain_t pfnRetain; + ur_pfnEventRelease_t pfnRelease; + ur_pfnEventGetNativeHandle_t pfnGetNativeHandle; + ur_pfnEventCreateWithNativeHandle_t pfnCreateWithNativeHandle; + ur_pfnEventSetCallback_t pfnSetCallback; +} ur_event_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Event table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetEventProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_event_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetEventProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetEventProcAddrTable_t)( + ur_api_version_t, ur_event_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramCreateWithIL +typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithIL_t)( + ur_context_handle_t, const void *, size_t, const ur_program_properties_t *, + ur_program_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramCreateWithBinary +typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithBinary_t)( + ur_context_handle_t, uint32_t, ur_device_handle_t *, size_t *, + const uint8_t **, const ur_program_properties_t *, ur_program_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramBuild +typedef ur_result_t(UR_APICALL *ur_pfnProgramBuild_t)(ur_context_handle_t, + ur_program_handle_t, + const char *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramCompile +typedef ur_result_t(UR_APICALL *ur_pfnProgramCompile_t)(ur_context_handle_t, + ur_program_handle_t, + const char *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramLink +typedef ur_result_t(UR_APICALL *ur_pfnProgramLink_t)( + ur_context_handle_t, uint32_t, const ur_program_handle_t *, const char *, + ur_program_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramRetain +typedef ur_result_t(UR_APICALL *ur_pfnProgramRetain_t)(ur_program_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramRelease +typedef ur_result_t(UR_APICALL *ur_pfnProgramRelease_t)(ur_program_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramGetFunctionPointer +typedef ur_result_t(UR_APICALL *ur_pfnProgramGetFunctionPointer_t)( + ur_device_handle_t, ur_program_handle_t, const char *, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramGetGlobalVariablePointer +typedef ur_result_t(UR_APICALL *ur_pfnProgramGetGlobalVariablePointer_t)( + ur_device_handle_t, ur_program_handle_t, const char *, size_t *, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnProgramGetInfo_t)(ur_program_handle_t, + ur_program_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramGetBuildInfo +typedef ur_result_t(UR_APICALL *ur_pfnProgramGetBuildInfo_t)( + ur_program_handle_t, ur_device_handle_t, ur_program_build_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramSetSpecializationConstants +typedef ur_result_t(UR_APICALL *ur_pfnProgramSetSpecializationConstants_t)( + ur_program_handle_t, uint32_t, const ur_specialization_constant_info_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnProgramGetNativeHandle_t)( + ur_program_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnProgramCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, + const ur_program_native_properties_t *, ur_program_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Program functions pointers +typedef struct ur_program_dditable_t { + ur_pfnProgramCreateWithIL_t pfnCreateWithIL; + ur_pfnProgramCreateWithBinary_t pfnCreateWithBinary; + ur_pfnProgramBuild_t pfnBuild; + ur_pfnProgramCompile_t pfnCompile; + ur_pfnProgramLink_t pfnLink; + ur_pfnProgramRetain_t pfnRetain; + ur_pfnProgramRelease_t pfnRelease; + ur_pfnProgramGetFunctionPointer_t pfnGetFunctionPointer; + ur_pfnProgramGetGlobalVariablePointer_t pfnGetGlobalVariablePointer; + ur_pfnProgramGetInfo_t pfnGetInfo; + ur_pfnProgramGetBuildInfo_t pfnGetBuildInfo; + ur_pfnProgramSetSpecializationConstants_t pfnSetSpecializationConstants; + ur_pfnProgramGetNativeHandle_t pfnGetNativeHandle; + ur_pfnProgramCreateWithNativeHandle_t pfnCreateWithNativeHandle; +} ur_program_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Program table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_program_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetProgramProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetProgramProcAddrTable_t)( + ur_api_version_t, ur_program_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramBuildExp +typedef ur_result_t(UR_APICALL *ur_pfnProgramBuildExp_t)(ur_program_handle_t, + uint32_t, + ur_device_handle_t *, + const char *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramCompileExp +typedef ur_result_t(UR_APICALL *ur_pfnProgramCompileExp_t)(ur_program_handle_t, + uint32_t, + ur_device_handle_t *, + const char *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramLinkExp +typedef ur_result_t(UR_APICALL *ur_pfnProgramLinkExp_t)( + ur_context_handle_t, uint32_t, ur_device_handle_t *, uint32_t, + const ur_program_handle_t *, const char *, ur_program_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of ProgramExp functions pointers +typedef struct ur_program_exp_dditable_t { + ur_pfnProgramBuildExp_t pfnBuildExp; + ur_pfnProgramCompileExp_t pfnCompileExp; + ur_pfnProgramLinkExp_t pfnLinkExp; +} ur_program_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's ProgramExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_program_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetProgramExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetProgramExpProcAddrTable_t)( + ur_api_version_t, ur_program_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelCreate +typedef ur_result_t(UR_APICALL *ur_pfnKernelCreate_t)(ur_program_handle_t, + const char *, + ur_kernel_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnKernelGetInfo_t)(ur_kernel_handle_t, + ur_kernel_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelGetGroupInfo +typedef ur_result_t(UR_APICALL *ur_pfnKernelGetGroupInfo_t)( + ur_kernel_handle_t, ur_device_handle_t, ur_kernel_group_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelGetSubGroupInfo +typedef ur_result_t(UR_APICALL *ur_pfnKernelGetSubGroupInfo_t)( + ur_kernel_handle_t, ur_device_handle_t, ur_kernel_sub_group_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelRetain +typedef ur_result_t(UR_APICALL *ur_pfnKernelRetain_t)(ur_kernel_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelRelease +typedef ur_result_t(UR_APICALL *ur_pfnKernelRelease_t)(ur_kernel_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnKernelGetNativeHandle_t)( + ur_kernel_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnKernelCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, ur_program_handle_t, + const ur_kernel_native_properties_t *, ur_kernel_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelGetSuggestedLocalWorkSize +typedef ur_result_t(UR_APICALL *ur_pfnKernelGetSuggestedLocalWorkSize_t)( + ur_kernel_handle_t, ur_queue_handle_t, uint32_t, const size_t *, + const size_t *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetArgValue +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetArgValue_t)( + ur_kernel_handle_t, uint32_t, size_t, + const ur_kernel_arg_value_properties_t *, const void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetArgLocal +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetArgLocal_t)( + ur_kernel_handle_t, uint32_t, size_t, + const ur_kernel_arg_local_properties_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetArgPointer +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetArgPointer_t)( + ur_kernel_handle_t, uint32_t, const ur_kernel_arg_pointer_properties_t *, + const void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetExecInfo +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetExecInfo_t)( + ur_kernel_handle_t, ur_kernel_exec_info_t, size_t, + const ur_kernel_exec_info_properties_t *, const void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetArgSampler +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetArgSampler_t)( + ur_kernel_handle_t, uint32_t, const ur_kernel_arg_sampler_properties_t *, + ur_sampler_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetArgMemObj +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetArgMemObj_t)( + ur_kernel_handle_t, uint32_t, const ur_kernel_arg_mem_obj_properties_t *, + ur_mem_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSetSpecializationConstants +typedef ur_result_t(UR_APICALL *ur_pfnKernelSetSpecializationConstants_t)( + ur_kernel_handle_t, uint32_t, const ur_specialization_constant_info_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Kernel functions pointers +typedef struct ur_kernel_dditable_t { + ur_pfnKernelCreate_t pfnCreate; + ur_pfnKernelGetInfo_t pfnGetInfo; + ur_pfnKernelGetGroupInfo_t pfnGetGroupInfo; + ur_pfnKernelGetSubGroupInfo_t pfnGetSubGroupInfo; + ur_pfnKernelRetain_t pfnRetain; + ur_pfnKernelRelease_t pfnRelease; + ur_pfnKernelGetNativeHandle_t pfnGetNativeHandle; + ur_pfnKernelCreateWithNativeHandle_t pfnCreateWithNativeHandle; + ur_pfnKernelGetSuggestedLocalWorkSize_t pfnGetSuggestedLocalWorkSize; + ur_pfnKernelSetArgValue_t pfnSetArgValue; + ur_pfnKernelSetArgLocal_t pfnSetArgLocal; + ur_pfnKernelSetArgPointer_t pfnSetArgPointer; + ur_pfnKernelSetExecInfo_t pfnSetExecInfo; + ur_pfnKernelSetArgSampler_t pfnSetArgSampler; + ur_pfnKernelSetArgMemObj_t pfnSetArgMemObj; + ur_pfnKernelSetSpecializationConstants_t pfnSetSpecializationConstants; +} ur_kernel_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Kernel table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_kernel_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetKernelProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetKernelProcAddrTable_t)( + ur_api_version_t, ur_kernel_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp +typedef ur_result_t( + UR_APICALL *ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t)( + ur_kernel_handle_t, ur_device_handle_t, uint32_t, const size_t *, size_t, + uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of KernelExp functions pointers +typedef struct ur_kernel_exp_dditable_t { + ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t + pfnSuggestMaxCooperativeGroupCountExp; +} ur_kernel_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's KernelExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_kernel_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetKernelExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetKernelExpProcAddrTable_t)( + ur_api_version_t, ur_kernel_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnQueueGetInfo_t)(ur_queue_handle_t, + ur_queue_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueCreate +typedef ur_result_t(UR_APICALL *ur_pfnQueueCreate_t)( + ur_context_handle_t, ur_device_handle_t, const ur_queue_properties_t *, + ur_queue_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueRetain +typedef ur_result_t(UR_APICALL *ur_pfnQueueRetain_t)(ur_queue_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueRelease +typedef ur_result_t(UR_APICALL *ur_pfnQueueRelease_t)(ur_queue_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnQueueGetNativeHandle_t)( + ur_queue_handle_t, ur_queue_native_desc_t *, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnQueueCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, ur_device_handle_t, + const ur_queue_native_properties_t *, ur_queue_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueFinish +typedef ur_result_t(UR_APICALL *ur_pfnQueueFinish_t)(ur_queue_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urQueueFlush +typedef ur_result_t(UR_APICALL *ur_pfnQueueFlush_t)(ur_queue_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Queue functions pointers +typedef struct ur_queue_dditable_t { + ur_pfnQueueGetInfo_t pfnGetInfo; + ur_pfnQueueCreate_t pfnCreate; + ur_pfnQueueRetain_t pfnRetain; + ur_pfnQueueRelease_t pfnRelease; + ur_pfnQueueGetNativeHandle_t pfnGetNativeHandle; + ur_pfnQueueCreateWithNativeHandle_t pfnCreateWithNativeHandle; + ur_pfnQueueFinish_t pfnFinish; + ur_pfnQueueFlush_t pfnFlush; +} ur_queue_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Queue table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetQueueProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_queue_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetQueueProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetQueueProcAddrTable_t)( + ur_api_version_t, ur_queue_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urSamplerCreate +typedef ur_result_t(UR_APICALL *ur_pfnSamplerCreate_t)( + ur_context_handle_t, const ur_sampler_desc_t *, ur_sampler_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urSamplerRetain +typedef ur_result_t(UR_APICALL *ur_pfnSamplerRetain_t)(ur_sampler_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urSamplerRelease +typedef ur_result_t(UR_APICALL *ur_pfnSamplerRelease_t)(ur_sampler_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urSamplerGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnSamplerGetInfo_t)(ur_sampler_handle_t, + ur_sampler_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urSamplerGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnSamplerGetNativeHandle_t)( + ur_sampler_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urSamplerCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnSamplerCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, + const ur_sampler_native_properties_t *, ur_sampler_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Sampler functions pointers +typedef struct ur_sampler_dditable_t { + ur_pfnSamplerCreate_t pfnCreate; + ur_pfnSamplerRetain_t pfnRetain; + ur_pfnSamplerRelease_t pfnRelease; + ur_pfnSamplerGetInfo_t pfnGetInfo; + ur_pfnSamplerGetNativeHandle_t pfnGetNativeHandle; + ur_pfnSamplerCreateWithNativeHandle_t pfnCreateWithNativeHandle; +} ur_sampler_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Sampler table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetSamplerProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_sampler_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetSamplerProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetSamplerProcAddrTable_t)( + ur_api_version_t, ur_sampler_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemImageCreate +typedef ur_result_t(UR_APICALL *ur_pfnMemImageCreate_t)( + ur_context_handle_t, ur_mem_flags_t, const ur_image_format_t *, + const ur_image_desc_t *, void *, ur_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemBufferCreate +typedef ur_result_t(UR_APICALL *ur_pfnMemBufferCreate_t)( + ur_context_handle_t, ur_mem_flags_t, size_t, const ur_buffer_properties_t *, + ur_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemRetain +typedef ur_result_t(UR_APICALL *ur_pfnMemRetain_t)(ur_mem_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemRelease +typedef ur_result_t(UR_APICALL *ur_pfnMemRelease_t)(ur_mem_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemBufferPartition +typedef ur_result_t(UR_APICALL *ur_pfnMemBufferPartition_t)( + ur_mem_handle_t, ur_mem_flags_t, ur_buffer_create_type_t, + const ur_buffer_region_t *, ur_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnMemGetNativeHandle_t)( + ur_mem_handle_t, ur_device_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemBufferCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnMemBufferCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, const ur_mem_native_properties_t *, + ur_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemImageCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnMemImageCreateWithNativeHandle_t)( + ur_native_handle_t, ur_context_handle_t, const ur_image_format_t *, + const ur_image_desc_t *, const ur_mem_native_properties_t *, + ur_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnMemGetInfo_t)(ur_mem_handle_t, + ur_mem_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urMemImageGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnMemImageGetInfo_t)(ur_mem_handle_t, + ur_image_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Mem functions pointers +typedef struct ur_mem_dditable_t { + ur_pfnMemImageCreate_t pfnImageCreate; + ur_pfnMemBufferCreate_t pfnBufferCreate; + ur_pfnMemRetain_t pfnRetain; + ur_pfnMemRelease_t pfnRelease; + ur_pfnMemBufferPartition_t pfnBufferPartition; + ur_pfnMemGetNativeHandle_t pfnGetNativeHandle; + ur_pfnMemBufferCreateWithNativeHandle_t pfnBufferCreateWithNativeHandle; + ur_pfnMemImageCreateWithNativeHandle_t pfnImageCreateWithNativeHandle; + ur_pfnMemGetInfo_t pfnGetInfo; + ur_pfnMemImageGetInfo_t pfnImageGetInfo; +} ur_mem_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Mem table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetMemProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_mem_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetMemProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetMemProcAddrTable_t)( + ur_api_version_t, ur_mem_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPhysicalMemCreate +typedef ur_result_t(UR_APICALL *ur_pfnPhysicalMemCreate_t)( + ur_context_handle_t, ur_device_handle_t, size_t, + const ur_physical_mem_properties_t *, ur_physical_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPhysicalMemRetain +typedef ur_result_t(UR_APICALL *ur_pfnPhysicalMemRetain_t)( + ur_physical_mem_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPhysicalMemRelease +typedef ur_result_t(UR_APICALL *ur_pfnPhysicalMemRelease_t)( + ur_physical_mem_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urPhysicalMemGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnPhysicalMemGetInfo_t)( + ur_physical_mem_handle_t, ur_physical_mem_info_t, size_t, void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of PhysicalMem functions pointers +typedef struct ur_physical_mem_dditable_t { + ur_pfnPhysicalMemCreate_t pfnCreate; + ur_pfnPhysicalMemRetain_t pfnRetain; + ur_pfnPhysicalMemRelease_t pfnRelease; + ur_pfnPhysicalMemGetInfo_t pfnGetInfo; +} ur_physical_mem_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's PhysicalMem table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetPhysicalMemProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_physical_mem_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetPhysicalMemProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetPhysicalMemProcAddrTable_t)( + ur_api_version_t, ur_physical_mem_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterGet +typedef ur_result_t(UR_APICALL *ur_pfnAdapterGet_t)(uint32_t, + ur_adapter_handle_t *, + uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterRelease +typedef ur_result_t(UR_APICALL *ur_pfnAdapterRelease_t)(ur_adapter_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterRetain +typedef ur_result_t(UR_APICALL *ur_pfnAdapterRetain_t)(ur_adapter_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterGetLastError +typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetLastError_t)( + ur_adapter_handle_t, const char **, int32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetInfo_t)(ur_adapter_handle_t, + ur_adapter_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Global functions pointers +typedef struct ur_global_dditable_t { + ur_pfnAdapterGet_t pfnAdapterGet; + ur_pfnAdapterRelease_t pfnAdapterRelease; + ur_pfnAdapterRetain_t pfnAdapterRetain; + ur_pfnAdapterGetLastError_t pfnAdapterGetLastError; + ur_pfnAdapterGetInfo_t pfnAdapterGetInfo; +} ur_global_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Global table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_global_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetGlobalProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetGlobalProcAddrTable_t)( + ur_api_version_t, ur_global_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueKernelLaunch +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueKernelLaunch_t)( + ur_queue_handle_t, ur_kernel_handle_t, uint32_t, const size_t *, + const size_t *, const size_t *, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueEventsWait +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueEventsWait_t)( + ur_queue_handle_t, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueEventsWaitWithBarrier +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueEventsWaitWithBarrier_t)( + ur_queue_handle_t, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferRead +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferRead_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, size_t, size_t, void *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferWrite +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferWrite_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, size_t, size_t, const void *, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferReadRect +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferReadRect_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, ur_rect_offset_t, + ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferWriteRect +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferWriteRect_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, ur_rect_offset_t, + ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferCopy +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferCopy_t)( + ur_queue_handle_t, ur_mem_handle_t, ur_mem_handle_t, size_t, size_t, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferCopyRect +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferCopyRect_t)( + ur_queue_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, + ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferFill +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferFill_t)( + ur_queue_handle_t, ur_mem_handle_t, const void *, size_t, size_t, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemImageRead +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemImageRead_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, ur_rect_offset_t, + ur_rect_region_t, size_t, size_t, void *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemImageWrite +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemImageWrite_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, ur_rect_offset_t, + ur_rect_region_t, size_t, size_t, void *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemImageCopy +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemImageCopy_t)( + ur_queue_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, + ur_rect_offset_t, ur_rect_region_t, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemBufferMap +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemBufferMap_t)( + ur_queue_handle_t, ur_mem_handle_t, bool, ur_map_flags_t, size_t, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueMemUnmap +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueMemUnmap_t)( + ur_queue_handle_t, ur_mem_handle_t, void *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMFill +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMFill_t)( + ur_queue_handle_t, void *, size_t, const void *, size_t, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMMemcpy +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMMemcpy_t)( + ur_queue_handle_t, bool, void *, const void *, size_t, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMPrefetch +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMPrefetch_t)( + ur_queue_handle_t, const void *, size_t, ur_usm_migration_flags_t, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMAdvise +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMAdvise_t)(ur_queue_handle_t, + const void *, size_t, + ur_usm_advice_flags_t, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMFill2D +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMFill2D_t)( + ur_queue_handle_t, void *, size_t, size_t, const void *, size_t, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueUSMMemcpy2D +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueUSMMemcpy2D_t)( + ur_queue_handle_t, bool, void *, size_t, const void *, size_t, size_t, + size_t, uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueDeviceGlobalVariableWrite +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueDeviceGlobalVariableWrite_t)( + ur_queue_handle_t, ur_program_handle_t, const char *, bool, size_t, size_t, + const void *, uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueDeviceGlobalVariableRead +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueDeviceGlobalVariableRead_t)( + ur_queue_handle_t, ur_program_handle_t, const char *, bool, size_t, size_t, + void *, uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueReadHostPipe +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueReadHostPipe_t)( + ur_queue_handle_t, ur_program_handle_t, const char *, bool, void *, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueWriteHostPipe +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueWriteHostPipe_t)( + ur_queue_handle_t, ur_program_handle_t, const char *, bool, void *, size_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueEventsWaitWithBarrierExt +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueEventsWaitWithBarrierExt_t)( + ur_queue_handle_t, const ur_exp_enqueue_ext_properties_t *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Enqueue functions pointers +typedef struct ur_enqueue_dditable_t { + ur_pfnEnqueueKernelLaunch_t pfnKernelLaunch; + ur_pfnEnqueueEventsWait_t pfnEventsWait; + ur_pfnEnqueueEventsWaitWithBarrier_t pfnEventsWaitWithBarrier; + ur_pfnEnqueueMemBufferRead_t pfnMemBufferRead; + ur_pfnEnqueueMemBufferWrite_t pfnMemBufferWrite; + ur_pfnEnqueueMemBufferReadRect_t pfnMemBufferReadRect; + ur_pfnEnqueueMemBufferWriteRect_t pfnMemBufferWriteRect; + ur_pfnEnqueueMemBufferCopy_t pfnMemBufferCopy; + ur_pfnEnqueueMemBufferCopyRect_t pfnMemBufferCopyRect; + ur_pfnEnqueueMemBufferFill_t pfnMemBufferFill; + ur_pfnEnqueueMemImageRead_t pfnMemImageRead; + ur_pfnEnqueueMemImageWrite_t pfnMemImageWrite; + ur_pfnEnqueueMemImageCopy_t pfnMemImageCopy; + ur_pfnEnqueueMemBufferMap_t pfnMemBufferMap; + ur_pfnEnqueueMemUnmap_t pfnMemUnmap; + ur_pfnEnqueueUSMFill_t pfnUSMFill; + ur_pfnEnqueueUSMMemcpy_t pfnUSMMemcpy; + ur_pfnEnqueueUSMPrefetch_t pfnUSMPrefetch; + ur_pfnEnqueueUSMAdvise_t pfnUSMAdvise; + ur_pfnEnqueueUSMFill2D_t pfnUSMFill2D; + ur_pfnEnqueueUSMMemcpy2D_t pfnUSMMemcpy2D; + ur_pfnEnqueueDeviceGlobalVariableWrite_t pfnDeviceGlobalVariableWrite; + ur_pfnEnqueueDeviceGlobalVariableRead_t pfnDeviceGlobalVariableRead; + ur_pfnEnqueueReadHostPipe_t pfnReadHostPipe; + ur_pfnEnqueueWriteHostPipe_t pfnWriteHostPipe; + ur_pfnEnqueueEventsWaitWithBarrierExt_t pfnEventsWaitWithBarrierExt; +} ur_enqueue_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Enqueue table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_enqueue_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetEnqueueProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueProcAddrTable_t)( + ur_api_version_t, ur_enqueue_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueKernelLaunchCustomExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueKernelLaunchCustomExp_t)( + ur_queue_handle_t, ur_kernel_handle_t, uint32_t, const size_t *, + const size_t *, const size_t *, uint32_t, const ur_exp_launch_property_t *, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCooperativeKernelLaunchExp_t)( + ur_queue_handle_t, ur_kernel_handle_t, uint32_t, const size_t *, + const size_t *, const size_t *, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueTimestampRecordingExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueTimestampRecordingExp_t)( + ur_queue_handle_t, bool, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueNativeCommandExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueNativeCommandExp_t)( + ur_queue_handle_t, ur_exp_enqueue_native_command_function_t, void *, + uint32_t, const ur_mem_handle_t *, + const ur_exp_enqueue_native_command_properties_t *, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of EnqueueExp functions pointers +typedef struct ur_enqueue_exp_dditable_t { + ur_pfnEnqueueKernelLaunchCustomExp_t pfnKernelLaunchCustomExp; + ur_pfnEnqueueCooperativeKernelLaunchExp_t pfnCooperativeKernelLaunchExp; + ur_pfnEnqueueTimestampRecordingExp_t pfnTimestampRecordingExp; + ur_pfnEnqueueNativeCommandExp_t pfnNativeCommandExp; +} ur_enqueue_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's EnqueueExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_enqueue_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetEnqueueExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueExpProcAddrTable_t)( + ur_api_version_t, ur_enqueue_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesUnsampledImageHandleDestroyExp +typedef ur_result_t( + UR_APICALL *ur_pfnBindlessImagesUnsampledImageHandleDestroyExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_native_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesSampledImageHandleDestroyExp +typedef ur_result_t( + UR_APICALL *ur_pfnBindlessImagesSampledImageHandleDestroyExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_native_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesImageAllocateExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageAllocateExp_t)( + ur_context_handle_t, ur_device_handle_t, const ur_image_format_t *, + const ur_image_desc_t *, ur_exp_image_mem_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesImageFreeExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageFreeExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_mem_native_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesUnsampledImageCreateExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesUnsampledImageCreateExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_mem_native_handle_t, + const ur_image_format_t *, const ur_image_desc_t *, + ur_exp_image_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesSampledImageCreateExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesSampledImageCreateExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_mem_native_handle_t, + const ur_image_format_t *, const ur_image_desc_t *, ur_sampler_handle_t, + ur_exp_image_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesImageCopyExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageCopyExp_t)( + ur_queue_handle_t, const void *, void *, const ur_image_desc_t *, + const ur_image_desc_t *, const ur_image_format_t *, + const ur_image_format_t *, ur_exp_image_copy_region_t *, + ur_exp_image_copy_flags_t, uint32_t, const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesImageGetInfoExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImageGetInfoExp_t)( + ur_context_handle_t, ur_exp_image_mem_native_handle_t, ur_image_info_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesMipmapGetLevelExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesMipmapGetLevelExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_mem_native_handle_t, + uint32_t, ur_exp_image_mem_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesMipmapFreeExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesMipmapFreeExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_image_mem_native_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesImportExternalMemoryExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesImportExternalMemoryExp_t)( + ur_context_handle_t, ur_device_handle_t, size_t, ur_exp_external_mem_type_t, + ur_exp_external_mem_desc_t *, ur_exp_external_mem_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesMapExternalArrayExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesMapExternalArrayExp_t)( + ur_context_handle_t, ur_device_handle_t, const ur_image_format_t *, + const ur_image_desc_t *, ur_exp_external_mem_handle_t, + ur_exp_image_mem_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesMapExternalLinearMemoryExp +typedef ur_result_t( + UR_APICALL *ur_pfnBindlessImagesMapExternalLinearMemoryExp_t)( + ur_context_handle_t, ur_device_handle_t, uint64_t, uint64_t, + ur_exp_external_mem_handle_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesReleaseExternalMemoryExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesReleaseExternalMemoryExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_external_mem_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesImportExternalSemaphoreExp +typedef ur_result_t( + UR_APICALL *ur_pfnBindlessImagesImportExternalSemaphoreExp_t)( + ur_context_handle_t, ur_device_handle_t, ur_exp_external_semaphore_type_t, + ur_exp_external_semaphore_desc_t *, ur_exp_external_semaphore_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesReleaseExternalSemaphoreExp +typedef ur_result_t( + UR_APICALL *ur_pfnBindlessImagesReleaseExternalSemaphoreExp_t)( + ur_context_handle_t, ur_device_handle_t, + ur_exp_external_semaphore_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesWaitExternalSemaphoreExp +typedef ur_result_t(UR_APICALL *ur_pfnBindlessImagesWaitExternalSemaphoreExp_t)( + ur_queue_handle_t, ur_exp_external_semaphore_handle_t, bool, uint64_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urBindlessImagesSignalExternalSemaphoreExp +typedef ur_result_t( + UR_APICALL *ur_pfnBindlessImagesSignalExternalSemaphoreExp_t)( + ur_queue_handle_t, ur_exp_external_semaphore_handle_t, bool, uint64_t, + uint32_t, const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of BindlessImagesExp functions pointers +typedef struct ur_bindless_images_exp_dditable_t { + ur_pfnBindlessImagesUnsampledImageHandleDestroyExp_t + pfnUnsampledImageHandleDestroyExp; + ur_pfnBindlessImagesSampledImageHandleDestroyExp_t + pfnSampledImageHandleDestroyExp; + ur_pfnBindlessImagesImageAllocateExp_t pfnImageAllocateExp; + ur_pfnBindlessImagesImageFreeExp_t pfnImageFreeExp; + ur_pfnBindlessImagesUnsampledImageCreateExp_t pfnUnsampledImageCreateExp; + ur_pfnBindlessImagesSampledImageCreateExp_t pfnSampledImageCreateExp; + ur_pfnBindlessImagesImageCopyExp_t pfnImageCopyExp; + ur_pfnBindlessImagesImageGetInfoExp_t pfnImageGetInfoExp; + ur_pfnBindlessImagesMipmapGetLevelExp_t pfnMipmapGetLevelExp; + ur_pfnBindlessImagesMipmapFreeExp_t pfnMipmapFreeExp; + ur_pfnBindlessImagesImportExternalMemoryExp_t pfnImportExternalMemoryExp; + ur_pfnBindlessImagesMapExternalArrayExp_t pfnMapExternalArrayExp; + ur_pfnBindlessImagesMapExternalLinearMemoryExp_t + pfnMapExternalLinearMemoryExp; + ur_pfnBindlessImagesReleaseExternalMemoryExp_t pfnReleaseExternalMemoryExp; + ur_pfnBindlessImagesImportExternalSemaphoreExp_t + pfnImportExternalSemaphoreExp; + ur_pfnBindlessImagesReleaseExternalSemaphoreExp_t + pfnReleaseExternalSemaphoreExp; + ur_pfnBindlessImagesWaitExternalSemaphoreExp_t pfnWaitExternalSemaphoreExp; + ur_pfnBindlessImagesSignalExternalSemaphoreExp_t + pfnSignalExternalSemaphoreExp; +} ur_bindless_images_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's BindlessImagesExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetBindlessImagesExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_bindless_images_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetBindlessImagesExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetBindlessImagesExpProcAddrTable_t)( + ur_api_version_t, ur_bindless_images_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMHostAlloc +typedef ur_result_t(UR_APICALL *ur_pfnUSMHostAlloc_t)(ur_context_handle_t, + const ur_usm_desc_t *, + ur_usm_pool_handle_t, + size_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMDeviceAlloc +typedef ur_result_t(UR_APICALL *ur_pfnUSMDeviceAlloc_t)(ur_context_handle_t, + ur_device_handle_t, + const ur_usm_desc_t *, + ur_usm_pool_handle_t, + size_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMSharedAlloc +typedef ur_result_t(UR_APICALL *ur_pfnUSMSharedAlloc_t)(ur_context_handle_t, + ur_device_handle_t, + const ur_usm_desc_t *, + ur_usm_pool_handle_t, + size_t, void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMFree +typedef ur_result_t(UR_APICALL *ur_pfnUSMFree_t)(ur_context_handle_t, void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMGetMemAllocInfo +typedef ur_result_t(UR_APICALL *ur_pfnUSMGetMemAllocInfo_t)(ur_context_handle_t, + const void *, + ur_usm_alloc_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolCreate +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolCreate_t)(ur_context_handle_t, + ur_usm_pool_desc_t *, + ur_usm_pool_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolRetain +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolRetain_t)(ur_usm_pool_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolRelease +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolRelease_t)(ur_usm_pool_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPoolGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnUSMPoolGetInfo_t)(ur_usm_pool_handle_t, + ur_usm_pool_info_t, + size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of USM functions pointers +typedef struct ur_usm_dditable_t { + ur_pfnUSMHostAlloc_t pfnHostAlloc; + ur_pfnUSMDeviceAlloc_t pfnDeviceAlloc; + ur_pfnUSMSharedAlloc_t pfnSharedAlloc; + ur_pfnUSMFree_t pfnFree; + ur_pfnUSMGetMemAllocInfo_t pfnGetMemAllocInfo; + ur_pfnUSMPoolCreate_t pfnPoolCreate; + ur_pfnUSMPoolRetain_t pfnPoolRetain; + ur_pfnUSMPoolRelease_t pfnPoolRelease; + ur_pfnUSMPoolGetInfo_t pfnPoolGetInfo; +} ur_usm_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's USM table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_usm_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetUSMProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetUSMProcAddrTable_t)( + ur_api_version_t, ur_usm_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMPitchedAllocExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMPitchedAllocExp_t)( + ur_context_handle_t, ur_device_handle_t, const ur_usm_desc_t *, + ur_usm_pool_handle_t, size_t, size_t, size_t, void **, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMImportExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMImportExp_t)(ur_context_handle_t, + void *, size_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUSMReleaseExp +typedef ur_result_t(UR_APICALL *ur_pfnUSMReleaseExp_t)(ur_context_handle_t, + void *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of USMExp functions pointers +typedef struct ur_usm_exp_dditable_t { + ur_pfnUSMPitchedAllocExp_t pfnPitchedAllocExp; + ur_pfnUSMImportExp_t pfnImportExp; + ur_pfnUSMReleaseExp_t pfnReleaseExp; +} ur_usm_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's USMExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_usm_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetUSMExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetUSMExpProcAddrTable_t)( + ur_api_version_t, ur_usm_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferCreateExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferCreateExp_t)( + ur_context_handle_t, ur_device_handle_t, + const ur_exp_command_buffer_desc_t *, ur_exp_command_buffer_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferRetainExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferRetainExp_t)( + ur_exp_command_buffer_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferReleaseExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferReleaseExp_t)( + ur_exp_command_buffer_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferFinalizeExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferFinalizeExp_t)( + ur_exp_command_buffer_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendKernelLaunchExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)( + ur_exp_command_buffer_handle_t, ur_kernel_handle_t, uint32_t, + const size_t *, const size_t *, const size_t *, uint32_t, + ur_kernel_handle_t *, uint32_t, const ur_exp_command_buffer_sync_point_t *, + uint32_t, const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)( + ur_exp_command_buffer_handle_t, void *, const void *, size_t, uint32_t, + const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMFillExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)( + ur_exp_command_buffer_handle_t, void *, const void *, size_t, size_t, + uint32_t, const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, size_t, + size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, + uint32_t, const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, size_t, + const void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, + uint32_t, const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferReadExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, size_t, void *, + uint32_t, const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp +typedef ur_result_t( + UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, + ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, + size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, + uint32_t, const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp +typedef ur_result_t( + UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteRectExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, + ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, + uint32_t, const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp +typedef ur_result_t( + UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadRectExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, + ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, + uint32_t, const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( + ur_exp_command_buffer_handle_t, ur_mem_handle_t, const void *, size_t, + size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, + uint32_t, const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( + ur_exp_command_buffer_handle_t, const void *, size_t, + ur_usm_migration_flags_t, uint32_t, + const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( + ur_exp_command_buffer_handle_t, const void *, size_t, ur_usm_advice_flags_t, + uint32_t, const ur_exp_command_buffer_sync_point_t *, uint32_t, + const ur_event_handle_t *, ur_exp_command_buffer_sync_point_t *, + ur_event_handle_t *, ur_exp_command_buffer_command_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferEnqueueExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)( + ur_exp_command_buffer_handle_t, ur_queue_handle_t, uint32_t, + const ur_event_handle_t *, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferUpdateKernelLaunchExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateKernelLaunchExp_t)( + ur_exp_command_buffer_command_handle_t, + const ur_exp_command_buffer_update_kernel_launch_desc_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferUpdateSignalEventExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateSignalEventExp_t)( + ur_exp_command_buffer_command_handle_t, ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferUpdateWaitEventsExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferUpdateWaitEventsExp_t)( + ur_exp_command_buffer_command_handle_t, uint32_t, + const ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferGetInfoExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferGetInfoExp_t)( + ur_exp_command_buffer_handle_t, ur_exp_command_buffer_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of CommandBufferExp functions pointers +typedef struct ur_command_buffer_exp_dditable_t { + ur_pfnCommandBufferCreateExp_t pfnCreateExp; + ur_pfnCommandBufferRetainExp_t pfnRetainExp; + ur_pfnCommandBufferReleaseExp_t pfnReleaseExp; + ur_pfnCommandBufferFinalizeExp_t pfnFinalizeExp; + ur_pfnCommandBufferAppendKernelLaunchExp_t pfnAppendKernelLaunchExp; + ur_pfnCommandBufferAppendUSMMemcpyExp_t pfnAppendUSMMemcpyExp; + ur_pfnCommandBufferAppendUSMFillExp_t pfnAppendUSMFillExp; + ur_pfnCommandBufferAppendMemBufferCopyExp_t pfnAppendMemBufferCopyExp; + ur_pfnCommandBufferAppendMemBufferWriteExp_t pfnAppendMemBufferWriteExp; + ur_pfnCommandBufferAppendMemBufferReadExp_t pfnAppendMemBufferReadExp; + ur_pfnCommandBufferAppendMemBufferCopyRectExp_t pfnAppendMemBufferCopyRectExp; + ur_pfnCommandBufferAppendMemBufferWriteRectExp_t + pfnAppendMemBufferWriteRectExp; + ur_pfnCommandBufferAppendMemBufferReadRectExp_t pfnAppendMemBufferReadRectExp; + ur_pfnCommandBufferAppendMemBufferFillExp_t pfnAppendMemBufferFillExp; + ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp; + ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp; + ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp; + ur_pfnCommandBufferUpdateKernelLaunchExp_t pfnUpdateKernelLaunchExp; + ur_pfnCommandBufferUpdateSignalEventExp_t pfnUpdateSignalEventExp; + ur_pfnCommandBufferUpdateWaitEventsExp_t pfnUpdateWaitEventsExp; + ur_pfnCommandBufferGetInfoExp_t pfnGetInfoExp; +} ur_command_buffer_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's CommandBufferExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_command_buffer_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetCommandBufferExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetCommandBufferExpProcAddrTable_t)( + ur_api_version_t, ur_command_buffer_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUsmP2PEnablePeerAccessExp +typedef ur_result_t(UR_APICALL *ur_pfnUsmP2PEnablePeerAccessExp_t)( + ur_device_handle_t, ur_device_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUsmP2PDisablePeerAccessExp +typedef ur_result_t(UR_APICALL *ur_pfnUsmP2PDisablePeerAccessExp_t)( + ur_device_handle_t, ur_device_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urUsmP2PPeerAccessGetInfoExp +typedef ur_result_t(UR_APICALL *ur_pfnUsmP2PPeerAccessGetInfoExp_t)( + ur_device_handle_t, ur_device_handle_t, ur_exp_peer_info_t, size_t, void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of UsmP2PExp functions pointers +typedef struct ur_usm_p2p_exp_dditable_t { + ur_pfnUsmP2PEnablePeerAccessExp_t pfnEnablePeerAccessExp; + ur_pfnUsmP2PDisablePeerAccessExp_t pfnDisablePeerAccessExp; + ur_pfnUsmP2PPeerAccessGetInfoExp_t pfnPeerAccessGetInfoExp; +} ur_usm_p2p_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's UsmP2PExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetUsmP2PExpProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_usm_p2p_exp_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetUsmP2PExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetUsmP2PExpProcAddrTable_t)( + ur_api_version_t, ur_usm_p2p_exp_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemGranularityGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemGranularityGetInfo_t)( + ur_context_handle_t, ur_device_handle_t, ur_virtual_mem_granularity_info_t, + size_t, void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemReserve +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemReserve_t)(ur_context_handle_t, + const void *, size_t, + void **); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemFree +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemFree_t)(ur_context_handle_t, + const void *, size_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemMap +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemMap_t)( + ur_context_handle_t, const void *, size_t, ur_physical_mem_handle_t, size_t, + ur_virtual_mem_access_flags_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemUnmap +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemUnmap_t)(ur_context_handle_t, + const void *, size_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemSetAccess +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemSetAccess_t)( + ur_context_handle_t, const void *, size_t, ur_virtual_mem_access_flags_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urVirtualMemGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemGetInfo_t)( + ur_context_handle_t, const void *, size_t, ur_virtual_mem_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of VirtualMem functions pointers +typedef struct ur_virtual_mem_dditable_t { + ur_pfnVirtualMemGranularityGetInfo_t pfnGranularityGetInfo; + ur_pfnVirtualMemReserve_t pfnReserve; + ur_pfnVirtualMemFree_t pfnFree; + ur_pfnVirtualMemMap_t pfnMap; + ur_pfnVirtualMemUnmap_t pfnUnmap; + ur_pfnVirtualMemSetAccess_t pfnSetAccess; + ur_pfnVirtualMemGetInfo_t pfnGetInfo; +} ur_virtual_mem_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's VirtualMem table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetVirtualMemProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_virtual_mem_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetVirtualMemProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetVirtualMemProcAddrTable_t)( + ur_api_version_t, ur_virtual_mem_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceGet +typedef ur_result_t(UR_APICALL *ur_pfnDeviceGet_t)(ur_platform_handle_t, + ur_device_type_t, uint32_t, + ur_device_handle_t *, + uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnDeviceGetInfo_t)(ur_device_handle_t, + ur_device_info_t, size_t, + void *, size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceRetain +typedef ur_result_t(UR_APICALL *ur_pfnDeviceRetain_t)(ur_device_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceRelease +typedef ur_result_t(UR_APICALL *ur_pfnDeviceRelease_t)(ur_device_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDevicePartition +typedef ur_result_t(UR_APICALL *ur_pfnDevicePartition_t)( + ur_device_handle_t, const ur_device_partition_properties_t *, uint32_t, + ur_device_handle_t *, uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceSelectBinary +typedef ur_result_t(UR_APICALL *ur_pfnDeviceSelectBinary_t)( + ur_device_handle_t, const ur_device_binary_t *, uint32_t, uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceGetNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnDeviceGetNativeHandle_t)( + ur_device_handle_t, ur_native_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceCreateWithNativeHandle +typedef ur_result_t(UR_APICALL *ur_pfnDeviceCreateWithNativeHandle_t)( + ur_native_handle_t, ur_adapter_handle_t, + const ur_device_native_properties_t *, ur_device_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urDeviceGetGlobalTimestamps +typedef ur_result_t(UR_APICALL *ur_pfnDeviceGetGlobalTimestamps_t)( + ur_device_handle_t, uint64_t *, uint64_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Device functions pointers +typedef struct ur_device_dditable_t { + ur_pfnDeviceGet_t pfnGet; + ur_pfnDeviceGetInfo_t pfnGetInfo; + ur_pfnDeviceRetain_t pfnRetain; + ur_pfnDeviceRelease_t pfnRelease; + ur_pfnDevicePartition_t pfnPartition; + ur_pfnDeviceSelectBinary_t pfnSelectBinary; + ur_pfnDeviceGetNativeHandle_t pfnGetNativeHandle; + ur_pfnDeviceCreateWithNativeHandle_t pfnCreateWithNativeHandle; + ur_pfnDeviceGetGlobalTimestamps_t pfnGetGlobalTimestamps; +} ur_device_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Device table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceProcAddrTable( + /// [in] API version requested + ur_api_version_t version, + /// [in,out] pointer to table of DDI function pointers + ur_device_dditable_t *pDdiTable); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetDeviceProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetDeviceProcAddrTable_t)( + ur_api_version_t, ur_device_dditable_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Container for all DDI tables +typedef struct ur_dditable_t { + ur_platform_dditable_t Platform; + ur_context_dditable_t Context; + ur_event_dditable_t Event; + ur_program_dditable_t Program; + ur_program_exp_dditable_t ProgramExp; + ur_kernel_dditable_t Kernel; + ur_kernel_exp_dditable_t KernelExp; + ur_queue_dditable_t Queue; + ur_sampler_dditable_t Sampler; + ur_mem_dditable_t Mem; + ur_physical_mem_dditable_t PhysicalMem; + ur_global_dditable_t Global; + ur_enqueue_dditable_t Enqueue; + ur_enqueue_exp_dditable_t EnqueueExp; + ur_bindless_images_exp_dditable_t BindlessImagesExp; + ur_usm_dditable_t USM; + ur_usm_exp_dditable_t USMExp; + ur_command_buffer_exp_dditable_t CommandBufferExp; + ur_usm_p2p_exp_dditable_t UsmP2PExp; + ur_virtual_mem_dditable_t VirtualMem; + ur_device_dditable_t Device; +} ur_dditable_t; + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // UR_DDI_H_INCLUDED diff --git a/unified-runtime/include/ur_print.h b/unified-runtime/include/ur_print.h new file mode 100644 index 0000000000000..f58133bb8a0c1 --- /dev/null +++ b/unified-runtime/include/ur_print.h @@ -0,0 +1,3454 @@ +/* + * + * Copyright (C) 2023-2024 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 + * + * @file ur_print.h + * + */ +#ifndef UR_PRINT_H +#define UR_PRINT_H 1 + +#include "ur_api.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_function_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintFunction(enum ur_function_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_structure_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintStructureType(enum ur_structure_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_result_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintResult(enum ur_result_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_base_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBaseProperties(const struct ur_base_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_base_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBaseDesc(const struct ur_base_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_rect_offset_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintRectOffset(const struct ur_rect_offset_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_rect_region_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintRectRegion(const struct ur_rect_region_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_init_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceInitFlags(enum ur_device_init_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintLoaderConfigInfo(enum ur_loader_config_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_code_location_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCodeLocation(const struct ur_code_location_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintAdapterInfo(enum ur_adapter_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_backend_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintAdapterBackend(enum ur_adapter_backend_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintPlatformInfo(enum ur_platform_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_api_version_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintApiVersion(enum ur_api_version_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformNativeProperties( + const struct ur_platform_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_backend_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintPlatformBackend(enum ur_platform_backend_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_binary_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceBinary(const struct ur_device_binary_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceType(enum ur_device_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceInfo(enum ur_device_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_affinity_domain_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceAffinityDomainFlags( + enum ur_device_affinity_domain_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_partition_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDevicePartition(enum ur_device_partition_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_partition_property_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDevicePartitionProperty( + const struct ur_device_partition_property_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_partition_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDevicePartitionProperties( + const struct ur_device_partition_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_fp_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceFpCapabilityFlags( + enum ur_device_fp_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_mem_cache_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceMemCacheType(enum ur_device_mem_cache_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_local_mem_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceLocalMemType(enum ur_device_local_mem_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_exec_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceExecCapabilityFlags( + enum ur_device_exec_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceNativeProperties( + const struct ur_device_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_memory_order_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemoryOrderCapabilityFlags( + enum ur_memory_order_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_memory_scope_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemoryScopeCapabilityFlags( + enum ur_memory_scope_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_usm_access_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceUsmAccessCapabilityFlags( + enum ur_device_usm_access_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintContextFlags(enum ur_context_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextProperties( + const struct ur_context_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintContextInfo(enum ur_context_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextNativeProperties( + const struct ur_context_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemFlags(enum ur_mem_flag_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemType(enum ur_mem_type_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemInfo(enum ur_mem_info_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_channel_order_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintImageChannelOrder(enum ur_image_channel_order_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_channel_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintImageChannelType(enum ur_image_channel_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintImageInfo(enum ur_image_info_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_format_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintImageFormat(const struct ur_image_format_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintImageDesc(const struct ur_image_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_buffer_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBufferProperties(const struct ur_buffer_properties_t params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_buffer_channel_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBufferChannelProperties( + const struct ur_buffer_channel_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_buffer_alloc_location_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBufferAllocLocationProperties( + const struct ur_buffer_alloc_location_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_buffer_region_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBufferRegion(const struct ur_buffer_region_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_buffer_create_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBufferCreateType(enum ur_buffer_create_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemNativeProperties( + const struct ur_mem_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_filter_mode_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintSamplerFilterMode(enum ur_sampler_filter_mode_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_addressing_mode_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerAddressingMode( + enum ur_sampler_addressing_mode_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintSamplerInfo(enum ur_sampler_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintSamplerDesc(const struct ur_sampler_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerNativeProperties( + const struct ur_sampler_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_host_mem_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmHostMemFlags(enum ur_usm_host_mem_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_device_mem_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmDeviceMemFlags(enum ur_usm_device_mem_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmPoolFlags(enum ur_usm_pool_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmType(enum ur_usm_type_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_alloc_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmAllocInfo(enum ur_usm_alloc_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_advice_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmAdviceFlags(enum ur_usm_advice_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmDesc(const struct ur_usm_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_host_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmHostDesc(const struct ur_usm_host_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_device_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmDeviceDesc(const struct ur_usm_device_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_alloc_location_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmAllocLocationDesc( + const struct ur_usm_alloc_location_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmPoolDesc(const struct ur_usm_pool_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_limits_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolLimitsDesc( + const struct ur_usm_pool_limits_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmPoolInfo(enum ur_usm_pool_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_granularity_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemGranularityInfo( + enum ur_virtual_mem_granularity_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_access_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemAccessFlags( + enum ur_virtual_mem_access_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintVirtualMemInfo(enum ur_virtual_mem_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintPhysicalMemFlags(enum ur_physical_mem_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPhysicalMemProperties( + const struct ur_physical_mem_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintPhysicalMemInfo(enum ur_physical_mem_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_metadata_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramMetadataType(enum ur_program_metadata_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_metadata_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramMetadata(const struct ur_program_metadata_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramProperties( + const struct ur_program_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramInfo(enum ur_program_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_build_status_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramBuildStatus(enum ur_program_build_status_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_binary_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramBinaryType(enum ur_program_binary_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_build_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramBuildInfo(enum ur_program_build_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_specialization_constant_info_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSpecializationConstantInfo( + const struct ur_specialization_constant_info_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramNativeProperties( + const struct ur_program_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_arg_value_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelArgValueProperties( + const struct ur_kernel_arg_value_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_arg_local_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelArgLocalProperties( + const struct ur_kernel_arg_local_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelInfo(enum ur_kernel_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_group_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelGroupInfo(enum ur_kernel_group_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_sub_group_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelSubGroupInfo(enum ur_kernel_sub_group_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_cache_config_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelCacheConfig(enum ur_kernel_cache_config_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_exec_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelExecInfo(enum ur_kernel_exec_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_arg_pointer_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelArgPointerProperties( + const struct ur_kernel_arg_pointer_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_exec_info_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelExecInfoProperties( + const struct ur_kernel_exec_info_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_arg_sampler_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelArgSamplerProperties( + const struct ur_kernel_arg_sampler_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_arg_mem_obj_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelArgMemObjProperties( + const struct ur_kernel_arg_mem_obj_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelNativeProperties( + const struct ur_kernel_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueInfo(enum ur_queue_info_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintQueueFlags(enum ur_queue_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintQueueProperties(const struct ur_queue_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_index_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueIndexProperties( + const struct ur_queue_index_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_native_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintQueueNativeDesc(const struct ur_queue_native_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueNativeProperties( + const struct ur_queue_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommand(enum ur_command_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_status_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintEventStatus(enum ur_event_status_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventInfo(enum ur_event_info_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_profiling_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProfilingInfo(enum ur_profiling_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_native_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventNativeProperties( + const struct ur_event_native_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_execution_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExecutionInfo(enum ur_execution_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_map_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMapFlags(enum ur_map_flag_t value, + char *buffer, + const size_t buff_size, + size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_migration_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmMigrationFlags(enum ur_usm_migration_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_device_2d_block_array_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpDevice_2dBlockArrayCapabilityFlags( + enum ur_exp_device_2d_block_array_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_image_copy_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpImageCopyFlags(enum ur_exp_image_copy_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_sampler_cubemap_filter_mode_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerCubemapFilterMode( + enum ur_exp_sampler_cubemap_filter_mode_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_external_mem_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpExternalMemType(enum ur_exp_external_mem_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_external_semaphore_type_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpExternalSemaphoreType( + enum ur_exp_external_semaphore_type_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_file_descriptor_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpFileDescriptor( + const struct ur_exp_file_descriptor_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_win32_handle_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpWin32Handle(const struct ur_exp_win32_handle_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_sampler_mip_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerMipProperties( + const struct ur_exp_sampler_mip_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_sampler_addr_modes_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerAddrModes( + const struct ur_exp_sampler_addr_modes_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_sampler_cubemap_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpSamplerCubemapProperties( + const struct ur_exp_sampler_cubemap_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_external_mem_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpExternalMemDesc( + const struct ur_exp_external_mem_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_external_semaphore_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpExternalSemaphoreDesc( + const struct ur_exp_external_semaphore_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_image_copy_region_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpImageCopyRegion( + const struct ur_exp_image_copy_region_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_command_buffer_update_capability_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceCommandBufferUpdateCapabilityFlags( + enum ur_device_command_buffer_update_capability_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpCommandBufferInfo( + enum ur_exp_command_buffer_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_command_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpCommandBufferCommandInfo( + enum ur_exp_command_buffer_command_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpCommandBufferDesc( + const struct ur_exp_command_buffer_desc_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_update_memobj_arg_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpCommandBufferUpdateMemobjArgDesc( + const struct ur_exp_command_buffer_update_memobj_arg_desc_t params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_update_pointer_arg_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpCommandBufferUpdatePointerArgDesc( + const struct ur_exp_command_buffer_update_pointer_arg_desc_t params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_update_value_arg_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpCommandBufferUpdateValueArgDesc( + const struct ur_exp_command_buffer_update_value_arg_desc_t params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_update_kernel_launch_desc_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpCommandBufferUpdateKernelLaunchDesc( + const struct ur_exp_command_buffer_update_kernel_launch_desc_t params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_launch_property_id_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpLaunchPropertyId(enum ur_exp_launch_property_id_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_launch_property_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpLaunchProperty( + const struct ur_exp_launch_property_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_peer_info_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpPeerInfo(enum ur_exp_peer_info_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_enqueue_ext_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintExpEnqueueExtFlags(enum ur_exp_enqueue_ext_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_enqueue_ext_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpEnqueueExtProperties( + const struct ur_exp_enqueue_ext_properties_t params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_enqueue_native_command_flag_t enum +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpEnqueueNativeCommandFlags( + enum ur_exp_enqueue_native_command_flag_t value, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_enqueue_native_command_properties_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintExpEnqueueNativeCommandProperties( + const struct ur_exp_enqueue_native_command_properties_t params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigCreateParams( + const struct ur_loader_config_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigRetainParams( + const struct ur_loader_config_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigReleaseParams( + const struct ur_loader_config_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigGetInfoParams( + const struct ur_loader_config_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_enable_layer_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigEnableLayerParams( + const struct ur_loader_config_enable_layer_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_set_code_location_callback_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintLoaderConfigSetCodeLocationCallbackParams( + const struct ur_loader_config_set_code_location_callback_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_set_mocking_enabled_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderConfigSetMockingEnabledParams( + const struct ur_loader_config_set_mocking_enabled_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_get_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformGetParams( + const struct ur_platform_get_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformGetInfoParams( + const struct ur_platform_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformGetNativeHandleParams( + const struct ur_platform_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformCreateWithNativeHandleParams( + const struct ur_platform_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_get_api_version_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformGetApiVersionParams( + const struct ur_platform_get_api_version_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_get_backend_option_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPlatformGetBackendOptionParams( + const struct ur_platform_get_backend_option_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextCreateParams( + const struct ur_context_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextRetainParams( + const struct ur_context_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextReleaseParams( + const struct ur_context_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextGetInfoParams( + const struct ur_context_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextGetNativeHandleParams( + const struct ur_context_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextCreateWithNativeHandleParams( + const struct ur_context_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_set_extended_deleter_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintContextSetExtendedDeleterParams( + const struct ur_context_set_extended_deleter_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventGetInfoParams( + const struct ur_event_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_get_profiling_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventGetProfilingInfoParams( + const struct ur_event_get_profiling_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_wait_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintEventWaitParams(const struct ur_event_wait_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventRetainParams( + const struct ur_event_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventReleaseParams( + const struct ur_event_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventGetNativeHandleParams( + const struct ur_event_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventCreateWithNativeHandleParams( + const struct ur_event_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_set_callback_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEventSetCallbackParams( + const struct ur_event_set_callback_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_create_with_il_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramCreateWithIlParams( + const struct ur_program_create_with_il_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_create_with_binary_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramCreateWithBinaryParams( + const struct ur_program_create_with_binary_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_build_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramBuildParams( + const struct ur_program_build_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_build_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramBuildExpParams( + const struct ur_program_build_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_compile_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramCompileParams( + const struct ur_program_compile_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_compile_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramCompileExpParams( + const struct ur_program_compile_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_link_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramLinkParams( + const struct ur_program_link_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_link_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramLinkExpParams( + const struct ur_program_link_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramRetainParams( + const struct ur_program_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramReleaseParams( + const struct ur_program_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_get_function_pointer_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramGetFunctionPointerParams( + const struct ur_program_get_function_pointer_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_get_global_variable_pointer_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramGetGlobalVariablePointerParams( + const struct ur_program_get_global_variable_pointer_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramGetInfoParams( + const struct ur_program_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_get_build_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramGetBuildInfoParams( + const struct ur_program_get_build_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_set_specialization_constants_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintProgramSetSpecializationConstantsParams( + const struct ur_program_set_specialization_constants_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramGetNativeHandleParams( + const struct ur_program_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintProgramCreateWithNativeHandleParams( + const struct ur_program_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelCreateParams( + const struct ur_kernel_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelGetInfoParams( + const struct ur_kernel_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_get_group_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelGetGroupInfoParams( + const struct ur_kernel_get_group_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_get_sub_group_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelGetSubGroupInfoParams( + const struct ur_kernel_get_sub_group_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelRetainParams( + const struct ur_kernel_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelReleaseParams( + const struct ur_kernel_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelGetNativeHandleParams( + const struct ur_kernel_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelCreateWithNativeHandleParams( + const struct ur_kernel_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_get_suggested_local_work_size_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelGetSuggestedLocalWorkSizeParams( + const struct ur_kernel_get_suggested_local_work_size_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_arg_value_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelSetArgValueParams( + const struct ur_kernel_set_arg_value_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_arg_local_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelSetArgLocalParams( + const struct ur_kernel_set_arg_local_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_arg_pointer_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelSetArgPointerParams( + const struct ur_kernel_set_arg_pointer_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_exec_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelSetExecInfoParams( + const struct ur_kernel_set_exec_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_arg_sampler_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelSetArgSamplerParams( + const struct ur_kernel_set_arg_sampler_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_arg_mem_obj_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintKernelSetArgMemObjParams( + const struct ur_kernel_set_arg_mem_obj_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_set_specialization_constants_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelSetSpecializationConstantsParams( + const struct ur_kernel_set_specialization_constants_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_suggest_max_cooperative_group_count_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintKernelSuggestMaxCooperativeGroupCountExpParams( + const struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueGetInfoParams( + const struct ur_queue_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueCreateParams( + const struct ur_queue_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueRetainParams( + const struct ur_queue_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueReleaseParams( + const struct ur_queue_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueGetNativeHandleParams( + const struct ur_queue_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueCreateWithNativeHandleParams( + const struct ur_queue_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_finish_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintQueueFinishParams( + const struct ur_queue_finish_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_flush_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintQueueFlushParams(const struct ur_queue_flush_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerCreateParams( + const struct ur_sampler_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerRetainParams( + const struct ur_sampler_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerReleaseParams( + const struct ur_sampler_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerGetInfoParams( + const struct ur_sampler_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerGetNativeHandleParams( + const struct ur_sampler_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintSamplerCreateWithNativeHandleParams( + const struct ur_sampler_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_image_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemImageCreateParams( + const struct ur_mem_image_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_buffer_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemBufferCreateParams( + const struct ur_mem_buffer_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintMemRetainParams(const struct ur_mem_retain_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintMemReleaseParams(const struct ur_mem_release_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_buffer_partition_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemBufferPartitionParams( + const struct ur_mem_buffer_partition_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemGetNativeHandleParams( + const struct ur_mem_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_buffer_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintMemBufferCreateWithNativeHandleParams( + const struct ur_mem_buffer_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_image_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemImageCreateWithNativeHandleParams( + const struct ur_mem_image_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintMemGetInfoParams(const struct ur_mem_get_info_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_image_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintMemImageGetInfoParams( + const struct ur_mem_image_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPhysicalMemCreateParams( + const struct ur_physical_mem_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPhysicalMemRetainParams( + const struct ur_physical_mem_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPhysicalMemReleaseParams( + const struct ur_physical_mem_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintPhysicalMemGetInfoParams( + const struct ur_physical_mem_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_get_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintAdapterGetParams(const struct ur_adapter_get_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterReleaseParams( + const struct ur_adapter_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterRetainParams( + const struct ur_adapter_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_get_last_error_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterGetLastErrorParams( + const struct ur_adapter_get_last_error_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintAdapterGetInfoParams( + const struct ur_adapter_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_kernel_launch_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueKernelLaunchParams( + const struct ur_enqueue_kernel_launch_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_events_wait_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueEventsWaitParams( + const struct ur_enqueue_events_wait_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_events_wait_with_barrier_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueEventsWaitWithBarrierParams( + const struct ur_enqueue_events_wait_with_barrier_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_read_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferReadParams( + const struct ur_enqueue_mem_buffer_read_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_write_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferWriteParams( + const struct ur_enqueue_mem_buffer_write_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_read_rect_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferReadRectParams( + const struct ur_enqueue_mem_buffer_read_rect_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_write_rect_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferWriteRectParams( + const struct ur_enqueue_mem_buffer_write_rect_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_copy_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferCopyParams( + const struct ur_enqueue_mem_buffer_copy_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_copy_rect_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferCopyRectParams( + const struct ur_enqueue_mem_buffer_copy_rect_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_fill_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferFillParams( + const struct ur_enqueue_mem_buffer_fill_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_image_read_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemImageReadParams( + const struct ur_enqueue_mem_image_read_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_image_write_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemImageWriteParams( + const struct ur_enqueue_mem_image_write_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_image_copy_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemImageCopyParams( + const struct ur_enqueue_mem_image_copy_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_buffer_map_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemBufferMapParams( + const struct ur_enqueue_mem_buffer_map_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_mem_unmap_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueMemUnmapParams( + const struct ur_enqueue_mem_unmap_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_fill_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmFillParams( + const struct ur_enqueue_usm_fill_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_memcpy_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmMemcpyParams( + const struct ur_enqueue_usm_memcpy_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_prefetch_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmPrefetchParams( + const struct ur_enqueue_usm_prefetch_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_advise_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmAdviseParams( + const struct ur_enqueue_usm_advise_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_fill_2d_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmFill_2dParams( + const struct ur_enqueue_usm_fill_2d_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_usm_memcpy_2d_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueUsmMemcpy_2dParams( + const struct ur_enqueue_usm_memcpy_2d_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_device_global_variable_write_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintEnqueueDeviceGlobalVariableWriteParams( + const struct ur_enqueue_device_global_variable_write_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_device_global_variable_read_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintEnqueueDeviceGlobalVariableReadParams( + const struct ur_enqueue_device_global_variable_read_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_read_host_pipe_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueReadHostPipeParams( + const struct ur_enqueue_read_host_pipe_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_write_host_pipe_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueWriteHostPipeParams( + const struct ur_enqueue_write_host_pipe_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_kernel_launch_custom_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueKernelLaunchCustomExpParams( + const struct ur_enqueue_kernel_launch_custom_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_events_wait_with_barrier_ext_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintEnqueueEventsWaitWithBarrierExtParams( + const struct ur_enqueue_events_wait_with_barrier_ext_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_cooperative_kernel_launch_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintEnqueueCooperativeKernelLaunchExpParams( + const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_timestamp_recording_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueTimestampRecordingExpParams( + const struct ur_enqueue_timestamp_recording_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_enqueue_native_command_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintEnqueueNativeCommandExpParams( + const struct ur_enqueue_native_command_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_unsampled_image_handle_destroy_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesUnsampledImageHandleDestroyExpParams( + const struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_sampled_image_handle_destroy_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesSampledImageHandleDestroyExpParams( + const struct ur_bindless_images_sampled_image_handle_destroy_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_image_allocate_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesImageAllocateExpParams( + const struct ur_bindless_images_image_allocate_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_image_free_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesImageFreeExpParams( + const struct ur_bindless_images_image_free_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_unsampled_image_create_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesUnsampledImageCreateExpParams( + const struct ur_bindless_images_unsampled_image_create_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_sampled_image_create_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesSampledImageCreateExpParams( + const struct ur_bindless_images_sampled_image_create_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_image_copy_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesImageCopyExpParams( + const struct ur_bindless_images_image_copy_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_image_get_info_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesImageGetInfoExpParams( + const struct ur_bindless_images_image_get_info_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_mipmap_get_level_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesMipmapGetLevelExpParams( + const struct ur_bindless_images_mipmap_get_level_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_mipmap_free_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintBindlessImagesMipmapFreeExpParams( + const struct ur_bindless_images_mipmap_free_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_import_external_memory_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesImportExternalMemoryExpParams( + const struct ur_bindless_images_import_external_memory_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_map_external_array_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesMapExternalArrayExpParams( + const struct ur_bindless_images_map_external_array_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_map_external_linear_memory_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesMapExternalLinearMemoryExpParams( + const struct ur_bindless_images_map_external_linear_memory_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_release_external_memory_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesReleaseExternalMemoryExpParams( + const struct ur_bindless_images_release_external_memory_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_import_external_semaphore_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesImportExternalSemaphoreExpParams( + const struct ur_bindless_images_import_external_semaphore_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_release_external_semaphore_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesReleaseExternalSemaphoreExpParams( + const struct ur_bindless_images_release_external_semaphore_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_wait_external_semaphore_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesWaitExternalSemaphoreExpParams( + const struct ur_bindless_images_wait_external_semaphore_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_bindless_images_signal_external_semaphore_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintBindlessImagesSignalExternalSemaphoreExpParams( + const struct ur_bindless_images_signal_external_semaphore_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_host_alloc_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmHostAllocParams( + const struct ur_usm_host_alloc_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_device_alloc_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmDeviceAllocParams( + const struct ur_usm_device_alloc_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_shared_alloc_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmSharedAllocParams( + const struct ur_usm_shared_alloc_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_free_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintUsmFreeParams(const struct ur_usm_free_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_get_mem_alloc_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmGetMemAllocInfoParams( + const struct ur_usm_get_mem_alloc_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_create_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolCreateParams( + const struct ur_usm_pool_create_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolRetainParams( + const struct ur_usm_pool_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolReleaseParams( + const struct ur_usm_pool_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPoolGetInfoParams( + const struct ur_usm_pool_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pitched_alloc_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmPitchedAllocExpParams( + const struct ur_usm_pitched_alloc_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_import_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmImportExpParams( + const struct ur_usm_import_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_release_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmReleaseExpParams( + const struct ur_usm_release_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_create_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferCreateExpParams( + const struct ur_command_buffer_create_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_retain_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferRetainExpParams( + const struct ur_command_buffer_retain_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_release_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferReleaseExpParams( + const struct ur_command_buffer_release_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_finalize_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferFinalizeExpParams( + const struct ur_command_buffer_finalize_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_kernel_launch_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendKernelLaunchExpParams( + const struct ur_command_buffer_append_kernel_launch_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_usm_memcpy_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendUsmMemcpyExpParams( + const struct ur_command_buffer_append_usm_memcpy_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_usm_fill_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferAppendUsmFillExpParams( + const struct ur_command_buffer_append_usm_fill_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_copy_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferCopyExpParams( + const struct ur_command_buffer_append_mem_buffer_copy_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_write_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferWriteExpParams( + const struct ur_command_buffer_append_mem_buffer_write_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_read_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferReadExpParams( + const struct ur_command_buffer_append_mem_buffer_read_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferCopyRectExpParams( + const struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_write_rect_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferWriteRectExpParams( + const struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_read_rect_exp_params_t +/// struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferReadRectExpParams( + const struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t + *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_mem_buffer_fill_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendMemBufferFillExpParams( + const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_usm_prefetch_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendUsmPrefetchExpParams( + const struct ur_command_buffer_append_usm_prefetch_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_append_usm_advise_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferAppendUsmAdviseExpParams( + const struct ur_command_buffer_append_usm_advise_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_enqueue_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferEnqueueExpParams( + const struct ur_command_buffer_enqueue_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_update_kernel_launch_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferUpdateKernelLaunchExpParams( + const struct ur_command_buffer_update_kernel_launch_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_update_signal_event_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferUpdateSignalEventExpParams( + const struct ur_command_buffer_update_signal_event_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_update_wait_events_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintCommandBufferUpdateWaitEventsExpParams( + const struct ur_command_buffer_update_wait_events_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_command_buffer_get_info_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintCommandBufferGetInfoExpParams( + const struct ur_command_buffer_get_info_exp_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_p2p_enable_peer_access_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmP2pEnablePeerAccessExpParams( + const struct ur_usm_p2p_enable_peer_access_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_p2p_disable_peer_access_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmP2pDisablePeerAccessExpParams( + const struct ur_usm_p2p_disable_peer_access_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_p2p_peer_access_get_info_exp_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintUsmP2pPeerAccessGetInfoExpParams( + const struct ur_usm_p2p_peer_access_get_info_exp_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_init_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintLoaderInitParams(const struct ur_loader_init_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_tear_down_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintLoaderTearDownParams( + const struct ur_loader_tear_down_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_granularity_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemGranularityGetInfoParams( + const struct ur_virtual_mem_granularity_get_info_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_reserve_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemReserveParams( + const struct ur_virtual_mem_reserve_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_free_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemFreeParams( + const struct ur_virtual_mem_free_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_map_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemMapParams( + const struct ur_virtual_mem_map_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_unmap_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemUnmapParams( + const struct ur_virtual_mem_unmap_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_set_access_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemSetAccessParams( + const struct ur_virtual_mem_set_access_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintVirtualMemGetInfoParams( + const struct ur_virtual_mem_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_get_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintDeviceGetParams(const struct ur_device_get_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_get_selected_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceGetSelectedParams( + const struct ur_device_get_selected_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_get_info_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceGetInfoParams( + const struct ur_device_get_info_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_retain_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceRetainParams( + const struct ur_device_retain_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_release_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceReleaseParams( + const struct ur_device_release_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_partition_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDevicePartitionParams( + const struct ur_device_partition_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_select_binary_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceSelectBinaryParams( + const struct ur_device_select_binary_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_get_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceGetNativeHandleParams( + const struct ur_device_get_native_handle_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_create_with_native_handle_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceCreateWithNativeHandleParams( + const struct ur_device_create_with_native_handle_params_t *params, + char *buffer, const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_get_global_timestamps_params_t struct +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL urPrintDeviceGetGlobalTimestampsParams( + const struct ur_device_get_global_timestamps_params_t *params, char *buffer, + const size_t buff_size, size_t *out_size); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print function parameters +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - `NULL == params` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// - `buff_size < out_size` +UR_APIEXPORT ur_result_t UR_APICALL +urPrintFunctionParams(enum ur_function_t function, const void *params, + char *buffer, const size_t buff_size, size_t *out_size); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif /* UR_PRINT_H */ diff --git a/unified-runtime/include/ur_print.hpp b/unified-runtime/include/ur_print.hpp new file mode 100644 index 0000000000000..5c5f573477929 --- /dev/null +++ b/unified-runtime/include/ur_print.hpp @@ -0,0 +1,20158 @@ +/* + * + * Copyright (C) 2023-2024 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 + * + * @file ur_print.hpp + * @version v0.12-r0 + * + */ +#ifndef UR_PRINT_HPP +#define UR_PRINT_HPP 1 + +#include "ur_api.h" +#include +#include + +namespace ur::details { +template struct is_handle : std::false_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template inline constexpr bool is_handle_v = is_handle::value; +template +inline ur_result_t printPtr(std::ostream &os, const T *ptr); +template +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); +template +inline ur_result_t printTagged(std::ostream &os, const void *ptr, T value, + size_t size); + +inline ur_result_t printStruct(std::ostream &os, const void *ptr); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_loader_config_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_adapter_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_platform_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_device_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +inline ur_result_t printUnion(std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t +printFlag(std::ostream &os, uint32_t flag); + +template <> +inline ur_result_t +printFlag(std::ostream &os, uint32_t flag); + +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_context_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_mem_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_image_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_sampler_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_usm_alloc_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_usm_pool_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_granularity_info_t value, + size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_physical_mem_info_t value, size_t size); + +inline ur_result_t printUnion(std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_program_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_program_build_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_group_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_sub_group_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_exec_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_queue_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_event_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_profiling_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag); +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_exp_command_buffer_info_t value, size_t size); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_exp_command_buffer_command_info_t value, + size_t size); + +inline ur_result_t printUnion(std::ostream &os, + const union ur_exp_launch_property_value_t params, + const enum ur_exp_launch_property_id_t tag); + +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_exp_peer_info_t value, size_t size); + +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag); + +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag); + +} // namespace ur::details + +inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_structure_type_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_base_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_base_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_rect_offset_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_rect_region_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_init_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_loader_config_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_code_location_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_adapter_backend_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_platform_info_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_platform_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_platform_backend_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_binary_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_affinity_domain_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_partition_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_partition_property_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_partition_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_fp_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_mem_cache_type_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_local_mem_type_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_exec_capability_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_memory_order_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_memory_scope_capability_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, enum ur_device_usm_access_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_context_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_context_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_image_channel_order_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_image_channel_type_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_image_format_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_image_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_buffer_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_buffer_channel_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_buffer_alloc_location_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_buffer_region_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_buffer_create_type_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_sampler_filter_mode_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_sampler_addressing_mode_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_sampler_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_host_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_device_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_pool_flag_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_alloc_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_advice_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_host_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_device_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_alloc_location_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_pool_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_virtual_mem_granularity_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_virtual_mem_access_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_virtual_mem_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_physical_mem_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_physical_mem_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_metadata_type_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_metadata_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_program_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_build_status_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_binary_type_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_build_info_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_specialization_constant_info_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_native_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_value_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_local_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_group_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_sub_group_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_cache_config_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_exec_info_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_pointer_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_exec_info_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_sampler_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_mem_obj_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_index_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_native_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_event_status_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_profiling_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_execution_info_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_migration_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, + enum ur_exp_device_2d_block_array_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_image_copy_flag_t value); +inline std::ostream & +operator<<(std::ostream &os, enum ur_exp_sampler_cubemap_filter_mode_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_external_mem_type_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_external_semaphore_type_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_file_descriptor_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_win32_handle_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_sampler_cubemap_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_external_mem_desc_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_external_semaphore_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_image_copy_region_t params); +inline std::ostream & +operator<<(std::ostream &os, + enum ur_device_command_buffer_update_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_command_buffer_info_t value); +inline std::ostream & +operator<<(std::ostream &os, enum ur_exp_command_buffer_command_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_command_buffer_update_memobj_arg_desc_t + params); +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_exp_command_buffer_update_pointer_arg_desc_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_command_buffer_update_value_arg_desc_t + params); +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_exp_command_buffer_update_kernel_launch_desc_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_launch_property_id_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_launch_property_t params); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_peer_info_t value); +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_enqueue_ext_flag_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_enqueue_ext_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, enum ur_exp_enqueue_native_command_flag_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_enqueue_native_command_properties_t + params); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_function_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { + switch (value) { + case UR_FUNCTION_CONTEXT_CREATE: + os << "UR_FUNCTION_CONTEXT_CREATE"; + break; + case UR_FUNCTION_CONTEXT_RETAIN: + os << "UR_FUNCTION_CONTEXT_RETAIN"; + break; + case UR_FUNCTION_CONTEXT_RELEASE: + os << "UR_FUNCTION_CONTEXT_RELEASE"; + break; + case UR_FUNCTION_CONTEXT_GET_INFO: + os << "UR_FUNCTION_CONTEXT_GET_INFO"; + break; + case UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER: + os << "UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER"; + break; + case UR_FUNCTION_DEVICE_GET: + os << "UR_FUNCTION_DEVICE_GET"; + break; + case UR_FUNCTION_DEVICE_GET_INFO: + os << "UR_FUNCTION_DEVICE_GET_INFO"; + break; + case UR_FUNCTION_DEVICE_RETAIN: + os << "UR_FUNCTION_DEVICE_RETAIN"; + break; + case UR_FUNCTION_DEVICE_RELEASE: + os << "UR_FUNCTION_DEVICE_RELEASE"; + break; + case UR_FUNCTION_DEVICE_PARTITION: + os << "UR_FUNCTION_DEVICE_PARTITION"; + break; + case UR_FUNCTION_DEVICE_SELECT_BINARY: + os << "UR_FUNCTION_DEVICE_SELECT_BINARY"; + break; + case UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS: + os << "UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS"; + break; + case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH: + os << "UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH"; + break; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT: + os << "UR_FUNCTION_ENQUEUE_EVENTS_WAIT"; + break; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER: + os << "UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL"; + break; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ: + os << "UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ"; + break; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE: + os << "UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE"; + break; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY: + os << "UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY"; + break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP: + os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP"; + break; + case UR_FUNCTION_ENQUEUE_MEM_UNMAP: + os << "UR_FUNCTION_ENQUEUE_MEM_UNMAP"; + break; + case UR_FUNCTION_ENQUEUE_USM_FILL: + os << "UR_FUNCTION_ENQUEUE_USM_FILL"; + break; + case UR_FUNCTION_ENQUEUE_USM_MEMCPY: + os << "UR_FUNCTION_ENQUEUE_USM_MEMCPY"; + break; + case UR_FUNCTION_ENQUEUE_USM_PREFETCH: + os << "UR_FUNCTION_ENQUEUE_USM_PREFETCH"; + break; + case UR_FUNCTION_ENQUEUE_USM_ADVISE: + os << "UR_FUNCTION_ENQUEUE_USM_ADVISE"; + break; + case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE: + os << "UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE"; + break; + case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ: + os << "UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ"; + break; + case UR_FUNCTION_EVENT_GET_INFO: + os << "UR_FUNCTION_EVENT_GET_INFO"; + break; + case UR_FUNCTION_EVENT_GET_PROFILING_INFO: + os << "UR_FUNCTION_EVENT_GET_PROFILING_INFO"; + break; + case UR_FUNCTION_EVENT_WAIT: + os << "UR_FUNCTION_EVENT_WAIT"; + break; + case UR_FUNCTION_EVENT_RETAIN: + os << "UR_FUNCTION_EVENT_RETAIN"; + break; + case UR_FUNCTION_EVENT_RELEASE: + os << "UR_FUNCTION_EVENT_RELEASE"; + break; + case UR_FUNCTION_EVENT_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_EVENT_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_EVENT_SET_CALLBACK: + os << "UR_FUNCTION_EVENT_SET_CALLBACK"; + break; + case UR_FUNCTION_KERNEL_CREATE: + os << "UR_FUNCTION_KERNEL_CREATE"; + break; + case UR_FUNCTION_KERNEL_SET_ARG_VALUE: + os << "UR_FUNCTION_KERNEL_SET_ARG_VALUE"; + break; + case UR_FUNCTION_KERNEL_SET_ARG_LOCAL: + os << "UR_FUNCTION_KERNEL_SET_ARG_LOCAL"; + break; + case UR_FUNCTION_KERNEL_GET_INFO: + os << "UR_FUNCTION_KERNEL_GET_INFO"; + break; + case UR_FUNCTION_KERNEL_GET_GROUP_INFO: + os << "UR_FUNCTION_KERNEL_GET_GROUP_INFO"; + break; + case UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO: + os << "UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO"; + break; + case UR_FUNCTION_KERNEL_RETAIN: + os << "UR_FUNCTION_KERNEL_RETAIN"; + break; + case UR_FUNCTION_KERNEL_RELEASE: + os << "UR_FUNCTION_KERNEL_RELEASE"; + break; + case UR_FUNCTION_KERNEL_SET_ARG_POINTER: + os << "UR_FUNCTION_KERNEL_SET_ARG_POINTER"; + break; + case UR_FUNCTION_KERNEL_SET_EXEC_INFO: + os << "UR_FUNCTION_KERNEL_SET_EXEC_INFO"; + break; + case UR_FUNCTION_KERNEL_SET_ARG_SAMPLER: + os << "UR_FUNCTION_KERNEL_SET_ARG_SAMPLER"; + break; + case UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ: + os << "UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ"; + break; + case UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS: + os << "UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS"; + break; + case UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_MEM_IMAGE_CREATE: + os << "UR_FUNCTION_MEM_IMAGE_CREATE"; + break; + case UR_FUNCTION_MEM_BUFFER_CREATE: + os << "UR_FUNCTION_MEM_BUFFER_CREATE"; + break; + case UR_FUNCTION_MEM_RETAIN: + os << "UR_FUNCTION_MEM_RETAIN"; + break; + case UR_FUNCTION_MEM_RELEASE: + os << "UR_FUNCTION_MEM_RELEASE"; + break; + case UR_FUNCTION_MEM_BUFFER_PARTITION: + os << "UR_FUNCTION_MEM_BUFFER_PARTITION"; + break; + case UR_FUNCTION_MEM_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_MEM_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_ENQUEUE_READ_HOST_PIPE: + os << "UR_FUNCTION_ENQUEUE_READ_HOST_PIPE"; + break; + case UR_FUNCTION_MEM_GET_INFO: + os << "UR_FUNCTION_MEM_GET_INFO"; + break; + case UR_FUNCTION_MEM_IMAGE_GET_INFO: + os << "UR_FUNCTION_MEM_IMAGE_GET_INFO"; + break; + case UR_FUNCTION_PLATFORM_GET: + os << "UR_FUNCTION_PLATFORM_GET"; + break; + case UR_FUNCTION_PLATFORM_GET_INFO: + os << "UR_FUNCTION_PLATFORM_GET_INFO"; + break; + case UR_FUNCTION_PLATFORM_GET_API_VERSION: + os << "UR_FUNCTION_PLATFORM_GET_API_VERSION"; + break; + case UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_IL: + os << "UR_FUNCTION_PROGRAM_CREATE_WITH_IL"; + break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY: + os << "UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY"; + break; + case UR_FUNCTION_PROGRAM_BUILD: + os << "UR_FUNCTION_PROGRAM_BUILD"; + break; + case UR_FUNCTION_PROGRAM_COMPILE: + os << "UR_FUNCTION_PROGRAM_COMPILE"; + break; + case UR_FUNCTION_PROGRAM_LINK: + os << "UR_FUNCTION_PROGRAM_LINK"; + break; + case UR_FUNCTION_PROGRAM_RETAIN: + os << "UR_FUNCTION_PROGRAM_RETAIN"; + break; + case UR_FUNCTION_PROGRAM_RELEASE: + os << "UR_FUNCTION_PROGRAM_RELEASE"; + break; + case UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER: + os << "UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER"; + break; + case UR_FUNCTION_PROGRAM_GET_INFO: + os << "UR_FUNCTION_PROGRAM_GET_INFO"; + break; + case UR_FUNCTION_PROGRAM_GET_BUILD_INFO: + os << "UR_FUNCTION_PROGRAM_GET_BUILD_INFO"; + break; + case UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS: + os << "UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS"; + break; + case UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_QUEUE_GET_INFO: + os << "UR_FUNCTION_QUEUE_GET_INFO"; + break; + case UR_FUNCTION_QUEUE_CREATE: + os << "UR_FUNCTION_QUEUE_CREATE"; + break; + case UR_FUNCTION_QUEUE_RETAIN: + os << "UR_FUNCTION_QUEUE_RETAIN"; + break; + case UR_FUNCTION_QUEUE_RELEASE: + os << "UR_FUNCTION_QUEUE_RELEASE"; + break; + case UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_QUEUE_FINISH: + os << "UR_FUNCTION_QUEUE_FINISH"; + break; + case UR_FUNCTION_QUEUE_FLUSH: + os << "UR_FUNCTION_QUEUE_FLUSH"; + break; + case UR_FUNCTION_SAMPLER_CREATE: + os << "UR_FUNCTION_SAMPLER_CREATE"; + break; + case UR_FUNCTION_SAMPLER_RETAIN: + os << "UR_FUNCTION_SAMPLER_RETAIN"; + break; + case UR_FUNCTION_SAMPLER_RELEASE: + os << "UR_FUNCTION_SAMPLER_RELEASE"; + break; + case UR_FUNCTION_SAMPLER_GET_INFO: + os << "UR_FUNCTION_SAMPLER_GET_INFO"; + break; + case UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE: + os << "UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE"; + break; + case UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_USM_HOST_ALLOC: + os << "UR_FUNCTION_USM_HOST_ALLOC"; + break; + case UR_FUNCTION_USM_DEVICE_ALLOC: + os << "UR_FUNCTION_USM_DEVICE_ALLOC"; + break; + case UR_FUNCTION_USM_SHARED_ALLOC: + os << "UR_FUNCTION_USM_SHARED_ALLOC"; + break; + case UR_FUNCTION_USM_FREE: + os << "UR_FUNCTION_USM_FREE"; + break; + case UR_FUNCTION_USM_GET_MEM_ALLOC_INFO: + os << "UR_FUNCTION_USM_GET_MEM_ALLOC_INFO"; + break; + case UR_FUNCTION_USM_POOL_CREATE: + os << "UR_FUNCTION_USM_POOL_CREATE"; + break; + case UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP"; + break; + case UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION: + os << "UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION"; + break; + case UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE: + os << "UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE"; + break; + case UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE: + os << "UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE"; + break; + case UR_FUNCTION_USM_POOL_RETAIN: + os << "UR_FUNCTION_USM_POOL_RETAIN"; + break; + case UR_FUNCTION_USM_POOL_RELEASE: + os << "UR_FUNCTION_USM_POOL_RELEASE"; + break; + case UR_FUNCTION_USM_POOL_GET_INFO: + os << "UR_FUNCTION_USM_POOL_GET_INFO"; + break; + case UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP"; + break; + case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: + os << "UR_FUNCTION_USM_PITCHED_ALLOC_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP"; + break; + case UR_FUNCTION_ENQUEUE_USM_FILL_2D: + os << "UR_FUNCTION_ENQUEUE_USM_FILL_2D"; + break; + case UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D: + os << "UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D"; + break; + case UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO: + os << "UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO"; + break; + case UR_FUNCTION_VIRTUAL_MEM_RESERVE: + os << "UR_FUNCTION_VIRTUAL_MEM_RESERVE"; + break; + case UR_FUNCTION_VIRTUAL_MEM_FREE: + os << "UR_FUNCTION_VIRTUAL_MEM_FREE"; + break; + case UR_FUNCTION_VIRTUAL_MEM_MAP: + os << "UR_FUNCTION_VIRTUAL_MEM_MAP"; + break; + case UR_FUNCTION_VIRTUAL_MEM_UNMAP: + os << "UR_FUNCTION_VIRTUAL_MEM_UNMAP"; + break; + case UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS: + os << "UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS"; + break; + case UR_FUNCTION_VIRTUAL_MEM_GET_INFO: + os << "UR_FUNCTION_VIRTUAL_MEM_GET_INFO"; + break; + case UR_FUNCTION_PHYSICAL_MEM_CREATE: + os << "UR_FUNCTION_PHYSICAL_MEM_CREATE"; + break; + case UR_FUNCTION_PHYSICAL_MEM_RETAIN: + os << "UR_FUNCTION_PHYSICAL_MEM_RETAIN"; + break; + case UR_FUNCTION_PHYSICAL_MEM_RELEASE: + os << "UR_FUNCTION_PHYSICAL_MEM_RELEASE"; + break; + case UR_FUNCTION_USM_IMPORT_EXP: + os << "UR_FUNCTION_USM_IMPORT_EXP"; + break; + case UR_FUNCTION_USM_RELEASE_EXP: + os << "UR_FUNCTION_USM_RELEASE_EXP"; + break; + case UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP: + os << "UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP"; + break; + case UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP: + os << "UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP"; + break; + case UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP: + os << "UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP"; + break; + case UR_FUNCTION_LOADER_CONFIG_CREATE: + os << "UR_FUNCTION_LOADER_CONFIG_CREATE"; + break; + case UR_FUNCTION_LOADER_CONFIG_RELEASE: + os << "UR_FUNCTION_LOADER_CONFIG_RELEASE"; + break; + case UR_FUNCTION_LOADER_CONFIG_RETAIN: + os << "UR_FUNCTION_LOADER_CONFIG_RETAIN"; + break; + case UR_FUNCTION_LOADER_CONFIG_GET_INFO: + os << "UR_FUNCTION_LOADER_CONFIG_GET_INFO"; + break; + case UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER: + os << "UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER"; + break; + case UR_FUNCTION_ADAPTER_RELEASE: + os << "UR_FUNCTION_ADAPTER_RELEASE"; + break; + case UR_FUNCTION_ADAPTER_GET: + os << "UR_FUNCTION_ADAPTER_GET"; + break; + case UR_FUNCTION_ADAPTER_RETAIN: + os << "UR_FUNCTION_ADAPTER_RETAIN"; + break; + case UR_FUNCTION_ADAPTER_GET_LAST_ERROR: + os << "UR_FUNCTION_ADAPTER_GET_LAST_ERROR"; + break; + case UR_FUNCTION_ADAPTER_GET_INFO: + os << "UR_FUNCTION_ADAPTER_GET_INFO"; + break; + case UR_FUNCTION_PROGRAM_BUILD_EXP: + os << "UR_FUNCTION_PROGRAM_BUILD_EXP"; + break; + case UR_FUNCTION_PROGRAM_COMPILE_EXP: + os << "UR_FUNCTION_PROGRAM_COMPILE_EXP"; + break; + case UR_FUNCTION_PROGRAM_LINK_EXP: + os << "UR_FUNCTION_PROGRAM_LINK_EXP"; + break; + case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: + os << "UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK"; + break; + case UR_FUNCTION_LOADER_INIT: + os << "UR_FUNCTION_LOADER_INIT"; + break; + case UR_FUNCTION_LOADER_TEAR_DOWN: + os << "UR_FUNCTION_LOADER_TEAR_DOWN"; + break; + case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: + os << "UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP"; + break; + case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: + os << "UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP"; + break; + case UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER: + os << "UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER"; + break; + case UR_FUNCTION_DEVICE_GET_SELECTED: + os << "UR_FUNCTION_DEVICE_GET_SELECTED"; + break; + case UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP"; + break; + case UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP: + os << "UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP"; + break; + case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP: + os << "UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP"; + break; + case UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE: + os << "UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP"; + break; + case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP: + os << "UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP"; + break; + case UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED: + os << "UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP"; + break; + case UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP"; + break; + case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP: + os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP"; + break; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT: + os << "UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT"; + break; + case UR_FUNCTION_PHYSICAL_MEM_GET_INFO: + os << "UR_FUNCTION_PHYSICAL_MEM_GET_INFO"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_structure_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_structure_type_t value) { + switch (value) { + case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: + os << "UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_IMAGE_DESC: + os << "UR_STRUCTURE_TYPE_IMAGE_DESC"; + break; + case UR_STRUCTURE_TYPE_BUFFER_PROPERTIES: + os << "UR_STRUCTURE_TYPE_BUFFER_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_BUFFER_REGION: + os << "UR_STRUCTURE_TYPE_BUFFER_REGION"; + break; + case UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES: + os << "UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES: + os << "UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES: + os << "UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_USM_DESC: + os << "UR_STRUCTURE_TYPE_USM_DESC"; + break; + case UR_STRUCTURE_TYPE_USM_HOST_DESC: + os << "UR_STRUCTURE_TYPE_USM_HOST_DESC"; + break; + case UR_STRUCTURE_TYPE_USM_DEVICE_DESC: + os << "UR_STRUCTURE_TYPE_USM_DEVICE_DESC"; + break; + case UR_STRUCTURE_TYPE_USM_POOL_DESC: + os << "UR_STRUCTURE_TYPE_USM_POOL_DESC"; + break; + case UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC: + os << "UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC"; + break; + case UR_STRUCTURE_TYPE_DEVICE_BINARY: + os << "UR_STRUCTURE_TYPE_DEVICE_BINARY"; + break; + case UR_STRUCTURE_TYPE_SAMPLER_DESC: + os << "UR_STRUCTURE_TYPE_SAMPLER_DESC"; + break; + case UR_STRUCTURE_TYPE_QUEUE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_QUEUE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES: + os << "UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC: + os << "UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC"; + break; + case UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES: + os << "UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES: + os << "UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: + os << "UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC: + os << "UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: + os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC: + os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC: + os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC: + os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC: + os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_EXP_EXTERNAL_MEM_DESC: + os << "UR_STRUCTURE_TYPE_EXP_EXTERNAL_MEM_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_EXTERNAL_SEMAPHORE_DESC: + os << "UR_STRUCTURE_TYPE_EXP_EXTERNAL_SEMAPHORE_DESC"; + break; + case UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR: + os << "UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR"; + break; + case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: + os << "UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE"; + break; + case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: + os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES"; + break; + case UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION: + os << "UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION"; + break; + case UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES"; + break; + case UR_STRUCTURE_TYPE_EXP_ENQUEUE_EXT_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EXP_ENQUEUE_EXT_PROPERTIES"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_structure_type_t struct +inline ur_result_t printStruct(std::ostream &os, const void *ptr) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + const enum ur_structure_type_t *value = (const enum ur_structure_type_t *)ptr; + switch (*value) { + + case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: { + const ur_context_properties_t *pstruct = + (const ur_context_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_IMAGE_DESC: { + const ur_image_desc_t *pstruct = (const ur_image_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_BUFFER_PROPERTIES: { + const ur_buffer_properties_t *pstruct = (const ur_buffer_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_BUFFER_REGION: { + const ur_buffer_region_t *pstruct = (const ur_buffer_region_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES: { + const ur_buffer_channel_properties_t *pstruct = + (const ur_buffer_channel_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES: { + const ur_buffer_alloc_location_properties_t *pstruct = + (const ur_buffer_alloc_location_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES: { + const ur_program_properties_t *pstruct = + (const ur_program_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_USM_DESC: { + const ur_usm_desc_t *pstruct = (const ur_usm_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_USM_HOST_DESC: { + const ur_usm_host_desc_t *pstruct = (const ur_usm_host_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_USM_DEVICE_DESC: { + const ur_usm_device_desc_t *pstruct = (const ur_usm_device_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_USM_POOL_DESC: { + const ur_usm_pool_desc_t *pstruct = (const ur_usm_pool_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC: { + const ur_usm_pool_limits_desc_t *pstruct = + (const ur_usm_pool_limits_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_DEVICE_BINARY: { + const ur_device_binary_t *pstruct = (const ur_device_binary_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_SAMPLER_DESC: { + const ur_sampler_desc_t *pstruct = (const ur_sampler_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_QUEUE_PROPERTIES: { + const ur_queue_properties_t *pstruct = (const ur_queue_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES: { + const ur_queue_index_properties_t *pstruct = + (const ur_queue_index_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES: { + const ur_context_native_properties_t *pstruct = + (const ur_context_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES: { + const ur_kernel_native_properties_t *pstruct = + (const ur_kernel_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES: { + const ur_queue_native_properties_t *pstruct = + (const ur_queue_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES: { + const ur_mem_native_properties_t *pstruct = + (const ur_mem_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES: { + const ur_event_native_properties_t *pstruct = + (const ur_event_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES: { + const ur_platform_native_properties_t *pstruct = + (const ur_platform_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES: { + const ur_device_native_properties_t *pstruct = + (const ur_device_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES: { + const ur_program_native_properties_t *pstruct = + (const ur_program_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES: { + const ur_sampler_native_properties_t *pstruct = + (const ur_sampler_native_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC: { + const ur_queue_native_desc_t *pstruct = (const ur_queue_native_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES: { + const ur_device_partition_properties_t *pstruct = + (const ur_device_partition_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES: { + const ur_kernel_arg_mem_obj_properties_t *pstruct = + (const ur_kernel_arg_mem_obj_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES: { + const ur_physical_mem_properties_t *pstruct = + (const ur_physical_mem_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES: { + const ur_kernel_arg_pointer_properties_t *pstruct = + (const ur_kernel_arg_pointer_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES: { + const ur_kernel_arg_sampler_properties_t *pstruct = + (const ur_kernel_arg_sampler_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES: { + const ur_kernel_exec_info_properties_t *pstruct = + (const ur_kernel_exec_info_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES: { + const ur_kernel_arg_value_properties_t *pstruct = + (const ur_kernel_arg_value_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: { + const ur_kernel_arg_local_properties_t *pstruct = + (const ur_kernel_arg_local_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC: { + const ur_usm_alloc_location_desc_t *pstruct = + (const ur_usm_alloc_location_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: { + const ur_exp_command_buffer_desc_t *pstruct = + (const ur_exp_command_buffer_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC: { + const ur_exp_command_buffer_update_kernel_launch_desc_t *pstruct = + (const ur_exp_command_buffer_update_kernel_launch_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC: { + const ur_exp_command_buffer_update_memobj_arg_desc_t *pstruct = + (const ur_exp_command_buffer_update_memobj_arg_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC: { + const ur_exp_command_buffer_update_pointer_arg_desc_t *pstruct = + (const ur_exp_command_buffer_update_pointer_arg_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC: { + const ur_exp_command_buffer_update_value_arg_desc_t *pstruct = + (const ur_exp_command_buffer_update_value_arg_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES: { + const ur_exp_sampler_mip_properties_t *pstruct = + (const ur_exp_sampler_mip_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_EXTERNAL_MEM_DESC: { + const ur_exp_external_mem_desc_t *pstruct = + (const ur_exp_external_mem_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_EXTERNAL_SEMAPHORE_DESC: { + const ur_exp_external_semaphore_desc_t *pstruct = + (const ur_exp_external_semaphore_desc_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR: { + const ur_exp_file_descriptor_t *pstruct = + (const ur_exp_file_descriptor_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: { + const ur_exp_win32_handle_t *pstruct = (const ur_exp_win32_handle_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: { + const ur_exp_sampler_addr_modes_t *pstruct = + (const ur_exp_sampler_addr_modes_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES: { + const ur_exp_sampler_cubemap_properties_t *pstruct = + (const ur_exp_sampler_cubemap_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_IMAGE_COPY_REGION: { + const ur_exp_image_copy_region_t *pstruct = + (const ur_exp_image_copy_region_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_ENQUEUE_NATIVE_COMMAND_PROPERTIES: { + const ur_exp_enqueue_native_command_properties_t *pstruct = + (const ur_exp_enqueue_native_command_properties_t *)ptr; + printPtr(os, pstruct); + } break; + + case UR_STRUCTURE_TYPE_EXP_ENQUEUE_EXT_PROPERTIES: { + const ur_exp_enqueue_ext_properties_t *pstruct = + (const ur_exp_enqueue_ext_properties_t *)ptr; + printPtr(os, pstruct); + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_result_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) { + switch (value) { + case UR_RESULT_SUCCESS: + os << "UR_RESULT_SUCCESS"; + break; + case UR_RESULT_ERROR_INVALID_OPERATION: + os << "UR_RESULT_ERROR_INVALID_OPERATION"; + break; + case UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES: + os << "UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES"; + break; + case UR_RESULT_ERROR_INVALID_QUEUE: + os << "UR_RESULT_ERROR_INVALID_QUEUE"; + break; + case UR_RESULT_ERROR_INVALID_VALUE: + os << "UR_RESULT_ERROR_INVALID_VALUE"; + break; + case UR_RESULT_ERROR_INVALID_CONTEXT: + os << "UR_RESULT_ERROR_INVALID_CONTEXT"; + break; + case UR_RESULT_ERROR_INVALID_PLATFORM: + os << "UR_RESULT_ERROR_INVALID_PLATFORM"; + break; + case UR_RESULT_ERROR_INVALID_BINARY: + os << "UR_RESULT_ERROR_INVALID_BINARY"; + break; + case UR_RESULT_ERROR_INVALID_PROGRAM: + os << "UR_RESULT_ERROR_INVALID_PROGRAM"; + break; + case UR_RESULT_ERROR_INVALID_SAMPLER: + os << "UR_RESULT_ERROR_INVALID_SAMPLER"; + break; + case UR_RESULT_ERROR_INVALID_BUFFER_SIZE: + os << "UR_RESULT_ERROR_INVALID_BUFFER_SIZE"; + break; + case UR_RESULT_ERROR_INVALID_MEM_OBJECT: + os << "UR_RESULT_ERROR_INVALID_MEM_OBJECT"; + break; + case UR_RESULT_ERROR_INVALID_EVENT: + os << "UR_RESULT_ERROR_INVALID_EVENT"; + break; + case UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST: + os << "UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST"; + break; + case UR_RESULT_ERROR_MISALIGNED_SUB_BUFFER_OFFSET: + os << "UR_RESULT_ERROR_MISALIGNED_SUB_BUFFER_OFFSET"; + break; + case UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE: + os << "UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE"; + break; + case UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE: + os << "UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE"; + break; + case UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE: + os << "UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE"; + break; + case UR_RESULT_ERROR_DEVICE_NOT_FOUND: + os << "UR_RESULT_ERROR_DEVICE_NOT_FOUND"; + break; + case UR_RESULT_ERROR_INVALID_DEVICE: + os << "UR_RESULT_ERROR_INVALID_DEVICE"; + break; + case UR_RESULT_ERROR_DEVICE_LOST: + os << "UR_RESULT_ERROR_DEVICE_LOST"; + break; + case UR_RESULT_ERROR_DEVICE_REQUIRES_RESET: + os << "UR_RESULT_ERROR_DEVICE_REQUIRES_RESET"; + break; + case UR_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE: + os << "UR_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE"; + break; + case UR_RESULT_ERROR_DEVICE_PARTITION_FAILED: + os << "UR_RESULT_ERROR_DEVICE_PARTITION_FAILED"; + break; + case UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT: + os << "UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT"; + break; + case UR_RESULT_ERROR_INVALID_WORK_ITEM_SIZE: + os << "UR_RESULT_ERROR_INVALID_WORK_ITEM_SIZE"; + break; + case UR_RESULT_ERROR_INVALID_WORK_DIMENSION: + os << "UR_RESULT_ERROR_INVALID_WORK_DIMENSION"; + break; + case UR_RESULT_ERROR_INVALID_KERNEL_ARGS: + os << "UR_RESULT_ERROR_INVALID_KERNEL_ARGS"; + break; + case UR_RESULT_ERROR_INVALID_KERNEL: + os << "UR_RESULT_ERROR_INVALID_KERNEL"; + break; + case UR_RESULT_ERROR_INVALID_KERNEL_NAME: + os << "UR_RESULT_ERROR_INVALID_KERNEL_NAME"; + break; + case UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX: + os << "UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX"; + break; + case UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE: + os << "UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE"; + break; + case UR_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE: + os << "UR_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE"; + break; + case UR_RESULT_ERROR_INVALID_IMAGE_SIZE: + os << "UR_RESULT_ERROR_INVALID_IMAGE_SIZE"; + break; + case UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: + os << "UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR"; + break; + case UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE: + os << "UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE"; + break; + case UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE: + os << "UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE"; + break; + case UR_RESULT_ERROR_UNINITIALIZED: + os << "UR_RESULT_ERROR_UNINITIALIZED"; + break; + case UR_RESULT_ERROR_OUT_OF_HOST_MEMORY: + os << "UR_RESULT_ERROR_OUT_OF_HOST_MEMORY"; + break; + case UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY: + os << "UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"; + break; + case UR_RESULT_ERROR_OUT_OF_RESOURCES: + os << "UR_RESULT_ERROR_OUT_OF_RESOURCES"; + break; + case UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE: + os << "UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE"; + break; + case UR_RESULT_ERROR_PROGRAM_LINK_FAILURE: + os << "UR_RESULT_ERROR_PROGRAM_LINK_FAILURE"; + break; + case UR_RESULT_ERROR_UNSUPPORTED_VERSION: + os << "UR_RESULT_ERROR_UNSUPPORTED_VERSION"; + break; + case UR_RESULT_ERROR_UNSUPPORTED_FEATURE: + os << "UR_RESULT_ERROR_UNSUPPORTED_FEATURE"; + break; + case UR_RESULT_ERROR_INVALID_ARGUMENT: + os << "UR_RESULT_ERROR_INVALID_ARGUMENT"; + break; + case UR_RESULT_ERROR_INVALID_NULL_HANDLE: + os << "UR_RESULT_ERROR_INVALID_NULL_HANDLE"; + break; + case UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE: + os << "UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE"; + break; + case UR_RESULT_ERROR_INVALID_NULL_POINTER: + os << "UR_RESULT_ERROR_INVALID_NULL_POINTER"; + break; + case UR_RESULT_ERROR_INVALID_SIZE: + os << "UR_RESULT_ERROR_INVALID_SIZE"; + break; + case UR_RESULT_ERROR_UNSUPPORTED_SIZE: + os << "UR_RESULT_ERROR_UNSUPPORTED_SIZE"; + break; + case UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT: + os << "UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"; + break; + case UR_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT: + os << "UR_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"; + break; + case UR_RESULT_ERROR_INVALID_ENUMERATION: + os << "UR_RESULT_ERROR_INVALID_ENUMERATION"; + break; + case UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION: + os << "UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION"; + break; + case UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT: + os << "UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT"; + break; + case UR_RESULT_ERROR_INVALID_NATIVE_BINARY: + os << "UR_RESULT_ERROR_INVALID_NATIVE_BINARY"; + break; + case UR_RESULT_ERROR_INVALID_GLOBAL_NAME: + os << "UR_RESULT_ERROR_INVALID_GLOBAL_NAME"; + break; + case UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE: + os << "UR_RESULT_ERROR_FUNCTION_ADDRESS_NOT_AVAILABLE"; + break; + case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION: + os << "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION"; + break; + case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION: + os << "UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION"; + break; + case UR_RESULT_ERROR_PROGRAM_UNLINKED: + os << "UR_RESULT_ERROR_PROGRAM_UNLINKED"; + break; + case UR_RESULT_ERROR_OVERLAPPING_REGIONS: + os << "UR_RESULT_ERROR_OVERLAPPING_REGIONS"; + break; + case UR_RESULT_ERROR_INVALID_HOST_PTR: + os << "UR_RESULT_ERROR_INVALID_HOST_PTR"; + break; + case UR_RESULT_ERROR_INVALID_USM_SIZE: + os << "UR_RESULT_ERROR_INVALID_USM_SIZE"; + break; + case UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE: + os << "UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE"; + break; + case UR_RESULT_ERROR_ADAPTER_SPECIFIC: + os << "UR_RESULT_ERROR_ADAPTER_SPECIFIC"; + break; + case UR_RESULT_ERROR_LAYER_NOT_PRESENT: + os << "UR_RESULT_ERROR_LAYER_NOT_PRESENT"; + break; + case UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS: + os << "UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS"; + break; + case UR_RESULT_ERROR_DEVICE_NOT_AVAILABLE: + os << "UR_RESULT_ERROR_DEVICE_NOT_AVAILABLE"; + break; + case UR_RESULT_ERROR_INVALID_SPEC_ID: + os << "UR_RESULT_ERROR_INVALID_SPEC_ID"; + break; + case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP: + os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP"; + break; + case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP: + os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP"; + break; + case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP"; + break; + case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP: + os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_COMMAND_HANDLE_EXP"; + break; + case UR_RESULT_ERROR_UNKNOWN: + os << "UR_RESULT_ERROR_UNKNOWN"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_base_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_base_properties_t params) { + os << "(struct ur_base_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_base_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_base_desc_t params) { + os << "(struct ur_base_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_rect_offset_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_rect_offset_t params) { + os << "(struct ur_rect_offset_t){"; + + os << ".x = "; + + os << (params.x); + + os << ", "; + os << ".y = "; + + os << (params.y); + + os << ", "; + os << ".z = "; + + os << (params.z); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_rect_region_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_rect_region_t params) { + os << "(struct ur_rect_region_t){"; + + os << ".width = "; + + os << (params.width); + + os << ", "; + os << ".height = "; + + os << (params.height); + + os << ", "; + os << ".depth = "; + + os << (params.depth); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_init_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_init_flag_t value) { + switch (value) { + case UR_DEVICE_INIT_FLAG_GPU: + os << "UR_DEVICE_INIT_FLAG_GPU"; + break; + case UR_DEVICE_INIT_FLAG_CPU: + os << "UR_DEVICE_INIT_FLAG_CPU"; + break; + case UR_DEVICE_INIT_FLAG_FPGA: + os << "UR_DEVICE_INIT_FLAG_FPGA"; + break; + case UR_DEVICE_INIT_FLAG_MCA: + os << "UR_DEVICE_INIT_FLAG_MCA"; + break; + case UR_DEVICE_INIT_FLAG_VPU: + os << "UR_DEVICE_INIT_FLAG_VPU"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_init_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_DEVICE_INIT_FLAG_GPU) == (uint32_t)UR_DEVICE_INIT_FLAG_GPU) { + val ^= (uint32_t)UR_DEVICE_INIT_FLAG_GPU; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_INIT_FLAG_GPU; + } + + if ((val & UR_DEVICE_INIT_FLAG_CPU) == (uint32_t)UR_DEVICE_INIT_FLAG_CPU) { + val ^= (uint32_t)UR_DEVICE_INIT_FLAG_CPU; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_INIT_FLAG_CPU; + } + + if ((val & UR_DEVICE_INIT_FLAG_FPGA) == (uint32_t)UR_DEVICE_INIT_FLAG_FPGA) { + val ^= (uint32_t)UR_DEVICE_INIT_FLAG_FPGA; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_INIT_FLAG_FPGA; + } + + if ((val & UR_DEVICE_INIT_FLAG_MCA) == (uint32_t)UR_DEVICE_INIT_FLAG_MCA) { + val ^= (uint32_t)UR_DEVICE_INIT_FLAG_MCA; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_INIT_FLAG_MCA; + } + + if ((val & UR_DEVICE_INIT_FLAG_VPU) == (uint32_t)UR_DEVICE_INIT_FLAG_VPU) { + val ^= (uint32_t)UR_DEVICE_INIT_FLAG_VPU; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_INIT_FLAG_VPU; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_loader_config_info_t value) { + switch (value) { + case UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS: + os << "UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS"; + break; + case UR_LOADER_CONFIG_INFO_REFERENCE_COUNT: + os << "UR_LOADER_CONFIG_INFO_REFERENCE_COUNT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_loader_config_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_LOADER_CONFIG_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_code_location_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_code_location_t params) { + os << "(struct ur_code_location_t){"; + + os << ".functionName = "; + + ur::details::printPtr(os, (params.functionName)); + + os << ", "; + os << ".sourceFile = "; + + ur::details::printPtr(os, (params.sourceFile)); + + os << ", "; + os << ".lineNumber = "; + + os << (params.lineNumber); + + os << ", "; + os << ".columnNumber = "; + + os << (params.columnNumber); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_adapter_info_t value) { + switch (value) { + case UR_ADAPTER_INFO_BACKEND: + os << "UR_ADAPTER_INFO_BACKEND"; + break; + case UR_ADAPTER_INFO_REFERENCE_COUNT: + os << "UR_ADAPTER_INFO_REFERENCE_COUNT"; + break; + case UR_ADAPTER_INFO_VERSION: + os << "UR_ADAPTER_INFO_VERSION"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_adapter_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_ADAPTER_INFO_BACKEND: { + const ur_adapter_backend_t *tptr = (const ur_adapter_backend_t *)ptr; + if (sizeof(ur_adapter_backend_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_adapter_backend_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_ADAPTER_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_ADAPTER_INFO_VERSION: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_backend_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_adapter_backend_t value) { + switch (value) { + case UR_ADAPTER_BACKEND_UNKNOWN: + os << "UR_ADAPTER_BACKEND_UNKNOWN"; + break; + case UR_ADAPTER_BACKEND_LEVEL_ZERO: + os << "UR_ADAPTER_BACKEND_LEVEL_ZERO"; + break; + case UR_ADAPTER_BACKEND_OPENCL: + os << "UR_ADAPTER_BACKEND_OPENCL"; + break; + case UR_ADAPTER_BACKEND_CUDA: + os << "UR_ADAPTER_BACKEND_CUDA"; + break; + case UR_ADAPTER_BACKEND_HIP: + os << "UR_ADAPTER_BACKEND_HIP"; + break; + case UR_ADAPTER_BACKEND_NATIVE_CPU: + os << "UR_ADAPTER_BACKEND_NATIVE_CPU"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_platform_info_t value) { + switch (value) { + case UR_PLATFORM_INFO_NAME: + os << "UR_PLATFORM_INFO_NAME"; + break; + case UR_PLATFORM_INFO_VENDOR_NAME: + os << "UR_PLATFORM_INFO_VENDOR_NAME"; + break; + case UR_PLATFORM_INFO_VERSION: + os << "UR_PLATFORM_INFO_VERSION"; + break; + case UR_PLATFORM_INFO_EXTENSIONS: + os << "UR_PLATFORM_INFO_EXTENSIONS"; + break; + case UR_PLATFORM_INFO_PROFILE: + os << "UR_PLATFORM_INFO_PROFILE"; + break; + case UR_PLATFORM_INFO_BACKEND: + os << "UR_PLATFORM_INFO_BACKEND"; + break; + case UR_PLATFORM_INFO_ADAPTER: + os << "UR_PLATFORM_INFO_ADAPTER"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_platform_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_PLATFORM_INFO_NAME: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PLATFORM_INFO_VENDOR_NAME: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PLATFORM_INFO_VERSION: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PLATFORM_INFO_EXTENSIONS: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PLATFORM_INFO_PROFILE: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PLATFORM_INFO_BACKEND: { + const ur_platform_backend_t *tptr = (const ur_platform_backend_t *)ptr; + if (sizeof(ur_platform_backend_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_platform_backend_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PLATFORM_INFO_ADAPTER: { + const ur_adapter_handle_t *tptr = (const ur_adapter_handle_t *)ptr; + if (sizeof(ur_adapter_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_adapter_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_api_version_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value) { + os << UR_MAJOR_VERSION(value) << "." << UR_MINOR_VERSION(value); + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_platform_native_properties_t params) { + os << "(struct ur_platform_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_backend_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_platform_backend_t value) { + switch (value) { + case UR_PLATFORM_BACKEND_UNKNOWN: + os << "UR_PLATFORM_BACKEND_UNKNOWN"; + break; + case UR_PLATFORM_BACKEND_LEVEL_ZERO: + os << "UR_PLATFORM_BACKEND_LEVEL_ZERO"; + break; + case UR_PLATFORM_BACKEND_OPENCL: + os << "UR_PLATFORM_BACKEND_OPENCL"; + break; + case UR_PLATFORM_BACKEND_CUDA: + os << "UR_PLATFORM_BACKEND_CUDA"; + break; + case UR_PLATFORM_BACKEND_HIP: + os << "UR_PLATFORM_BACKEND_HIP"; + break; + case UR_PLATFORM_BACKEND_NATIVE_CPU: + os << "UR_PLATFORM_BACKEND_NATIVE_CPU"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_binary_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_device_binary_t params) { + os << "(struct ur_device_binary_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".pDeviceTargetSpec = "; + + ur::details::printPtr(os, (params.pDeviceTargetSpec)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value) { + switch (value) { + case UR_DEVICE_TYPE_DEFAULT: + os << "UR_DEVICE_TYPE_DEFAULT"; + break; + case UR_DEVICE_TYPE_ALL: + os << "UR_DEVICE_TYPE_ALL"; + break; + case UR_DEVICE_TYPE_GPU: + os << "UR_DEVICE_TYPE_GPU"; + break; + case UR_DEVICE_TYPE_CPU: + os << "UR_DEVICE_TYPE_CPU"; + break; + case UR_DEVICE_TYPE_FPGA: + os << "UR_DEVICE_TYPE_FPGA"; + break; + case UR_DEVICE_TYPE_MCA: + os << "UR_DEVICE_TYPE_MCA"; + break; + case UR_DEVICE_TYPE_VPU: + os << "UR_DEVICE_TYPE_VPU"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { + switch (value) { + case UR_DEVICE_INFO_TYPE: + os << "UR_DEVICE_INFO_TYPE"; + break; + case UR_DEVICE_INFO_VENDOR_ID: + os << "UR_DEVICE_INFO_VENDOR_ID"; + break; + case UR_DEVICE_INFO_DEVICE_ID: + os << "UR_DEVICE_INFO_DEVICE_ID"; + break; + case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: + os << "UR_DEVICE_INFO_MAX_COMPUTE_UNITS"; + break; + case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: + os << "UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS"; + break; + case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: + os << "UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES"; + break; + case UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE: + os << "UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE"; + break; + case UR_DEVICE_INFO_SINGLE_FP_CONFIG: + os << "UR_DEVICE_INFO_SINGLE_FP_CONFIG"; + break; + case UR_DEVICE_INFO_HALF_FP_CONFIG: + os << "UR_DEVICE_INFO_HALF_FP_CONFIG"; + break; + case UR_DEVICE_INFO_DOUBLE_FP_CONFIG: + os << "UR_DEVICE_INFO_DOUBLE_FP_CONFIG"; + break; + case UR_DEVICE_INFO_QUEUE_PROPERTIES: + os << "UR_DEVICE_INFO_QUEUE_PROPERTIES"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE"; + break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF: + os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE"; + break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF: + os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF"; + break; + case UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY: + os << "UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY"; + break; + case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: + os << "UR_DEVICE_INFO_MEMORY_CLOCK_RATE"; + break; + case UR_DEVICE_INFO_ADDRESS_BITS: + os << "UR_DEVICE_INFO_ADDRESS_BITS"; + break; + case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: + os << "UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE"; + break; + case UR_DEVICE_INFO_IMAGE_SUPPORTED: + os << "UR_DEVICE_INFO_IMAGE_SUPPORTED"; + break; + case UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS: + os << "UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS"; + break; + case UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS: + os << "UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS"; + break; + case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS: + os << "UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS"; + break; + case UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH: + os << "UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH"; + break; + case UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT: + os << "UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT"; + break; + case UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH: + os << "UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH"; + break; + case UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT: + os << "UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT"; + break; + case UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH: + os << "UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH"; + break; + case UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE: + os << "UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE"; + break; + case UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE: + os << "UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE"; + break; + case UR_DEVICE_INFO_MAX_SAMPLERS: + os << "UR_DEVICE_INFO_MAX_SAMPLERS"; + break; + case UR_DEVICE_INFO_MAX_PARAMETER_SIZE: + os << "UR_DEVICE_INFO_MAX_PARAMETER_SIZE"; + break; + case UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN: + os << "UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN"; + break; + case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE: + os << "UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE"; + break; + case UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE: + os << "UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE"; + break; + case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE: + os << "UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE"; + break; + case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: + os << "UR_DEVICE_INFO_GLOBAL_MEM_SIZE"; + break; + case UR_DEVICE_INFO_GLOBAL_MEM_FREE: + os << "UR_DEVICE_INFO_GLOBAL_MEM_FREE"; + break; + case UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE: + os << "UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE"; + break; + case UR_DEVICE_INFO_MAX_CONSTANT_ARGS: + os << "UR_DEVICE_INFO_MAX_CONSTANT_ARGS"; + break; + case UR_DEVICE_INFO_LOCAL_MEM_TYPE: + os << "UR_DEVICE_INFO_LOCAL_MEM_TYPE"; + break; + case UR_DEVICE_INFO_LOCAL_MEM_SIZE: + os << "UR_DEVICE_INFO_LOCAL_MEM_SIZE"; + break; + case UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT: + os << "UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT"; + break; + case UR_DEVICE_INFO_HOST_UNIFIED_MEMORY: + os << "UR_DEVICE_INFO_HOST_UNIFIED_MEMORY"; + break; + case UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION: + os << "UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION"; + break; + case UR_DEVICE_INFO_ENDIAN_LITTLE: + os << "UR_DEVICE_INFO_ENDIAN_LITTLE"; + break; + case UR_DEVICE_INFO_AVAILABLE: + os << "UR_DEVICE_INFO_AVAILABLE"; + break; + case UR_DEVICE_INFO_COMPILER_AVAILABLE: + os << "UR_DEVICE_INFO_COMPILER_AVAILABLE"; + break; + case UR_DEVICE_INFO_LINKER_AVAILABLE: + os << "UR_DEVICE_INFO_LINKER_AVAILABLE"; + break; + case UR_DEVICE_INFO_EXECUTION_CAPABILITIES: + os << "UR_DEVICE_INFO_EXECUTION_CAPABILITIES"; + break; + case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES: + os << "UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES"; + break; + case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: + os << "UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES"; + break; + case UR_DEVICE_INFO_BUILT_IN_KERNELS: + os << "UR_DEVICE_INFO_BUILT_IN_KERNELS"; + break; + case UR_DEVICE_INFO_PLATFORM: + os << "UR_DEVICE_INFO_PLATFORM"; + break; + case UR_DEVICE_INFO_REFERENCE_COUNT: + os << "UR_DEVICE_INFO_REFERENCE_COUNT"; + break; + case UR_DEVICE_INFO_IL_VERSION: + os << "UR_DEVICE_INFO_IL_VERSION"; + break; + case UR_DEVICE_INFO_NAME: + os << "UR_DEVICE_INFO_NAME"; + break; + case UR_DEVICE_INFO_VENDOR: + os << "UR_DEVICE_INFO_VENDOR"; + break; + case UR_DEVICE_INFO_DRIVER_VERSION: + os << "UR_DEVICE_INFO_DRIVER_VERSION"; + break; + case UR_DEVICE_INFO_PROFILE: + os << "UR_DEVICE_INFO_PROFILE"; + break; + case UR_DEVICE_INFO_VERSION: + os << "UR_DEVICE_INFO_VERSION"; + break; + case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: + os << "UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION"; + break; + case UR_DEVICE_INFO_EXTENSIONS: + os << "UR_DEVICE_INFO_EXTENSIONS"; + break; + case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE: + os << "UR_DEVICE_INFO_PRINTF_BUFFER_SIZE"; + break; + case UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC: + os << "UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC"; + break; + case UR_DEVICE_INFO_PARENT_DEVICE: + os << "UR_DEVICE_INFO_PARENT_DEVICE"; + break; + case UR_DEVICE_INFO_SUPPORTED_PARTITIONS: + os << "UR_DEVICE_INFO_SUPPORTED_PARTITIONS"; + break; + case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: + os << "UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES"; + break; + case UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: + os << "UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN"; + break; + case UR_DEVICE_INFO_PARTITION_TYPE: + os << "UR_DEVICE_INFO_PARTITION_TYPE"; + break; + case UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS: + os << "UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS"; + break; + case UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: + os << "UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS"; + break; + case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: + os << "UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL"; + break; + case UR_DEVICE_INFO_USM_HOST_SUPPORT: + os << "UR_DEVICE_INFO_USM_HOST_SUPPORT"; + break; + case UR_DEVICE_INFO_USM_DEVICE_SUPPORT: + os << "UR_DEVICE_INFO_USM_DEVICE_SUPPORT"; + break; + case UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT: + os << "UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT"; + break; + case UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT: + os << "UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT"; + break; + case UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT: + os << "UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT"; + break; + case UR_DEVICE_INFO_UUID: + os << "UR_DEVICE_INFO_UUID"; + break; + case UR_DEVICE_INFO_PCI_ADDRESS: + os << "UR_DEVICE_INFO_PCI_ADDRESS"; + break; + case UR_DEVICE_INFO_GPU_EU_COUNT: + os << "UR_DEVICE_INFO_GPU_EU_COUNT"; + break; + case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH: + os << "UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH"; + break; + case UR_DEVICE_INFO_GPU_EU_SLICES: + os << "UR_DEVICE_INFO_GPU_EU_SLICES"; + break; + case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE: + os << "UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE"; + break; + case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE: + os << "UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE"; + break; + case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU: + os << "UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU"; + break; + case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH: + os << "UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH"; + break; + case UR_DEVICE_INFO_IMAGE_SRGB: + os << "UR_DEVICE_INFO_IMAGE_SRGB"; + break; + case UR_DEVICE_INFO_BUILD_ON_SUBDEVICE: + os << "UR_DEVICE_INFO_BUILD_ON_SUBDEVICE"; + break; + case UR_DEVICE_INFO_ATOMIC_64: + os << "UR_DEVICE_INFO_ATOMIC_64"; + break; + case UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: + os << "UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES"; + break; + case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: + os << "UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES"; + break; + case UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: + os << "UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES"; + break; + case UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: + os << "UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES"; + break; + case UR_DEVICE_INFO_BFLOAT16: + os << "UR_DEVICE_INFO_BFLOAT16"; + break; + case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: + os << "UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES"; + break; + case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS: + os << "UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS"; + break; + case UR_DEVICE_INFO_MEMORY_BUS_WIDTH: + os << "UR_DEVICE_INFO_MEMORY_BUS_WIDTH"; + break; + case UR_DEVICE_INFO_MAX_WORK_GROUPS_3D: + os << "UR_DEVICE_INFO_MAX_WORK_GROUPS_3D"; + break; + case UR_DEVICE_INFO_ASYNC_BARRIER: + os << "UR_DEVICE_INFO_ASYNC_BARRIER"; + break; + case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT: + os << "UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT"; + break; + case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED: + os << "UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED"; + break; + case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: + os << "UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP"; + break; + case UR_DEVICE_INFO_IP_VERSION: + os << "UR_DEVICE_INFO_IP_VERSION"; + break; + case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: + os << "UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT"; + break; + case UR_DEVICE_INFO_ESIMD_SUPPORT: + os << "UR_DEVICE_INFO_ESIMD_SUPPORT"; + break; + case UR_DEVICE_INFO_COMPONENT_DEVICES: + os << "UR_DEVICE_INFO_COMPONENT_DEVICES"; + break; + case UR_DEVICE_INFO_COMPOSITE_DEVICE: + os << "UR_DEVICE_INFO_COMPOSITE_DEVICE"; + break; + case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT: + os << "UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT"; + break; + case UR_DEVICE_INFO_USM_POOL_SUPPORT: + os << "UR_DEVICE_INFO_USM_POOL_SUPPORT"; + break; + case UR_DEVICE_INFO_NUM_COMPUTE_UNITS: + os << "UR_DEVICE_INFO_NUM_COMPUTE_UNITS"; + break; + case UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS: + os << "UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS"; + break; + case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP: + os << "UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP: + os << "UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP"; + break; + case UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP: + os << "UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP: + os << "UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: + os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: + os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: + os << "UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: + os << "UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: + os << "UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP"; + break; + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: + os << "UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP"; + break; + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: + os << "UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP"; + break; + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: + os << "UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP"; + break; + case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: + os << "UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: + os << "UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: + os << "UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP"; + break; + case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: + os << "UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_EXTERNAL_MEMORY_IMPORT_SUPPORT_EXP: + os << "UR_DEVICE_INFO_EXTERNAL_MEMORY_IMPORT_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_EXTERNAL_SEMAPHORE_IMPORT_SUPPORT_EXP: + os << "UR_DEVICE_INFO_EXTERNAL_SEMAPHORE_IMPORT_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP: + os << "UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP: + os << "UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP"; + break; + case UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP: + os << "UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_IMAGE_ARRAY_SUPPORT_EXP: + os << "UR_DEVICE_INFO_IMAGE_ARRAY_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP: + os << "UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLE_1D_USM_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLE_1D_USM_EXP"; + break; + case UR_DEVICE_INFO_BINDLESS_SAMPLE_2D_USM_EXP: + os << "UR_DEVICE_INFO_BINDLESS_SAMPLE_2D_USM_EXP"; + break; + case UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP: + os << "UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP"; + break; + case UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP: + os << "UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP"; + break; + case UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP: + os << "UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_device_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_DEVICE_INFO_TYPE: { + const ur_device_type_t *tptr = (const ur_device_type_t *)ptr; + if (sizeof(ur_device_type_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_VENDOR_ID: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_DEVICE_ID: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: { + + const size_t *tptr = (const size_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(size_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_SINGLE_FP_CONFIG: { + const ur_device_fp_capability_flags_t *tptr = + (const ur_device_fp_capability_flags_t *)ptr; + if (sizeof(ur_device_fp_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_HALF_FP_CONFIG: { + const ur_device_fp_capability_flags_t *tptr = + (const ur_device_fp_capability_flags_t *)ptr; + if (sizeof(ur_device_fp_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_DOUBLE_FP_CONFIG: { + const ur_device_fp_capability_flags_t *tptr = + (const ur_device_fp_capability_flags_t *)ptr; + if (sizeof(ur_device_fp_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_QUEUE_PROPERTIES: { + const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; + if (sizeof(ur_queue_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ADDRESS_BITS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE_SUPPORTED: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_SAMPLERS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_PARAMETER_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE: { + const ur_device_mem_cache_type_t *tptr = + (const ur_device_mem_cache_type_t *)ptr; + if (sizeof(ur_device_mem_cache_type_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_mem_cache_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GLOBAL_MEM_FREE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_CONSTANT_ARGS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_LOCAL_MEM_TYPE: { + const ur_device_local_mem_type_t *tptr = + (const ur_device_local_mem_type_t *)ptr; + if (sizeof(ur_device_local_mem_type_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_local_mem_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_LOCAL_MEM_SIZE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_HOST_UNIFIED_MEMORY: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ENDIAN_LITTLE: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_AVAILABLE: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_COMPILER_AVAILABLE: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_LINKER_AVAILABLE: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_EXECUTION_CAPABILITIES: { + const ur_device_exec_capability_flags_t *tptr = + (const ur_device_exec_capability_flags_t *)ptr; + if (sizeof(ur_device_exec_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_exec_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES: { + const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; + if (sizeof(ur_queue_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: { + const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; + if (sizeof(ur_queue_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_BUILT_IN_KERNELS: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_PLATFORM: { + const ur_platform_handle_t *tptr = (const ur_platform_handle_t *)ptr; + if (sizeof(ur_platform_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_platform_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IL_VERSION: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_NAME: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_VENDOR: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_DRIVER_VERSION: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_PROFILE: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_VERSION: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_EXTENSIONS: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PARENT_DEVICE: { + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + if (sizeof(ur_device_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_SUPPORTED_PARTITIONS: { + + const ur_device_partition_t *tptr = (const ur_device_partition_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(ur_device_partition_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: { + const ur_device_affinity_domain_flags_t *tptr = + (const ur_device_affinity_domain_flags_t *)ptr; + if (sizeof(ur_device_affinity_domain_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_affinity_domain_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_PARTITION_TYPE: { + + const ur_device_partition_property_t *tptr = + (const ur_device_partition_property_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(ur_device_partition_property_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: { + + const uint32_t *tptr = (const uint32_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(uint32_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_DEVICE_INFO_USM_HOST_SUPPORT: { + const ur_device_usm_access_capability_flags_t *tptr = + (const ur_device_usm_access_capability_flags_t *)ptr; + if (sizeof(ur_device_usm_access_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_USM_DEVICE_SUPPORT: { + const ur_device_usm_access_capability_flags_t *tptr = + (const ur_device_usm_access_capability_flags_t *)ptr; + if (sizeof(ur_device_usm_access_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT: { + const ur_device_usm_access_capability_flags_t *tptr = + (const ur_device_usm_access_capability_flags_t *)ptr; + if (sizeof(ur_device_usm_access_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT: { + const ur_device_usm_access_capability_flags_t *tptr = + (const ur_device_usm_access_capability_flags_t *)ptr; + if (sizeof(ur_device_usm_access_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT: { + const ur_device_usm_access_capability_flags_t *tptr = + (const ur_device_usm_access_capability_flags_t *)ptr; + if (sizeof(ur_device_usm_access_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_UUID: { + + const uint8_t *tptr = (const uint8_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(uint8_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << static_cast(tptr[i]); + } + os << "}"; + } break; + case UR_DEVICE_INFO_PCI_ADDRESS: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_DEVICE_INFO_GPU_EU_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GPU_EU_SLICES: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE_SRGB: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BUILD_ON_SUBDEVICE: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ATOMIC_64: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: { + const ur_memory_order_capability_flags_t *tptr = + (const ur_memory_order_capability_flags_t *)ptr; + if (sizeof(ur_memory_order_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: { + const ur_memory_scope_capability_flags_t *tptr = + (const ur_memory_scope_capability_flags_t *)ptr; + if (sizeof(ur_memory_scope_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: { + const ur_memory_order_capability_flags_t *tptr = + (const ur_memory_order_capability_flags_t *)ptr; + if (sizeof(ur_memory_order_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: { + const ur_memory_scope_capability_flags_t *tptr = + (const ur_memory_scope_capability_flags_t *)ptr; + if (sizeof(ur_memory_scope_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_BFLOAT16: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MEMORY_BUS_WIDTH: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_WORK_GROUPS_3D: { + + const size_t *tptr = (const size_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(size_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_DEVICE_INFO_ASYNC_BARRIER: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IP_VERSION: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ESIMD_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_COMPONENT_DEVICES: { + + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(ur_device_handle_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, tptr[i]); + } + os << "}"; + } break; + case UR_DEVICE_INFO_COMPOSITE_DEVICE: { + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + if (sizeof(ur_device_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_GLOBAL_VARIABLE_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_USM_POOL_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_NUM_COMPUTE_UNITS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_PROGRAM_SET_SPECIALIZATION_CONSTANTS: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP: { + const ur_device_command_buffer_update_capability_flags_t *tptr = + (const ur_device_command_buffer_update_capability_flags_t *)ptr; + if (sizeof(ur_device_command_buffer_update_capability_flags_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" + << sizeof(ur_device_command_buffer_update_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag( + os, *tptr); + + os << ")"; + } break; + case UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_CLUSTER_LAUNCH_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_EXTERNAL_MEMORY_IMPORT_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_EXTERNAL_SEMAPHORE_IMPORT_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_IMAGE_ARRAY_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLE_1D_USM_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_BINDLESS_SAMPLE_2D_USM_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_LOW_POWER_EVENTS_EXP: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_DEVICE_INFO_2D_BLOCK_ARRAY_CAPABILITIES_EXP: { + const ur_exp_device_2d_block_array_capability_flags_t *tptr = + (const ur_exp_device_2d_block_array_capability_flags_t *)ptr; + if (sizeof(ur_exp_device_2d_block_array_capability_flags_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" + << sizeof(ur_exp_device_2d_block_array_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag( + os, *tptr); + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_affinity_domain_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_affinity_domain_flag_t value) { + switch (value) { + case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA: + os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA"; + break; + case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE: + os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE"; + break; + case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE: + os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE"; + break; + case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE: + os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE"; + break; + case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE: + os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE"; + break; + case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE: + os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_affinity_domain_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA) == + (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA) { + val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA; + } + + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE) == + (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE) { + val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE; + } + + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE) == + (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE) { + val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE; + } + + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE) == + (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE) { + val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE; + } + + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE) == + (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE) { + val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE; + } + + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE) == + (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE) { + val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_partition_t value) { + switch (value) { + case UR_DEVICE_PARTITION_EQUALLY: + os << "UR_DEVICE_PARTITION_EQUALLY"; + break; + case UR_DEVICE_PARTITION_BY_COUNTS: + os << "UR_DEVICE_PARTITION_BY_COUNTS"; + break; + case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN: + os << "UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN"; + break; + case UR_DEVICE_PARTITION_BY_CSLICE: + os << "UR_DEVICE_PARTITION_BY_CSLICE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { + +/////////////////////////////////////////////////////////////////////////////// +// @brief Print ur_device_partition_value_t union +inline ur_result_t printUnion(std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag) { + os << "(union ur_device_partition_value_t){"; + + switch (tag) { + case UR_DEVICE_PARTITION_EQUALLY: + + os << ".equally = "; + + os << (params.equally); + + break; + case UR_DEVICE_PARTITION_BY_COUNTS: + + os << ".count = "; + + os << (params.count); + + break; + case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN: + + os << ".affinity_domain = "; + + ur::details::printFlag( + os, (params.affinity_domain)); + + break; + default: + os << ""; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + os << "}"; + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_property_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_device_partition_property_t params) { + os << "(struct ur_device_partition_property_t){"; + + os << ".type = "; + + os << (params.type); + + os << ", "; + os << ".value = "; + ur::details::printUnion(os, (params.value), params.type); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_device_partition_properties_t params) { + os << "(struct ur_device_partition_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, (params.pProperties)); + + os << ", "; + os << ".PropCount = "; + + os << (params.PropCount); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_fp_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_fp_capability_flag_t value) { + switch (value) { + case UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_DENORM: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_DENORM"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_FMA: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_FMA"; + break; + case UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT: + os << "UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_fp_capability_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_DENORM) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_DENORM) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_DENORM; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_DENORM; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_FMA) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_FMA) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_FMA; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_FMA; + } + + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT) == + (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_mem_cache_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_mem_cache_type_t value) { + switch (value) { + case UR_DEVICE_MEM_CACHE_TYPE_NONE: + os << "UR_DEVICE_MEM_CACHE_TYPE_NONE"; + break; + case UR_DEVICE_MEM_CACHE_TYPE_READ_ONLY_CACHE: + os << "UR_DEVICE_MEM_CACHE_TYPE_READ_ONLY_CACHE"; + break; + case UR_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE: + os << "UR_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_local_mem_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_local_mem_type_t value) { + switch (value) { + case UR_DEVICE_LOCAL_MEM_TYPE_NONE: + os << "UR_DEVICE_LOCAL_MEM_TYPE_NONE"; + break; + case UR_DEVICE_LOCAL_MEM_TYPE_LOCAL: + os << "UR_DEVICE_LOCAL_MEM_TYPE_LOCAL"; + break; + case UR_DEVICE_LOCAL_MEM_TYPE_GLOBAL: + os << "UR_DEVICE_LOCAL_MEM_TYPE_GLOBAL"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_exec_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_device_exec_capability_flag_t value) { + switch (value) { + case UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL: + os << "UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL"; + break; + case UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL: + os << "UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_exec_capability_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL) == + (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL) { + val ^= (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL; + } + + if ((val & UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL) == + (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL) { + val ^= (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_device_native_properties_t params) { + os << "(struct ur_device_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_memory_order_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_memory_order_capability_flag_t value) { + switch (value) { + case UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED: + os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED"; + break; + case UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE: + os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE"; + break; + case UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE: + os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE"; + break; + case UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL: + os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL"; + break; + case UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST: + os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_memory_order_capability_flag_t flag +template <> +inline ur_result_t +printFlag(std::ostream &os, uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED) == + (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED) { + val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED; + } + + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE) == + (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE) { + val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE; + } + + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE) == + (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE) { + val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE; + } + + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL) == + (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL) { + val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL; + } + + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST) == + (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST) { + val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_memory_scope_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_memory_scope_capability_flag_t value) { + switch (value) { + case UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM: + os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM"; + break; + case UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP: + os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP"; + break; + case UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP: + os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP"; + break; + case UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE: + os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE"; + break; + case UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM: + os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_memory_scope_capability_flag_t flag +template <> +inline ur_result_t +printFlag(std::ostream &os, uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM) == + (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM) { + val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM; + } + + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP) == + (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP) { + val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP; + } + + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP) == + (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP) { + val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP; + } + + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE) == + (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE) { + val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE; + } + + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM) == + (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM) { + val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_usm_access_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + enum ur_device_usm_access_capability_flag_t value) { + switch (value) { + case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS: + os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS"; + break; + case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS: + os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS"; + break; + case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS: + os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS"; + break; + case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS: + os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_usm_access_capability_flag_t flag +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS) == + (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS) { + val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS; + } + + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS) == + (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS) { + val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS; + } + + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS) == + (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS) { + val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS; + } + + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS) == + (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS) { + val ^= + (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_context_flag_t value) { + switch (value) { + case UR_CONTEXT_FLAG_TBD: + os << "UR_CONTEXT_FLAG_TBD"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_CONTEXT_FLAG_TBD) == (uint32_t)UR_CONTEXT_FLAG_TBD) { + val ^= (uint32_t)UR_CONTEXT_FLAG_TBD; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_CONTEXT_FLAG_TBD; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_context_properties_t params) { + os << "(struct ur_context_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_context_info_t value) { + switch (value) { + case UR_CONTEXT_INFO_NUM_DEVICES: + os << "UR_CONTEXT_INFO_NUM_DEVICES"; + break; + case UR_CONTEXT_INFO_DEVICES: + os << "UR_CONTEXT_INFO_DEVICES"; + break; + case UR_CONTEXT_INFO_REFERENCE_COUNT: + os << "UR_CONTEXT_INFO_REFERENCE_COUNT"; + break; + case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT: + os << "UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT"; + break; + case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT: + os << "UR_CONTEXT_INFO_USM_FILL2D_SUPPORT"; + break; + case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: + os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES"; + break; + case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: + os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES"; + break; + case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: + os << "UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES"; + break; + case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: + os << "UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_context_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_CONTEXT_INFO_NUM_DEVICES: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_CONTEXT_INFO_DEVICES: { + + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(ur_device_handle_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, tptr[i]); + } + os << "}"; + } break; + case UR_CONTEXT_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: { + const ur_memory_order_capability_flags_t *tptr = + (const ur_memory_order_capability_flags_t *)ptr; + if (sizeof(ur_memory_order_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: { + const ur_memory_scope_capability_flags_t *tptr = + (const ur_memory_scope_capability_flags_t *)ptr; + if (sizeof(ur_memory_scope_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: { + const ur_memory_order_capability_flags_t *tptr = + (const ur_memory_order_capability_flags_t *)ptr; + if (sizeof(ur_memory_order_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: { + const ur_memory_scope_capability_flags_t *tptr = + (const ur_memory_scope_capability_flags_t *)ptr; + if (sizeof(ur_memory_scope_capability_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_context_native_properties_t params) { + os << "(struct ur_context_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value) { + switch (value) { + case UR_MEM_FLAG_READ_WRITE: + os << "UR_MEM_FLAG_READ_WRITE"; + break; + case UR_MEM_FLAG_WRITE_ONLY: + os << "UR_MEM_FLAG_WRITE_ONLY"; + break; + case UR_MEM_FLAG_READ_ONLY: + os << "UR_MEM_FLAG_READ_ONLY"; + break; + case UR_MEM_FLAG_USE_HOST_POINTER: + os << "UR_MEM_FLAG_USE_HOST_POINTER"; + break; + case UR_MEM_FLAG_ALLOC_HOST_POINTER: + os << "UR_MEM_FLAG_ALLOC_HOST_POINTER"; + break; + case UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER: + os << "UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_MEM_FLAG_READ_WRITE) == (uint32_t)UR_MEM_FLAG_READ_WRITE) { + val ^= (uint32_t)UR_MEM_FLAG_READ_WRITE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEM_FLAG_READ_WRITE; + } + + if ((val & UR_MEM_FLAG_WRITE_ONLY) == (uint32_t)UR_MEM_FLAG_WRITE_ONLY) { + val ^= (uint32_t)UR_MEM_FLAG_WRITE_ONLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEM_FLAG_WRITE_ONLY; + } + + if ((val & UR_MEM_FLAG_READ_ONLY) == (uint32_t)UR_MEM_FLAG_READ_ONLY) { + val ^= (uint32_t)UR_MEM_FLAG_READ_ONLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEM_FLAG_READ_ONLY; + } + + if ((val & UR_MEM_FLAG_USE_HOST_POINTER) == + (uint32_t)UR_MEM_FLAG_USE_HOST_POINTER) { + val ^= (uint32_t)UR_MEM_FLAG_USE_HOST_POINTER; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEM_FLAG_USE_HOST_POINTER; + } + + if ((val & UR_MEM_FLAG_ALLOC_HOST_POINTER) == + (uint32_t)UR_MEM_FLAG_ALLOC_HOST_POINTER) { + val ^= (uint32_t)UR_MEM_FLAG_ALLOC_HOST_POINTER; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEM_FLAG_ALLOC_HOST_POINTER; + } + + if ((val & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) == + (uint32_t)UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) { + val ^= (uint32_t)UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { + switch (value) { + case UR_MEM_TYPE_IMAGE2D: + os << "UR_MEM_TYPE_IMAGE2D"; + break; + case UR_MEM_TYPE_IMAGE3D: + os << "UR_MEM_TYPE_IMAGE3D"; + break; + case UR_MEM_TYPE_IMAGE2D_ARRAY: + os << "UR_MEM_TYPE_IMAGE2D_ARRAY"; + break; + case UR_MEM_TYPE_IMAGE1D: + os << "UR_MEM_TYPE_IMAGE1D"; + break; + case UR_MEM_TYPE_IMAGE1D_ARRAY: + os << "UR_MEM_TYPE_IMAGE1D_ARRAY"; + break; + case UR_MEM_TYPE_IMAGE_CUBEMAP_EXP: + os << "UR_MEM_TYPE_IMAGE_CUBEMAP_EXP"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { + switch (value) { + case UR_MEM_INFO_SIZE: + os << "UR_MEM_INFO_SIZE"; + break; + case UR_MEM_INFO_CONTEXT: + os << "UR_MEM_INFO_CONTEXT"; + break; + case UR_MEM_INFO_REFERENCE_COUNT: + os << "UR_MEM_INFO_REFERENCE_COUNT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_mem_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_MEM_INFO_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_MEM_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_MEM_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_channel_order_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_image_channel_order_t value) { + switch (value) { + case UR_IMAGE_CHANNEL_ORDER_A: + os << "UR_IMAGE_CHANNEL_ORDER_A"; + break; + case UR_IMAGE_CHANNEL_ORDER_R: + os << "UR_IMAGE_CHANNEL_ORDER_R"; + break; + case UR_IMAGE_CHANNEL_ORDER_RG: + os << "UR_IMAGE_CHANNEL_ORDER_RG"; + break; + case UR_IMAGE_CHANNEL_ORDER_RA: + os << "UR_IMAGE_CHANNEL_ORDER_RA"; + break; + case UR_IMAGE_CHANNEL_ORDER_RGB: + os << "UR_IMAGE_CHANNEL_ORDER_RGB"; + break; + case UR_IMAGE_CHANNEL_ORDER_RGBA: + os << "UR_IMAGE_CHANNEL_ORDER_RGBA"; + break; + case UR_IMAGE_CHANNEL_ORDER_BGRA: + os << "UR_IMAGE_CHANNEL_ORDER_BGRA"; + break; + case UR_IMAGE_CHANNEL_ORDER_ARGB: + os << "UR_IMAGE_CHANNEL_ORDER_ARGB"; + break; + case UR_IMAGE_CHANNEL_ORDER_ABGR: + os << "UR_IMAGE_CHANNEL_ORDER_ABGR"; + break; + case UR_IMAGE_CHANNEL_ORDER_INTENSITY: + os << "UR_IMAGE_CHANNEL_ORDER_INTENSITY"; + break; + case UR_IMAGE_CHANNEL_ORDER_LUMINANCE: + os << "UR_IMAGE_CHANNEL_ORDER_LUMINANCE"; + break; + case UR_IMAGE_CHANNEL_ORDER_RX: + os << "UR_IMAGE_CHANNEL_ORDER_RX"; + break; + case UR_IMAGE_CHANNEL_ORDER_RGX: + os << "UR_IMAGE_CHANNEL_ORDER_RGX"; + break; + case UR_IMAGE_CHANNEL_ORDER_RGBX: + os << "UR_IMAGE_CHANNEL_ORDER_RGBX"; + break; + case UR_IMAGE_CHANNEL_ORDER_SRGBA: + os << "UR_IMAGE_CHANNEL_ORDER_SRGBA"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_channel_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_image_channel_type_t value) { + switch (value) { + case UR_IMAGE_CHANNEL_TYPE_SNORM_INT8: + os << "UR_IMAGE_CHANNEL_TYPE_SNORM_INT8"; + break; + case UR_IMAGE_CHANNEL_TYPE_SNORM_INT16: + os << "UR_IMAGE_CHANNEL_TYPE_SNORM_INT16"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: + os << "UR_IMAGE_CHANNEL_TYPE_UNORM_INT8"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: + os << "UR_IMAGE_CHANNEL_TYPE_UNORM_INT16"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565: + os << "UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555: + os << "UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555"; + break; + case UR_IMAGE_CHANNEL_TYPE_INT_101010: + os << "UR_IMAGE_CHANNEL_TYPE_INT_101010"; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: + os << "UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8"; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: + os << "UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16"; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: + os << "UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: + os << "UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: + os << "UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16"; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: + os << "UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32"; + break; + case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: + os << "UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT"; + break; + case UR_IMAGE_CHANNEL_TYPE_FLOAT: + os << "UR_IMAGE_CHANNEL_TYPE_FLOAT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value) { + switch (value) { + case UR_IMAGE_INFO_FORMAT: + os << "UR_IMAGE_INFO_FORMAT"; + break; + case UR_IMAGE_INFO_ELEMENT_SIZE: + os << "UR_IMAGE_INFO_ELEMENT_SIZE"; + break; + case UR_IMAGE_INFO_ROW_PITCH: + os << "UR_IMAGE_INFO_ROW_PITCH"; + break; + case UR_IMAGE_INFO_SLICE_PITCH: + os << "UR_IMAGE_INFO_SLICE_PITCH"; + break; + case UR_IMAGE_INFO_WIDTH: + os << "UR_IMAGE_INFO_WIDTH"; + break; + case UR_IMAGE_INFO_HEIGHT: + os << "UR_IMAGE_INFO_HEIGHT"; + break; + case UR_IMAGE_INFO_DEPTH: + os << "UR_IMAGE_INFO_DEPTH"; + break; + case UR_IMAGE_INFO_ARRAY_SIZE: + os << "UR_IMAGE_INFO_ARRAY_SIZE"; + break; + case UR_IMAGE_INFO_NUM_MIP_LEVELS: + os << "UR_IMAGE_INFO_NUM_MIP_LEVELS"; + break; + case UR_IMAGE_INFO_NUM_SAMPLES: + os << "UR_IMAGE_INFO_NUM_SAMPLES"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_image_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_IMAGE_INFO_FORMAT: { + const ur_image_format_t *tptr = (const ur_image_format_t *)ptr; + if (sizeof(ur_image_format_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_image_format_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_ELEMENT_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_ROW_PITCH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_SLICE_PITCH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_WIDTH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_HEIGHT: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_DEPTH: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_ARRAY_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_NUM_MIP_LEVELS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_IMAGE_INFO_NUM_SAMPLES: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_format_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_image_format_t params) { + os << "(struct ur_image_format_t){"; + + os << ".channelOrder = "; + + os << (params.channelOrder); + + os << ", "; + os << ".channelType = "; + + os << (params.channelType); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_image_desc_t params) { + os << "(struct ur_image_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".type = "; + + os << (params.type); + + os << ", "; + os << ".width = "; + + os << (params.width); + + os << ", "; + os << ".height = "; + + os << (params.height); + + os << ", "; + os << ".depth = "; + + os << (params.depth); + + os << ", "; + os << ".arraySize = "; + + os << (params.arraySize); + + os << ", "; + os << ".rowPitch = "; + + os << (params.rowPitch); + + os << ", "; + os << ".slicePitch = "; + + os << (params.slicePitch); + + os << ", "; + os << ".numMipLevel = "; + + os << (params.numMipLevel); + + os << ", "; + os << ".numSamples = "; + + os << (params.numSamples); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_buffer_properties_t params) { + os << "(struct ur_buffer_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".pHost = "; + + ur::details::printPtr(os, (params.pHost)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_channel_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_buffer_channel_properties_t params) { + os << "(struct ur_buffer_channel_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".channel = "; + + os << (params.channel); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_alloc_location_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_buffer_alloc_location_properties_t params) { + os << "(struct ur_buffer_alloc_location_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".location = "; + + os << (params.location); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_region_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_buffer_region_t params) { + os << "(struct ur_buffer_region_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".origin = "; + + os << (params.origin); + + os << ", "; + os << ".size = "; + + os << (params.size); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_create_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_buffer_create_type_t value) { + switch (value) { + case UR_BUFFER_CREATE_TYPE_REGION: + os << "UR_BUFFER_CREATE_TYPE_REGION"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { + os << "(struct ur_mem_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_filter_mode_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_sampler_filter_mode_t value) { + switch (value) { + case UR_SAMPLER_FILTER_MODE_NEAREST: + os << "UR_SAMPLER_FILTER_MODE_NEAREST"; + break; + case UR_SAMPLER_FILTER_MODE_LINEAR: + os << "UR_SAMPLER_FILTER_MODE_LINEAR"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_addressing_mode_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_sampler_addressing_mode_t value) { + switch (value) { + case UR_SAMPLER_ADDRESSING_MODE_NONE: + os << "UR_SAMPLER_ADDRESSING_MODE_NONE"; + break; + case UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE: + os << "UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE"; + break; + case UR_SAMPLER_ADDRESSING_MODE_CLAMP: + os << "UR_SAMPLER_ADDRESSING_MODE_CLAMP"; + break; + case UR_SAMPLER_ADDRESSING_MODE_REPEAT: + os << "UR_SAMPLER_ADDRESSING_MODE_REPEAT"; + break; + case UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT: + os << "UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_sampler_info_t value) { + switch (value) { + case UR_SAMPLER_INFO_REFERENCE_COUNT: + os << "UR_SAMPLER_INFO_REFERENCE_COUNT"; + break; + case UR_SAMPLER_INFO_CONTEXT: + os << "UR_SAMPLER_INFO_CONTEXT"; + break; + case UR_SAMPLER_INFO_NORMALIZED_COORDS: + os << "UR_SAMPLER_INFO_NORMALIZED_COORDS"; + break; + case UR_SAMPLER_INFO_ADDRESSING_MODE: + os << "UR_SAMPLER_INFO_ADDRESSING_MODE"; + break; + case UR_SAMPLER_INFO_FILTER_MODE: + os << "UR_SAMPLER_INFO_FILTER_MODE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_sampler_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_SAMPLER_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_SAMPLER_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_SAMPLER_INFO_NORMALIZED_COORDS: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_SAMPLER_INFO_ADDRESSING_MODE: { + const ur_sampler_addressing_mode_t *tptr = + (const ur_sampler_addressing_mode_t *)ptr; + if (sizeof(ur_sampler_addressing_mode_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_sampler_addressing_mode_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_SAMPLER_INFO_FILTER_MODE: { + const ur_sampler_filter_mode_t *tptr = + (const ur_sampler_filter_mode_t *)ptr; + if (sizeof(ur_sampler_filter_mode_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_sampler_filter_mode_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_sampler_desc_t params) { + os << "(struct ur_sampler_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".normalizedCoords = "; + + os << (params.normalizedCoords); + + os << ", "; + os << ".addressingMode = "; + + os << (params.addressingMode); + + os << ", "; + os << ".filterMode = "; + + os << (params.filterMode); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_sampler_native_properties_t params) { + os << "(struct ur_sampler_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_host_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_host_mem_flag_t value) { + switch (value) { + case UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT: + os << "UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_host_mem_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) == + (uint32_t)UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) { + val ^= (uint32_t)UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_device_mem_flag_t value) { + switch (value) { + case UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED: + os << "UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED"; + break; + case UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT: + os << "UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT"; + break; + case UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY: + os << "UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_device_mem_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) == + (uint32_t)UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) { + val ^= (uint32_t)UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED; + } + + if ((val & UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) == + (uint32_t)UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) { + val ^= (uint32_t)UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT; + } + + if ((val & UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY) == + (uint32_t)UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY) { + val ^= (uint32_t)UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_pool_flag_t value) { + switch (value) { + case UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK: + os << "UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK) == + (uint32_t)UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK) { + val ^= (uint32_t)UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value) { + switch (value) { + case UR_USM_TYPE_UNKNOWN: + os << "UR_USM_TYPE_UNKNOWN"; + break; + case UR_USM_TYPE_HOST: + os << "UR_USM_TYPE_HOST"; + break; + case UR_USM_TYPE_DEVICE: + os << "UR_USM_TYPE_DEVICE"; + break; + case UR_USM_TYPE_SHARED: + os << "UR_USM_TYPE_SHARED"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_alloc_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_alloc_info_t value) { + switch (value) { + case UR_USM_ALLOC_INFO_TYPE: + os << "UR_USM_ALLOC_INFO_TYPE"; + break; + case UR_USM_ALLOC_INFO_BASE_PTR: + os << "UR_USM_ALLOC_INFO_BASE_PTR"; + break; + case UR_USM_ALLOC_INFO_SIZE: + os << "UR_USM_ALLOC_INFO_SIZE"; + break; + case UR_USM_ALLOC_INFO_DEVICE: + os << "UR_USM_ALLOC_INFO_DEVICE"; + break; + case UR_USM_ALLOC_INFO_POOL: + os << "UR_USM_ALLOC_INFO_POOL"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_alloc_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_usm_alloc_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_USM_ALLOC_INFO_TYPE: { + const ur_usm_type_t *tptr = (const ur_usm_type_t *)ptr; + if (sizeof(ur_usm_type_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_usm_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_ALLOC_INFO_BASE_PTR: { + const void *const *tptr = (const void *const *)ptr; + if (sizeof(void *) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(void *) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_ALLOC_INFO_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_ALLOC_INFO_DEVICE: { + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + if (sizeof(ur_device_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_USM_ALLOC_INFO_POOL: { + const ur_usm_pool_handle_t *tptr = (const ur_usm_pool_handle_t *)ptr; + if (sizeof(ur_usm_pool_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_usm_pool_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_advice_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_advice_flag_t value) { + switch (value) { + case UR_USM_ADVICE_FLAG_DEFAULT: + os << "UR_USM_ADVICE_FLAG_DEFAULT"; + break; + case UR_USM_ADVICE_FLAG_SET_READ_MOSTLY: + os << "UR_USM_ADVICE_FLAG_SET_READ_MOSTLY"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY: + os << "UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY"; + break; + case UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION: + os << "UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION: + os << "UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION"; + break; + case UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY: + os << "UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY: + os << "UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY"; + break; + case UR_USM_ADVICE_FLAG_BIAS_CACHED: + os << "UR_USM_ADVICE_FLAG_BIAS_CACHED"; + break; + case UR_USM_ADVICE_FLAG_BIAS_UNCACHED: + os << "UR_USM_ADVICE_FLAG_BIAS_UNCACHED"; + break; + case UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE: + os << "UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE: + os << "UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE"; + break; + case UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST: + os << "UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST: + os << "UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST"; + break; + case UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST: + os << "UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST: + os << "UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST"; + break; + case UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY: + os << "UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY: + os << "UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_advice_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_USM_ADVICE_FLAG_DEFAULT) == + (uint32_t)UR_USM_ADVICE_FLAG_DEFAULT) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_DEFAULT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_DEFAULT; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_READ_MOSTLY) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_READ_MOSTLY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_READ_MOSTLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_READ_MOSTLY; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY; + } + + if ((val & UR_USM_ADVICE_FLAG_BIAS_CACHED) == + (uint32_t)UR_USM_ADVICE_FLAG_BIAS_CACHED) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_BIAS_CACHED; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_BIAS_CACHED; + } + + if ((val & UR_USM_ADVICE_FLAG_BIAS_UNCACHED) == + (uint32_t)UR_USM_ADVICE_FLAG_BIAS_UNCACHED) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_BIAS_UNCACHED; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_BIAS_UNCACHED; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST; + } + + if ((val & UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY) == + (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY) == + (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_usm_desc_t params) { + os << "(struct ur_usm_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".hints = "; + + ur::details::printFlag(os, (params.hints)); + + os << ", "; + os << ".align = "; + + os << (params.align); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_host_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_usm_host_desc_t params) { + os << "(struct ur_usm_host_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_usm_device_desc_t params) { + os << "(struct ur_usm_device_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_alloc_location_desc_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_usm_alloc_location_desc_t params) { + os << "(struct ur_usm_alloc_location_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".location = "; + + os << (params.location); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_usm_pool_desc_t params) { + os << "(struct ur_usm_pool_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_limits_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_usm_pool_limits_desc_t params) { + os << "(struct ur_usm_pool_limits_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".maxPoolableSize = "; + + os << (params.maxPoolableSize); + + os << ", "; + os << ".minDriverAllocSize = "; + + os << (params.minDriverAllocSize); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_pool_info_t value) { + switch (value) { + case UR_USM_POOL_INFO_REFERENCE_COUNT: + os << "UR_USM_POOL_INFO_REFERENCE_COUNT"; + break; + case UR_USM_POOL_INFO_CONTEXT: + os << "UR_USM_POOL_INFO_CONTEXT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_usm_pool_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_USM_POOL_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_USM_POOL_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_granularity_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_virtual_mem_granularity_info_t value) { + switch (value) { + case UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM: + os << "UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM"; + break; + case UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED: + os << "UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_granularity_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_granularity_info_t value, + size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_access_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_virtual_mem_access_flag_t value) { + switch (value) { + case UR_VIRTUAL_MEM_ACCESS_FLAG_NONE: + os << "UR_VIRTUAL_MEM_ACCESS_FLAG_NONE"; + break; + case UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE: + os << "UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE"; + break; + case UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY: + os << "UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_access_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_NONE) == + (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_NONE) { + val ^= (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_NONE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_VIRTUAL_MEM_ACCESS_FLAG_NONE; + } + + if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE) == + (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE) { + val ^= (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE; + } + + if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY) == + (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY) { + val ^= (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_virtual_mem_info_t value) { + switch (value) { + case UR_VIRTUAL_MEM_INFO_ACCESS_MODE: + os << "UR_VIRTUAL_MEM_INFO_ACCESS_MODE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_VIRTUAL_MEM_INFO_ACCESS_MODE: { + const ur_virtual_mem_access_flags_t *tptr = + (const ur_virtual_mem_access_flags_t *)ptr; + if (sizeof(ur_virtual_mem_access_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_virtual_mem_access_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_physical_mem_flag_t value) { + switch (value) { + case UR_PHYSICAL_MEM_FLAG_TBD: + os << "UR_PHYSICAL_MEM_FLAG_TBD"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_PHYSICAL_MEM_FLAG_TBD) == (uint32_t)UR_PHYSICAL_MEM_FLAG_TBD) { + val ^= (uint32_t)UR_PHYSICAL_MEM_FLAG_TBD; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_PHYSICAL_MEM_FLAG_TBD; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { + os << "(struct ur_physical_mem_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_physical_mem_info_t value) { + switch (value) { + case UR_PHYSICAL_MEM_INFO_CONTEXT: + os << "UR_PHYSICAL_MEM_INFO_CONTEXT"; + break; + case UR_PHYSICAL_MEM_INFO_DEVICE: + os << "UR_PHYSICAL_MEM_INFO_DEVICE"; + break; + case UR_PHYSICAL_MEM_INFO_SIZE: + os << "UR_PHYSICAL_MEM_INFO_SIZE"; + break; + case UR_PHYSICAL_MEM_INFO_PROPERTIES: + os << "UR_PHYSICAL_MEM_INFO_PROPERTIES"; + break; + case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT: + os << "UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_physical_mem_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_PHYSICAL_MEM_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_PHYSICAL_MEM_INFO_DEVICE: { + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + if (sizeof(ur_device_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_PHYSICAL_MEM_INFO_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PHYSICAL_MEM_INFO_PROPERTIES: { + const ur_physical_mem_properties_t *tptr = + (const ur_physical_mem_properties_t *)ptr; + if (sizeof(ur_physical_mem_properties_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_physical_mem_properties_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PHYSICAL_MEM_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_metadata_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_metadata_type_t value) { + switch (value) { + case UR_PROGRAM_METADATA_TYPE_UINT32: + os << "UR_PROGRAM_METADATA_TYPE_UINT32"; + break; + case UR_PROGRAM_METADATA_TYPE_UINT64: + os << "UR_PROGRAM_METADATA_TYPE_UINT64"; + break; + case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: + os << "UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY"; + break; + case UR_PROGRAM_METADATA_TYPE_STRING: + os << "UR_PROGRAM_METADATA_TYPE_STRING"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { + +/////////////////////////////////////////////////////////////////////////////// +// @brief Print ur_program_metadata_value_t union +inline ur_result_t printUnion(std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag) { + os << "(union ur_program_metadata_value_t){"; + + switch (tag) { + case UR_PROGRAM_METADATA_TYPE_UINT32: + + os << ".data32 = "; + + os << (params.data32); + + break; + case UR_PROGRAM_METADATA_TYPE_UINT64: + + os << ".data64 = "; + + os << (params.data64); + + break; + case UR_PROGRAM_METADATA_TYPE_STRING: + + os << ".pString = "; + + ur::details::printPtr(os, (params.pString)); + + break; + case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: + + os << ".pData = "; + + ur::details::printPtr(os, (params.pData)); + + break; + default: + os << ""; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + os << "}"; + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_metadata_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_program_metadata_t params) { + os << "(struct ur_program_metadata_t){"; + + os << ".pName = "; + + ur::details::printPtr(os, (params.pName)); + + os << ", "; + os << ".type = "; + + os << (params.type); + + os << ", "; + os << ".size = "; + + os << (params.size); + + os << ", "; + os << ".value = "; + ur::details::printUnion(os, (params.value), params.type); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_program_properties_t params) { + os << "(struct ur_program_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".count = "; + + os << (params.count); + + os << ", "; + os << ".pMetadatas = "; + ur::details::printPtr(os, + reinterpret_cast((params.pMetadatas))); + if ((params.pMetadatas) != NULL) { + os << " {"; + for (size_t i = 0; i < params.count; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pMetadatas))[i]; + } + os << "}"; + } + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_info_t value) { + switch (value) { + case UR_PROGRAM_INFO_REFERENCE_COUNT: + os << "UR_PROGRAM_INFO_REFERENCE_COUNT"; + break; + case UR_PROGRAM_INFO_CONTEXT: + os << "UR_PROGRAM_INFO_CONTEXT"; + break; + case UR_PROGRAM_INFO_NUM_DEVICES: + os << "UR_PROGRAM_INFO_NUM_DEVICES"; + break; + case UR_PROGRAM_INFO_DEVICES: + os << "UR_PROGRAM_INFO_DEVICES"; + break; + case UR_PROGRAM_INFO_IL: + os << "UR_PROGRAM_INFO_IL"; + break; + case UR_PROGRAM_INFO_BINARY_SIZES: + os << "UR_PROGRAM_INFO_BINARY_SIZES"; + break; + case UR_PROGRAM_INFO_BINARIES: + os << "UR_PROGRAM_INFO_BINARIES"; + break; + case UR_PROGRAM_INFO_NUM_KERNELS: + os << "UR_PROGRAM_INFO_NUM_KERNELS"; + break; + case UR_PROGRAM_INFO_KERNEL_NAMES: + os << "UR_PROGRAM_INFO_KERNEL_NAMES"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_program_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_PROGRAM_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROGRAM_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_PROGRAM_INFO_NUM_DEVICES: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROGRAM_INFO_DEVICES: { + + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(ur_device_handle_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, tptr[i]); + } + os << "}"; + } break; + case UR_PROGRAM_INFO_IL: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PROGRAM_INFO_BINARY_SIZES: { + + const size_t *tptr = (const size_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(size_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_PROGRAM_INFO_BINARIES: { + + const unsigned char *tptr = (const unsigned char *)ptr; + printPtr(os, tptr); + } break; + case UR_PROGRAM_INFO_NUM_KERNELS: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROGRAM_INFO_KERNEL_NAMES: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_status_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_build_status_t value) { + switch (value) { + case UR_PROGRAM_BUILD_STATUS_NONE: + os << "UR_PROGRAM_BUILD_STATUS_NONE"; + break; + case UR_PROGRAM_BUILD_STATUS_ERROR: + os << "UR_PROGRAM_BUILD_STATUS_ERROR"; + break; + case UR_PROGRAM_BUILD_STATUS_SUCCESS: + os << "UR_PROGRAM_BUILD_STATUS_SUCCESS"; + break; + case UR_PROGRAM_BUILD_STATUS_IN_PROGRESS: + os << "UR_PROGRAM_BUILD_STATUS_IN_PROGRESS"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_binary_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_binary_type_t value) { + switch (value) { + case UR_PROGRAM_BINARY_TYPE_NONE: + os << "UR_PROGRAM_BINARY_TYPE_NONE"; + break; + case UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT: + os << "UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT"; + break; + case UR_PROGRAM_BINARY_TYPE_LIBRARY: + os << "UR_PROGRAM_BINARY_TYPE_LIBRARY"; + break; + case UR_PROGRAM_BINARY_TYPE_EXECUTABLE: + os << "UR_PROGRAM_BINARY_TYPE_EXECUTABLE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_program_build_info_t value) { + switch (value) { + case UR_PROGRAM_BUILD_INFO_STATUS: + os << "UR_PROGRAM_BUILD_INFO_STATUS"; + break; + case UR_PROGRAM_BUILD_INFO_OPTIONS: + os << "UR_PROGRAM_BUILD_INFO_OPTIONS"; + break; + case UR_PROGRAM_BUILD_INFO_LOG: + os << "UR_PROGRAM_BUILD_INFO_LOG"; + break; + case UR_PROGRAM_BUILD_INFO_BINARY_TYPE: + os << "UR_PROGRAM_BUILD_INFO_BINARY_TYPE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_build_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_program_build_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_PROGRAM_BUILD_INFO_STATUS: { + const ur_program_build_status_t *tptr = + (const ur_program_build_status_t *)ptr; + if (sizeof(ur_program_build_status_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_program_build_status_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROGRAM_BUILD_INFO_OPTIONS: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PROGRAM_BUILD_INFO_LOG: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_PROGRAM_BUILD_INFO_BINARY_TYPE: { + const ur_program_binary_type_t *tptr = + (const ur_program_binary_type_t *)ptr; + if (sizeof(ur_program_binary_type_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_program_binary_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_specialization_constant_info_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_specialization_constant_info_t params) { + os << "(struct ur_specialization_constant_info_t){"; + + os << ".id = "; + + os << (params.id); + + os << ", "; + os << ".size = "; + + os << (params.size); + + os << ", "; + os << ".pValue = "; + + ur::details::printPtr(os, (params.pValue)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_program_native_properties_t params) { + os << "(struct ur_program_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_value_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_arg_value_properties_t params) { + os << "(struct ur_kernel_arg_value_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_local_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_arg_local_properties_t params) { + os << "(struct ur_kernel_arg_local_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value) { + switch (value) { + case UR_KERNEL_INFO_FUNCTION_NAME: + os << "UR_KERNEL_INFO_FUNCTION_NAME"; + break; + case UR_KERNEL_INFO_NUM_ARGS: + os << "UR_KERNEL_INFO_NUM_ARGS"; + break; + case UR_KERNEL_INFO_REFERENCE_COUNT: + os << "UR_KERNEL_INFO_REFERENCE_COUNT"; + break; + case UR_KERNEL_INFO_CONTEXT: + os << "UR_KERNEL_INFO_CONTEXT"; + break; + case UR_KERNEL_INFO_PROGRAM: + os << "UR_KERNEL_INFO_PROGRAM"; + break; + case UR_KERNEL_INFO_ATTRIBUTES: + os << "UR_KERNEL_INFO_ATTRIBUTES"; + break; + case UR_KERNEL_INFO_NUM_REGS: + os << "UR_KERNEL_INFO_NUM_REGS"; + break; + case UR_KERNEL_INFO_SPILL_MEM_SIZE: + os << "UR_KERNEL_INFO_SPILL_MEM_SIZE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_KERNEL_INFO_FUNCTION_NAME: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_KERNEL_INFO_NUM_ARGS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_KERNEL_INFO_PROGRAM: { + const ur_program_handle_t *tptr = (const ur_program_handle_t *)ptr; + if (sizeof(ur_program_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_program_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_KERNEL_INFO_ATTRIBUTES: { + + const char *tptr = (const char *)ptr; + printPtr(os, tptr); + } break; + case UR_KERNEL_INFO_NUM_REGS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_INFO_SPILL_MEM_SIZE: { + + const uint32_t *tptr = (const uint32_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(uint32_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_group_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_group_info_t value) { + switch (value) { + case UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE: + os << "UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE"; + break; + case UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE: + os << "UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE"; + break; + case UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE: + os << "UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE"; + break; + case UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE: + os << "UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE"; + break; + case UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: + os << "UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE"; + break; + case UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: + os << "UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE"; + break; + case UR_KERNEL_GROUP_INFO_COMPILE_MAX_WORK_GROUP_SIZE: + os << "UR_KERNEL_GROUP_INFO_COMPILE_MAX_WORK_GROUP_SIZE"; + break; + case UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE: + os << "UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_group_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_group_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE: { + + const size_t *tptr = (const size_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(size_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE: { + + const size_t *tptr = (const size_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(size_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_GROUP_INFO_COMPILE_MAX_WORK_GROUP_SIZE: { + + const size_t *tptr = (const size_t *)ptr; + os << "{"; + size_t nelems = size / sizeof(size_t); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_KERNEL_GROUP_INFO_COMPILE_MAX_LINEAR_WORK_GROUP_SIZE: { + const size_t *tptr = (const size_t *)ptr; + if (sizeof(size_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_sub_group_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_sub_group_info_t value) { + switch (value) { + case UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE: + os << "UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE"; + break; + case UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS: + os << "UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS"; + break; + case UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS: + os << "UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS"; + break; + case UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL: + os << "UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_sub_group_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_sub_group_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_cache_config_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_cache_config_t value) { + switch (value) { + case UR_KERNEL_CACHE_CONFIG_DEFAULT: + os << "UR_KERNEL_CACHE_CONFIG_DEFAULT"; + break; + case UR_KERNEL_CACHE_CONFIG_LARGE_SLM: + os << "UR_KERNEL_CACHE_CONFIG_LARGE_SLM"; + break; + case UR_KERNEL_CACHE_CONFIG_LARGE_DATA: + os << "UR_KERNEL_CACHE_CONFIG_LARGE_DATA"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_exec_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_kernel_exec_info_t value) { + switch (value) { + case UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS: + os << "UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS"; + break; + case UR_KERNEL_EXEC_INFO_USM_PTRS: + os << "UR_KERNEL_EXEC_INFO_USM_PTRS"; + break; + case UR_KERNEL_EXEC_INFO_CACHE_CONFIG: + os << "UR_KERNEL_EXEC_INFO_CACHE_CONFIG"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_exec_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_kernel_exec_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_KERNEL_EXEC_INFO_USM_PTRS: { + + const void *const *tptr = (const void *const *)ptr; + os << "{"; + size_t nelems = size / sizeof(void *); + for (size_t i = 0; i < nelems; ++i) { + if (i != 0) { + os << ", "; + } + + os << tptr[i]; + } + os << "}"; + } break; + case UR_KERNEL_EXEC_INFO_CACHE_CONFIG: { + const ur_kernel_cache_config_t *tptr = + (const ur_kernel_cache_config_t *)ptr; + if (sizeof(ur_kernel_cache_config_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_kernel_cache_config_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_pointer_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_arg_pointer_properties_t params) { + os << "(struct ur_kernel_arg_pointer_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_exec_info_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_exec_info_properties_t params) { + os << "(struct ur_kernel_exec_info_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_sampler_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_arg_sampler_properties_t params) { + os << "(struct ur_kernel_arg_sampler_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_mem_obj_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_arg_mem_obj_properties_t params) { + os << "(struct ur_kernel_arg_mem_obj_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".memoryAccess = "; + + ur::details::printFlag(os, (params.memoryAccess)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_kernel_native_properties_t params) { + os << "(struct ur_kernel_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value) { + switch (value) { + case UR_QUEUE_INFO_CONTEXT: + os << "UR_QUEUE_INFO_CONTEXT"; + break; + case UR_QUEUE_INFO_DEVICE: + os << "UR_QUEUE_INFO_DEVICE"; + break; + case UR_QUEUE_INFO_DEVICE_DEFAULT: + os << "UR_QUEUE_INFO_DEVICE_DEFAULT"; + break; + case UR_QUEUE_INFO_FLAGS: + os << "UR_QUEUE_INFO_FLAGS"; + break; + case UR_QUEUE_INFO_REFERENCE_COUNT: + os << "UR_QUEUE_INFO_REFERENCE_COUNT"; + break; + case UR_QUEUE_INFO_SIZE: + os << "UR_QUEUE_INFO_SIZE"; + break; + case UR_QUEUE_INFO_EMPTY: + os << "UR_QUEUE_INFO_EMPTY"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_queue_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_QUEUE_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_QUEUE_INFO_DEVICE: { + const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; + if (sizeof(ur_device_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_QUEUE_INFO_DEVICE_DEFAULT: { + const ur_queue_handle_t *tptr = (const ur_queue_handle_t *)ptr; + if (sizeof(ur_queue_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_QUEUE_INFO_FLAGS: { + const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; + if (sizeof(ur_queue_flags_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printFlag(os, *tptr); + + os << ")"; + } break; + case UR_QUEUE_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_QUEUE_INFO_SIZE: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_QUEUE_INFO_EMPTY: { + const ur_bool_t *tptr = (const ur_bool_t *)ptr; + if (sizeof(ur_bool_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { + switch (value) { + case UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE: + os << "UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE"; + break; + case UR_QUEUE_FLAG_PROFILING_ENABLE: + os << "UR_QUEUE_FLAG_PROFILING_ENABLE"; + break; + case UR_QUEUE_FLAG_ON_DEVICE: + os << "UR_QUEUE_FLAG_ON_DEVICE"; + break; + case UR_QUEUE_FLAG_ON_DEVICE_DEFAULT: + os << "UR_QUEUE_FLAG_ON_DEVICE_DEFAULT"; + break; + case UR_QUEUE_FLAG_DISCARD_EVENTS: + os << "UR_QUEUE_FLAG_DISCARD_EVENTS"; + break; + case UR_QUEUE_FLAG_PRIORITY_LOW: + os << "UR_QUEUE_FLAG_PRIORITY_LOW"; + break; + case UR_QUEUE_FLAG_PRIORITY_HIGH: + os << "UR_QUEUE_FLAG_PRIORITY_HIGH"; + break; + case UR_QUEUE_FLAG_SUBMISSION_BATCHED: + os << "UR_QUEUE_FLAG_SUBMISSION_BATCHED"; + break; + case UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE: + os << "UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE"; + break; + case UR_QUEUE_FLAG_USE_DEFAULT_STREAM: + os << "UR_QUEUE_FLAG_USE_DEFAULT_STREAM"; + break; + case UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM: + os << "UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM"; + break; + case UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP: + os << "UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) == + (uint32_t)UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) { + val ^= (uint32_t)UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE; + } + + if ((val & UR_QUEUE_FLAG_PROFILING_ENABLE) == + (uint32_t)UR_QUEUE_FLAG_PROFILING_ENABLE) { + val ^= (uint32_t)UR_QUEUE_FLAG_PROFILING_ENABLE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_PROFILING_ENABLE; + } + + if ((val & UR_QUEUE_FLAG_ON_DEVICE) == (uint32_t)UR_QUEUE_FLAG_ON_DEVICE) { + val ^= (uint32_t)UR_QUEUE_FLAG_ON_DEVICE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_ON_DEVICE; + } + + if ((val & UR_QUEUE_FLAG_ON_DEVICE_DEFAULT) == + (uint32_t)UR_QUEUE_FLAG_ON_DEVICE_DEFAULT) { + val ^= (uint32_t)UR_QUEUE_FLAG_ON_DEVICE_DEFAULT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_ON_DEVICE_DEFAULT; + } + + if ((val & UR_QUEUE_FLAG_DISCARD_EVENTS) == + (uint32_t)UR_QUEUE_FLAG_DISCARD_EVENTS) { + val ^= (uint32_t)UR_QUEUE_FLAG_DISCARD_EVENTS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_DISCARD_EVENTS; + } + + if ((val & UR_QUEUE_FLAG_PRIORITY_LOW) == + (uint32_t)UR_QUEUE_FLAG_PRIORITY_LOW) { + val ^= (uint32_t)UR_QUEUE_FLAG_PRIORITY_LOW; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_PRIORITY_LOW; + } + + if ((val & UR_QUEUE_FLAG_PRIORITY_HIGH) == + (uint32_t)UR_QUEUE_FLAG_PRIORITY_HIGH) { + val ^= (uint32_t)UR_QUEUE_FLAG_PRIORITY_HIGH; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_PRIORITY_HIGH; + } + + if ((val & UR_QUEUE_FLAG_SUBMISSION_BATCHED) == + (uint32_t)UR_QUEUE_FLAG_SUBMISSION_BATCHED) { + val ^= (uint32_t)UR_QUEUE_FLAG_SUBMISSION_BATCHED; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_SUBMISSION_BATCHED; + } + + if ((val & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) == + (uint32_t)UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) { + val ^= (uint32_t)UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE; + } + + if ((val & UR_QUEUE_FLAG_USE_DEFAULT_STREAM) == + (uint32_t)UR_QUEUE_FLAG_USE_DEFAULT_STREAM) { + val ^= (uint32_t)UR_QUEUE_FLAG_USE_DEFAULT_STREAM; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_USE_DEFAULT_STREAM; + } + + if ((val & UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) == + (uint32_t)UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) { + val ^= (uint32_t)UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM; + } + + if ((val & UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP) == + (uint32_t)UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP) { + val ^= (uint32_t)UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_QUEUE_FLAG_LOW_POWER_EVENTS_EXP; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_queue_properties_t params) { + os << "(struct ur_queue_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_index_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { + os << "(struct ur_queue_index_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".computeIndex = "; + + os << (params.computeIndex); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_native_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_queue_native_desc_t params) { + os << "(struct ur_queue_native_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".pNativeData = "; + + ur::details::printPtr(os, (params.pNativeData)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { + os << "(struct ur_queue_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value) { + switch (value) { + case UR_COMMAND_KERNEL_LAUNCH: + os << "UR_COMMAND_KERNEL_LAUNCH"; + break; + case UR_COMMAND_EVENTS_WAIT: + os << "UR_COMMAND_EVENTS_WAIT"; + break; + case UR_COMMAND_EVENTS_WAIT_WITH_BARRIER: + os << "UR_COMMAND_EVENTS_WAIT_WITH_BARRIER"; + break; + case UR_COMMAND_MEM_BUFFER_READ: + os << "UR_COMMAND_MEM_BUFFER_READ"; + break; + case UR_COMMAND_MEM_BUFFER_WRITE: + os << "UR_COMMAND_MEM_BUFFER_WRITE"; + break; + case UR_COMMAND_MEM_BUFFER_READ_RECT: + os << "UR_COMMAND_MEM_BUFFER_READ_RECT"; + break; + case UR_COMMAND_MEM_BUFFER_WRITE_RECT: + os << "UR_COMMAND_MEM_BUFFER_WRITE_RECT"; + break; + case UR_COMMAND_MEM_BUFFER_COPY: + os << "UR_COMMAND_MEM_BUFFER_COPY"; + break; + case UR_COMMAND_MEM_BUFFER_COPY_RECT: + os << "UR_COMMAND_MEM_BUFFER_COPY_RECT"; + break; + case UR_COMMAND_MEM_BUFFER_FILL: + os << "UR_COMMAND_MEM_BUFFER_FILL"; + break; + case UR_COMMAND_MEM_IMAGE_READ: + os << "UR_COMMAND_MEM_IMAGE_READ"; + break; + case UR_COMMAND_MEM_IMAGE_WRITE: + os << "UR_COMMAND_MEM_IMAGE_WRITE"; + break; + case UR_COMMAND_MEM_IMAGE_COPY: + os << "UR_COMMAND_MEM_IMAGE_COPY"; + break; + case UR_COMMAND_MEM_BUFFER_MAP: + os << "UR_COMMAND_MEM_BUFFER_MAP"; + break; + case UR_COMMAND_MEM_UNMAP: + os << "UR_COMMAND_MEM_UNMAP"; + break; + case UR_COMMAND_USM_FILL: + os << "UR_COMMAND_USM_FILL"; + break; + case UR_COMMAND_USM_MEMCPY: + os << "UR_COMMAND_USM_MEMCPY"; + break; + case UR_COMMAND_USM_PREFETCH: + os << "UR_COMMAND_USM_PREFETCH"; + break; + case UR_COMMAND_USM_ADVISE: + os << "UR_COMMAND_USM_ADVISE"; + break; + case UR_COMMAND_USM_FILL_2D: + os << "UR_COMMAND_USM_FILL_2D"; + break; + case UR_COMMAND_USM_MEMCPY_2D: + os << "UR_COMMAND_USM_MEMCPY_2D"; + break; + case UR_COMMAND_DEVICE_GLOBAL_VARIABLE_WRITE: + os << "UR_COMMAND_DEVICE_GLOBAL_VARIABLE_WRITE"; + break; + case UR_COMMAND_DEVICE_GLOBAL_VARIABLE_READ: + os << "UR_COMMAND_DEVICE_GLOBAL_VARIABLE_READ"; + break; + case UR_COMMAND_READ_HOST_PIPE: + os << "UR_COMMAND_READ_HOST_PIPE"; + break; + case UR_COMMAND_WRITE_HOST_PIPE: + os << "UR_COMMAND_WRITE_HOST_PIPE"; + break; + case UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP: + os << "UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP"; + break; + case UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP: + os << "UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP"; + break; + case UR_COMMAND_EXTERNAL_SEMAPHORE_SIGNAL_EXP: + os << "UR_COMMAND_EXTERNAL_SEMAPHORE_SIGNAL_EXP"; + break; + case UR_COMMAND_TIMESTAMP_RECORDING_EXP: + os << "UR_COMMAND_TIMESTAMP_RECORDING_EXP"; + break; + case UR_COMMAND_ENQUEUE_NATIVE_EXP: + os << "UR_COMMAND_ENQUEUE_NATIVE_EXP"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_status_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_event_status_t value) { + switch (value) { + case UR_EVENT_STATUS_COMPLETE: + os << "UR_EVENT_STATUS_COMPLETE"; + break; + case UR_EVENT_STATUS_RUNNING: + os << "UR_EVENT_STATUS_RUNNING"; + break; + case UR_EVENT_STATUS_SUBMITTED: + os << "UR_EVENT_STATUS_SUBMITTED"; + break; + case UR_EVENT_STATUS_QUEUED: + os << "UR_EVENT_STATUS_QUEUED"; + break; + case UR_EVENT_STATUS_ERROR: + os << "UR_EVENT_STATUS_ERROR"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value) { + switch (value) { + case UR_EVENT_INFO_COMMAND_QUEUE: + os << "UR_EVENT_INFO_COMMAND_QUEUE"; + break; + case UR_EVENT_INFO_CONTEXT: + os << "UR_EVENT_INFO_CONTEXT"; + break; + case UR_EVENT_INFO_COMMAND_TYPE: + os << "UR_EVENT_INFO_COMMAND_TYPE"; + break; + case UR_EVENT_INFO_COMMAND_EXECUTION_STATUS: + os << "UR_EVENT_INFO_COMMAND_EXECUTION_STATUS"; + break; + case UR_EVENT_INFO_REFERENCE_COUNT: + os << "UR_EVENT_INFO_REFERENCE_COUNT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_event_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_EVENT_INFO_COMMAND_QUEUE: { + const ur_queue_handle_t *tptr = (const ur_queue_handle_t *)ptr; + if (sizeof(ur_queue_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_EVENT_INFO_CONTEXT: { + const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; + if (sizeof(ur_context_handle_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + ur::details::printPtr(os, *tptr); + + os << ")"; + } break; + case UR_EVENT_INFO_COMMAND_TYPE: { + const ur_command_t *tptr = (const ur_command_t *)ptr; + if (sizeof(ur_command_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_command_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_EVENT_INFO_COMMAND_EXECUTION_STATUS: { + const ur_event_status_t *tptr = (const ur_event_status_t *)ptr; + if (sizeof(ur_event_status_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_event_status_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_EVENT_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_profiling_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_profiling_info_t value) { + switch (value) { + case UR_PROFILING_INFO_COMMAND_QUEUED: + os << "UR_PROFILING_INFO_COMMAND_QUEUED"; + break; + case UR_PROFILING_INFO_COMMAND_SUBMIT: + os << "UR_PROFILING_INFO_COMMAND_SUBMIT"; + break; + case UR_PROFILING_INFO_COMMAND_START: + os << "UR_PROFILING_INFO_COMMAND_START"; + break; + case UR_PROFILING_INFO_COMMAND_END: + os << "UR_PROFILING_INFO_COMMAND_END"; + break; + case UR_PROFILING_INFO_COMMAND_COMPLETE: + os << "UR_PROFILING_INFO_COMMAND_COMPLETE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_profiling_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_profiling_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_PROFILING_INFO_COMMAND_QUEUED: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROFILING_INFO_COMMAND_SUBMIT: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROFILING_INFO_COMMAND_START: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROFILING_INFO_COMMAND_END: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_PROFILING_INFO_COMMAND_COMPLETE: { + const uint64_t *tptr = (const uint64_t *)ptr; + if (sizeof(uint64_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { + os << "(struct ur_event_native_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isNativeHandleOwned = "; + + os << (params.isNativeHandleOwned); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_execution_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_execution_info_t value) { + switch (value) { + case UR_EXECUTION_INFO_COMPLETE: + os << "UR_EXECUTION_INFO_COMPLETE"; + break; + case UR_EXECUTION_INFO_RUNNING: + os << "UR_EXECUTION_INFO_RUNNING"; + break; + case UR_EXECUTION_INFO_SUBMITTED: + os << "UR_EXECUTION_INFO_SUBMITTED"; + break; + case UR_EXECUTION_INFO_QUEUED: + os << "UR_EXECUTION_INFO_QUEUED"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_map_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value) { + switch (value) { + case UR_MAP_FLAG_READ: + os << "UR_MAP_FLAG_READ"; + break; + case UR_MAP_FLAG_WRITE: + os << "UR_MAP_FLAG_WRITE"; + break; + case UR_MAP_FLAG_WRITE_INVALIDATE_REGION: + os << "UR_MAP_FLAG_WRITE_INVALIDATE_REGION"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_map_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_MAP_FLAG_READ) == (uint32_t)UR_MAP_FLAG_READ) { + val ^= (uint32_t)UR_MAP_FLAG_READ; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MAP_FLAG_READ; + } + + if ((val & UR_MAP_FLAG_WRITE) == (uint32_t)UR_MAP_FLAG_WRITE) { + val ^= (uint32_t)UR_MAP_FLAG_WRITE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MAP_FLAG_WRITE; + } + + if ((val & UR_MAP_FLAG_WRITE_INVALIDATE_REGION) == + (uint32_t)UR_MAP_FLAG_WRITE_INVALIDATE_REGION) { + val ^= (uint32_t)UR_MAP_FLAG_WRITE_INVALIDATE_REGION; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_MAP_FLAG_WRITE_INVALIDATE_REGION; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_migration_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_usm_migration_flag_t value) { + switch (value) { + case UR_USM_MIGRATION_FLAG_DEFAULT: + os << "UR_USM_MIGRATION_FLAG_DEFAULT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_migration_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_USM_MIGRATION_FLAG_DEFAULT) == + (uint32_t)UR_USM_MIGRATION_FLAG_DEFAULT) { + val ^= (uint32_t)UR_USM_MIGRATION_FLAG_DEFAULT; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_MIGRATION_FLAG_DEFAULT; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_device_2d_block_array_capability_flag_t +/// type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + enum ur_exp_device_2d_block_array_capability_flag_t value) { + switch (value) { + case UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD: + os << "UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD"; + break; + case UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE: + os << "UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_device_2d_block_array_capability_flag_t flag +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD) == + (uint32_t)UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD) { + val ^= (uint32_t)UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_LOAD; + } + + if ((val & UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE) == + (uint32_t)UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE) { + val ^= (uint32_t)UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_DEVICE_2D_BLOCK_ARRAY_CAPABILITY_FLAG_STORE; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_image_copy_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_image_copy_flag_t value) { + switch (value) { + case UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE: + os << "UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE"; + break; + case UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST: + os << "UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST"; + break; + case UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE: + os << "UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE"; + break; + case UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST: + os << "UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_image_copy_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) == + (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) { + val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE; + } + + if ((val & UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) == + (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) { + val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST; + } + + if ((val & UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) == + (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) { + val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE; + } + + if ((val & UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST) == + (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST) { + val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_IMAGE_COPY_FLAG_HOST_TO_HOST; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_sampler_cubemap_filter_mode_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, enum ur_exp_sampler_cubemap_filter_mode_t value) { + switch (value) { + case UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED: + os << "UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED"; + break; + case UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS: + os << "UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_external_mem_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_external_mem_type_t value) { + switch (value) { + case UR_EXP_EXTERNAL_MEM_TYPE_OPAQUE_FD: + os << "UR_EXP_EXTERNAL_MEM_TYPE_OPAQUE_FD"; + break; + case UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT: + os << "UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT"; + break; + case UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT_DX12_RESOURCE: + os << "UR_EXP_EXTERNAL_MEM_TYPE_WIN32_NT_DX12_RESOURCE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_external_semaphore_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_external_semaphore_type_t value) { + switch (value) { + case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_OPAQUE_FD: + os << "UR_EXP_EXTERNAL_SEMAPHORE_TYPE_OPAQUE_FD"; + break; + case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT: + os << "UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT"; + break; + case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE: + os << "UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_file_descriptor_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_exp_file_descriptor_t params) { + os << "(struct ur_exp_file_descriptor_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".fd = "; + + os << (params.fd); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_win32_handle_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_exp_win32_handle_t params) { + os << "(struct ur_exp_win32_handle_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".handle = "; + + ur::details::printPtr(os, (params.handle)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_sampler_mip_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_sampler_mip_properties_t params) { + os << "(struct ur_exp_sampler_mip_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".minMipmapLevelClamp = "; + + os << (params.minMipmapLevelClamp); + + os << ", "; + os << ".maxMipmapLevelClamp = "; + + os << (params.maxMipmapLevelClamp); + + os << ", "; + os << ".maxAnisotropy = "; + + os << (params.maxAnisotropy); + + os << ", "; + os << ".mipFilterMode = "; + + os << (params.mipFilterMode); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_sampler_addr_modes_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { + os << "(struct ur_exp_sampler_addr_modes_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".addrModes = {"; + for (auto i = 0; i < 3; i++) { + if (i != 0) { + os << ", "; + } + + os << (params.addrModes[i]); + } + os << "}"; + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_sampler_cubemap_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_sampler_cubemap_properties_t params) { + os << "(struct ur_exp_sampler_cubemap_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".cubemapFilterMode = "; + + os << (params.cubemapFilterMode); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_external_mem_desc_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_exp_external_mem_desc_t params) { + os << "(struct ur_exp_external_mem_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_external_semaphore_desc_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_external_semaphore_desc_t params) { + os << "(struct ur_exp_external_semaphore_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_image_copy_region_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_exp_image_copy_region_t params) { + os << "(struct ur_exp_image_copy_region_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".srcOffset = "; + + os << (params.srcOffset); + + os << ", "; + os << ".dstOffset = "; + + os << (params.dstOffset); + + os << ", "; + os << ".copyExtent = "; + + os << (params.copyExtent); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_device_command_buffer_update_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + enum ur_device_command_buffer_update_capability_flag_t value) { + switch (value) { + case UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS: + os << "UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS"; + break; + case UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE: + os << "UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE"; + break; + case UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE: + os << "UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE"; + break; + case UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET: + os << "UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET"; + break; + case UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE: + os << "UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE"; + break; + case UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS: + os << "UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_command_buffer_update_capability_flag_t flag +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS) == + (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS) { + val ^= (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_ARGUMENTS; + } + + if ((val & UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE) == + (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE) { + val ^= (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_LOCAL_WORK_SIZE; + } + + if ((val & + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE) == + (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE) { + val ^= (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_SIZE; + } + + if ((val & + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET) == + (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET) { + val ^= (uint32_t) + UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_GLOBAL_WORK_OFFSET; + } + + if ((val & UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE) == + (uint32_t)UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE) { + val ^= + (uint32_t)UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_KERNEL_HANDLE; + } + + if ((val & UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS) == + (uint32_t)UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS) { + val ^= (uint32_t)UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_DEVICE_COMMAND_BUFFER_UPDATE_CAPABILITY_FLAG_EVENTS; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_command_buffer_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_command_buffer_info_t value) { + switch (value) { + case UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT: + os << "UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT"; + break; + case UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR: + os << "UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_exp_command_buffer_info_t value, + size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_EXP_COMMAND_BUFFER_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_EXP_COMMAND_BUFFER_INFO_DESCRIPTOR: { + const ur_exp_command_buffer_desc_t *tptr = + (const ur_exp_command_buffer_desc_t *)ptr; + if (sizeof(ur_exp_command_buffer_desc_t) > size) { + os << "invalid size (is: " << size + << ", expected: >=" << sizeof(ur_exp_command_buffer_desc_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_command_buffer_command_info_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, enum ur_exp_command_buffer_command_info_t value) { + switch (value) { + case UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT: + os << "UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_command_buffer_command_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_exp_command_buffer_command_info_t value, + size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_EXP_COMMAND_BUFFER_COMMAND_INFO_REFERENCE_COUNT: { + const uint32_t *tptr = (const uint32_t *)ptr; + if (sizeof(uint32_t) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_command_buffer_desc_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { + os << "(struct ur_exp_command_buffer_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".isUpdatable = "; + + os << (params.isUpdatable); + + os << ", "; + os << ".isInOrder = "; + + os << (params.isInOrder); + + os << ", "; + os << ".enableProfiling = "; + + os << (params.enableProfiling); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_command_buffer_update_memobj_arg_desc_t +/// type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_command_buffer_update_memobj_arg_desc_t params) { + os << "(struct ur_exp_command_buffer_update_memobj_arg_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".argIndex = "; + + os << (params.argIndex); + + os << ", "; + os << ".pProperties = "; + + os << (params.pProperties); + + os << ", "; + os << ".hNewMemObjArg = "; + + ur::details::printPtr(os, (params.hNewMemObjArg)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_exp_command_buffer_update_pointer_arg_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + const struct ur_exp_command_buffer_update_pointer_arg_desc_t params) { + os << "(struct ur_exp_command_buffer_update_pointer_arg_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".argIndex = "; + + os << (params.argIndex); + + os << ", "; + os << ".pProperties = "; + + os << (params.pProperties); + + os << ", "; + os << ".pNewPointerArg = "; + + os << (params.pNewPointerArg); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_command_buffer_update_value_arg_desc_t +/// type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_command_buffer_update_value_arg_desc_t params) { + os << "(struct ur_exp_command_buffer_update_value_arg_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".argIndex = "; + + os << (params.argIndex); + + os << ", "; + os << ".argSize = "; + + os << (params.argSize); + + os << ", "; + os << ".pProperties = "; + + os << (params.pProperties); + + os << ", "; + os << ".pNewValueArg = "; + + os << (params.pNewValueArg); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_exp_command_buffer_update_kernel_launch_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + const struct ur_exp_command_buffer_update_kernel_launch_desc_t params) { + os << "(struct ur_exp_command_buffer_update_kernel_launch_desc_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".hNewKernel = "; + + ur::details::printPtr(os, (params.hNewKernel)); + + os << ", "; + os << ".numNewMemObjArgs = "; + + os << (params.numNewMemObjArgs); + + os << ", "; + os << ".numNewPointerArgs = "; + + os << (params.numNewPointerArgs); + + os << ", "; + os << ".numNewValueArgs = "; + + os << (params.numNewValueArgs); + + os << ", "; + os << ".newWorkDim = "; + + os << (params.newWorkDim); + + os << ", "; + os << ".pNewMemObjArgList = "; + ur::details::printPtr( + os, reinterpret_cast((params.pNewMemObjArgList))); + if ((params.pNewMemObjArgList) != NULL) { + os << " {"; + for (size_t i = 0; i < params.numNewMemObjArgs; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pNewMemObjArgList))[i]; + } + os << "}"; + } + + os << ", "; + os << ".pNewPointerArgList = "; + ur::details::printPtr( + os, reinterpret_cast((params.pNewPointerArgList))); + if ((params.pNewPointerArgList) != NULL) { + os << " {"; + for (size_t i = 0; i < params.numNewPointerArgs; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pNewPointerArgList))[i]; + } + os << "}"; + } + + os << ", "; + os << ".pNewValueArgList = "; + ur::details::printPtr( + os, reinterpret_cast((params.pNewValueArgList))); + if ((params.pNewValueArgList) != NULL) { + os << " {"; + for (size_t i = 0; i < params.numNewValueArgs; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pNewValueArgList))[i]; + } + os << "}"; + } + + os << ", "; + os << ".pNewGlobalWorkOffset = "; + ur::details::printPtr( + os, reinterpret_cast((params.pNewGlobalWorkOffset))); + if ((params.pNewGlobalWorkOffset) != NULL) { + os << " {"; + for (size_t i = 0; i < params.newWorkDim; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pNewGlobalWorkOffset))[i]; + } + os << "}"; + } + + os << ", "; + os << ".pNewGlobalWorkSize = "; + ur::details::printPtr( + os, reinterpret_cast((params.pNewGlobalWorkSize))); + if ((params.pNewGlobalWorkSize) != NULL) { + os << " {"; + for (size_t i = 0; i < params.newWorkDim; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pNewGlobalWorkSize))[i]; + } + os << "}"; + } + + os << ", "; + os << ".pNewLocalWorkSize = "; + ur::details::printPtr( + os, reinterpret_cast((params.pNewLocalWorkSize))); + if ((params.pNewLocalWorkSize) != NULL) { + os << " {"; + for (size_t i = 0; i < params.newWorkDim; ++i) { + if (i != 0) { + os << ", "; + } + + os << ((params.pNewLocalWorkSize))[i]; + } + os << "}"; + } + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_launch_property_id_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_launch_property_id_t value) { + switch (value) { + case UR_EXP_LAUNCH_PROPERTY_ID_IGNORE: + os << "UR_EXP_LAUNCH_PROPERTY_ID_IGNORE"; + break; + case UR_EXP_LAUNCH_PROPERTY_ID_COOPERATIVE: + os << "UR_EXP_LAUNCH_PROPERTY_ID_COOPERATIVE"; + break; + case UR_EXP_LAUNCH_PROPERTY_ID_CLUSTER_DIMENSION: + os << "UR_EXP_LAUNCH_PROPERTY_ID_CLUSTER_DIMENSION"; + break; + case UR_EXP_LAUNCH_PROPERTY_ID_WORK_GROUP_MEMORY: + os << "UR_EXP_LAUNCH_PROPERTY_ID_WORK_GROUP_MEMORY"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { + +/////////////////////////////////////////////////////////////////////////////// +// @brief Print ur_exp_launch_property_value_t union +inline ur_result_t printUnion(std::ostream &os, + const union ur_exp_launch_property_value_t params, + const enum ur_exp_launch_property_id_t tag) { + os << "(union ur_exp_launch_property_value_t){"; + + switch (tag) { + case UR_EXP_LAUNCH_PROPERTY_ID_CLUSTER_DIMENSION: + + os << ".clusterDim = {"; + for (auto i = 0; i < 3; i++) { + if (i != 0) { + os << ", "; + } + + os << (params.clusterDim[i]); + } + os << "}"; + + break; + case UR_EXP_LAUNCH_PROPERTY_ID_COOPERATIVE: + + os << ".cooperative = "; + + os << (params.cooperative); + + break; + case UR_EXP_LAUNCH_PROPERTY_ID_WORK_GROUP_MEMORY: + + os << ".workgroup_mem_size = "; + + os << (params.workgroup_mem_size); + + break; + default: + os << ""; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + os << "}"; + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_launch_property_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + const struct ur_exp_launch_property_t params) { + os << "(struct ur_exp_launch_property_t){"; + + os << ".id = "; + + os << (params.id); + + os << ", "; + os << ".value = "; + ur::details::printUnion(os, (params.value), params.id); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_peer_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_peer_info_t value) { + switch (value) { + case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: + os << "UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED"; + break; + case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: + os << "UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_peer_info_t enum value +template <> +inline ur_result_t printTagged(std::ostream &os, const void *ptr, + ur_exp_peer_info_t value, size_t size) { + if (ptr == NULL) { + return printPtr(os, ptr); + } + + switch (value) { + case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: { + const int *tptr = (const int *)ptr; + if (sizeof(int) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(int) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: { + const int *tptr = (const int *)ptr; + if (sizeof(int) > size) { + os << "invalid size (is: " << size << ", expected: >=" << sizeof(int) + << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; + } + os << (const void *)(tptr) << " ("; + + os << *tptr; + + os << ")"; + } break; + default: + os << "unknown enumerator"; + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_enqueue_ext_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, + enum ur_exp_enqueue_ext_flag_t value) { + switch (value) { + case UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS: + os << "UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_enqueue_ext_flag_t flag +template <> +inline ur_result_t printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS) == + (uint32_t)UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS) { + val ^= (uint32_t)UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_enqueue_ext_properties_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_enqueue_ext_properties_t params) { + os << "(struct ur_exp_enqueue_ext_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, (params.flags)); + + os << "}"; + return os; +} +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_enqueue_native_command_flag_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, enum ur_exp_enqueue_native_command_flag_t value) { + switch (value) { + case UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD: + os << "UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD"; + break; + default: + os << "unknown enumerator"; + break; + } + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_enqueue_native_command_flag_t flag +template <> +inline ur_result_t +printFlag(std::ostream &os, + uint32_t flag) { + uint32_t val = flag; + bool first = true; + + if ((val & UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD) == + (uint32_t)UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD) { + val ^= (uint32_t)UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_EXP_ENQUEUE_NATIVE_COMMAND_FLAG_TBD; + } + if (val != 0) { + std::bitset<32> bits(val); + if (!first) { + os << " | "; + } + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_enqueue_native_command_properties_t +/// type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_enqueue_native_command_properties_t params) { + os << "(struct ur_exp_enqueue_native_command_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur::details::printStruct(os, (params.pNext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, + (params.flags)); + + os << "}"; + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_create_params_t *params) { + + os << ".phLoaderConfig = "; + + ur::details::printPtr(os, *(params->pphLoaderConfig)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_retain_params_t *params) { + + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_release_params_t *params) { + + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_get_info_params_t *params) { + + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_enable_layer_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_enable_layer_params_t + *params) { + + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + os << ", "; + os << ".pLayerName = "; + + ur::details::printPtr(os, *(params->ppLayerName)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_loader_config_set_code_location_callback_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_loader_config_set_code_location_callback_params_t *params) { + + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + os << ", "; + os << ".pfnCodeloc = "; + + os << reinterpret_cast(*(params->ppfnCodeloc)); + + os << ", "; + os << ".pUserData = "; + + ur::details::printPtr(os, *(params->ppUserData)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_set_mocking_enabled_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_set_mocking_enabled_params_t + *params) { + + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + os << ", "; + os << ".enable = "; + + os << *(params->penable); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_params_t *params) { + + os << ".phAdapters = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphAdapters))); + if (*(params->pphAdapters) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pNumAdapters; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphAdapters))[i]); + } + os << "}"; + } + + os << ", "; + os << ".NumAdapters = "; + + os << *(params->pNumAdapters); + + os << ", "; + os << ".NumEntries = "; + + os << *(params->pNumEntries); + + os << ", "; + os << ".phPlatforms = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphPlatforms))); + if (*(params->pphPlatforms) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pNumEntries; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphPlatforms))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pNumPlatforms = "; + + ur::details::printPtr(os, *(params->ppNumPlatforms)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_info_params_t *params) { + + os << ".hPlatform = "; + + ur::details::printPtr(os, *(params->phPlatform)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_native_handle_params_t + *params) { + + os << ".hPlatform = "; + + ur::details::printPtr(os, *(params->phPlatform)); + + os << ", "; + os << ".phNativePlatform = "; + + ur::details::printPtr(os, *(params->pphNativePlatform)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_platform_create_with_native_handle_params_t + *params) { + + os << ".hNativePlatform = "; + + ur::details::printPtr(os, + reinterpret_cast(*(params->phNativePlatform))); + + os << ", "; + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phPlatform = "; + + ur::details::printPtr(os, *(params->pphPlatform)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_api_version_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_api_version_params_t + *params) { + + os << ".hPlatform = "; + + ur::details::printPtr(os, *(params->phPlatform)); + + os << ", "; + os << ".pVersion = "; + + ur::details::printPtr(os, *(params->ppVersion)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_backend_option_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_backend_option_params_t + *params) { + + os << ".hPlatform = "; + + ur::details::printPtr(os, *(params->phPlatform)); + + os << ", "; + os << ".pFrontendOption = "; + + ur::details::printPtr(os, *(params->ppFrontendOption)); + + os << ", "; + os << ".ppPlatformOption = "; + + ur::details::printPtr(os, *(params->pppPlatformOption)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_create_params_t *params) { + + os << ".DeviceCount = "; + + os << *(params->pDeviceCount); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pDeviceCount; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phContext = "; + + ur::details::printPtr(os, *(params->pphContext)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_retain_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_release_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_get_info_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_get_native_handle_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".phNativeContext = "; + + ur::details::printPtr(os, *(params->pphNativeContext)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_context_create_with_native_handle_params_t + *params) { + + os << ".hNativeContext = "; + + ur::details::printPtr(os, + reinterpret_cast(*(params->phNativeContext))); + + os << ", "; + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phContext = "; + + ur::details::printPtr(os, *(params->pphContext)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_set_extended_deleter_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_context_set_extended_deleter_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pfnDeleter = "; + + os << reinterpret_cast(*(params->ppfnDeleter)); + + os << ", "; + os << ".pUserData = "; + + ur::details::printPtr(os, *(params->ppUserData)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_get_info_params_t *params) { + + os << ".hEvent = "; + + ur::details::printPtr(os, *(params->phEvent)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_get_profiling_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_get_profiling_info_params_t + *params) { + + os << ".hEvent = "; + + ur::details::printPtr(os, *(params->phEvent)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_wait_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_wait_params_t *params) { + + os << ".numEvents = "; + + os << *(params->pnumEvents); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEvents; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_retain_params_t *params) { + + os << ".hEvent = "; + + ur::details::printPtr(os, *(params->phEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_release_params_t *params) { + + os << ".hEvent = "; + + ur::details::printPtr(os, *(params->phEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_event_get_native_handle_params_t *params) { + + os << ".hEvent = "; + + ur::details::printPtr(os, *(params->phEvent)); + + os << ", "; + os << ".phNativeEvent = "; + + ur::details::printPtr(os, *(params->pphNativeEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_event_create_with_native_handle_params_t + *params) { + + os << ".hNativeEvent = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phNativeEvent))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_set_callback_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_event_set_callback_params_t *params) { + + os << ".hEvent = "; + + ur::details::printPtr(os, *(params->phEvent)); + + os << ", "; + os << ".execStatus = "; + + os << *(params->pexecStatus); + + os << ", "; + os << ".pfnNotify = "; + + os << reinterpret_cast(*(params->ppfnNotify)); + + os << ", "; + os << ".pUserData = "; + + ur::details::printPtr(os, *(params->ppUserData)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_create_with_il_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_create_with_il_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pIL = "; + + ur::details::printPtr(os, *(params->ppIL)); + + os << ", "; + os << ".length = "; + + os << *(params->plength); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phProgram = "; + + ur::details::printPtr(os, *(params->pphProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_create_with_binary_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_create_with_binary_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pLengths = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->ppLengths))); + if (*(params->ppLengths) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + os << (*(params->ppLengths))[i]; + } + os << "}"; + } + + os << ", "; + os << ".ppBinaries = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pppBinaries))); + if (*(params->pppBinaries) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pppBinaries))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phProgram = "; + + ur::details::printPtr(os, *(params->pphProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_build_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pOptions = "; + + ur::details::printPtr(os, *(params->ppOptions)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_build_exp_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pOptions = "; + + ur::details::printPtr(os, *(params->ppOptions)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_compile_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_compile_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pOptions = "; + + ur::details::printPtr(os, *(params->ppOptions)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_compile_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_compile_exp_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pOptions = "; + + ur::details::printPtr(os, *(params->ppOptions)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_link_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_link_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".phPrograms = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphPrograms))); + if (*(params->pphPrograms) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pcount; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphPrograms))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pOptions = "; + + ur::details::printPtr(os, *(params->ppOptions)); + + os << ", "; + os << ".phProgram = "; + + ur::details::printPtr(os, *(params->pphProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_link_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_link_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".phPrograms = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphPrograms))); + if (*(params->pphPrograms) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pcount; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphPrograms))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pOptions = "; + + ur::details::printPtr(os, *(params->ppOptions)); + + os << ", "; + os << ".phProgram = "; + + ur::details::printPtr(os, *(params->pphProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_retain_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_release_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_function_pointer_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_get_function_pointer_params_t + *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pFunctionName = "; + + ur::details::printPtr(os, *(params->ppFunctionName)); + + os << ", "; + os << ".ppFunctionPointer = "; + + ur::details::printPtr(os, *(params->pppFunctionPointer)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_program_get_global_variable_pointer_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_program_get_global_variable_pointer_params_t *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pGlobalVariableName = "; + + ur::details::printPtr(os, *(params->ppGlobalVariableName)); + + os << ", "; + os << ".pGlobalVariableSizeRet = "; + + ur::details::printPtr(os, *(params->ppGlobalVariableSizeRet)); + + os << ", "; + os << ".ppGlobalVariablePointerRet = "; + + ur::details::printPtr(os, *(params->pppGlobalVariablePointerRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_get_info_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_build_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_get_build_info_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_program_set_specialization_constants_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_program_set_specialization_constants_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".pSpecConstants = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->ppSpecConstants))); + if (*(params->ppSpecConstants) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pcount; ++i) { + if (i != 0) { + os << ", "; + } + + os << (*(params->ppSpecConstants))[i]; + } + os << "}"; + } + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_get_native_handle_params_t + *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".phNativeProgram = "; + + ur::details::printPtr(os, *(params->pphNativeProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_create_with_native_handle_params_t + *params) { + + os << ".hNativeProgram = "; + + ur::details::printPtr(os, + reinterpret_cast(*(params->phNativeProgram))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phProgram = "; + + ur::details::printPtr(os, *(params->pphProgram)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_create_params_t *params) { + + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pKernelName = "; + + ur::details::printPtr(os, *(params->ppKernelName)); + + os << ", "; + os << ".phKernel = "; + + ur::details::printPtr(os, *(params->pphKernel)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_get_info_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_group_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_get_group_info_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_sub_group_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_get_sub_group_info_params_t + *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_retain_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_release_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_get_native_handle_params_t + *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".phNativeKernel = "; + + ur::details::printPtr(os, *(params->pphNativeKernel)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_create_with_native_handle_params_t + *params) { + + os << ".hNativeKernel = "; + + ur::details::printPtr(os, + reinterpret_cast(*(params->phNativeKernel))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phKernel = "; + + ur::details::printPtr(os, *(params->pphKernel)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_kernel_get_suggested_local_work_size_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_kernel_get_suggested_local_work_size_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".numWorkDim = "; + + os << *(params->pnumWorkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pSuggestedLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppSuggestedLocalWorkSize)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_value_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_value_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".argIndex = "; + + os << *(params->pargIndex); + + os << ", "; + os << ".argSize = "; + + os << *(params->pargSize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".pArgValue = "; + + ur::details::printPtr(os, *(params->ppArgValue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_local_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_local_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".argIndex = "; + + os << *(params->pargIndex); + + os << ", "; + os << ".argSize = "; + + os << *(params->pargSize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_pointer_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_pointer_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".argIndex = "; + + os << *(params->pargIndex); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".pArgValue = "; + + ur::details::printPtr(os, *(params->ppArgValue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_exec_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_exec_info_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_sampler_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_sampler_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".argIndex = "; + + os << *(params->pargIndex); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".hArgValue = "; + + ur::details::printPtr(os, *(params->phArgValue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_mem_obj_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_mem_obj_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".argIndex = "; + + os << *(params->pargIndex); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".hArgValue = "; + + ur::details::printPtr(os, *(params->phArgValue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_kernel_set_specialization_constants_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_kernel_set_specialization_constants_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".pSpecConstants = "; + + ur::details::printPtr(os, *(params->ppSpecConstants)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_kernel_suggest_max_cooperative_group_count_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_kernel_suggest_max_cooperative_group_count_exp_params_t *params) { + + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".dynamicSharedMemorySize = "; + + os << *(params->pdynamicSharedMemorySize); + + os << ", "; + os << ".pGroupCountRet = "; + + ur::details::printPtr(os, *(params->ppGroupCountRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_get_info_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_create_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phQueue = "; + + ur::details::printPtr(os, *(params->pphQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_retain_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_release_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_queue_get_native_handle_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pDesc = "; + + ur::details::printPtr(os, *(params->ppDesc)); + + os << ", "; + os << ".phNativeQueue = "; + + ur::details::printPtr(os, *(params->pphNativeQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_queue_create_with_native_handle_params_t + *params) { + + os << ".hNativeQueue = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phNativeQueue))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phQueue = "; + + ur::details::printPtr(os, *(params->pphQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_finish_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_finish_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_flush_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_flush_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_create_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pDesc = "; + + ur::details::printPtr(os, *(params->ppDesc)); + + os << ", "; + os << ".phSampler = "; + + ur::details::printPtr(os, *(params->pphSampler)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_retain_params_t *params) { + + os << ".hSampler = "; + + ur::details::printPtr(os, *(params->phSampler)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_release_params_t *params) { + + os << ".hSampler = "; + + ur::details::printPtr(os, *(params->phSampler)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_get_info_params_t *params) { + + os << ".hSampler = "; + + ur::details::printPtr(os, *(params->phSampler)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_get_native_handle_params_t + *params) { + + os << ".hSampler = "; + + ur::details::printPtr(os, *(params->phSampler)); + + os << ", "; + os << ".phNativeSampler = "; + + ur::details::printPtr(os, *(params->pphNativeSampler)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_sampler_create_with_native_handle_params_t + *params) { + + os << ".hNativeSampler = "; + + ur::details::printPtr(os, + reinterpret_cast(*(params->phNativeSampler))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phSampler = "; + + ur::details::printPtr(os, *(params->pphSampler)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_image_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_image_create_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".pHost = "; + + ur::details::printPtr(os, *(params->ppHost)); + + os << ", "; + os << ".phMem = "; + + ur::details::printPtr(os, *(params->pphMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_buffer_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_buffer_create_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phBuffer = "; + + ur::details::printPtr(os, *(params->pphBuffer)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_retain_params_t *params) { + + os << ".hMem = "; + + ur::details::printPtr(os, *(params->phMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_release_params_t *params) { + + os << ".hMem = "; + + ur::details::printPtr(os, *(params->phMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_buffer_partition_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_buffer_partition_params_t *params) { + + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + os << ", "; + os << ".bufferCreateType = "; + + os << *(params->pbufferCreateType); + + os << ", "; + os << ".pRegion = "; + + ur::details::printPtr(os, *(params->ppRegion)); + + os << ", "; + os << ".phMem = "; + + ur::details::printPtr(os, *(params->pphMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_get_native_handle_params_t *params) { + + os << ".hMem = "; + + ur::details::printPtr(os, *(params->phMem)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".phNativeMem = "; + + ur::details::printPtr(os, *(params->pphNativeMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_mem_buffer_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_mem_buffer_create_with_native_handle_params_t *params) { + + os << ".hNativeMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phNativeMem))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phMem = "; + + ur::details::printPtr(os, *(params->pphMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_mem_image_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_mem_image_create_with_native_handle_params_t *params) { + + os << ".hNativeMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phNativeMem))); + + os << ", "; + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phMem = "; + + ur::details::printPtr(os, *(params->pphMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_get_info_params_t *params) { + + os << ".hMemory = "; + + ur::details::printPtr(os, *(params->phMemory)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_image_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_image_get_info_params_t *params) { + + os << ".hMemory = "; + + ur::details::printPtr(os, *(params->phMemory)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_create_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phPhysicalMem = "; + + ur::details::printPtr(os, *(params->pphPhysicalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_retain_params_t *params) { + + os << ".hPhysicalMem = "; + + ur::details::printPtr(os, *(params->phPhysicalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_release_params_t *params) { + + os << ".hPhysicalMem = "; + + ur::details::printPtr(os, *(params->phPhysicalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_get_info_params_t *params) { + + os << ".hPhysicalMem = "; + + ur::details::printPtr(os, *(params->phPhysicalMem)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_get_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_get_params_t *params) { + + os << ".NumEntries = "; + + os << *(params->pNumEntries); + + os << ", "; + os << ".phAdapters = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphAdapters))); + if (*(params->pphAdapters) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pNumEntries; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphAdapters))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pNumAdapters = "; + + ur::details::printPtr(os, *(params->ppNumAdapters)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_release_params_t *params) { + + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_retain_params_t *params) { + + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_get_last_error_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_adapter_get_last_error_params_t *params) { + + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + os << ", "; + os << ".ppMessage = "; + + ur::details::printPtr(os, *(params->pppMessage)); + + os << ", "; + os << ".pError = "; + + ur::details::printPtr(os, *(params->ppError)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_get_info_params_t *params) { + + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_kernel_launch_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_kernel_launch_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_events_wait_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_events_wait_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_events_wait_with_barrier_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_events_wait_with_barrier_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_read_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".blockingRead = "; + + os << *(params->pblockingRead); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_write_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".blockingWrite = "; + + os << *(params->pblockingWrite); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_read_rect_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_rect_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".blockingRead = "; + + os << *(params->pblockingRead); + + os << ", "; + os << ".bufferOrigin = "; + + os << *(params->pbufferOrigin); + + os << ", "; + os << ".hostOrigin = "; + + os << *(params->phostOrigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".bufferRowPitch = "; + + os << *(params->pbufferRowPitch); + + os << ", "; + os << ".bufferSlicePitch = "; + + os << *(params->pbufferSlicePitch); + + os << ", "; + os << ".hostRowPitch = "; + + os << *(params->phostRowPitch); + + os << ", "; + os << ".hostSlicePitch = "; + + os << *(params->phostSlicePitch); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_write_rect_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_rect_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".blockingWrite = "; + + os << *(params->pblockingWrite); + + os << ", "; + os << ".bufferOrigin = "; + + os << *(params->pbufferOrigin); + + os << ", "; + os << ".hostOrigin = "; + + os << *(params->phostOrigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".bufferRowPitch = "; + + os << *(params->pbufferRowPitch); + + os << ", "; + os << ".bufferSlicePitch = "; + + os << *(params->pbufferSlicePitch); + + os << ", "; + os << ".hostRowPitch = "; + + os << *(params->phostRowPitch); + + os << ", "; + os << ".hostSlicePitch = "; + + os << *(params->phostSlicePitch); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_copy_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBufferSrc = "; + + ur::details::printPtr(os, *(params->phBufferSrc)); + + os << ", "; + os << ".hBufferDst = "; + + ur::details::printPtr(os, *(params->phBufferDst)); + + os << ", "; + os << ".srcOffset = "; + + os << *(params->psrcOffset); + + os << ", "; + os << ".dstOffset = "; + + os << *(params->pdstOffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_copy_rect_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_rect_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBufferSrc = "; + + ur::details::printPtr(os, *(params->phBufferSrc)); + + os << ", "; + os << ".hBufferDst = "; + + ur::details::printPtr(os, *(params->phBufferDst)); + + os << ", "; + os << ".srcOrigin = "; + + os << *(params->psrcOrigin); + + os << ", "; + os << ".dstOrigin = "; + + os << *(params->pdstOrigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".srcRowPitch = "; + + os << *(params->psrcRowPitch); + + os << ", "; + os << ".srcSlicePitch = "; + + os << *(params->psrcSlicePitch); + + os << ", "; + os << ".dstRowPitch = "; + + os << *(params->pdstRowPitch); + + os << ", "; + os << ".dstSlicePitch = "; + + os << *(params->pdstSlicePitch); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_fill_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_fill_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".pPattern = "; + + ur::details::printPtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_image_read_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_image_read_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hImage = "; + + ur::details::printPtr(os, *(params->phImage)); + + os << ", "; + os << ".blockingRead = "; + + os << *(params->pblockingRead); + + os << ", "; + os << ".origin = "; + + os << *(params->porigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".rowPitch = "; + + os << *(params->prowPitch); + + os << ", "; + os << ".slicePitch = "; + + os << *(params->pslicePitch); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_image_write_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_image_write_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hImage = "; + + ur::details::printPtr(os, *(params->phImage)); + + os << ", "; + os << ".blockingWrite = "; + + os << *(params->pblockingWrite); + + os << ", "; + os << ".origin = "; + + os << *(params->porigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".rowPitch = "; + + os << *(params->prowPitch); + + os << ", "; + os << ".slicePitch = "; + + os << *(params->pslicePitch); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_image_copy_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_image_copy_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hImageSrc = "; + + ur::details::printPtr(os, *(params->phImageSrc)); + + os << ", "; + os << ".hImageDst = "; + + ur::details::printPtr(os, *(params->phImageDst)); + + os << ", "; + os << ".srcOrigin = "; + + os << *(params->psrcOrigin); + + os << ", "; + os << ".dstOrigin = "; + + os << *(params->pdstOrigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_map_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_map_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".blockingMap = "; + + os << *(params->pblockingMap); + + os << ", "; + os << ".mapFlags = "; + + ur::details::printFlag(os, *(params->pmapFlags)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".ppRetMap = "; + + ur::details::printPtr(os, *(params->pppRetMap)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_unmap_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_unmap_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hMem = "; + + ur::details::printPtr(os, *(params->phMem)); + + os << ", "; + os << ".pMappedPtr = "; + + ur::details::printPtr(os, *(params->ppMappedPtr)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_fill_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_fill_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".pPattern = "; + + ur::details::printPtr(os, *(params->ppPattern)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_memcpy_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_memcpy_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".blocking = "; + + os << *(params->pblocking); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_prefetch_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_prefetch_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_advise_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_advise_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".advice = "; + + ur::details::printFlag(os, *(params->padvice)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_fill_2d_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_fill_2d_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".pitch = "; + + os << *(params->ppitch); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".pPattern = "; + + ur::details::printPtr(os, *(params->ppPattern)); + + os << ", "; + os << ".width = "; + + os << *(params->pwidth); + + os << ", "; + os << ".height = "; + + os << *(params->pheight); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_memcpy_2d_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_memcpy_2d_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".blocking = "; + + os << *(params->pblocking); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".dstPitch = "; + + os << *(params->pdstPitch); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".srcPitch = "; + + os << *(params->psrcPitch); + + os << ", "; + os << ".width = "; + + os << *(params->pwidth); + + os << ", "; + os << ".height = "; + + os << *(params->pheight); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_enqueue_device_global_variable_write_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_device_global_variable_write_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".name = "; + + ur::details::printPtr(os, *(params->pname)); + + os << ", "; + os << ".blockingWrite = "; + + os << *(params->pblockingWrite); + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_enqueue_device_global_variable_read_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_device_global_variable_read_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".name = "; + + ur::details::printPtr(os, *(params->pname)); + + os << ", "; + os << ".blockingRead = "; + + os << *(params->pblockingRead); + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_read_host_pipe_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_read_host_pipe_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pipe_symbol = "; + + ur::details::printPtr(os, *(params->ppipe_symbol)); + + os << ", "; + os << ".blocking = "; + + os << *(params->pblocking); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_write_host_pipe_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_write_host_pipe_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hProgram = "; + + ur::details::printPtr(os, *(params->phProgram)); + + os << ", "; + os << ".pipe_symbol = "; + + ur::details::printPtr(os, *(params->ppipe_symbol)); + + os << ", "; + os << ".blocking = "; + + os << *(params->pblocking); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_kernel_launch_custom_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_kernel_launch_custom_exp_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numPropsInLaunchPropList = "; + + os << *(params->pnumPropsInLaunchPropList); + + os << ", "; + os << ".launchPropList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->plaunchPropList))); + if (*(params->plaunchPropList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumPropsInLaunchPropList; ++i) { + if (i != 0) { + os << ", "; + } + + os << (*(params->plaunchPropList))[i]; + } + os << "}"; + } + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_enqueue_events_wait_with_barrier_ext_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_events_wait_with_barrier_ext_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_enqueue_cooperative_kernel_launch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_timestamp_recording_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_timestamp_recording_exp_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".blocking = "; + + os << *(params->pblocking); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_native_command_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_native_command_exp_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pfnNativeEnqueue = "; + + os << reinterpret_cast(*(params->ppfnNativeEnqueue)); + + os << ", "; + os << ".data = "; + + ur::details::printPtr(os, *(params->pdata)); + + os << ", "; + os << ".numMemsInMemList = "; + + os << *(params->pnumMemsInMemList); + + os << ", "; + os << ".phMemList = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphMemList))); + if (*(params->pphMemList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumMemsInMemList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphMemList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_unsampled_image_handle_destroy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hImage = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImage))); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_sampled_image_handle_destroy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_sampled_image_handle_destroy_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hImage = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImage))); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_allocate_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_allocate_exp_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".phImageMem = "; + + ur::details::printPtr(os, *(params->pphImageMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_free_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_free_exp_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hImageMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_unsampled_image_create_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_unsampled_image_create_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hImageMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".phImage = "; + + ur::details::printPtr(os, *(params->pphImage)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_sampled_image_create_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_sampled_image_create_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hImageMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".hSampler = "; + + ur::details::printPtr(os, *(params->phSampler)); + + os << ", "; + os << ".phImage = "; + + ur::details::printPtr(os, *(params->pphImage)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_copy_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_copy_exp_params_t + *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".pSrcImageDesc = "; + + ur::details::printPtr(os, *(params->ppSrcImageDesc)); + + os << ", "; + os << ".pDstImageDesc = "; + + ur::details::printPtr(os, *(params->ppDstImageDesc)); + + os << ", "; + os << ".pSrcImageFormat = "; + + ur::details::printPtr(os, *(params->ppSrcImageFormat)); + + os << ", "; + os << ".pDstImageFormat = "; + + ur::details::printPtr(os, *(params->ppDstImageFormat)); + + os << ", "; + os << ".pCopyRegion = "; + + ur::details::printPtr(os, *(params->ppCopyRegion)); + + os << ", "; + os << ".imageCopyFlags = "; + + ur::details::printFlag(os, + *(params->pimageCopyFlags)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_get_info_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hImageMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".pPropValue = "; + + ur::details::printPtr(os, *(params->ppPropValue)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_mipmap_get_level_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_mipmap_get_level_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hImageMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phImageMem))); + + os << ", "; + os << ".mipmapLevel = "; + + os << *(params->pmipmapLevel); + + os << ", "; + os << ".phImageMem = "; + + ur::details::printPtr(os, *(params->pphImageMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_mipmap_free_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_mipmap_free_exp_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hMem = "; + + ur::details::printPtr(os, reinterpret_cast(*(params->phMem))); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_import_external_memory_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_import_external_memory_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".memHandleType = "; + + os << *(params->pmemHandleType); + + os << ", "; + os << ".pExternalMemDesc = "; + + ur::details::printPtr(os, *(params->ppExternalMemDesc)); + + os << ", "; + os << ".phExternalMem = "; + + ur::details::printPtr(os, *(params->pphExternalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_map_external_array_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_map_external_array_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pImageFormat = "; + + ur::details::printPtr(os, *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + ur::details::printPtr(os, *(params->ppImageDesc)); + + os << ", "; + os << ".hExternalMem = "; + + ur::details::printPtr(os, *(params->phExternalMem)); + + os << ", "; + os << ".phImageMem = "; + + ur::details::printPtr(os, *(params->pphImageMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_map_external_linear_memory_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_map_external_linear_memory_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".hExternalMem = "; + + ur::details::printPtr(os, *(params->phExternalMem)); + + os << ", "; + os << ".ppRetMem = "; + + ur::details::printPtr(os, *(params->pppRetMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_release_external_memory_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_release_external_memory_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hExternalMem = "; + + ur::details::printPtr(os, *(params->phExternalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_import_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_import_external_semaphore_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".semHandleType = "; + + os << *(params->psemHandleType); + + os << ", "; + os << ".pExternalSemaphoreDesc = "; + + ur::details::printPtr(os, *(params->ppExternalSemaphoreDesc)); + + os << ", "; + os << ".phExternalSemaphore = "; + + ur::details::printPtr(os, *(params->pphExternalSemaphore)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_release_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_release_external_semaphore_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".hExternalSemaphore = "; + + ur::details::printPtr(os, *(params->phExternalSemaphore)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_wait_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_wait_external_semaphore_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hSemaphore = "; + + ur::details::printPtr(os, *(params->phSemaphore)); + + os << ", "; + os << ".hasWaitValue = "; + + os << *(params->phasWaitValue); + + os << ", "; + os << ".waitValue = "; + + os << *(params->pwaitValue); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_bindless_images_signal_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_signal_external_semaphore_exp_params_t *params) { + + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".hSemaphore = "; + + ur::details::printPtr(os, *(params->phSemaphore)); + + os << ", "; + os << ".hasSignalValue = "; + + os << *(params->phasSignalValue); + + os << ", "; + os << ".signalValue = "; + + os << *(params->psignalValue); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_host_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_host_alloc_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pUSMDesc = "; + + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_device_alloc_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pUSMDesc = "; + + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_shared_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_shared_alloc_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pUSMDesc = "; + + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_free_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_free_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_get_mem_alloc_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_get_mem_alloc_info_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_create_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pPoolDesc = "; + + ur::details::printPtr(os, *(params->ppPoolDesc)); + + os << ", "; + os << ".ppPool = "; + + ur::details::printPtr(os, *(params->pppPool)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_retain_params_t *params) { + + os << ".pPool = "; + + ur::details::printPtr(os, *(params->ppPool)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_release_params_t *params) { + + os << ".pPool = "; + + ur::details::printPtr(os, *(params->ppPool)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_get_info_params_t *params) { + + os << ".hPool = "; + + ur::details::printPtr(os, *(params->phPool)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pitched_alloc_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pitched_alloc_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pUSMDesc = "; + + ur::details::printPtr(os, *(params->ppUSMDesc)); + + os << ", "; + os << ".pool = "; + + ur::details::printPtr(os, *(params->ppool)); + + os << ", "; + os << ".widthInBytes = "; + + os << *(params->pwidthInBytes); + + os << ", "; + os << ".height = "; + + os << *(params->pheight); + + os << ", "; + os << ".elementSizeBytes = "; + + os << *(params->pelementSizeBytes); + + os << ", "; + os << ".ppMem = "; + + ur::details::printPtr(os, *(params->pppMem)); + + os << ", "; + os << ".pResultPitch = "; + + ur::details::printPtr(os, *(params->ppResultPitch)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_import_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_import_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_release_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_release_exp_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pMem = "; + + ur::details::printPtr(os, *(params->ppMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_create_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_create_exp_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pCommandBufferDesc = "; + + ur::details::printPtr(os, *(params->ppCommandBufferDesc)); + + os << ", "; + os << ".phCommandBuffer = "; + + ur::details::printPtr(os, *(params->pphCommandBuffer)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_retain_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_retain_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_release_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_release_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_finalize_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_finalize_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_kernel_launch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_kernel_launch_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hKernel = "; + + ur::details::printPtr(os, *(params->phKernel)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur::details::printPtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur::details::printPtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numKernelAlternatives = "; + + os << *(params->pnumKernelAlternatives); + + os << ", "; + os << ".phKernelAlternatives = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphKernelAlternatives))); + if (*(params->pphKernelAlternatives) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumKernelAlternatives; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphKernelAlternatives))[i]); + } + os << "}"; + } + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_usm_memcpy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_memcpy_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_usm_fill_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_append_usm_fill_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur::details::printPtr(os, *(params->ppMemory)); + + os << ", "; + os << ".pPattern = "; + + ur::details::printPtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_copy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_copy_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hSrcMem = "; + + ur::details::printPtr(os, *(params->phSrcMem)); + + os << ", "; + os << ".hDstMem = "; + + ur::details::printPtr(os, *(params->phDstMem)); + + os << ", "; + os << ".srcOffset = "; + + os << *(params->psrcOffset); + + os << ", "; + os << ".dstOffset = "; + + os << *(params->pdstOffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_write_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_write_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_read_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_read_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hSrcMem = "; + + ur::details::printPtr(os, *(params->phSrcMem)); + + os << ", "; + os << ".hDstMem = "; + + ur::details::printPtr(os, *(params->phDstMem)); + + os << ", "; + os << ".srcOrigin = "; + + os << *(params->psrcOrigin); + + os << ", "; + os << ".dstOrigin = "; + + os << *(params->pdstOrigin); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".srcRowPitch = "; + + os << *(params->psrcRowPitch); + + os << ", "; + os << ".srcSlicePitch = "; + + os << *(params->psrcSlicePitch); + + os << ", "; + os << ".dstRowPitch = "; + + os << *(params->pdstRowPitch); + + os << ", "; + os << ".dstSlicePitch = "; + + os << *(params->pdstSlicePitch); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_write_rect_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".bufferOffset = "; + + os << *(params->pbufferOffset); + + os << ", "; + os << ".hostOffset = "; + + os << *(params->phostOffset); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".bufferRowPitch = "; + + os << *(params->pbufferRowPitch); + + os << ", "; + os << ".bufferSlicePitch = "; + + os << *(params->pbufferSlicePitch); + + os << ", "; + os << ".hostRowPitch = "; + + os << *(params->phostRowPitch); + + os << ", "; + os << ".hostSlicePitch = "; + + os << *(params->phostSlicePitch); + + os << ", "; + os << ".pSrc = "; + + ur::details::printPtr(os, *(params->ppSrc)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_read_rect_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".bufferOffset = "; + + os << *(params->pbufferOffset); + + os << ", "; + os << ".hostOffset = "; + + os << *(params->phostOffset); + + os << ", "; + os << ".region = "; + + os << *(params->pregion); + + os << ", "; + os << ".bufferRowPitch = "; + + os << *(params->pbufferRowPitch); + + os << ", "; + os << ".bufferSlicePitch = "; + + os << *(params->pbufferSlicePitch); + + os << ", "; + os << ".hostRowPitch = "; + + os << *(params->phostRowPitch); + + os << ", "; + os << ".hostSlicePitch = "; + + os << *(params->phostSlicePitch); + + os << ", "; + os << ".pDst = "; + + ur::details::printPtr(os, *(params->ppDst)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_mem_buffer_fill_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_fill_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur::details::printPtr(os, *(params->phBuffer)); + + os << ", "; + os << ".pPattern = "; + + ur::details::printPtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_usm_prefetch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_prefetch_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur::details::printPtr(os, *(params->ppMemory)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_append_usm_advise_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_advise_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur::details::printPtr(os, *(params->ppMemory)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".advice = "; + + ur::details::printFlag(os, *(params->padvice)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur::details::printPtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pSyncPoint = "; + + ur::details::printPtr(os, *(params->ppSyncPoint)); + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + os << ", "; + os << ".phCommand = "; + + ur::details::printPtr(os, *(params->pphCommand)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_enqueue_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hQueue = "; + + ur::details::printPtr(os, *(params->phQueue)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + os << ", "; + os << ".phEvent = "; + + ur::details::printPtr(os, *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_update_kernel_launch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_update_kernel_launch_exp_params_t *params) { + + os << ".hCommand = "; + + ur::details::printPtr(os, *(params->phCommand)); + + os << ", "; + os << ".pUpdateKernelLaunch = "; + + ur::details::printPtr(os, *(params->ppUpdateKernelLaunch)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_update_signal_event_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_update_signal_event_exp_params_t *params) { + + os << ".hCommand = "; + + ur::details::printPtr(os, *(params->phCommand)); + + os << ", "; + os << ".phSignalEvent = "; + + ur::details::printPtr(os, *(params->pphSignalEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the +/// ur_command_buffer_update_wait_events_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_update_wait_events_exp_params_t *params) { + + os << ".hCommand = "; + + ur::details::printPtr(os, *(params->phCommand)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphEventWaitList))); + if (*(params->pphEventWaitList) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + } + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_get_info_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_command_buffer_get_info_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur::details::printPtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_p2p_enable_peer_access_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_p2p_enable_peer_access_exp_params_t + *params) { + + os << ".commandDevice = "; + + ur::details::printPtr(os, *(params->pcommandDevice)); + + os << ", "; + os << ".peerDevice = "; + + ur::details::printPtr(os, *(params->ppeerDevice)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_p2p_disable_peer_access_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_p2p_disable_peer_access_exp_params_t + *params) { + + os << ".commandDevice = "; + + ur::details::printPtr(os, *(params->pcommandDevice)); + + os << ", "; + os << ".peerDevice = "; + + ur::details::printPtr(os, *(params->ppeerDevice)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_p2p_peer_access_get_info_exp_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_p2p_peer_access_get_info_exp_params_t + *params) { + + os << ".commandDevice = "; + + ur::details::printPtr(os, *(params->pcommandDevice)); + + os << ", "; + os << ".peerDevice = "; + + ur::details::printPtr(os, *(params->ppeerDevice)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_init_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_loader_init_params_t *params) { + + os << ".device_flags = "; + + ur::details::printFlag(os, *(params->pdevice_flags)); + + os << ", "; + os << ".hLoaderConfig = "; + + ur::details::printPtr(os, *(params->phLoaderConfig)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_tear_down_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_loader_tear_down_params_t *params) { + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_granularity_get_info_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_granularity_get_info_params_t + *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_reserve_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_reserve_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pStart = "; + + ur::details::printPtr(os, *(params->ppStart)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".ppStart = "; + + ur::details::printPtr(os, *(params->pppStart)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_free_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_free_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pStart = "; + + ur::details::printPtr(os, *(params->ppStart)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_map_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_map_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pStart = "; + + ur::details::printPtr(os, *(params->ppStart)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".hPhysicalMem = "; + + ur::details::printPtr(os, *(params->phPhysicalMem)); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_unmap_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_unmap_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pStart = "; + + ur::details::printPtr(os, *(params->ppStart)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_set_access_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_set_access_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pStart = "; + + ur::details::printPtr(os, *(params->ppStart)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".flags = "; + + ur::details::printFlag(os, *(params->pflags)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_get_info_params_t *params) { + + os << ".hContext = "; + + ur::details::printPtr(os, *(params->phContext)); + + os << ", "; + os << ".pStart = "; + + ur::details::printPtr(os, *(params->ppStart)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_get_params_t *params) { + + os << ".hPlatform = "; + + ur::details::printPtr(os, *(params->phPlatform)); + + os << ", "; + os << ".DeviceType = "; + + os << *(params->pDeviceType); + + os << ", "; + os << ".NumEntries = "; + + os << *(params->pNumEntries); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pNumEntries; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pNumDevices = "; + + ur::details::printPtr(os, *(params->ppNumDevices)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_selected_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_get_selected_params_t *params) { + + os << ".hPlatform = "; + + ur::details::printPtr(os, *(params->phPlatform)); + + os << ", "; + os << ".DeviceType = "; + + os << *(params->pDeviceType); + + os << ", "; + os << ".NumEntries = "; + + os << *(params->pNumEntries); + + os << ", "; + os << ".phDevices = "; + ur::details::printPtr(os, + reinterpret_cast(*(params->pphDevices))); + if (*(params->pphDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pNumEntries; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pNumDevices = "; + + ur::details::printPtr(os, *(params->ppNumDevices)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_get_info_params_t *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".propName = "; + + os << *(params->ppropName); + + os << ", "; + os << ".propSize = "; + + os << *(params->ppropSize); + + os << ", "; + os << ".pPropValue = "; + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; + + ur::details::printPtr(os, *(params->ppPropSizeRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_retain_params_t *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_release_params_t *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_partition_params_t *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".NumDevices = "; + + os << *(params->pNumDevices); + + os << ", "; + os << ".phSubDevices = "; + ur::details::printPtr( + os, reinterpret_cast(*(params->pphSubDevices))); + if (*(params->pphSubDevices) != NULL) { + os << " {"; + for (size_t i = 0; i < *params->pNumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + ur::details::printPtr(os, (*(params->pphSubDevices))[i]); + } + os << "}"; + } + + os << ", "; + os << ".pNumDevicesRet = "; + + ur::details::printPtr(os, *(params->ppNumDevicesRet)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_select_binary_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_select_binary_params_t *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pBinaries = "; + + ur::details::printPtr(os, *(params->ppBinaries)); + + os << ", "; + os << ".NumBinaries = "; + + os << *(params->pNumBinaries); + + os << ", "; + os << ".pSelectedBinary = "; + + ur::details::printPtr(os, *(params->ppSelectedBinary)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_get_native_handle_params_t + *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".phNativeDevice = "; + + ur::details::printPtr(os, *(params->pphNativeDevice)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_create_with_native_handle_params_t +/// type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_create_with_native_handle_params_t + *params) { + + os << ".hNativeDevice = "; + + ur::details::printPtr(os, + reinterpret_cast(*(params->phNativeDevice))); + + os << ", "; + os << ".hAdapter = "; + + ur::details::printPtr(os, *(params->phAdapter)); + + os << ", "; + os << ".pProperties = "; + + ur::details::printPtr(os, *(params->ppProperties)); + + os << ", "; + os << ".phDevice = "; + + ur::details::printPtr(os, *(params->pphDevice)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_global_timestamps_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_get_global_timestamps_params_t + *params) { + + os << ".hDevice = "; + + ur::details::printPtr(os, *(params->phDevice)); + + os << ", "; + os << ".pDeviceTimestamp = "; + + ur::details::printPtr(os, *(params->ppDeviceTimestamp)); + + os << ", "; + os << ".pHostTimestamp = "; + + ur::details::printPtr(os, *(params->ppHostTimestamp)); + + return os; +} + +inline std::ostream &operator<<(std::ostream &os, + [[maybe_unused]] const ur_bool_t value) { + os << (value ? "true" : "false"); + return os; +} + +namespace ur::details { +/////////////////////////////////////////////////////////////////////////////// +// @brief Print pointer value +template +inline ur_result_t printPtr(std::ostream &os, const T *ptr) { + if (ptr == nullptr) { + os << "nullptr"; + } else if constexpr (std::is_pointer_v) { + os << (const void *)(ptr) << " ("; + printPtr(os, *ptr); + os << ")"; + } else if constexpr (std::is_void_v || is_handle_v) { + os << (const void *)ptr; + } else if constexpr (std::is_same_v, char>) { + os << (const void *)(ptr) << " ("; + os << ptr; + os << ")"; + } else { + os << (const void *)(ptr) << " ("; + os << *ptr; + os << ")"; + } + + return UR_RESULT_SUCCESS; +} +} // namespace ur::details + +namespace ur::extras { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print function parameters +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - `NULL == params` +inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, + ur_function_t function, + const void *params) { + if (!params) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + switch (function) { + case UR_FUNCTION_LOADER_CONFIG_CREATE: { + os << (const struct ur_loader_config_create_params_t *)params; + } break; + case UR_FUNCTION_LOADER_CONFIG_RETAIN: { + os << (const struct ur_loader_config_retain_params_t *)params; + } break; + case UR_FUNCTION_LOADER_CONFIG_RELEASE: { + os << (const struct ur_loader_config_release_params_t *)params; + } break; + case UR_FUNCTION_LOADER_CONFIG_GET_INFO: { + os << (const struct ur_loader_config_get_info_params_t *)params; + } break; + case UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER: { + os << (const struct ur_loader_config_enable_layer_params_t *)params; + } break; + case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: { + os << (const struct ur_loader_config_set_code_location_callback_params_t *) + params; + } break; + case UR_FUNCTION_LOADER_CONFIG_SET_MOCKING_ENABLED: { + os << (const struct ur_loader_config_set_mocking_enabled_params_t *)params; + } break; + case UR_FUNCTION_PLATFORM_GET: { + os << (const struct ur_platform_get_params_t *)params; + } break; + case UR_FUNCTION_PLATFORM_GET_INFO: { + os << (const struct ur_platform_get_info_params_t *)params; + } break; + case UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE: { + os << (const struct ur_platform_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_platform_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_PLATFORM_GET_API_VERSION: { + os << (const struct ur_platform_get_api_version_params_t *)params; + } break; + case UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION: { + os << (const struct ur_platform_get_backend_option_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_CREATE: { + os << (const struct ur_context_create_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_RETAIN: { + os << (const struct ur_context_retain_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_RELEASE: { + os << (const struct ur_context_release_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_GET_INFO: { + os << (const struct ur_context_get_info_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE: { + os << (const struct ur_context_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_context_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER: { + os << (const struct ur_context_set_extended_deleter_params_t *)params; + } break; + case UR_FUNCTION_EVENT_GET_INFO: { + os << (const struct ur_event_get_info_params_t *)params; + } break; + case UR_FUNCTION_EVENT_GET_PROFILING_INFO: { + os << (const struct ur_event_get_profiling_info_params_t *)params; + } break; + case UR_FUNCTION_EVENT_WAIT: { + os << (const struct ur_event_wait_params_t *)params; + } break; + case UR_FUNCTION_EVENT_RETAIN: { + os << (const struct ur_event_retain_params_t *)params; + } break; + case UR_FUNCTION_EVENT_RELEASE: { + os << (const struct ur_event_release_params_t *)params; + } break; + case UR_FUNCTION_EVENT_GET_NATIVE_HANDLE: { + os << (const struct ur_event_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_event_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_EVENT_SET_CALLBACK: { + os << (const struct ur_event_set_callback_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_IL: { + os << (const struct ur_program_create_with_il_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY: { + os << (const struct ur_program_create_with_binary_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_BUILD: { + os << (const struct ur_program_build_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_BUILD_EXP: { + os << (const struct ur_program_build_exp_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_COMPILE: { + os << (const struct ur_program_compile_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_COMPILE_EXP: { + os << (const struct ur_program_compile_exp_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_LINK: { + os << (const struct ur_program_link_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_LINK_EXP: { + os << (const struct ur_program_link_exp_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_RETAIN: { + os << (const struct ur_program_retain_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_RELEASE: { + os << (const struct ur_program_release_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER: { + os << (const struct ur_program_get_function_pointer_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_GLOBAL_VARIABLE_POINTER: { + os << (const struct ur_program_get_global_variable_pointer_params_t *) + params; + } break; + case UR_FUNCTION_PROGRAM_GET_INFO: { + os << (const struct ur_program_get_info_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_BUILD_INFO: { + os << (const struct ur_program_get_build_info_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS: { + os << (const struct ur_program_set_specialization_constants_params_t *) + params; + } break; + case UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE: { + os << (const struct ur_program_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_program_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_CREATE: { + os << (const struct ur_kernel_create_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_GET_INFO: { + os << (const struct ur_kernel_get_info_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_GET_GROUP_INFO: { + os << (const struct ur_kernel_get_group_info_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO: { + os << (const struct ur_kernel_get_sub_group_info_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_RETAIN: { + os << (const struct ur_kernel_retain_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_RELEASE: { + os << (const struct ur_kernel_release_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE: { + os << (const struct ur_kernel_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_kernel_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_GET_SUGGESTED_LOCAL_WORK_SIZE: { + os << (const struct ur_kernel_get_suggested_local_work_size_params_t *) + params; + } break; + case UR_FUNCTION_KERNEL_SET_ARG_VALUE: { + os << (const struct ur_kernel_set_arg_value_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_SET_ARG_LOCAL: { + os << (const struct ur_kernel_set_arg_local_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_SET_ARG_POINTER: { + os << (const struct ur_kernel_set_arg_pointer_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_SET_EXEC_INFO: { + os << (const struct ur_kernel_set_exec_info_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_SET_ARG_SAMPLER: { + os << (const struct ur_kernel_set_arg_sampler_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ: { + os << (const struct ur_kernel_set_arg_mem_obj_params_t *)params; + } break; + case UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS: { + os << (const struct ur_kernel_set_specialization_constants_params_t *) + params; + } break; + case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: { + os << (const struct + ur_kernel_suggest_max_cooperative_group_count_exp_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_GET_INFO: { + os << (const struct ur_queue_get_info_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_CREATE: { + os << (const struct ur_queue_create_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_RETAIN: { + os << (const struct ur_queue_retain_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_RELEASE: { + os << (const struct ur_queue_release_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE: { + os << (const struct ur_queue_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_queue_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_FINISH: { + os << (const struct ur_queue_finish_params_t *)params; + } break; + case UR_FUNCTION_QUEUE_FLUSH: { + os << (const struct ur_queue_flush_params_t *)params; + } break; + case UR_FUNCTION_SAMPLER_CREATE: { + os << (const struct ur_sampler_create_params_t *)params; + } break; + case UR_FUNCTION_SAMPLER_RETAIN: { + os << (const struct ur_sampler_retain_params_t *)params; + } break; + case UR_FUNCTION_SAMPLER_RELEASE: { + os << (const struct ur_sampler_release_params_t *)params; + } break; + case UR_FUNCTION_SAMPLER_GET_INFO: { + os << (const struct ur_sampler_get_info_params_t *)params; + } break; + case UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE: { + os << (const struct ur_sampler_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_sampler_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_MEM_IMAGE_CREATE: { + os << (const struct ur_mem_image_create_params_t *)params; + } break; + case UR_FUNCTION_MEM_BUFFER_CREATE: { + os << (const struct ur_mem_buffer_create_params_t *)params; + } break; + case UR_FUNCTION_MEM_RETAIN: { + os << (const struct ur_mem_retain_params_t *)params; + } break; + case UR_FUNCTION_MEM_RELEASE: { + os << (const struct ur_mem_release_params_t *)params; + } break; + case UR_FUNCTION_MEM_BUFFER_PARTITION: { + os << (const struct ur_mem_buffer_partition_params_t *)params; + } break; + case UR_FUNCTION_MEM_GET_NATIVE_HANDLE: { + os << (const struct ur_mem_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_mem_buffer_create_with_native_handle_params_t *) + params; + } break; + case UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_mem_image_create_with_native_handle_params_t *) + params; + } break; + case UR_FUNCTION_MEM_GET_INFO: { + os << (const struct ur_mem_get_info_params_t *)params; + } break; + case UR_FUNCTION_MEM_IMAGE_GET_INFO: { + os << (const struct ur_mem_image_get_info_params_t *)params; + } break; + case UR_FUNCTION_PHYSICAL_MEM_CREATE: { + os << (const struct ur_physical_mem_create_params_t *)params; + } break; + case UR_FUNCTION_PHYSICAL_MEM_RETAIN: { + os << (const struct ur_physical_mem_retain_params_t *)params; + } break; + case UR_FUNCTION_PHYSICAL_MEM_RELEASE: { + os << (const struct ur_physical_mem_release_params_t *)params; + } break; + case UR_FUNCTION_PHYSICAL_MEM_GET_INFO: { + os << (const struct ur_physical_mem_get_info_params_t *)params; + } break; + case UR_FUNCTION_ADAPTER_GET: { + os << (const struct ur_adapter_get_params_t *)params; + } break; + case UR_FUNCTION_ADAPTER_RELEASE: { + os << (const struct ur_adapter_release_params_t *)params; + } break; + case UR_FUNCTION_ADAPTER_RETAIN: { + os << (const struct ur_adapter_retain_params_t *)params; + } break; + case UR_FUNCTION_ADAPTER_GET_LAST_ERROR: { + os << (const struct ur_adapter_get_last_error_params_t *)params; + } break; + case UR_FUNCTION_ADAPTER_GET_INFO: { + os << (const struct ur_adapter_get_info_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH: { + os << (const struct ur_enqueue_kernel_launch_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT: { + os << (const struct ur_enqueue_events_wait_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER: { + os << (const struct ur_enqueue_events_wait_with_barrier_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ: { + os << (const struct ur_enqueue_mem_buffer_read_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE: { + os << (const struct ur_enqueue_mem_buffer_write_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT: { + os << (const struct ur_enqueue_mem_buffer_read_rect_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT: { + os << (const struct ur_enqueue_mem_buffer_write_rect_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY: { + os << (const struct ur_enqueue_mem_buffer_copy_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT: { + os << (const struct ur_enqueue_mem_buffer_copy_rect_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL: { + os << (const struct ur_enqueue_mem_buffer_fill_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ: { + os << (const struct ur_enqueue_mem_image_read_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE: { + os << (const struct ur_enqueue_mem_image_write_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY: { + os << (const struct ur_enqueue_mem_image_copy_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP: { + os << (const struct ur_enqueue_mem_buffer_map_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_UNMAP: { + os << (const struct ur_enqueue_mem_unmap_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_FILL: { + os << (const struct ur_enqueue_usm_fill_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_MEMCPY: { + os << (const struct ur_enqueue_usm_memcpy_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_PREFETCH: { + os << (const struct ur_enqueue_usm_prefetch_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_ADVISE: { + os << (const struct ur_enqueue_usm_advise_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_FILL_2D: { + os << (const struct ur_enqueue_usm_fill_2d_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D: { + os << (const struct ur_enqueue_usm_memcpy_2d_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE: { + os << (const struct ur_enqueue_device_global_variable_write_params_t *) + params; + } break; + case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ: { + os << (const struct ur_enqueue_device_global_variable_read_params_t *) + params; + } break; + case UR_FUNCTION_ENQUEUE_READ_HOST_PIPE: { + os << (const struct ur_enqueue_read_host_pipe_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE: { + os << (const struct ur_enqueue_write_host_pipe_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH_CUSTOM_EXP: { + os << (const struct ur_enqueue_kernel_launch_custom_exp_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER_EXT: { + os << (const struct ur_enqueue_events_wait_with_barrier_ext_params_t *) + params; + } break; + case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: { + os << (const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *) + params; + } break; + case UR_FUNCTION_ENQUEUE_TIMESTAMP_RECORDING_EXP: { + os << (const struct ur_enqueue_timestamp_recording_exp_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_NATIVE_COMMAND_EXP: { + os << (const struct ur_enqueue_native_command_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP: { + os << (const struct + ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *) + params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP: { + os << (const struct + ur_bindless_images_sampled_image_handle_destroy_exp_params_t *) + params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP: { + os << (const struct ur_bindless_images_image_allocate_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP: { + os << (const struct ur_bindless_images_image_free_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP: { + os << (const struct ur_bindless_images_unsampled_image_create_exp_params_t + *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP: { + os << (const struct ur_bindless_images_sampled_image_create_exp_params_t *) + params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP: { + os << (const struct ur_bindless_images_image_copy_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP: { + os << (const struct ur_bindless_images_image_get_info_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP: { + os << (const struct ur_bindless_images_mipmap_get_level_exp_params_t *) + params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP: { + os << (const struct ur_bindless_images_mipmap_free_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_MEMORY_EXP: { + os << (const struct ur_bindless_images_import_external_memory_exp_params_t + *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP: { + os << (const struct ur_bindless_images_map_external_array_exp_params_t *) + params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_LINEAR_MEMORY_EXP: { + os << (const struct + ur_bindless_images_map_external_linear_memory_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_MEMORY_EXP: { + os << (const struct ur_bindless_images_release_external_memory_exp_params_t + *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct + ur_bindless_images_import_external_semaphore_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct + ur_bindless_images_release_external_semaphore_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct ur_bindless_images_wait_external_semaphore_exp_params_t + *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct + ur_bindless_images_signal_external_semaphore_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_HOST_ALLOC: { + os << (const struct ur_usm_host_alloc_params_t *)params; + } break; + case UR_FUNCTION_USM_DEVICE_ALLOC: { + os << (const struct ur_usm_device_alloc_params_t *)params; + } break; + case UR_FUNCTION_USM_SHARED_ALLOC: { + os << (const struct ur_usm_shared_alloc_params_t *)params; + } break; + case UR_FUNCTION_USM_FREE: { + os << (const struct ur_usm_free_params_t *)params; + } break; + case UR_FUNCTION_USM_GET_MEM_ALLOC_INFO: { + os << (const struct ur_usm_get_mem_alloc_info_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_CREATE: { + os << (const struct ur_usm_pool_create_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_RETAIN: { + os << (const struct ur_usm_pool_retain_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_RELEASE: { + os << (const struct ur_usm_pool_release_params_t *)params; + } break; + case UR_FUNCTION_USM_POOL_GET_INFO: { + os << (const struct ur_usm_pool_get_info_params_t *)params; + } break; + case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: { + os << (const struct ur_usm_pitched_alloc_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_IMPORT_EXP: { + os << (const struct ur_usm_import_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_RELEASE_EXP: { + os << (const struct ur_usm_release_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP: { + os << (const struct ur_command_buffer_create_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP: { + os << (const struct ur_command_buffer_retain_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP: { + os << (const struct ur_command_buffer_release_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP: { + os << (const struct ur_command_buffer_finalize_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP: { + os << (const struct ur_command_buffer_append_kernel_launch_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: { + os << (const struct ur_command_buffer_append_usm_memcpy_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: { + os << (const struct ur_command_buffer_append_usm_fill_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_copy_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_write_exp_params_t + *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_read_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: { + os << (const struct ur_command_buffer_append_usm_prefetch_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: { + os << (const struct ur_command_buffer_append_usm_advise_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: { + os << (const struct ur_command_buffer_enqueue_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_EXP: { + os << (const struct ur_command_buffer_update_kernel_launch_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_UPDATE_SIGNAL_EVENT_EXP: { + os << (const struct ur_command_buffer_update_signal_event_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_UPDATE_WAIT_EVENTS_EXP: { + os << (const struct ur_command_buffer_update_wait_events_exp_params_t *) + params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_GET_INFO_EXP: { + os << (const struct ur_command_buffer_get_info_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP: { + os << (const struct ur_usm_p2p_enable_peer_access_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP: { + os << (const struct ur_usm_p2p_disable_peer_access_exp_params_t *)params; + } break; + case UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP: { + os << (const struct ur_usm_p2p_peer_access_get_info_exp_params_t *)params; + } break; + case UR_FUNCTION_LOADER_INIT: { + os << (const struct ur_loader_init_params_t *)params; + } break; + case UR_FUNCTION_LOADER_TEAR_DOWN: { + os << (const struct ur_loader_tear_down_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO: { + os << (const struct ur_virtual_mem_granularity_get_info_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_RESERVE: { + os << (const struct ur_virtual_mem_reserve_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_FREE: { + os << (const struct ur_virtual_mem_free_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_MAP: { + os << (const struct ur_virtual_mem_map_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_UNMAP: { + os << (const struct ur_virtual_mem_unmap_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS: { + os << (const struct ur_virtual_mem_set_access_params_t *)params; + } break; + case UR_FUNCTION_VIRTUAL_MEM_GET_INFO: { + os << (const struct ur_virtual_mem_get_info_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_GET: { + os << (const struct ur_device_get_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_GET_SELECTED: { + os << (const struct ur_device_get_selected_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_GET_INFO: { + os << (const struct ur_device_get_info_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_RETAIN: { + os << (const struct ur_device_retain_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_RELEASE: { + os << (const struct ur_device_release_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_PARTITION: { + os << (const struct ur_device_partition_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_SELECT_BINARY: { + os << (const struct ur_device_select_binary_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE: { + os << (const struct ur_device_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_device_create_with_native_handle_params_t *)params; + } break; + case UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS: { + os << (const struct ur_device_get_global_timestamps_params_t *)params; + } break; + default: + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + return UR_RESULT_SUCCESS; +} +} // namespace ur::extras + +#endif /* UR_PRINT_HPP */ diff --git a/unified-runtime/sanitizer-ignorelist.txt b/unified-runtime/sanitizer-ignorelist.txt new file mode 100644 index 0000000000000..85e8adc38da6f --- /dev/null +++ b/unified-runtime/sanitizer-ignorelist.txt @@ -0,0 +1,6 @@ +[cfi-unrelated-cast] +# std::_Sp_counted_ptr_inplace::_Sp_counted_ptr_inplace() (libstdc++). +# This ctor is used by std::make_shared and needs to cast to uninitialized T* +# in order to call std::allocator_traits::construct. +# See: https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/cfi/cfi_ignorelist.txt +fun:_ZNSt23_Sp_counted_ptr_inplace* diff --git a/unified-runtime/scripts/Doxyfile b/unified-runtime/scripts/Doxyfile new file mode 100644 index 0000000000000..cc9aee53c2a50 --- /dev/null +++ b/unified-runtime/scripts/Doxyfile @@ -0,0 +1,2501 @@ +# Doxyfile 1.8.15 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Intel One API Unified Runtime API" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = v0.12 + +# 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 +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = ../docs/source/images/intel-logo.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = ../ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is +# Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = YES + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = YES + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = YES + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ../include/ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.h \ + *.hpp + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = README.md + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = *::details + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = ../images + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = INTRO.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = NO + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = ../docs/html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = YES + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/xcode/), introduced with OSX +# 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /